Thanks Thomas,

I've applied this and committed it. Looks great!

Cheers,
James


On Wed, Aug 8, 2012 at 12:06 PM, Thomas Robinson <thom...@mirthcorp.com>wrote:

> On mine they are placed in the action listeners for the radio buttons and
> the caret update (to handle the XML highlighter).
> Here is what I have for the buttons.
>
>         myRdbtnEr7.addActionListener(new ActionListener() {
>>             public void actionPerformed(ActionEvent theE) {
>>                 removeHighlights();
>>                 myMessage.setEncoding(Hl7V2EncodingTypeEnum.ER_7);
>>             }
>>         });
>>         myRdbtnXml.addActionListener(new ActionListener() {
>>             public void actionPerformed(ActionEvent theE) {
>>                 removeHighlights();
>>                 myMessage.setEncoding(Hl7V2EncodingTypeEnum.XML);
>>             }
>>         });
>
>
> And this is for the XML.
>
>        myMessageEditor.addCaretListener(new CaretListener() {
>>             public void caretUpdate(CaretEvent theE) {
>>                 removeMostHighlights();
>>                 if (!myDisableCaretUpdateHandling) {
>>                     myMessage.setHighlitedPathBasedOnRange(new
>> Range(theE.getDot(), theE.getMark()));
>>                     myTreePanel.repaint();
>>                 }
>>             }
>>         });
>
>
> Hope that helps.
>
> Regards,
> Thomas
>
> On Wed, Aug 8, 2012 at 7:51 AM, James Agnew <ja...@jamesagnew.ca> wrote:
>
>> Hi Thomas,
>>
>> Thanks for the code, sounds useful!
>>
>> I'd love to incorporate this, but where do these two methods get called?
>> If it's easier, you could just attach a diff to an email, and I'll apply it.
>>
>> Cheers,
>> James
>>
>> On Tue, Aug 7, 2012 at 2:30 PM, Thomas Robinson <thom...@mirthcorp.com>wrote:
>>
>>> Hello again,
>>>
>>> I was working with your TestPanel (converting XML to ER7 and back again)
>>> when I stumbled across a bug that keeps the highlighting done in XML view,
>>> and overlays it with the ER7 view. The result is a strange (seemingly
>>> random, but it corresponds to the XML data and not the ER7 data)
>>> highlighting of the text.
>>> I did a simple fix so when switching from XML to ER7 it wipes all the
>>> highlighting, and I also made it so XML only highlights one tag (the
>>> starter and the closer) at a time.
>>> Here's the code if interested.
>>>
>>>
>>>  private void removeHighlights() {
>>>>         Highlighter hilite = myMessageEditor.getHighlighter();
>>>>         Highlighter.Highlight[] hilites = hilite.getHighlights();
>>>>     for (int i = 0; i < hilites.length; i++) {
>>>>         hilite.removeHighlight(hilites[i]);
>>>>     }
>>>>   }
>>>>     //Removes all but the 2 most recent highlights - the last tag pair
>>>> selected.
>>>>     private void removeMostHighlights() {
>>>>         Highlighter hilite = myMessageEditor.getHighlighter();
>>>>         Highlighter.Highlight[] hilites = hilite.getHighlights();
>>>>     for (int i =0; i < hilites.length - 2; i++) {
>>>>         hilite.removeHighlight(hilites[i]);
>>>>     }
>>>>     }
>>>
>>>
>>> Regards,
>>> Thomas.
>>>
>>> CONFIDENTIALITY NOTICE: The information contained in this electronic
>>> transmission may be confidential. If you are not an intended recipient, be
>>> aware that any disclosure, copying, distribution or use of the information
>>> contained in this transmission is prohibited and may be unlawful. If you
>>> have received this transmission in error, please notify us by email reply
>>> and then erase it from your computer system.
>>>
>>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>> _______________________________________________
>>> Hl7api-devel mailing list
>>> Hl7api-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>>
>>>
>>
>
> CONFIDENTIALITY NOTICE: The information contained in this electronic
> transmission may be confidential. If you are not an intended recipient, be
> aware that any disclosure, copying, distribution or use of the information
> contained in this transmission is prohibited and may be unlawful. If you
> have received this transmission in error, please notify us by email reply
> and then erase it from your computer system.
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to