svn commit: r14692 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-05-11 09:26:55-0700
New Revision: 14692

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java

Log:
For the moment only allow one selected child Fig throughout the entire application.

I would hope this would improve to allow ctrl-click to select more than one within the same FigNode (e.g. Drag multiple attributes from one FigClass to another)

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java?view=diff&rev=14692&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java&r1=14691&r2=14692
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java	2008-05-11 09:26:55-0700
@@ -49,7 +49,7 @@
     /**
      * Text highlighted by mouse actions on the diagram.<p>
      */
-    private CompartmentFigText highlightedFigText;
+    private static CompartmentFigText highlightedFigText = null;
 
     private Fig borderFig;
     
@@ -121,6 +121,10 @@
             FigEditableCompartment figCompartment = (FigEditableCompartment) f;
             f = figCompartment.hitFig(r);
             if (f instanceof CompartmentFigText) {
+                if (highlightedFigText != null && highlightedFigText != f) {
+                    highlightedFigText.setHighlighted(false);
+                    highlightedFigText.getGroup().damage();
+                }
                 ((CompartmentFigText) f).setHighlighted(true);
                 highlightedFigText = (CompartmentFigText) f;
                 TargetManager.getInstance().setTarget(f);
@@ -128,13 +132,13 @@
         }
     }
 
-    /*
-     * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
-     */
-    public void mouseExited(MouseEvent me) {
-        super.mouseExited(me);
-        unhighlight();
-    }
+//    /*
+//     * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
+//     */
+//    public void mouseExited(MouseEvent me) {
+//        super.mouseExited(me);
+//        unhighlight();
+//    }
 
     /**
      * Remove the highlight from the currently highlit FigText.
@@ -171,7 +175,7 @@
             if (ft instanceof CompartmentFigText
                     && ((CompartmentFigText) ft).isHighlighted()) {
                 ((CompartmentFigText) ft).setHighlighted(false);
-                highlightedFigText = null;
+                ft.getGroup().damage();
                 return ((CompartmentFigText) ft);
             }
         }
@@ -192,6 +196,10 @@
         if (figList.size() > 0) {
             Fig fig = (Fig) figList.get(figList.size() - 1);
             if (fig != null && fig instanceof CompartmentFigText) {
+                if (highlightedFigText != null) {
+                    highlightedFigText.setHighlighted(false);
+                    highlightedFigText.getGroup().damage();
+                }
                 CompartmentFigText ft = (CompartmentFigText) fig;
                 ft.startTextEditor(ie);
                 ft.setHighlighted(true);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.