Author: bobtarling
Date: 2010-01-04 06:02:11-0800
New Revision: 17734

Modified:
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java

Log:
Issue 5944: Get rid of borderFig

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java?view=diff&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
 (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
 2010-01-04 06:02:11-0800
@@ -83,7 +83,6 @@
                 DEFAULT_COMPARTMENT_BOUNDS, 
                 getSettings()));
         addFig(getOperationsFig());
-        addFig(getBorderFig());
         
         // Make all the parts match the main fig
         setFilled(true);
@@ -109,10 +108,6 @@
         while (thisIter.hasNext()) {
             Fig thisFig = (Fig) thisIter.next();
             Fig cloneFig = (Fig) cloneIter.next();
-            if (thisFig == getBorderFig()) {
-                /* TODO: complete this */
-//                figClone.setBorderFig(thisFig);
-            }
         }
         return figClone;
     }

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java?view=diff&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
 (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
 2010-01-04 06:02:11-0800
@@ -49,9 +49,7 @@
 import org.argouml.uml.diagram.ui.FigAttributesCompartment;
 import org.argouml.uml.diagram.ui.FigCompartment;
 import org.argouml.uml.diagram.ui.FigCompartmentBox;
-import org.argouml.uml.diagram.ui.FigEditableCompartment;
 import org.argouml.uml.diagram.ui.FigOperationsCompartment;
-import org.argouml.uml.ui.foundation.core.ActionAddOperation;
 import org.tigris.gef.base.Editor;
 import org.tigris.gef.base.Globals;
 import org.tigris.gef.base.Selection;
@@ -70,12 +68,6 @@
      */
     private FigOperationsCompartment operationsFigCompartment;
     
-    /**
-     * Initialization shared by all constructors.
-     */
-    private void constructFigs() {
-    }
-
     private Rectangle getDefaultBounds() {
         // this rectangle marks the operation section; all operations
         // are inside it
@@ -99,7 +91,6 @@
                 owner, 
                 getDefaultBounds(),
                 getSettings());
-        constructFigs();
     }
 
     /*
@@ -260,10 +251,21 @@
         return operationsFigCompartment.getBounds();
     }
 
+    /**
+     * @deprecated by Bob Tarling in 0.29.2 use
+     * isCompartmentVisible(Model.getMetaTypes().getOperation())
+     * @return the visibility
+     */
     public boolean isOperationsVisible() {
         return operationsFigCompartment != null && 
operationsFigCompartment.isVisible();
     }
 
+    /**
+     * TODO: Should not be on this class as we don't know if we'll have
+     * operations
+     * @param isVisible true if the operation compartment is visible
+     * @deprecated by Bob Tarling in 0.29.2 use setCompartmentVisible
+     */
     public void setOperationsVisible(boolean isVisible) {
         setCompartmentVisible(operationsFigCompartment, isVisible);
     }
@@ -292,7 +294,7 @@
 
     /**
      * @deprecated by Bob Tarling in 0.29.2 use
-     * getCompartment(Model.getMetaTypes().getAttribute()).isVisible()
+     * isCompartmentVisible(Model.getMetaTypes().getAttribute())
      * @return the visibility
      */
     @Deprecated

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java?view=diff&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
      (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
      2010-01-04 06:02:11-0800
@@ -74,7 +74,6 @@
         addFig(getStereotypeFig());
         addExtraCompartments();
         addFig(getOperationsFig());
-        addFig(getBorderFig());
         
         // Make all the parts match the main fig
         setFilled(true);

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java?view=diff&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
     (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
     2010-01-04 06:02:11-0800
@@ -79,7 +79,6 @@
                     getSettings()));
         }
         addFig(getOperationsFig());
-        addFig(getBorderFig());
 
         // Make all the parts match the main fig
         setFilled(true);

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java?view=diff&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
        (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
        2010-01-04 06:02:11-0800
@@ -78,7 +78,6 @@
                 DEFAULT_COMPARTMENT_BOUNDS, 
                 getSettings()));
         addFig(getOperationsFig());
-        addFig(getBorderFig());
 
         // Make all the parts match the main fig
         setFilled(true);

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java?view=diff&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
 (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
 2010-01-04 06:02:11-0800
@@ -75,8 +75,6 @@
 //        addFig(tagsFig);
 //        addFig(constraintsFig);
 
-        addFig(getBorderFig());
-        
         // Make all the parts match the main fig
         setFilled(true);
         setFillColor(FILL_COLOR);

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&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 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 
2010-01-04 06:02:11-0800
@@ -59,6 +59,7 @@
 import org.tigris.gef.base.Selection;
 import org.tigris.gef.presentation.Fig;
 import org.tigris.gef.presentation.FigGroup;
+import org.tigris.gef.presentation.FigRect;
 
 /**
  * Class to display graphics for a node with compartments in a diagram.
@@ -68,28 +69,11 @@
  * bottom order.
  * <p>
  * 
- * It adds a border around the box, and deals with highlighting editable
- * compartments.
+ * It deals with highlighting editable compartments.
  * <p>
  * 
  * All descendants of this class have the bigPort filled with the main fig fill
- * color, without border. The borderFig has a transparent fill, and a visible
- * border.
- * <p>
- * 
- * TODO: Why do we need a separate border fig: I (MVW) think because 
- * some figs may have parts protruding outside the box like a 
- * UML Package or like a UML Component.
- * Bob says: But we already have bigPort. Why do we need another Fig the same
- * size as that. Can't we have bigPort set with a fill color and line color?
- * 
- * TODO: Why is the fill not drawn by the borderFig? In the current 
- * situation, the border is drawn OVER the background fill (which 
- * won't work if colors have alpha channels). But the fill should only 
- * be drawn WITHIN the border. MVW: I propose to have the borderFig
- * show the fill color and have the bigPort be transparent and 
- * without border. Then we would need a drawing sequence change,
- * too. Or maybe the compartments should draw the fill color instead?
+ * color, with line border.
  * <p>
  * 
  * The name, keyword and stereotype are shown in transparent figs without
@@ -114,8 +98,6 @@
      */
     private static CompartmentFigText highlightedFigText = null;
 
-    private Fig borderFig;
-
     private List<FigCompartment> compartments = 
         new ArrayList<FigCompartment>();
 
@@ -138,23 +120,15 @@
          * drawn by the bigPort.
          */
         getNameFig().setFillColor(null);
-
-        /*
-         * The borderFig shows the outside border of the box around all
-         * compartments. Its size always equals the bigPort. Its body is
-         * transparent.
-         */
-        borderFig = createBorderFig();
-
-        getBigPort().setLineWidth(0);
-        /* The bigPort draws the background color: */
-        getBigPort().setFillColor(FILL_COLOR);
     }
 
-    protected Fig createBorderFig() {
-        Fig b = new FigEmptyRect(X0, Y0, 0, 0);
-        b.setLineColor(LINE_COLOR);
-        b.setLineWidth(LINE_WIDTH);
+    /**
+     * Overrule this if a rectangle is not usable.
+     * 
+     * @return the Fig to be used as bigPort
+     */
+    protected Fig createBigPortFig() {
+        Fig b = new FigRect(X0, Y0, 0, 0, LINE_COLOR, FILL_COLOR);
         return b;
     }
 
@@ -188,6 +162,20 @@
         return null;
     }
     
+    /**
+     * Return true of a compartment exists and is visible
+     * @param metaType the model element type for which the compartment is
+     * required.
+     * @return true if the compartment exists and is visible
+     */
+    public boolean isCompartmentVisible(Object metaType) {
+        FigCompartment f = getCompartment(metaType);
+        if (f == null) {
+            return false;
+        }
+        return f.isVisible();
+    }
+    
     protected List<FigCompartment> getCompartments() {
         return compartments;
     }
@@ -387,7 +375,6 @@
 
         /* Finally set the bounds of the big box and the border fig: */
         getBigPort().setBounds(x, y, newW, newH);
-        getBorderFig().setBounds(x, y, newW, newH);
 
         // Now force calculation of the bounds of the figure, update the edges
         // and trigger anyone who's listening to see if the "bounds" property
@@ -573,10 +560,6 @@
         ie.consume();
     }
 
-    protected Fig getBorderFig() {
-        return borderFig;
-    }
-
     /**
      * Show or hide a compartment based on the meta-type of its contents.
      * 
@@ -647,7 +630,7 @@
 
     @Override
     public int getLineWidth() {
-        return borderFig.getLineWidth();
+        return getBigPort().getLineWidth();
     }
 
     @Override

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java?view=diff&pathrev=17734&r1=17733&r2=17734
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java   
    (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java   
    2010-01-04 06:02:11-0800
@@ -166,7 +166,6 @@
         addFig(getStereotypeFig());
         addFig(epc);
         addFig(separatorFig);
-        addFig(getBorderFig());
 
         // Make all the parts match the main fig
         setFilled(true);
@@ -190,11 +189,6 @@
     @Override
     protected Fig createBigPortFig() {
         /* Use arbitrary dimensions for now. */
-        return new FigMyCircle(0, 0, 100, 60);
-    }
-
-    @Override
-    protected Fig createBorderFig() {
         Fig b = new FigMyCircle(0, 0, 100, 60);
         b.setLineColor(LINE_COLOR);
         b.setLineWidth(LINE_WIDTH);
@@ -447,7 +441,6 @@
     @Override
     public void setFillColor(Color col) {
         super.setFillColor(col);
-        getBorderFig().setFillColor(null);
     }
 
     /**
@@ -464,7 +457,6 @@
     @Override
     public void setFilled(boolean f) {
         super.setFilled(f);
-        getBorderFig().setFilled(false);
     }
 
     /**

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

To unsubscribe from this discussion, e-mail: 
[[email protected]].

Reply via email to