svn commit: r13329 - trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-08-13 21:11:54-0700
New Revision: 13329

Modified:
   trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java

Log:
Don't attempt to setFillColor if Fig isn't fully instantiated.  Causes project load (and TestPropertyPanels) to fail.

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java?view=diff&rev=13329&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java&r1=13328&r2=13329
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java	2007-08-13 21:11:54-0700
@@ -94,10 +94,11 @@
     }
 
     /**
-     * Discover the attached FigEdgeAssociationClass and the
-     * FigClassAssociationClass attached to that. Remove them from the diagram
-     * before removing this.
+     * Remove entire composite Fig from Diagram. Discover the attached
+     * FigEdgeAssociationClass and the FigClassAssociationClass attached to
+     * that. Remove them from the diagram before removing this.
      */
+    @Override
     protected void removeFromDiagramImpl() {
         FigEdgeAssociationClass figEdgeLink = null;
         List edges = null;
@@ -130,10 +131,12 @@
     }
 
     /*
+     * TODO: Is this required? Why would the fig already be dashed?
+     * 
      * @see org.tigris.gef.presentation.FigEdge#setFig(
-     *      org.tigris.gef.presentation.Fig) TODO: Is this required? Why would
-     *      the fig already be dashed?
+     *      org.tigris.gef.presentation.Fig)
      */
+    @Override
     public void setFig(Fig f) {
         super.setFig(f);
         getFig().setDashed(false);
@@ -142,12 +145,15 @@
     /*
      * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#getNameFig()
      */
+    @Override
     protected FigText getNameFig() {
         return null;
     }
 
     /**
-     * Overrided in order to implement AttributesCompartmentContainer.
+     * @return the bounds of the operations compartment for the associated
+     *         FigClassAssociationClass.
+     * @see org.argouml.uml.diagram.AttributesCompartmentContainer#getAttributesBounds()
      */
     public Rectangle getAttributesBounds() {
         if (getAssociationClass() != null)
@@ -170,8 +176,9 @@
      * Overrided in order to implement AttributesCompartmentContainer.
      */
     public void setAttributesVisible(boolean visible) {
-        getAssociationClass().setAttributesVisible(visible);
-
+        if (getAssociationClass() != null) {
+            getAssociationClass().setAttributesVisible(visible);
+        }
     }
 
     /**
@@ -188,34 +195,40 @@
      * Overrided in order to implement PathCompartmentContainer.
      */
     public void setPathVisible(boolean visible) {
-        getAssociationClass().setPathVisible(visible);
+        if (getAssociationClass() != null) {
+            getAssociationClass().setPathVisible(visible);
+        }
     }
 
     /**
      * Overrided in order to implement OperationsCompartmentContainer.
      */
     public Rectangle getOperationsBounds() {
-        if (getAssociationClass() != null)
+        if (getAssociationClass() != null) {
             return getAssociationClass().getOperationsBounds();
-        else
+        } else {
             return new Rectangle(0, 0, 0, 0);
+        }
     }
 
     /**
      * Overrided in order to implement OperationsCompartmentContainer.
      */
     public boolean isOperationsVisible() {
-        if (getAssociationClass() != null)
+        if (getAssociationClass() != null) {
             return getAssociationClass().isOperationsVisible();
-        else
+        } else {
             return true;
+        }
     }
 
     /**
      * Overrided in order to implement OperationsCompartmentContainer.
      */
     public void setOperationsVisible(boolean visible) {
-        getAssociationClass().setOperationsVisible(visible);
+        if (getAssociationClass() != null) {
+            getAssociationClass().setOperationsVisible(visible);
+        }
     }
 
     /**
@@ -224,7 +237,9 @@
      */
     @Override
     public void setFillColor(Color color) {
-        getAssociationClass().setFillColor(color);
+        if (getAssociationClass() != null) {
+            getAssociationClass().setFillColor(color);
+        }
     }
 
     /**
@@ -233,10 +248,11 @@
      */
     @Override
     public Color getFillColor() {
-        if (getAssociationClass() != null)
+        if (getAssociationClass() != null) {
             return getAssociationClass().getFillColor();
-        else
+        } else {
             return Color.white;
+        }
     }
 
     /**
@@ -318,4 +334,4 @@
 
         return figEdgeLink;
     }
-} /* end class FigAssociationClass */
+}
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.