svn commit: r17101 - trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java

Thomas Neustupny <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2009-04-13 01:49:37-0700
New Revision: 17101

Modified:
   trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java

Log:
allow changing fill and line color for multiselection

Modified: trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java?view=diff&pathrev=17101&r1=17100&r2=17101
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java	2009-04-13 01:49:37-0700
@@ -43,9 +43,13 @@
 import org.apache.log4j.Logger;
 import org.argouml.i18n.Translator;
 import org.argouml.swingext.SpacerPanel;
+import org.argouml.ui.targetmanager.TargetManager;
+import org.argouml.uml.diagram.ArgoDiagram;
+import org.argouml.uml.diagram.DiagramUtils;
 import org.argouml.uml.diagram.DiagramSettings.StereotypeStyle;
 import org.argouml.uml.diagram.ui.ArgoFig;
 import org.argouml.uml.diagram.ui.FigEdgeModelElement;
+import org.argouml.uml.diagram.ui.FigNodeModelElement;
 import org.argouml.uml.diagram.ui.StereotypeStyled;
 import org.argouml.util.ArgoFrame;
 import org.tigris.gef.presentation.Fig;
@@ -460,11 +464,32 @@
         if (target == null || c == null) {
             return;
         }
-        if (c instanceof Color) {
+        Boolean isColor = (c instanceof Color);
+        if (isColor) {
             target.setFillColor((Color) c);
         }
-        target.setFilled(c instanceof Color);
+        target.setFilled(isColor);
         target.endTrans();
+        
+        // TODO: The following handling of multiselection is just a local
+        // solution for the fill color, better find a more general solution:
+        // (I don't know if it's undoable this way - thn)
+        ArgoDiagram activeDiagram = DiagramUtils.getActiveDiagram();
+        for (Object t : TargetManager.getInstance().getTargets()) {
+            Fig fig = null;
+            if (t instanceof FigNodeModelElement) {
+                fig = (Fig) t;
+            } else {
+                fig = activeDiagram.presentationFor(t);
+            }
+            if (fig != null && fig != target) {
+                if (isColor) {
+                    fig.setFillColor((Color) c);
+                }
+                fig.setFilled(isColor);
+                fig.endTrans();
+            }
+        }
     }
 
     /**
@@ -476,11 +501,32 @@
         if (target == null || c == null) {
             return;
         }
-        if (c instanceof Color) {
+        Boolean isColor = (c instanceof Color);
+        if (isColor) {
             target.setLineColor((Color) c);
         }
-        target.setLineWidth((c instanceof Color) ? ArgoFig.LINE_WIDTH : 0);
+        target.setLineWidth(isColor ? ArgoFig.LINE_WIDTH : 0);
         target.endTrans();
+        
+        // TODO: The following handling of multiselection is just a local
+        // solution for the line color, better find a more general solution:
+        // (I don't know if it's undoable this way - thn)
+        ArgoDiagram activeDiagram = DiagramUtils.getActiveDiagram();
+        for (Object t : TargetManager.getInstance().getTargets()) {
+            Fig fig = null;
+            if (t instanceof FigNodeModelElement) {
+                fig = (Fig) t;
+            } else {
+                fig = activeDiagram.presentationFor(t);
+            }
+            if (fig != null && fig != target) {
+                if (isColor) {
+                    fig.setLineColor((Color) c);
+                }
+                fig.setLineWidth(isColor ? ArgoFig.LINE_WIDTH : 0);
+                fig.endTrans();
+            }
+        }
     }
 
     /*

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1685653

To unsubscribe from this discussion, e-mail: [[email protected]].
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.