Topic
  • 5 replies
  • Latest Post - ‏2012-11-21T15:42:36Z by llandale
Bjoern_Karpenstein
Bjoern_Karpenstein
34 Posts

Pinned topic Diff in DXL Attribute (obj.attrDXLName) without color

‏2012-11-20T20:12:56Z |

Hello!

I want to make a diff in an DXL Attribute. My Problem is, when i do it in the way like in a layout DXL, the colors aren't printed.

In Layout DXL i normally use displayRichTextWithColor() function.

What can i do to see the colors in DXL-Attributes?

Buffer buff1 = create()
                Buffer buff2 = create()
                        Buffer resBuf = create()
                        buff1 = obj.attributeToCompareValueALM
                        buff2 = o.attributeToCompareValueUIT
                        diff(resBuf, buff1, buff2)
                                        obj.attrDXLName =richText stringOf(resBuf)                      
 
                        delete resBuf
                        delete buff1
                        delete buff2
Updated on 2014-01-06T14:48:04Z at 2014-01-06T14:48:04Z by iron-man
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: Diff in DXL Attribute (obj.attrDXLName) without color

    ‏2012-11-20T22:55:22Z  

    There are 3 different declaration variations for the DXL diff() function.

    The one you have used does not define the mark-up colours and font.

    You need to use the following variant.

    diff(Buffer result, Buffer source, Buffer target, string removeMarkup,insertMarkup)
    

     

    An example using your code would be as follows

     

     

    diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf3\\ul ")
    displayRichWithColor(stringOf(resBuf))
    


    This will strike out deleted characters and display them in a red color, and will underline inserted characters and display them in a blue color

    I recommend that you have a look at the DXL Reference manual to learn more about the removeMarkup and insertMarkup arguments. Select Help > DXL Reference Manual from the DOORS Explorer menu, then navigate to the following help section Modules->History->diff(buffer)

     

     

     


    Paul Miller,
    Melbourne, Australia

     

     

    Updated on 2014-01-06T14:48:38Z at 2014-01-06T14:48:38Z by iron-man
  • Bjoern_Karpenstein
    Bjoern_Karpenstein
    34 Posts

    Re: Diff in DXL Attribute (obj.attrDXLName) without color

    ‏2012-11-21T06:57:27Z  

    There are 3 different declaration variations for the DXL diff() function.

    The one you have used does not define the mark-up colours and font.

    You need to use the following variant.

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">diff(Buffer result, Buffer source, Buffer target, string removeMarkup,insertMarkup) </pre>

     

    An example using your code would be as follows

     

     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf3\\ul ") displayRichWithColor(stringOf(resBuf)) </pre>


    This will strike out deleted characters and display them in a red color, and will underline inserted characters and display them in a blue color

    I recommend that you have a look at the DXL Reference manual to learn more about the removeMarkup and insertMarkup arguments. Select Help > DXL Reference Manual from the DOORS Explorer menu, then navigate to the following help section Modules->History->diff(buffer)

     

     

     


    Paul Miller,
    Melbourne, Australia

     

     

    Hello Mr. Miller.

    Thanks for your reply. I tried to use it as follows, unfortunalety nothing happened:

    Buffer buff1 = create()
                    Buffer buff2 = create()
                            Buffer resBuf = create()
                            buff1 = obj.attributeToCompareValueALM
                            buff2 = o.attributeToCompareValueUIT
                            diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf3\\ul ")
                        obj.attrDXLName = richText(stringOf(resBuf));                                                       
                        // displayRich richText(stringOf(resBuf));  
                            delete resBuf
                            delete buff1
                            delete buff2
    

     


    It looks like there is no coloring?

     

    Updated on 2014-01-06T14:48:53Z at 2014-01-06T14:48:53Z by iron-man
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: Diff in DXL Attribute (obj.attrDXLName) without color

    ‏2012-11-21T07:47:40Z  

    Hello Mr. Miller.

    Thanks for your reply. I tried to use it as follows, unfortunalety nothing happened:

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Buffer buff1 = create() Buffer buff2 = create() Buffer resBuf = create() buff1 = obj.attributeToCompareValueALM buff2 = o.attributeToCompareValueUIT diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf3\\ul ") obj.attrDXLName = richText(stringOf(resBuf)); // displayRich richText(stringOf(resBuf)); delete resBuf delete buff1 delete buff2 </pre>

     


    It looks like there is no coloring?

     

    I also cannot get the color to work when using a DXL Attribute. So maybe this is not possible and you have to use DXL Layout.

    I tried to convert one of my DXL Layout scripts that uses the diff() function into a DXL Attribute - but the DXL Attribute will not display the color for deleted text and inserted text.

    DOORS has a Module menu function that converts DXL Layout columns into a DXL Attribute via Tools > Support Tools > Convert Layout DXL to Attribute DXL.

    Even though this conversion tool adds special DXL code to capture the output of the displayRichTextWithColor() function into a buffer, I think that the richText() function used in obj.attrDXLName = richText(stringOf(resBuf)) does not recognize the RTF color commands \\cf1 and \\cf3.
    Paul Miller,
    Melbourne, Australia
  • Mathias Mamsch
    Mathias Mamsch
    1970 Posts

    Re: Diff in DXL Attribute (obj.attrDXLName) without color

    ‏2012-11-21T11:10:05Z  
    I also cannot get the color to work when using a DXL Attribute. So maybe this is not possible and you have to use DXL Layout.

    I tried to convert one of my DXL Layout scripts that uses the diff() function into a DXL Attribute - but the DXL Attribute will not display the color for deleted text and inserted text.

    DOORS has a Module menu function that converts DXL Layout columns into a DXL Attribute via Tools > Support Tools > Convert Layout DXL to Attribute DXL.

    Even though this conversion tool adds special DXL code to capture the output of the displayRichTextWithColor() function into a buffer, I think that the richText() function used in obj.attrDXLName = richText(stringOf(resBuf)) does not recognize the RTF color commands \\cf1 and \\cf3.
    Paul Miller,
    Melbourne, Australia

    In fact there is one supported richText tag, that will add color to a normal attribute: \highlight ... unfortunately this will only set the brackground color of the text, but this is normally better than just underlining or striking.

    Try:
     

    ...
    diff(resBuf, buff1, buff2, "\\cf1\\highlight2 ","\\cf3\\highlight1 ")
    ...
    

     


    Maybe that helps, regards, Mathias

     

     

     


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

     

     

    Updated on 2014-01-06T14:49:07Z at 2014-01-06T14:49:07Z by iron-man
  • llandale
    llandale
    2972 Posts

    Re: Diff in DXL Attribute (obj.attrDXLName) without color

    ‏2012-11-21T15:42:36Z  
    I don't think you can display color in an attribute like that, although you can in a layout.