You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Will Luo <wi...@apmindsf.com> on 2003/04/12 02:06:02 UTC

ConcreteTextSelector.clearSelection() fix

Hi there, i'm a new batik user, and i recently discovered that the
TextSelectionManager's clearSelection() method is not clearing the
text selection. I got a little curious and started to dig around the CVS
tree a little and found that ConcreteTextSelector's clearSelection() method
is missing a few steps, compared to what it's doing in
checkSelectGesture(). In any case, i made the following changes which fixed
the problem. Please take a look. Thanks!

will



Index: ConcreteTextSelector.java
===================================================================
RCS file: /home/cvspublic/xml-batik/sources/org/apache/batik/gvt/text/ConcreteTextSelector.java,v
retrieving revision 1.14
diff -c -r1.14 ConcreteTextSelector.java
*** ConcreteTextSelector.java 11 Apr 2003 13:58:48 -0000 1.14
--- ConcreteTextSelector.java 12 Apr 2003 00:03:33 -0000
***************
*** 117,125 ****
--- 117,129 ----
      }
  
      public void clearSelection() {
+         if (selectionNode != null) {
+             selectionNode.getRoot().removeTreeGraphicsNodeChangeListener(this);
+         }
          dispatchSelectionEvent(new SelectionEvent
              (null, SelectionEvent.SELECTION_CLEARED, null));
          copyToClipboard(null);
+         selectionNode = null;
      }
  
      /*
***************
*** 154,169 ****
              p = t.transform(p, null);
  
              if (isDeselectGesture(evt)) {
!                 if (selectionNode != null)
!                     selectionNode.getRoot()
!                         .removeTreeGraphicsNodeChangeListener(this);
! 
!                 dispatchSelectionEvent(
!                         new SelectionEvent(null,
!                                 SelectionEvent.SELECTION_CLEARED,
!                                 null));
!                 copyToClipboard(null);
!                 selectionNode = null;
              } else if (isSelectStartGesture(evt)) {
                  if (selectionNode != source) {
                      if (selectionNode != null)
--- 158,164 ----
              p = t.transform(p, null);
  
              if (isDeselectGesture(evt)) {
!                 clearSelection();
              } else if (isSelectStartGesture(evt)) {
                  if (selectionNode != source) {
                      if (selectionNode != null)


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org