svn commit: r17229 - trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-08-07 14:44:24-0700
New Revision: 17229

Removed:
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionActor.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionClass.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionComponent.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionComponentInstance.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionDataType.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionEnumeration.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionException.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionInterface.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionNode.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionNodeInstance.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionObject.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionSignal.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionStereotype.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionUseCase.java
Modified:
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAbstraction2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigActor2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationClass2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationEnd2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClass2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClassAssociationClass2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComment2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponent2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponentInstance2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDataType2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDependency2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeAssociationClass2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeNote2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEnumeration2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigException2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigGeneralization2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigInterface2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigLink2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigMNode2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeAssociation2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeInstance2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigObject2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigPermission2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigSignal2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigStereotypeDeclaration2.java
   trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigUseCase2.java

Log:
Simply extend the UML1.4 Figs - Selection classes are not needed for now

Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAbstraction2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAbstraction2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAbstraction2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAbstraction2.java	2009-08-07 14:44:24-0700
@@ -25,6 +25,7 @@
 package org.argouml.structure2.diagram;

 

 import org.argouml.uml.diagram.DiagramSettings;

+import org.argouml.uml.diagram.ui.FigAbstraction;

 import org.tigris.gef.presentation.ArrowHead;

 import org.tigris.gef.presentation.ArrowHeadTriangle;

 

@@ -36,18 +37,7 @@
  * 

  * @author agauthie

  */

-class FigAbstraction2 extends FigDependency2 {

-

-    /**

-     * Create the arrow head for the abstraction. This overrides the

-     * superclass to create a filled arrow head.

-     * @return the arrow head.

-     */

-    protected ArrowHead createEndArrow() {

-        final ArrowHead arrow = new ArrowHeadTriangle();

-        arrow.setFillColor(FILL_COLOR);

-        return arrow;

-    }

+class FigAbstraction2 extends FigAbstraction {

 

     /**

      * Construct a Fig.


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigActor2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigActor2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigActor2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigActor2.java	2009-08-07 14:44:24-0700
@@ -24,93 +24,17 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Color;

-import java.awt.Dimension;

-import java.awt.Font;

-import java.awt.Point;

 import java.awt.Rectangle;

-import java.awt.event.MouseEvent;

-import java.beans.PropertyChangeEvent;

-import java.util.ArrayList;

-import java.util.List;

-import java.util.Vector;

 

-import org.argouml.model.Model;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ui.FigNodeModelElement;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigCircle;

-import org.tigris.gef.presentation.FigLine;

-import org.tigris.gef.presentation.FigRect;

+import org.argouml.uml.diagram.use_case.ui.FigActor;

 

 /**

  * Class to display graphics for an Actor in a diagram.

  */

-class FigActor2 extends FigNodeModelElement {

+class FigActor2 extends FigActor {

 

     /**

-     * The serialization version - Eclipse generated for rev. 1.40

-     */

-    private static final long serialVersionUID = 7265843766314395713L;

-

-    /**

-     * The padding between the actor body and name and the top of the

-     * stereotype.

-     */

-    protected static final int MIN_VERT_PADDING = 4;

-

-    //These are the positions of child figs inside this fig

-    //They must be added in the constructor in this order.

-    //For now the name must not be last as this would force

-    //zero width lines (until GEF is fixed)

-    private static final int HEAD_POSN = 2;

-    private static final int BODY_POSN = 3;

-    private static final int ARMS_POSN = 4;

-    private static final int LEFT_LEG_POSN = 5;

-    private static final int RIGHT_LEG_POSN = 6;

-

-    private void constructFigs() {

-        Color fg = getLineColor();

-        Color fill = getFillColor();

-        

-        // Put this rectangle behind the rest, so it goes first

-        FigRect bigPort = new ActorPortFigRect(X0, Y0, 0, 0, this);

-        FigCircle head =

-            new FigCircle(X0 + 2, Y0, 16, 15, fg, fill);

-        FigLine body = new FigLine(X0 + 10, Y0 + 15, 20, 40, fg);

-        FigLine arms = new FigLine(X0, Y0 + 20, 30, 30, fg);

-        FigLine leftLeg = new FigLine(X0 + 10, Y0 + 30, 15, 55, fg);

-        FigLine rightLeg = new FigLine(X0 + 10, Y0 + 30, 25, 55, fg);

-        body.setLineWidth(LINE_WIDTH);

-        arms.setLineWidth(LINE_WIDTH);

-        leftLeg.setLineWidth(LINE_WIDTH);

-        rightLeg.setLineWidth(LINE_WIDTH);

-        

-        getNameFig().setBounds(X0, Y0 + 45, 20, 20);

-

-        getNameFig().setTextFilled(false);

-        getNameFig().setFilled(false);

-        getNameFig().setLineWidth(0);

-        // initialize any other Figs here

-        getStereotypeFig().setBounds(getBigPort().getCenter().x,

-                                     getBigPort().getCenter().y,

-                                     0, 0);

-        setSuppressCalcBounds(true);

-        // add Figs to the FigNode in back-to-front order

-        addFig(bigPort);

-        addFig(getNameFig());

-        addFig(head);

-        addFig(body);

-        addFig(arms);

-        addFig(leftLeg);

-        addFig(rightLeg);

-        addFig(getStereotypeFig());

-        setBigPort(bigPort);

-        setSuppressCalcBounds(false);

-    }

-    

-    /**

      * Construct a new Actor with the given owner, bounds, and settings.  This

      * constructor is used by the PGML parser.

      * 

@@ -120,258 +44,5 @@
      */

     public FigActor2(Object owner, Rectangle bounds, DiagramSettings settings) {

         super(owner, bounds, settings);

-        constructFigs();

-        if (bounds != null) {

-            setLocation(bounds.x, bounds.y);

-        }

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setLineWidth(int)

-     */

-    @Override

-    public void setLineWidth(int width) {

-        // Miss out the text fix, this should have no line

-        for (int i = HEAD_POSN; i < RIGHT_LEG_POSN; i++) {

-            Fig f = getFigAt(i);

-            if (f != null) {

-                f.setLineWidth(width);

-            }

-        }

-        getFigAt(HEAD_POSN).setLineWidth(width);

-        getFigAt(BODY_POSN).setLineWidth(width);

-        getFigAt(ARMS_POSN).setLineWidth(width);

-        getFigAt(LEFT_LEG_POSN).setLineWidth(width);

-        getFigAt(RIGHT_LEG_POSN).setLineWidth(width);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setFilled(boolean)

-     */

-    @Override

-    public void setFilled(boolean filled) {

-        // Only the head should be filled (not the text)

-        getFigAt(HEAD_POSN).setFilled(filled);

-    }

-

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionActor(this);

-    }

-

-    /*

-     * @see org.tigris.gef.ui.PopupGenerator#getPopUpActions(

-     *         java.awt.event.MouseEvent)

-     */

-    @Override

-    public Vector getPopUpActions(MouseEvent me) {

-        Vector popUpActions = super.getPopUpActions(me);

-        // Modifiers ...

-        popUpActions.add(

-                popUpActions.size() - getPopupAddOffset(),

-                buildModifierPopUp(ABSTRACT | LEAF | ROOT));

-        return popUpActions;

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#isResizable()

-     */

-    @Override

-    public boolean isResizable() {

-        return false;

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getMinimumSize()

-     */

-    @Override

-    public Dimension getMinimumSize() {

-        Dimension nameDim = getNameFig().getMinimumSize();

-        int w = Math.max(nameDim.width, 40);

-        int h = nameDim.height + 55;

-        if (getStereotypeFig().isVisible()) {

-            Dimension stereoDim = getStereotypeFig().getMinimumSize();

-            w = Math.max(stereoDim.width, w);

-            h = h + stereoDim.height;

-        }

-        return new Dimension(w, h);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)

-     */

-    @Override

-    protected void setBoundsImpl(final int x, final int y, 

-            final int w, final int h) {

-        int middle = x + w / 2;

-

-        Rectangle oldBounds = getBounds();

-        getBigPort().setBounds(x, y, w, h);

-

-        getFigAt(HEAD_POSN).setLocation(

-                middle - getFigAt(HEAD_POSN).getWidth() / 2, y + 10);

-        getFigAt(BODY_POSN).setLocation(middle, y + 25);

-        getFigAt(ARMS_POSN).setLocation(

-                middle - getFigAt(ARMS_POSN).getWidth() / 2, y + 30);

-        getFigAt(LEFT_LEG_POSN).setLocation(

-                middle - getFigAt(LEFT_LEG_POSN).getWidth(), y + 40);

-        getFigAt(RIGHT_LEG_POSN).setLocation(middle, y +  40);

-

-        Dimension minTextSize = getNameFig().getMinimumSize();

-        getNameFig().setBounds(middle - minTextSize.width / 2,

-	        y +  55,

-	        minTextSize.width,

-	        minTextSize.height);

-

-        if (getStereotypeFig().isVisible()) {

-            Dimension minStereoSize = getStereotypeFig().getMinimumSize();

-            assert minStereoSize.width <= w;

-            getStereotypeFig().setBounds(middle - minStereoSize.width / 2,

-                    y + 55 + getNameFig().getHeight(),

-                    minStereoSize.width, 

-                    minStereoSize.height);

-        }

-        calcBounds(); //Accumulate a bounding box for all the Figs in the group.

-        firePropChange("bounds", oldBounds, getBounds());

-        updateEdges();

-    }

-

-    /**

-     * Overruled the parent implementation, to always use the minimum size.

-     * 

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateBounds()

-     */

-    @Override

-    protected void updateBounds() {

-        if (!isCheckSize()) {

-            return;

-        }

-        Rectangle bbox = getBounds();

-        Dimension minSize = getMinimumSize();

-        setBounds(bbox.x, bbox.y, minSize.width, minSize.height);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.FigNode#deepHitPort(int, int)

-     */

-    @Override

-    public Object deepHitPort(int x, int y) {

-        Object o = super.deepHitPort(x, y);

-        if (o != null) {

-            return o;

-        }

-        if (hit(new Rectangle(new Dimension(x, y)))) {

-            return getOwner();

-        }

-        return null;

     }

-

-    /*

-     * Makes sure that the edges stick to the outline of the fig.

-     * @see org.tigris.gef.presentation.Fig#getGravityPoints()

-     */

-    @Override

-    public List<Point> getGravityPoints() {

-        final int maxPoints = 20;

-        List<Point> ret = new ArrayList<Point>();

-        int cx = getFigAt(HEAD_POSN).getCenter().x;

-        int cy = getFigAt(HEAD_POSN).getCenter().y;

-        int radiusx = Math.round(getFigAt(HEAD_POSN).getWidth() / 2) + 1;

-        int radiusy = Math.round(getFigAt(HEAD_POSN).getHeight() / 2) + 1;

-        Point point = null;

-        for (int i = 0; i < maxPoints; i++) {

-            double angle = 2 * Math.PI / maxPoints * i;

-            point =

-                new Point((int) (cx + Math.cos(angle) * radiusx),

-                          (int) (cy + Math.sin(angle) * radiusy));

-            ret.add(point);

-        }

-        ret.add(new Point(((FigLine) getFigAt(LEFT_LEG_POSN)).getX2(),

-                          ((FigLine) getFigAt(LEFT_LEG_POSN)).getY2()));

-        ret.add(new Point(((FigLine) getFigAt(RIGHT_LEG_POSN)).getX2(),

-                          ((FigLine) getFigAt(RIGHT_LEG_POSN)).getY2()));

-        ret.add(new Point(((FigLine) getFigAt(ARMS_POSN)).getX1(),

-                          ((FigLine) getFigAt(ARMS_POSN)).getY1()));

-        ret.add(new Point(((FigLine) getFigAt(ARMS_POSN)).getX2(),

-                          ((FigLine) getFigAt(ARMS_POSN)).getY2()));

-        return ret;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    protected void modelChanged(PropertyChangeEvent mee) {

-        //      name updating

-        super.modelChanged(mee);

-

-        boolean damage = false;

-        if (getOwner() == null) {

-            return;

-        }

-

-        if (mee == null 

-                || mee.getPropertyName().equals("stereotype") 

-                || Model.getFacade().getStereotypes(getOwner())

-                                .contains(mee.getSource())) {

-            updateStereotypeText();

-            damage = true;

-        }

-

-        if (damage) {

-            damage();

-        }

-    }

-

-    @Override

-    protected int getNameFigFontStyle() {

-        Object cls = getOwner();

-        return Model.getFacade().isAbstract(cls) ? Font.ITALIC : Font.PLAIN;

-    }

-

-    /**

-     * The bigport needs to overrule the getGravityPoints,

-     * because it is the port of this FigNode.

-     *

-     * @author [email protected]

-     */

-    static class ActorPortFigRect extends FigRect {

-        /**

-         * the parent fig, i.e. the Actor

-         */

-        private Fig parent;

-

-        /**

-         * The constructor.

-         *

-         * @param x the x

-         * @param y the y

-         * @param w the width

-         * @param h the height

-         * @param p the Actor fig

-         */

-        public ActorPortFigRect(int x, int y, int w, int h, Fig p) {

-            super(x, y, w, h, null, null);

-            parent = p;

-        }

-

-        /**

-         * Makes sure that the edges stick to the outline of the fig.

-         * @see org.tigris.gef.presentation.Fig#getGravityPoints()

-         */

-        @Override

-        public List getGravityPoints() {

-            return parent.getGravityPoints();

-        }

-

-        /**

-         * The serial version - Eclipse generated for Rev. 1.40

-         */

-        private static final long serialVersionUID = 5973857118854162659L;

-    }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationClass2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationClass2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationClass2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationClass2.java	2009-08-07 14:44:24-0700
@@ -24,20 +24,8 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Color;

-import java.awt.Rectangle;

-import java.util.Iterator;

-import java.util.List;

-

-import org.argouml.uml.diagram.AttributesCompartmentContainer;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.OperationsCompartmentContainer;

-import org.argouml.uml.diagram.PathContainer;

-import org.argouml.uml.diagram.ui.FigEdgePort;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigNode;

-import org.tigris.gef.presentation.FigPoly;

-import org.tigris.gef.presentation.FigText;

+import org.argouml.uml.diagram.ui.FigAssociationClass;

 

 /**

  * An Association Class is represented by 3 separate Figs:

@@ -58,14 +46,8 @@
  * then there is no such event. Hence the removeFromDiagram method is overridden

  * to delegate removal from a single removeFromDiagram method on

  * FigAssociationClass.

- *

- * @author [email protected]

  */

-class FigAssociationClass2 extends FigAssociation2 implements

-        AttributesCompartmentContainer, PathContainer,

-        OperationsCompartmentContainer {

-

-    private static final long serialVersionUID = 3643715304027095083L;

+class FigAssociationClass2 extends FigAssociationClass {

 

     /**

      * Construct an association class figure for the given AssociationClass

@@ -76,265 +58,5 @@
      */

     public FigAssociationClass2(Object element, DiagramSettings settings) {

         super(element, settings);

-        setBetweenNearestPoints(true);

-        ((FigPoly) getFig()).setRectilinear(false);

-        setDashed(false);

-    }

-    

-    /**

-     * This overrides the parent class to do nothing here. An association class

-     * has no name label but instead has the name and stereotype editable in

-     * the association-classes class box.

-     * 

-     * @param owner owning uml element

-     * @param settings rendering settings

-     */

-    protected void createNameLabel(Object owner, DiagramSettings settings) {

-    }

-    

-    /**

-     * 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() {

-        FigEdgeAssociationClass2 figEdgeLink = null;

-        List edges = null;

-

-        FigEdgePort figEdgePort = getEdgePort();

-        if (figEdgePort != null) {

-            edges = figEdgePort.getFigEdges();

-        }

-

-        if (edges != null) {

-            for (Iterator it = edges.iterator(); it.hasNext()

-                    && figEdgeLink == null;) {

-                Object o = it.next();

-                if (o instanceof FigEdgeAssociationClass2) {

-                    figEdgeLink = (FigEdgeAssociationClass2) o;

-                }

-            }

-        }

-

-        if (figEdgeLink != null) {

-            FigNode figClassBox = figEdgeLink.getDestFigNode();

-            if (!(figClassBox instanceof FigClassAssociationClass2)) {

-                figClassBox = figEdgeLink.getSourceFigNode();

-            }

-            figEdgeLink.removeFromDiagramImpl();

-            ((FigClassAssociationClass2) figClassBox).removeFromDiagramImpl();

-        }

-

-        super.removeFromDiagramImpl();

-    }

-

-    /*

-     * TODO: Is this required? Why would the fig already be dashed?

-     * 

-     * @see org.tigris.gef.presentation.FigEdge#setFig(

-     *      org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setFig(Fig f) {

-        super.setFig(f);

-        getFig().setDashed(false);

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#getNameFig()

-     */

-    @Override

-    protected FigText getNameFig() {

-        return null;

-    }

-

-    /**

-     * @return the bounds of the operations compartment for the associated

-     *         FigClassAssociationClass.

-     * @see org.argouml.uml.diagram.AttributesCompartmentContainer#getAttributesBounds()

-     */

-    public Rectangle getAttributesBounds() {

-        if (getAssociationClass() != null) {

-            return getAssociationClass().getAttributesBounds();

-        } else {

-            return new Rectangle(0, 0, 0, 0);

-        }

-    }

-

-    /*

-     * Overridden in order to implement AttributesCompartmentContainer.

-     */

-    public boolean isAttributesVisible() {

-        if (getAssociationClass() != null) {

-            return getAssociationClass().isAttributesVisible();

-        } else {

-            return true;

-        }

-    }

-

-    /*

-     * Overridden in order to implement AttributesCompartmentContainer.

-     */

-    public void setAttributesVisible(boolean visible) {

-        if (getAssociationClass() != null) {

-            getAssociationClass().setAttributesVisible(visible);

-        }

-    }

-

-    /*

-     * Overridden in order to implement PathCompartmentContainer.

-     */

-    public boolean isPathVisible() {

-        if (getAssociationClass() != null) {

-            return getAssociationClass().isPathVisible();

-        } else {

-            return false;

-        }

-    }

-

-    /*

-     * Overridden in order to implement PathCompartmentContainer.

-     */

-    public void setPathVisible(boolean visible) {

-        if (getAssociationClass() != null) {

-            getAssociationClass().setPathVisible(visible);

-        }

-    }

-

-    /*

-     * Overridden in order to implement OperationsCompartmentContainer.

-     */

-    public Rectangle getOperationsBounds() {

-        if (getAssociationClass() != null) {

-            return getAssociationClass().getOperationsBounds();

-        } else {

-            return new Rectangle(0, 0, 0, 0);

-        }

-    }

-

-    /*

-     * Overridden in order to implement OperationsCompartmentContainer.

-     */

-    public boolean isOperationsVisible() {

-        if (getAssociationClass() != null) {

-            return getAssociationClass().isOperationsVisible();

-        } else {

-            return true;

-        }

-    }

-

-    /*

-     * Overridden in order to implement OperationsCompartmentContainer.

-     */

-    public void setOperationsVisible(boolean visible) {

-        if (getAssociationClass() != null) {

-            getAssociationClass().setOperationsVisible(visible);

-        }

-    }

-

-    /**

-     * Set fill color of contained FigClassAssociationClass.

-     * 

-     * @param color new fill color

-     */

-    @Override

-    public void setFillColor(Color color) {

-        if (getAssociationClass() != null) {

-            getAssociationClass().setFillColor(color);

-        }

-    }

-

-    /**

-     * @return fill color of contained FigClassAssociationClass.

-     */

-    @Override

-    public Color getFillColor() {

-        if (getAssociationClass() != null) {

-            return getAssociationClass().getFillColor();

-        } else {

-            return FILL_COLOR;

-        }

-    }

-

-    /**

-     * Set line color of contained FigClassAssociationClass.

-     * 

-     * @param arg0 new line color

-     */

-    @Override

-    public void setLineColor(Color arg0) {

-        super.setLineColor(arg0);

-        if (getAssociationClass() != null) {

-            getAssociationClass().setLineColor(arg0);

-        }

-        if (getFigEdgeAssociationClass() != null) {

-            getFigEdgeAssociationClass().setLineColor(arg0);

-        }

-    }

-

-    /**

-     * Gets FigClassAssociationClass that is contained in this

-     * FigAssociationClass.

-     *

-     * @return FigClassAssociationClass that is contained in this

-     *         FigAssociationClass.

-     */

-    public FigClassAssociationClass2 getAssociationClass() {

-        FigEdgeAssociationClass2 figEdgeLink = null;

-        List edges = null;

-

-        FigEdgePort figEdgePort = this.getEdgePort();

-        if (figEdgePort != null) {

-            edges = figEdgePort.getFigEdges();

-        }

-

-        if (edges != null) {

-            for (Iterator it = edges.iterator(); it.hasNext()

-                    && figEdgeLink == null;) {

-                Object o = it.next();

-                if (o instanceof FigEdgeAssociationClass2) {

-                    figEdgeLink = (FigEdgeAssociationClass2) o;

-                }

-            }

-        }

-

-        FigNode figClassBox = null;

-        if (figEdgeLink != null) {

-            figClassBox = figEdgeLink.getDestFigNode();

-            if (!(figClassBox instanceof FigClassAssociationClass2)) {

-                figClassBox = figEdgeLink.getSourceFigNode();

-            }

-        }

-        return (FigClassAssociationClass2) figClassBox;

-    }

-

-    /**

-     * Gets FigEdgeAssociationClass that is contained in this

-     * FigAssociationClass.

-     *

-     * @return FigEdgeAssociationClass that is contained in this

-     *         FigAssociationClass

-     */

-    public FigEdgeAssociationClass2 getFigEdgeAssociationClass() {

-        FigEdgeAssociationClass2 figEdgeLink = null;

-        List edges = null;

-

-        FigEdgePort figEdgePort = this.getEdgePort();

-        if (figEdgePort != null) {

-            edges = figEdgePort.getFigEdges();

-        }

-

-        if (edges != null) {

-            for (Iterator it = edges.iterator(); it.hasNext()

-                    && figEdgeLink == null;) {

-                Object o = it.next();

-                if (o instanceof FigEdgeAssociationClass2) {

-                    figEdgeLink = (FigEdgeAssociationClass2) o;

-                }

-            }

-        }

-

-        return figEdgeLink;

     }

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationEnd2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationEnd2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationEnd2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigAssociationEnd2.java	2009-08-07 14:44:24-0700
@@ -49,5 +49,4 @@
     public FigAssociationEnd2(Object owner, DiagramSettings settings) {

         super(owner, settings);

     }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClass2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClass2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClass2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClass2.java	2009-08-07 14:44:24-0700
@@ -25,17 +25,9 @@
 package org.argouml.structure2.diagram;

 

 import java.awt.Rectangle;

-import java.util.ArrayList;

-import java.util.Iterator;

-import java.util.List;

 

-import org.argouml.model.Model;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.static_structure.ui.FigClassifierBoxWithAttributes;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigGroup;

-import org.tigris.gef.presentation.FigText;

+import org.argouml.uml.diagram.static_structure.ui.FigClass;

 

 /**

  * Class to display graphics for a UML Class in a diagram.<p>

@@ -43,19 +35,10 @@
  * A Class may show compartments for stereotypes,

  * attributes and operations.

  */

-class FigClass2 extends FigClassifierBoxWithAttributes {

+class FigClass2 extends FigClass {

 

-    private void constructFigs() {

-        addFig(getBigPort());

-        addFig(getStereotypeFig());

-        addFig(getNameFig());

-        addFig(getOperationsFig());

-        addFig(getAttributesFig());

-        addFig(borderFig);

-    }

-    

     /**

-     * Constructor for a {@link FigClass2} during file load.<p>

+     * Constructor for a {@link FigClass2}.<p>

      *

      * Parent {@link org.argouml.uml.diagram.ui.FigNodeModelElement}

      * will have created the main box {@link #getBigPort()} and its

@@ -81,144 +64,5 @@
     public FigClass2(Object element, Rectangle bounds, 

             DiagramSettings settings) {

         super(element, bounds, settings);

-        constructFigs();

-        Rectangle r = getBounds();

-        setStandardBounds(r.x, r.y, r.width, r.height);

-    }

-

-    /*

-     * @see java.lang.Object#clone()

-     */

-    @Override

-    public Object clone() {

-        FigClass2 figClone = (FigClass2) super.clone();

-        Iterator thisIter = this.getFigs().iterator();

-        Iterator cloneIter = figClone.getFigs().iterator();

-        while (thisIter.hasNext()) {

-            Fig thisFig = (Fig) thisIter.next();

-            Fig cloneFig = (Fig) cloneIter.next();

-            if (thisFig == borderFig) {

-                figClone.borderFig = thisFig;

-            }

-        }

-        return figClone;

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    public Selection makeSelection() {

-        return new SelectionClass(this);

-    }

-

-    protected Object buildModifierPopUp() {

-        return buildModifierPopUp(ABSTRACT | LEAF | ROOT | ACTIVE);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineWidth()

-     */

-    public int getLineWidth() {

-        return borderFig.getLineWidth();

-    }

-

-    /**

-     * @param fgVec the FigGroup

-     * @param ft    the Figtext

-     * @param i     get the fig before fig i

-     * @return the FigText

-     */

-    protected FigText getPreviousVisibleFeature(FigGroup fgVec,

-						FigText ft, int i) {

-        if (fgVec == null || i < 1) {

-            return null;

-        }

-        FigText ft2 = null;

-        List figs = fgVec.getFigs();

-        if (i >= figs.size() || !((FigText) figs.get(i)).isVisible()) {

-            return null;

-        }

-        do {

-            i--;

-            while (i < 1) {

-                if (fgVec == getAttributesFig()) {

-                    fgVec = getOperationsFig();

-                } else {

-                    fgVec = getAttributesFig();

-                }

-                figs = fgVec.getFigs();

-                i = figs.size() - 1;

-            }

-            ft2 = (FigText) figs.get(i);

-            if (!ft2.isVisible()) {

-                ft2 = null;

-            }

-        } while (ft2 == null);

-        return ft2;

-    }

-

-    /**

-     * @param fgVec the FigGroup

-     * @param ft    the Figtext

-     * @param i     get the fig after fig i

-     * @return the FigText

-     */

-    protected FigText getNextVisibleFeature(FigGroup fgVec, FigText ft, int i) {

-        if (fgVec == null || i < 1) {

-            return null;

-        }

-        FigText ft2 = null;

-        List v = fgVec.getFigs();

-        if (i >= v.size() || !((FigText) v.get(i)).isVisible()) {

-            return null;

-        }

-        do {

-            i++;

-            while (i >= v.size()) {

-                if (fgVec == getAttributesFig()) {

-                    fgVec = getOperationsFig();

-                } else {

-                    fgVec = getAttributesFig();

-                }

-                v = new ArrayList(fgVec.getFigs());

-                i = 1;

-            }

-            ft2 = (FigText) v.get(i);

-            if (!ft2.isVisible()) {

-                ft2 = null;

-            }

-        } while (ft2 == null);

-        return ft2;

-    }

-

-    public void setEnclosingFig(Fig encloser) {

-        if (encloser == getEncloser()) {

-            return;

-        }

-        if (encloser == null

-                || (encloser != null

-                && !Model.getFacade().isAInstance(encloser.getOwner()))) {

-            super.setEnclosingFig(encloser);

-        }

-        if (!(Model.getFacade().isAUMLElement(getOwner()))) {

-            return;

-        }

-        if (encloser != null

-                && (Model.getFacade().isAComponent(encloser.getOwner()))) {

-            moveIntoComponent(encloser);

-            super.setEnclosingFig(encloser);

-        }

-

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateNameText()

-     */

-    @Override

-    protected void updateNameText() {

-        super.updateNameText();

-        calcBounds();

-        setBounds(getBounds());

     }

-    

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClassAssociationClass2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClassAssociationClass2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClassAssociationClass2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigClassAssociationClass2.java	2009-08-07 14:44:24-0700
@@ -27,17 +27,13 @@
 import java.awt.Rectangle;

 

 import org.argouml.uml.diagram.DiagramSettings;

-import org.tigris.gef.presentation.Fig;

+import org.argouml.uml.diagram.ui.FigClassAssociationClass;

 

 /**

  * Class to display the Class box fig piece of an Association Class.

  * <em>NOTE:</em> It must be used only from a FigAssociationClass

- *

- * @author pepargouml

  */

-class FigClassAssociationClass2 extends FigClass2 {

-

-    private static final long serialVersionUID = -4101337246957593739L;

+class FigClassAssociationClass2 extends FigClassAssociationClass {

     

     /**

      * Construct the Class box piece of a complex association class fig.

@@ -49,24 +45,5 @@
     public FigClassAssociationClass2(Object owner, Rectangle bounds, 

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        enableSizeChecking(true);

-    }

-    

-    protected Fig getRemoveDelegate() {

-        // Look for the dashed edge

-        for (Object fig : getFigEdges()) {

-            if (fig instanceof FigEdgeAssociationClass2) {

-                // We have the dashed edge now find the opposite FigNode

-                FigEdgeAssociationClass2 dashedEdge =

-                    (FigEdgeAssociationClass2) fig;

-                return dashedEdge.getRemoveDelegate();

-            }

-        }

-        return null;

-    }

-

-    @Override

-    protected void removeFromDiagramImpl() {

-        super.removeFromDiagramImpl();

     }

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComment2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComment2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComment2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComment2.java	2009-08-07 14:44:24-0700
@@ -24,149 +24,19 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Color;

-import java.awt.Dimension;

-import java.awt.Point;

-import java.awt.Polygon;

 import java.awt.Rectangle;

-import java.awt.event.InputEvent;

-import java.awt.event.KeyEvent;

-import java.awt.event.KeyListener;

-import java.awt.event.MouseEvent;

-import java.awt.event.MouseListener;

-import java.beans.PropertyChangeEvent;

-import java.beans.PropertyChangeListener;

-import java.beans.VetoableChangeListener;

-import java.util.ArrayList;

-import java.util.Collection;

-import java.util.Iterator;

 

-import javax.swing.SwingUtilities;

-

-import org.apache.log4j.Logger;

-import org.argouml.kernel.DelayedChangeNotify;

-import org.argouml.kernel.DelayedVChangeListener;

-import org.argouml.model.AttributeChangeEvent;

-import org.argouml.model.Model;

-import org.argouml.model.RemoveAssociationEvent;

-import org.argouml.model.UmlChangeEvent;

-import org.argouml.ui.ArgoJMenu;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.static_structure.ui.SelectionComment;

-import org.argouml.uml.diagram.ui.FigMultiLineText;

-import org.argouml.uml.diagram.ui.FigNodeModelElement;

-import org.tigris.gef.base.Geometry;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigPoly;

-import org.tigris.gef.presentation.FigRect;

-import org.tigris.gef.presentation.FigText;

+import org.argouml.uml.diagram.static_structure.ui.FigComment;

 

 /**

  * Class to display a UML comment in a diagram.

- *

- * @author Andreas Rueckert

  */

-class FigComment2

-    extends FigNodeModelElement

-    implements VetoableChangeListener,

-	       DelayedVChangeListener,

-	       MouseListener,

-	       KeyListener,

-	       PropertyChangeListener {

-    /**

-     * Logger.

-     */

-    private static final Logger LOG = Logger.getLogger(FigComment2.class);

-

-    ////////////////////////////////////////////////////////////////

-    // constants

-

-    private int width = 80;

-    private int height = 60;

-

-    /**

-     * A dog-ear is a bent corner in a book.

-     */

-    private int dogear = 10;

-

-    private boolean readyToEdit = true;

-

-    // The figure that holds the text of the note.

-    private FigText bodyTextFig;

-

-    private FigPoly outlineFig;

-

-    /**

-     * The upper right corner.

-     */

-    private FigPoly urCorner;

-

-    /**

-     * Flag to indicate that we have just been created. This is to fix the

-     * problem with loading comments that have stereotypes already

-     * defined.<p>

-     */

-    private boolean newlyCreated;

-

-    private void initialize() {

-        Color fg = super.getLineColor(); // Use super because not fully init'd

-        Color fill = super.getFillColor();

-        

-        outlineFig = new FigPoly(fg, fill);

-        outlineFig.addPoint(0, 0);

-        outlineFig.addPoint(width - 1 - dogear, 0);

-        outlineFig.addPoint(width - 1, dogear);

-        outlineFig.addPoint(width - 1, height - 1);

-        outlineFig.addPoint(0, height - 1);

-        outlineFig.addPoint(0, 0);

-        outlineFig.setFilled(true);

-        outlineFig.setLineWidth(LINE_WIDTH);

-

-        urCorner = new FigPoly(fg, fill);

-        urCorner.addPoint(width - 1 - dogear, 0);

-        urCorner.addPoint(width - 1, dogear);

-        urCorner.addPoint(width - 1 - dogear, dogear);

-        urCorner.addPoint(width - 1 - dogear, 0);

-        urCorner.setFilled(true);

-        Color col = outlineFig.getFillColor();

-        urCorner.setFillColor(col.darker());

-        urCorner.setLineWidth(LINE_WIDTH);

-

-        setBigPort(new FigRect(0, 0, width, height, null, null));

-        getBigPort().setFilled(false);

-        getBigPort().setLineWidth(0);

-

-

-        // add Figs to the FigNode in back-to-front order

-        addFig(getBigPort());

-        addFig(outlineFig);

-        addFig(urCorner);

-        addFig(getStereotypeFig());

-        addFig(bodyTextFig);

-        

-        col = outlineFig.getFillColor();

-        urCorner.setFillColor(col.darker());

-

-        setBlinkPorts(false); //make port invisible unless mouse enters

-        Rectangle r = getBounds();

-        setBounds(r.x, r.y, r.width, r.height);

-        updateEdges();

-

-        readyToEdit = false;

-        // Mark this as newly created. This is to get round the problem with

-        // creating figs for loaded comments that had stereotypes. They are

-        // saved with their dimensions INCLUDING the stereotype, but since we

-        // pretend the stereotype is not visible, we add height the first time

-        // we render such a comment. This is a complete fudge, and really we

-        // ought to address how comment objects with stereotypes are saved. But

-        // that will be hard work.

-        newlyCreated = true;

-    }

+class FigComment2 extends FigComment {

 

     /**

      * Construct a comment figure with the given model element, bounds, and

-     * settings. This constructor is used by the PGML parser.

+     * settings.

      * 

      * @param owner owning Comments

      * @param bounds position and size

@@ -175,565 +45,5 @@
     public FigComment2(Object owner, Rectangle bounds, 

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        

-        bodyTextFig = new FigMultiLineText(getOwner(), 

-                new Rectangle(2, 2, width - 2 - dogear, height - 4), 

-                getSettings(), true);

-        

-        initialize();

-        updateBody();

-        if (bounds != null) {

-            setLocation(bounds.x, bounds.y);

-        }

-    }

-

-    /**

-     * Get the default text for this figure.

-     *

-     * @return The default text for this figure.

-     */

-    @Override

-    public String placeString() {

-        String placeString = retrieveBody();

-        if (placeString == null) {

-            // TODO: I18N

-            placeString = "new note";

-        }

-        return placeString;

-    }

-

-    /**

-     * Clone this figure.

-     *

-     * @return The cloned figure.

-     */

-    @Override

-    public Object clone() {

-        FigComment2 figClone = (FigComment2) super.clone();

-        Iterator thisIter = this.getFigs().iterator();

-        while (thisIter.hasNext()) {

-            Object thisFig = thisIter.next();

-            if (thisFig == outlineFig) {

-                figClone.outlineFig = (FigPoly) thisFig;

-            }

-            if (thisFig == urCorner) {

-                figClone.urCorner = (FigPoly) thisFig;

-            }

-            if (thisFig == bodyTextFig) {

-                figClone.bodyTextFig = (FigText) thisFig;

-            }

-        }

-        return figClone;

-    }

-

-    private void updateBody() {

-        if (getOwner() != null) {

-            String body = (String) Model.getFacade().getBody(getOwner());

-            if (body != null) {

-                bodyTextFig.setText(body);

-            }

-        }

-    }

-

-

-    /**

-     * See FigNodeModelElement.java for more info on these methods.

-     */

-

-    /**

-     * If the user double clicks on any part of this FigNode, pass it

-     * down to one of the internal Figs.  This allows the user to

-     * initiate direct text editing.

-     *

-     * {@inheritDoc}

-     */

-    @Override

-    public void mouseClicked(MouseEvent me) {

-        if (!readyToEdit) {

-            Object owner = getOwner();

-            if (Model.getFacade().isAModelElement(owner) 

-                    && !Model.getModelManagementHelper().isReadOnly(owner)) {

-                readyToEdit = true;

-            } else {

-                LOG.debug("not ready to edit note");

-                return;

-            }

-        }

-        if (me.isConsumed()) {

-            return;

-        }

-        if (me.getClickCount() >= 2

-	    && !(me.isPopupTrigger()

-		 || me.getModifiers() == InputEvent.BUTTON3_MASK)) {

-            if (getOwner() == null) {

-                return;

-            }

-            Fig f = hitFig(new Rectangle(me.getX() - 2, me.getY() - 2, 4, 4));

-            if (f instanceof MouseListener) {

-                ((MouseListener) f).mouseClicked(me);

-            }

-        }

-        me.consume();

-    }

-

-    /*

-     * @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    public void vetoableChange(PropertyChangeEvent pce) {

-        Object src = pce.getSource();

-        if (src == getOwner()) {

-            DelayedChangeNotify delayedNotify =

-		new DelayedChangeNotify(this, pce);

-            SwingUtilities.invokeLater(delayedNotify);

-        } else {

-            LOG.debug("FigNodeModelElement got vetoableChange"

-		      + " from non-owner:" + src);

-        }

-    }

-

-    /*

-     * @see org.argouml.kernel.DelayedVChangeListener#delayedVetoableChange(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    public void delayedVetoableChange(PropertyChangeEvent pce) {

-        // update any text, colors, fonts, etc.

-        renderingChanged();

-        // update the relative sizes and positions of internel Figs

-        endTrans();

-    }

-

-    /*

-     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    public void propertyChange(PropertyChangeEvent pve) {

-        Object src = pve.getSource();

-        String pName = pve.getPropertyName();

-        if (pName.equals("editing")

-	    && Boolean.FALSE.equals(pve.getNewValue())) {

-            //parse the text that was edited

-            textEdited((FigText) src);

-            // resize the FigNode to accomodate the new text

-            Rectangle bbox = getBounds();

-            Dimension minSize = getMinimumSize();

-            bbox.width = Math.max(bbox.width, minSize.width);

-            bbox.height = Math.max(bbox.height, minSize.height);

-            setBounds(bbox.x, bbox.y, bbox.width, bbox.height);

-            endTrans();

-        } else {

-            super.propertyChange(pve);

-        }

-    }

-

-    /*

-     * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)

-     */

-    @Override

-    public void keyPressed(KeyEvent ke) {

-        // Not used, do nothing.

-    }

-

-    /*

-     * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)

-     */

-    @Override

-    public void keyReleased(KeyEvent ke) {

-        // Not used, do nothing.

-    }

-

-    /*

-     * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)

-     */

-    @Override

-    public void keyTyped(KeyEvent ke) {

-        if (Character.isISOControl(ke.getKeyChar())) {

-            return;

-        }

-        if (!readyToEdit) {

-            Object owner = getOwner();

-            if (Model.getFacade().isAModelElement(owner)

-                    && !Model.getModelManagementHelper().isReadOnly(owner)) {

-                storeBody("");

-                readyToEdit = true;

-            } else {

-                LOG.debug("not ready to edit note");

-                return;

-            }

-        }

-        if (ke.isConsumed()) {

-            return;

-        }

-        if (getOwner() == null) {

-            return;

-        }

-        bodyTextFig.keyTyped(ke);

-    }

-

-    ////////////////////////////////////////////////////////////////

-    // Fig accessors

-

-    /**

-     * @return an empty menu

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#buildShowPopUp()

-     */

-    @Override

-    protected ArgoJMenu buildShowPopUp() {

-        return new ArgoJMenu("menu.popup.show");

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionComment(this);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color)

-     */

-    @Override

-    public void setLineColor(Color col) {

-        // The text element has no border, so the line color doesn't matter.

-        outlineFig.setLineColor(col);

-        urCorner.setLineColor(col);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineColor()

-     */

-    @Override

-    public Color getLineColor() {

-        return outlineFig.getLineColor();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setFillColor(java.awt.Color)

-     */

-    @Override

-    public void setFillColor(Color col) {

-        outlineFig.setFillColor(col);

-        urCorner.setFillColor(col);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getFillColor()

-     */

-    @Override

-    public Color getFillColor() {

-        return outlineFig.getFillColor();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setFilled(boolean)

-     */

-    @Override

-    public void setFilled(boolean f) {

-        bodyTextFig.setFilled(false); // The text is always opaque.

-        outlineFig.setFilled(f);

-        urCorner.setFilled(f);

-    }

-

-    @Override

-    public boolean isFilled() {

-        return outlineFig.isFilled();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setLineWidth(int)

-     */

-    @Override

-    public void setLineWidth(int w) {

-        bodyTextFig.setLineWidth(0); // Make a seamless integration of the text

-        // in the note figure.

-        outlineFig.setLineWidth(w);

-        urCorner.setLineWidth(w);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineWidth()

-     */

-    @Override

-    public int getLineWidth() {

-        return outlineFig.getLineWidth();

-    }

-

-    ////////////////////////////////////////////////////////////////

-    // user interaction methods

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)

-     */

-    @Override

-    protected void textEdited(FigText ft) {

-        if (ft == bodyTextFig) {

-            storeBody(ft.getText());

-        }

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(org.tigris.gef.presentation.FigText)

-     */

-    @Override

-    protected void textEditStarted(FigText ft) {

-        showHelp("parsing.help.comment");

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setEnclosingFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setEnclosingFig(Fig encloser) {

-        super.setEnclosingFig(encloser);

-    }

-

-    ////////////////////////////////////////////////////////////////

-    // accessor methods

-

-    /**

-     * Stores the body text in the associated model element.

-     *

-     * @param body The body text to store.

-     */

-    public final void storeBody(String body) {

-        if (getOwner() != null) {

-            Model.getCoreHelper().setBody(getOwner(), body);

-        }

-    }

-

-    /**

-     * Retrieve the body text from the associated model element.

-     *

-     * @return The body from the associated model element.

-     */

-    private String retrieveBody() {

-        return (getOwner() != null)

-            ? (String) Model.getFacade().getBody(getOwner())

-            : null;

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getUseTrapRect()

-     */

-    @Override

-    public boolean getUseTrapRect() {

-        return true;

-    }

-    

-    /**

-     * Always returns null as the FigComment does not display its name.

-     * @return null

-     */

-    @Override

-    public Rectangle getNameBounds() {

-        return null;

-    }

-

-    /**

-     * Get the minimum size for the note figure.

-     *

-     * @return The minimum size for the note figure.

-     */

-    @Override

-    public Dimension getMinimumSize() {

-

-        // Get the size of the text field.

-        Dimension aSize = bodyTextFig.getMinimumSize();

-

-        // If we have a stereotype displayed, then allow some space for that

-        // (width and height)

-

-        if (getStereotypeFig().isVisible()) {

-            Dimension stereoMin = getStereotypeFig().getMinimumSize();

-            aSize.width =

-                Math.max(aSize.width,

-                         stereoMin.width);

-            aSize.height += stereoMin.height;

-        }

-

-        // And add the gaps around the textfield to get the minimum

-        // size of the note.

-        return new Dimension(aSize.width + 4 + dogear,

-			     aSize.height + 4);

     }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)

-     */

-    @Override

-    protected void setStandardBounds(int px, int py, int w, int h) {

-        if (bodyTextFig == null) {

-            return;

-        }

-

-        Dimension stereoMin = getStereotypeFig().getMinimumSize();

-

-        int stereotypeHeight = 0;

-        if (getStereotypeFig().isVisible()) {

-            stereotypeHeight = stereoMin.height;

-        }

-

-        Rectangle oldBounds = getBounds();

-

-        // Resize the text figure

-        bodyTextFig.setBounds(px + 2, py + 2 + stereotypeHeight,

-                w - 4 - dogear, h - 4 - stereotypeHeight);

-

-        getStereotypeFig().setBounds(px + 2, py + 2,

-                w - 4 - dogear, stereoMin.height);

-

-        // Resize the big port around the figure

-        getBigPort().setBounds(px, py, w, h);

-

-        // Since this is a complex polygon, there's no easy way to resize it.

-        Polygon newPoly = new Polygon();

-        newPoly.addPoint(px, py);

-        newPoly.addPoint(px + w - 1 - dogear, py);

-        newPoly.addPoint(px + w - 1, py + dogear);

-        newPoly.addPoint(px + w - 1, py + h - 1);

-        newPoly.addPoint(px, py + h - 1);

-        newPoly.addPoint(px, py);

-        outlineFig.setPolygon(newPoly);

-

-        // Just move the corner to it's new position.

-        urCorner.setBounds(px + w - 1 - dogear, py, dogear, dogear);

-

-        calcBounds(); //_x = x; _y = y; _w = w; _h = h;

-        firePropChange("bounds", oldBounds, getBounds());

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateBounds()

-     */

-    @Override

-    protected void updateBounds() {

-        Rectangle bbox = getBounds();

-        Dimension minSize = getMinimumSize();

-        bbox.width = Math.max(bbox.width, minSize.width);

-        bbox.height = Math.max(bbox.height, minSize.height);

-        setBounds(bbox.x, bbox.y, bbox.width, bbox.height);

-    }

-

-    ///////////////////////////////////////////////////////////////////

-    // Internal methods

-

-    @Override

-    protected final void updateLayout(UmlChangeEvent mee) {

-        super.updateLayout(mee);

-

-        if (mee instanceof AttributeChangeEvent

-                && mee.getPropertyName().equals("body")) {

-

-            bodyTextFig.setText(mee.getNewValue().toString());

-            calcBounds();

-            setBounds(getBounds());

-            damage();

-        } else if (mee instanceof RemoveAssociationEvent

-                && mee.getPropertyName().equals("annotatedElement")) {

-            /* Remove the commentedge.

-             * If there are more then one comment-edges between 

-             * the 2 objects, then delete them all. */

-            Collection<FigEdgeNote2> toRemove = new ArrayList<FigEdgeNote2>();

-            Collection c = getFigEdges(); // all connected edges

-            for (Iterator i = c.iterator(); i.hasNext(); ) {

-                FigEdgeNote2 fen = (FigEdgeNote2) i.next();

-                Object otherEnd = fen.getDestination(); // the UML object

-                if (otherEnd == getOwner()) { // wrong end of the edge

-                    otherEnd = fen.getSource();

-                }

-                if (otherEnd == mee.getOldValue())  {

-                    toRemove.add(fen);

-                }

-            }

-            

-            for (FigEdgeNote2 fen : toRemove) {

-                fen.removeFromDiagram();

-            }

-        }

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateStereotypeText()

-     */

-    @Override

-    protected void updateStereotypeText() {

-        Object me = getOwner();

-

-        if (me == null) {

-            return;

-        }

-

-        Rectangle rect = getBounds();

-

-        Dimension stereoMin = getStereotypeFig().getMinimumSize();

-

-        if (Model.getFacade().getStereotypes(me).isEmpty()) {

-

-            if (getStereotypeFig().isVisible()) {

-                getStereotypeFig().setVisible(false);

-                rect.y += stereoMin.height;

-                rect.height -= stereoMin.height;

-                setBounds(rect.x, rect.y, rect.width, rect.height);

-                calcBounds();

-            }

-        } else {

-            if (!getStereotypeFig().isVisible()) {

-                getStereotypeFig().setVisible(true);

-

-                // Only adjust the stereotype height if we are not newly

-                // created. This gets round the problem of loading classes with

-                // stereotypes defined, which have the height already including

-                // the stereotype.

-

-                if (!newlyCreated) {

-                    rect.y -= stereoMin.height;

-                    rect.height += stereoMin.height;

-                    rect.width =

-                        Math.max(getMinimumSize().width, rect.width);

-                    setBounds(rect.x, rect.y, rect.width, rect.height);

-                    calcBounds();

-                }

-            }

-        }

-        // Whatever happened we are no longer newly created, so clear the

-        // flag. Then set the bounds for the rectangle we have defined.

-        newlyCreated = false;

-    }

-    

-    /**

-     * Get the text body of the comment.

-     * @return the body of the comment

-     */

-    public String getBody() {

-        return bodyTextFig.getText();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getClosestPoint(java.awt.Point)

-     */

-    @Override

-    public Point getClosestPoint(Point anotherPt) {

-        Rectangle r = getBounds();

-        int[] xs = {

-            r.x, r.x + r.width - dogear, r.x + r.width,

-            r.x + r.width,  r.x,            r.x,

-        };

-        int[] ys = {

-            r.y, r.y,                    r.y + dogear,

-            r.y + r.height, r.y + r.height, r.y,

-        };

-        Point p =

-            Geometry.ptClosestTo(

-                xs,

-                ys,

-                6,

-                anotherPt);

-        return p;

-    }

-

-    /**

-     * The UID.

-     */

-    private static final long serialVersionUID = 7242542877839921267L;

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponent2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponent2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponent2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponent2.java	2009-08-07 14:44:24-0700
@@ -25,24 +25,11 @@
 package org.argouml.structure2.diagram;

 

 import java.awt.Rectangle;

-import java.awt.event.MouseEvent;

-import java.util.ArrayList;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Vector;

-

-import org.argouml.model.Model;

 import org.argouml.uml.diagram.DiagramSettings;

 import org.argouml.uml.diagram.deployment.ui.AbstractFigComponent;

-import org.argouml.uml.diagram.ui.FigEdgeModelElement;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigText;

 

 /**

  * Class to display graphics for a UML Component in a diagram.

- *

- * @author 5eichler

  */

 class FigComponent2 extends AbstractFigComponent {

 

@@ -57,71 +44,4 @@
             DiagramSettings settings) {

         super(owner, bounds, settings);

     }

-    

-    @Override

-    protected void textEditStarted(FigText ft) {

-        if (ft == getNameFig()) {

-            showHelp("parsing.help.fig-component");

-        }

-    }

-

-    @Override

-    public Selection makeSelection() {

-        return new SelectionComponent(this);

-    }

-

-    @Override

-    public void setEnclosingFig(Fig encloser) {

-

-        Object comp = getOwner();

-        if (encloser != null

-                && (Model.getFacade().isANode(encloser.getOwner()) 

-                        || Model.getFacade().isAComponent(encloser.getOwner()))

-                && getOwner() != null) {

-            if (Model.getFacade().isANode(encloser.getOwner())) {

-                Object node = encloser.getOwner();

-                if (!Model.getFacade().getDeploymentLocations(comp).contains(

-                        node)) {

-                    Model.getCoreHelper().addDeploymentLocation(comp, node);

-                }

-            }

-            super.setEnclosingFig(encloser);

-

-            if (getLayer() != null) {

-                // elementOrdering(figures);

-                List contents = new ArrayList(getLayer().getContents());

-                Iterator it = contents.iterator();

-                while (it.hasNext()) {

-                    Object o = it.next();

-                    if (o instanceof FigEdgeModelElement) {

-                        FigEdgeModelElement figedge = (FigEdgeModelElement) o;

-                        figedge.getLayer().bringToFront(figedge);

-                    }

-                }

-            }

-        } else if (encloser == null && getEnclosingFig() != null) {

-            Object encloserOwner = getEnclosingFig().getOwner();

-            if (Model.getFacade().isANode(encloserOwner)

-                    && (Model.getFacade().getDeploymentLocations(comp)

-                            .contains(encloserOwner))) {

-                Model.getCoreHelper().removeDeploymentLocation(comp,

-                        encloserOwner);

-            }

-            super.setEnclosingFig(encloser);

-        }

-    }

-

-    /*

-     * @see org.tigris.gef.ui.PopupGenerator#getPopUpActions(java.awt.event.MouseEvent)

-     */

-    @Override

-    public Vector getPopUpActions(MouseEvent me) {

-        Vector popUpActions = super.getPopUpActions(me);

-        // Modifiers ...

-        popUpActions.add(

-                popUpActions.size() - getPopupAddOffset(),

-                buildModifierPopUp(ABSTRACT | LEAF | ROOT));

-        return popUpActions;

-    }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponentInstance2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponentInstance2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponentInstance2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigComponentInstance2.java	2009-08-07 14:44:24-0700
@@ -25,25 +25,11 @@
 package org.argouml.structure2.diagram;

 

 import java.awt.Rectangle;

-import java.awt.event.MouseEvent;

-import java.util.ArrayList;

-import java.util.Iterator;

-import java.util.List;

-

-import org.argouml.model.Model;

-import org.argouml.notation.NotationProviderFactory2;

 import org.argouml.uml.diagram.DiagramSettings;

 import org.argouml.uml.diagram.deployment.ui.AbstractFigComponent;

-import org.argouml.uml.diagram.ui.FigEdgeModelElement;

-import org.tigris.gef.base.Editor;

-import org.tigris.gef.base.Globals;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

 

 /**

  * Class to display graphics for a UML ComponentInstance in a diagram.

- *

- * @author 5eichler

  */

 class FigComponentInstance2 extends AbstractFigComponent {

     

@@ -57,126 +43,5 @@
     public FigComponentInstance2(Object owner, Rectangle bounds,

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        getNameFig().setUnderline(true);

-    }

-

-    @Override

-    protected int getNotationProviderType() {

-        return NotationProviderFactory2.TYPE_COMPONENTINSTANCE;

-    }

-

-    /*

-     * @see java.lang.Object#clone()

-     */

-    @Override

-    public Object clone() {

-        FigComponentInstance2 figClone = (FigComponentInstance2) super.clone();

-        // nothing extra to do currently

-        return figClone;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateListeners(java.lang.Object, java.lang.Object)

-     */

-    @Override

-    protected void updateListeners(Object oldOwner, Object newOwner) {

-        super.updateListeners(oldOwner, newOwner);

-        if (newOwner != null) {

-            for (Object classifier 

-                    : Model.getFacade().getClassifiers(newOwner)) {

-                addElementListener(classifier, "name");

-            }

-        }

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionComponentInstance(this);

     }

-

-    /*

-     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)

-     */

-    @Override

-    public void mouseClicked(MouseEvent me) {

-        super.mouseClicked(me);

-        // TODO: What is this needed for? - tfm

-        setLineColor(LINE_COLOR);

-    }

-

-    /*

-     * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)

-     */

-    @Override

-    public void mousePressed(MouseEvent me) {

-        super.mousePressed(me);

-        Editor ce = Globals.curEditor();

-        Selection sel = ce.getSelectionManager().findSelectionFor(this);

-        if (sel instanceof SelectionComponentInstance) {

-            ((SelectionComponentInstance) sel).hideButtons();

-        }

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setEnclosingFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setEnclosingFig(Fig encloser) {

-

-        if (getOwner() != null) {

-            Object comp = getOwner();

-            if (encloser != null) {

-                Object nodeOrComp = encloser.getOwner();

-                if (Model.getFacade().isANodeInstance(nodeOrComp)) {

-                    if (Model.getFacade()

-                            .getNodeInstance(comp) != nodeOrComp) {

-                        Model.getCommonBehaviorHelper()

-                                .setNodeInstance(comp, nodeOrComp);

-                        super.setEnclosingFig(encloser);

-                    }

-                } else if (Model.getFacade().isAComponentInstance(nodeOrComp)) {

-                    if (Model.getFacade()

-                            .getComponentInstance(comp) != nodeOrComp) {

-                        Model.getCommonBehaviorHelper()

-                                .setComponentInstance(comp, nodeOrComp);

-                        super.setEnclosingFig(encloser);

-                    }

-                } else if (Model.getFacade().isANode(nodeOrComp)) {

-                    super.setEnclosingFig(encloser);

-                }

-

-                if (getLayer() != null) {

-                    // elementOrdering(figures);

-                    List contents = new ArrayList(getLayer().getContents());

-                    Iterator it = contents.iterator();

-                    while (it.hasNext()) {

-                        Object o = it.next();

-                        if (o instanceof FigEdgeModelElement) {

-                            FigEdgeModelElement figedge =

-                                    (FigEdgeModelElement) o;

-                            figedge.getLayer().bringToFront(figedge);

-                        }

-                    }

-                }

-            } else if (isVisible()

-                    // If we are not visible most likely we're being deleted.

-                    // TODO: This indicates a more fundamental problem that 

-                    // should be investigated - tfm - 20061230

-                    && encloser == null && getEnclosingFig() != null) {

-                if (Model.getFacade().getNodeInstance(comp) != null) {

-                    Model.getCommonBehaviorHelper()

-                            .setNodeInstance(comp, null);

-                }

-                if (Model.getFacade().getComponentInstance(comp) != null) {

-                    Model.getCommonBehaviorHelper()

-                            .setComponentInstance(comp, null);

-                }

-                super.setEnclosingFig(encloser);

-            }

-        }

-    }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDataType2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDataType2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDataType2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDataType2.java	2009-08-07 14:44:24-0700
@@ -24,17 +24,9 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Dimension;

 import java.awt.Rectangle;

-

-import org.apache.log4j.Logger;

-import org.argouml.model.Model;

-import org.argouml.ui.targetmanager.TargetManager;

-import org.argouml.uml.diagram.ArgoDiagram;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.static_structure.ui.FigClassifierBox;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

+import org.argouml.uml.diagram.static_structure.ui.FigDataType;

 

 /**

  * Class to display graphics for a UML DataType in a diagram.

@@ -47,28 +39,7 @@
  * Every DataType shows a keyword, but it is not 

  * always <<datatype>>, e.g. for an Enumeration.

  */

-class FigDataType2 extends FigClassifierBox {

-

-    private static final Logger LOG = Logger.getLogger(FigDataType2.class);

-    

-    private static final int MIN_WIDTH = 40;

-

-    private void constructFigs() {

-        getStereotypeFig().setKeyword(getKeyword());

-

-        setSuppressCalcBounds(true);

-        addFig(getBigPort());

-        addFig(getStereotypeFig());

-        addFig(getNameFig());

-        addFig(getOperationsFig());

-        addFig(borderFig);

-

-        setSuppressCalcBounds(false);

-

-        // Set the bounds of the figure to the total of the above 

-        enableSizeChecking(true);

-        super.setStandardBounds(X0, Y0, WIDTH, NAME_FIG_HEIGHT + ROWHEIGHT);

-    }

+class FigDataType2 extends FigDataType {

 

     /**

      * Primary constructor for a {@link FigDataType2}.

@@ -96,187 +67,5 @@
     public FigDataType2(Object owner, Rectangle bounds, 

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        constructFigs();

-    }

-

-    /**

-     * This function shall return the keyword to be used by the constructor. <p>

-     * 

-     * Subclasses of DataType shall 

-     * override this method to set their own keyword.

-     * 

-     * @return the string to be used as the keyword

-     */

-    protected String getKeyword() {

-        return "datatype";

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionDataType(this);

-    }

-

-    /**

-     * Gets the minimum size permitted for a datatype on the diagram.<p>

-     *

-     * Parts of this are hardcoded with magic numbers.<p>

-     *

-     * @return  the size of the minimum bounding box.

-     */

-    @Override

-    public Dimension getMinimumSize() {

-        // Use "aSize" to build up the minimum size. Start with the size of the

-        // name compartment and build up.

-

-        Dimension aSize = getNameFig().getMinimumSize();

-

-        aSize.height += NAME_V_PADDING * 2;

-        aSize.height = Math.max(NAME_FIG_HEIGHT, aSize.height);

-

-        // If we have a stereotype displayed, then allow some space for that

-        // (width and height)

-        aSize = addChildDimensions(aSize, getStereotypeFig());

-        aSize = addChildDimensions(aSize, getOperationsFig());

-

-        // we want to maintain a minimum width for datatypes

-        aSize.width = Math.max(MIN_WIDTH, aSize.width);

-

-        return aSize;

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineWidth()

-     */

-    @Override

-    public int getLineWidth() {

-        return borderFig.getLineWidth();

     }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setEnclosingFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setEnclosingFig(Fig encloser) {

-        Fig oldEncloser = getEnclosingFig();

-

-        if (encloser == null

-                || (encloser != null

-                && !Model.getFacade().isAInstance(encloser.getOwner()))) {

-            super.setEnclosingFig(encloser);

-        }

-        if (!(Model.getFacade().isAUMLElement(getOwner()))) {

-            return;

-        }

-        /* If this fig is not visible, do not adapt the UML model!

-         * This is used for deleting. See issue 3042.

-         */

-        if  (!isVisible()) {

-            return;

-        }

-        Object me = getOwner();

-        Object m = null;

-

-        try {

-            // If moved into an Package

-            if (encloser != null

-                    && oldEncloser != encloser

-                    && Model.getFacade().isAPackage(encloser.getOwner())) {

-                Model.getCoreHelper().setNamespace(me, encloser.getOwner());

-            }

-

-            // If default Namespace is not already set

-            if (Model.getFacade().getNamespace(me) == null

-                    && (TargetManager.getInstance().getTarget()

-                    instanceof ArgoDiagram)) {

-                m =

-                    ((ArgoDiagram) TargetManager.getInstance().getTarget())

-                        .getNamespace();

-                Model.getCoreHelper().setNamespace(me, m);

-            }

-        } catch (Exception e) {

-            LOG.error("could not set package due to:" + e

-                    + "' at " + encloser, e);

-        }

-

-    }

-

-    /**

-     * USED BY PGML.tee.

-     * @return the class name and bounds together with compartment

-     * visibility.

-     */

-    @Override

-    public String classNameAndBounds() {

-        return super.classNameAndBounds()

-                + "operationsVisible=" + isOperationsVisible();

-    }

-

-

-    /**

-     * Sets the bounds, but the size will be at least the one returned by

-     * {@link #getMinimumSize()}, unless checking of size is disabled.<p>

-     *

-     * If the required height is bigger, then the additional height is

-     * equally distributed among all figs (i.e. compartments), such that the

-     * accumulated height of all visible figs equals the demanded height<p>.

-     *

-     * @param x  Desired X coordinate of upper left corner

-     *

-     * @param y  Desired Y coordinate of upper left corner

-     *

-     * @param w  Desired width of the figure

-     *

-     * @param h  Desired height of the figure

-     * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)

-     */

-    @Override

-    protected void setStandardBounds(final int x, final int y, final int w,

-            final int h) {

-

-        // Save our old boundaries to use in our property message later

-        Rectangle oldBounds = getBounds();

-        // and get minimum size info.

-

-        // set bounds of big box

-        getBigPort().setBounds(x, y, w, h);

-        borderFig.setBounds(x, y, w, h);

-

-        int currentHeight = 0;

-

-        if (getStereotypeFig().isVisible()) {

-            int stereotypeHeight = getStereotypeFig().getMinimumSize().height;

-            getStereotypeFig().setBounds(

-                    x,

-                    y,

-                    w,

-                    stereotypeHeight);

-            currentHeight = stereotypeHeight;

-        }

-

-        int nameHeight = getNameFig().getMinimumSize().height;

-        getNameFig().setBounds(x, y + currentHeight, w, nameHeight);

-        currentHeight += nameHeight;

-

-        if (getOperationsFig().isVisible()) {

-            int operationsY = y + currentHeight;

-            int operationsHeight = (h + y) - operationsY - LINE_WIDTH;

-            getOperationsFig().setBounds(

-                    x,

-                    operationsY,

-                    w,

-                    operationsHeight);

-        }

-

-        // Now force calculation of the bounds of the figure, update the edges

-        // and trigger anyone who's listening to see if the "bounds" property

-        // has changed.

-

-        calcBounds();

-        updateEdges();

-        firePropChange("bounds", oldBounds, getBounds());

-    }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDependency2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDependency2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDependency2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigDependency2.java	2009-08-07 14:44:24-0700
@@ -27,52 +27,13 @@
 import java.awt.Color;

 

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ui.FigEdgeModelElement;

-import org.argouml.uml.diagram.ui.FigTextGroup;

-import org.argouml.uml.diagram.ui.PathItemPlacement;

-import org.tigris.gef.presentation.ArrowHead;

-import org.tigris.gef.presentation.ArrowHeadGreater;

-import org.tigris.gef.presentation.Fig;

+import org.argouml.uml.diagram.ui.FigDependency;

 

 /**

  * This class represents a Fig for a Dependency.

  * It has a dashed line and a V-shaped arrow-head.

- * 

- * @author ics 125b course, spring 1998

  */

-class FigDependency2 extends FigEdgeModelElement {

-

-    /**

-     * Serial version generated by Eclipse for rev. 1.22

-     */

-    private static final long serialVersionUID = -1779182458484724448L;

-

-    /*

-     * Text group to contain name & stereotype

-     */

-    private FigTextGroup middleGroup; 

-

-    private void constructFigs() {

-        middleGroup.addFig(getNameFig());

-        middleGroup.addFig(getStereotypeFig());

-        addPathItem(middleGroup,

-                new PathItemPlacement(this, middleGroup, 50, 25));

-        

-        setDestArrowHead(createEndArrow());

-        

-        setBetweenNearestPoints(true);

-        getFig().setDashed(true);

-    }

-    

-    /**

-     * Create the arrow head for the dependency. By default this is a

-     * stick figure arrow head with no fill. Descendants may override this as

-     * required.

-     * @return the arrow head.

-     */

-    protected ArrowHead createEndArrow() {

-        return new ArrowHeadGreater();

-    }

+class FigDependency2 extends FigDependency {

 

     /**

      * Construct a FigDependency.

@@ -82,47 +43,6 @@
      */

     public FigDependency2(Object owner, DiagramSettings settings) {

         super(owner, settings);

-        middleGroup = new FigTextGroup(owner, settings);

-        constructFigs();

     }

-    

-    /*

-     * @see org.tigris.gef.presentation.FigEdge#setFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setFig(Fig f) {

-        super.setFig(f);

-        getFig().setDashed(true);

-        // computeRoute();

-        // this recomputes the route if you reload the diagram.

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#canEdit(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    protected boolean canEdit(Fig f) {

-        return false;

-    }

-

-    public void setLineColor(Color color) {

-        ArrowHead arrow = getDestArrowHead();

-        if (arrow != null) {

-            arrow.setLineColor(getLineColor());

-        }

-    }

-    

-    @Override

-    protected void updateNameText() {

-        super.updateNameText();

-        middleGroup.calcBounds();

-    }

-

-    @Override

-    protected void updateStereotypeText() {

-        super.updateStereotypeText();

-        middleGroup.calcBounds();

-    }

-

 }

 


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeAssociationClass2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeAssociationClass2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeAssociationClass2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeAssociationClass2.java	2009-08-07 14:44:24-0700
@@ -24,20 +24,8 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.event.KeyListener;

-import java.awt.event.MouseListener;

-import java.beans.PropertyChangeEvent;

-import java.beans.PropertyChangeListener;

-import java.beans.VetoableChangeListener;

-

-import org.apache.log4j.Logger;

-import org.argouml.kernel.DelayedVChangeListener;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ui.FigEdgeModelElement;

-import org.argouml.uml.diagram.ui.FigEdgePort;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigNode;

-

+import org.argouml.uml.diagram.ui.FigEdgeAssociationClass;

 

 /**

  * Class to display the dashed line connecting the class box figure and the

@@ -48,46 +36,7 @@
  *

  * @author pepargouml

  */

-class FigEdgeAssociationClass2

-        extends FigEdgeModelElement

-        implements VetoableChangeListener,

-        DelayedVChangeListener,

-        MouseListener,

-        KeyListener,

-        PropertyChangeListener {

-

-    /**

-     * Serial version generated by Eclipse for rev 1.9

-     */

-    private static final long serialVersionUID = 4627163341288968877L;

-    

-    private static final Logger LOG =

-        Logger.getLogger(FigEdgeAssociationClass2.class);

-

-    private void constructFigs(FigClassAssociationClass2 classBoxFig,

-            Fig ownerFig) {

-        LOG.info("FigEdgeAssociationClass constructor");

-        if (classBoxFig == null) {

-            throw new IllegalArgumentException("No class box found while "

-                    + "creating FigEdgeAssociationClass");

-        }

-        if (ownerFig == null) {

-            throw new IllegalArgumentException("No association edge found "

-                    + "while creating FigEdgeAssociationClass");

-        }

-        setDestFigNode(classBoxFig);

-        setDestPortFig(classBoxFig);

-        final FigNode port;

-        if (ownerFig instanceof FigEdgeModelElement) {

-            ((FigEdgeModelElement) ownerFig).makeEdgePort();

-            port = ((FigEdgeModelElement) ownerFig).getEdgePort();

-        } else {

-            port = (FigNode) ownerFig;

-        }

-        setSourcePortFig(port);

-        setSourceFigNode(port);

-        computeRoute();

-    }

+class FigEdgeAssociationClass2 extends FigEdgeAssociationClass {

 

     /**

      * The constructor for the AssociationClass fig.

@@ -99,116 +48,5 @@
     FigEdgeAssociationClass2(FigClassAssociationClass2 classBoxFig,

             FigAssociationClass2 ownerFig, DiagramSettings settings) {

         super(ownerFig.getOwner(), settings);

-        constructFigs(classBoxFig, ownerFig);

-    }

-    

-    /**

-     * The constructor for the AssociationClass fig.

-     * 

-     * @param classBoxFig the figure representing the Class

-     * @param ownerFig the owner fig

-     * @param settings render settings

-     */

-    public FigEdgeAssociationClass2(FigClassAssociationClass2 classBoxFig,

-            FigNodeAssociation2 ownerFig, DiagramSettings settings) {

-        super(ownerFig.getOwner(), settings);

-        constructFigs(classBoxFig, ownerFig);

     }

-    

-    /**

-     * @param owner the owner

-     * @param settings the render settings

-     */

-    public FigEdgeAssociationClass2(Object owner,

-            DiagramSettings settings) {

-        super(owner, settings);

-        setBetweenNearestPoints(true);

-    }

-    

-    /*

-     * @see org.tigris.gef.presentation.FigEdge#setFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setFig(Fig f) {

-        super.setFig(f);

-        getFig().setDashed(true);

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#canEdit(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    protected boolean canEdit(Fig f) {

-        return false;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    protected void modelChanged(PropertyChangeEvent e) {

-        // TODO: are we intentionally eating all events? - tfm 20060203

-        // document!

-    }

-

-    /**

-     * If the user requests deletion of this Fig then delegate to the attached

-     * FigAssociationClass.

-     * @return the attached FigAssociationClass

-     */

-    @Override

-    protected Fig getRemoveDelegate() {

-        FigNode node = getDestFigNode();

-        if (!(node instanceof FigEdgePort || node instanceof FigNodeAssociation2)) {

-            node = getSourceFigNode();

-        }

-        if (!(node instanceof FigEdgePort || node instanceof FigNodeAssociation2)) {

-            LOG.warn("The is no FigEdgePort attached"

-                    + " to the association class link");

-            return null;

-        }

-        

-        final Fig delegate;

-        // Actually return the FigEdge that the FigEdgePort is part of.

-        if (node instanceof FigEdgePort) {

-            delegate = node.getGroup();

-        } else {

-            delegate = node;

-        }

-        if (LOG.isInfoEnabled()) {

-            LOG.info("Delegating remove to " + delegate.getClass().getName());

-//            throw new IllegalArgumentException();

-        }

-        return delegate;

-    }

-

-

-    @Override

-    public void setDestFigNode(FigNode fn) {

-        if (!(fn instanceof FigClassAssociationClass2)) {

-            throw new IllegalArgumentException(

-                    "The dest of an association class dashed link can "

-                    + "only be a FigClassAssociationClass");

-        }

-        super.setDestFigNode(fn);

-    }

-

-    @Override

-    public void setSourceFigNode(FigNode fn) {

-        if (!(fn instanceof FigEdgePort || fn instanceof FigNodeAssociation2)) {

-            throw new IllegalArgumentException(

-                    "The source of an association class dashed link can "

-                    + "only be a FigEdgePort");

-        }

-        super.setSourceFigNode(fn);

-    }

-

-    @Override

-    protected void removeFromDiagramImpl() {

-        // TODO Auto-generated method stub

-        super.removeFromDiagramImpl();

-    }

-    

-    

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeNote2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeNote2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeNote2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEdgeNote2.java	2009-08-07 14:44:24-0700
@@ -35,6 +35,7 @@
 import org.argouml.model.RemoveAssociationEvent;

 import org.argouml.uml.CommentEdge;

 import org.argouml.uml.diagram.DiagramSettings;

+import org.argouml.uml.diagram.static_structure.ui.FigEdgeNote;

 import org.argouml.uml.diagram.ui.ArgoFig;

 import org.argouml.uml.diagram.ui.ArgoFigUtil;

 import org.argouml.util.IItemUID;

@@ -49,22 +50,9 @@
  * 

  * The owner of this fig is always a CommentEdge. Because it is different from

  * most every other FigEdge in ArgoUML, it doesn't subclass FigEdgeModelElement.

- * 

- * @author Andreas Rueckert [email protected]

- * @author [email protected]

  */

-class FigEdgeNote2 extends FigEdgePoly implements ArgoFig, IItemUID,

-        PropertyChangeListener {

-

-    private static final Logger LOG = Logger.getLogger(FigEdgeNote2.class);

-

-    private Object comment;

-    private Object annotatedElement;

-

-    private DiagramSettings settings;

+class FigEdgeNote2 extends FigEdgeNote {

 

-    private ItemUID itemUid;

-    

     /**

      * @param element owning CommentEdge object. This is a special case since it

      *            is not a UML element.

@@ -73,236 +61,6 @@
     public FigEdgeNote2(Object element, DiagramSettings theSettings) {

         // element will normally be null when called from PGML parser

         // It will get it's source & destination set later in attachEdges

-        super();

-        settings = theSettings;

-

-        if (element != null) {

-            super.setOwner(element);

-        } else {

-            super.setOwner(new CommentEdge());

-        }

-        

-        setBetweenNearestPoints(true);

-        getFig().setLineWidth(LINE_WIDTH);

-        getFig().setDashed(true);

-        

-        // Unfortunately the Fig and it's associated CommentEdge will not be

-        // fully initialized yet here if we're being loaded from a PGML file.

-        // The remainder of the initialization will happen when 

-        // set{Dest|Source}FigNode are called from PGMLStackParser.attachEdges()

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.FigEdge#setFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setFig(Fig f) {

-        LOG.info("Setting the internal fig to " + f);

-        super.setFig(f);

-        getFig().setDashed(true);

-    }

-

-

-    /*

-     * @see java.lang.Object#toString()

-     */

-    @Override

-    public String toString() {

-        return Translator.localize("misc.comment-edge");

-    }

-

-    /*

-     * Listen for a RemoveAssociationEvent between the comment

-     * and the annotated element. When recieved delete the CommentEdge

-     * and this FigEdgeNote.

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    protected void modelChanged(PropertyChangeEvent e) {

-        if (e instanceof RemoveAssociationEvent

-                && e.getOldValue() == annotatedElement) {

-            removeFromDiagram();

-        }

-    }

-    

-    /*

-     * @see org.tigris.gef.presentation.Fig#getTipString(java.awt.event.MouseEvent)

-     */

-    @Override

-    public String getTipString(MouseEvent me) {

-        return "Comment Edge"; // TODO: get tip string from comment

-    }

-

-

-    /*

-     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    public void propertyChange(PropertyChangeEvent pve) {

-        modelChanged(pve);

-    }

-

- 

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#removeFromDiagram()

-     */

-    @Override

-    public final void removeFromDiagram() {

-        Object o = getOwner();

-        if (o != null) {

-            removeElementListener(o);

-        }

-

-        super.removeFromDiagram();

-        damage();

-    }

- 

-

-    /**

-     * Returns the source of the edge. The source is the owner of the

-     * node the edge travels from in a binary relationship. For

-     * instance: for a classifierrole, this is the sender.

-     * @return MModelElement

-     */

-    protected Object getSource() {

-        Object theOwner = getOwner();

-        if (theOwner != null) {

-            return ((CommentEdge) theOwner).getSource();

-        }

-        return null;

-    }

-    /**

-     * Returns the destination of the edge. The destination is the

-     * owner of the node the edge travels to in a binary

-     * relationship. For instance: for a classifierrole, this is the

-     * receiver.

-     * @return Object

-     */

-    protected Object getDestination() {

-        Object theOwner = getOwner();

-        if (theOwner != null) {

-            return ((CommentEdge) theOwner).getDestination();

-        }

-        return null;

-    }

-    

-    /*

-     * @see org.tigris.gef.presentation.FigEdge#setDestFigNode(org.tigris.gef.presentation.FigNode)

-     */

-    @Override

-    public void setDestFigNode(FigNode fn) {

-        // When this is called from PGMLStackParser.attachEdges, we finished

-        // the initialization of owning pseudo element (CommentEdge)

-        if (fn != null && Model.getFacade().isAComment(fn.getOwner())) {

-            Object oldComment = comment;

-            if (oldComment != null) {

-                removeElementListener(oldComment);

-            }

-            comment = fn.getOwner();

-            if (comment != null) {

-                addElementListener(comment);

-            }

-            

-            ((CommentEdge) getOwner()).setComment(comment);

-        } else if (fn != null 

-                && !Model.getFacade().isAComment(fn.getOwner())) {

-            annotatedElement = fn.getOwner();

-            ((CommentEdge) getOwner()).setAnnotatedElement(annotatedElement);

-        }

-

-        super.setDestFigNode(fn);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.FigEdge#setSourceFigNode(org.tigris.gef.presentation.FigNode)

-     */

-    @Override

-    public void setSourceFigNode(FigNode fn) {

-        // When this is called from PGMLStackParser.attachEdges, we finished

-        // the initialization of owning pseudo element (CommentEdge)

-        if (fn != null && Model.getFacade().isAComment(fn.getOwner())) {

-            Object oldComment = comment;

-            if (oldComment != null) {

-                removeElementListener(oldComment);

-            }

-            comment = fn.getOwner();

-            if (comment != null) {

-                addElementListener(comment);

-            }

-            ((CommentEdge) getOwner()).setComment(comment);

-        } else if (fn != null 

-                && !Model.getFacade().isAComment(fn.getOwner())) {

-            annotatedElement = fn.getOwner();

-            ((CommentEdge) getOwner()).setAnnotatedElement(annotatedElement);

-        }

-        super.setSourceFigNode(fn);

-    }

-    

-    private void addElementListener(Object element) {

-        Model.getPump().addModelEventListener(this, element);

-    }

-    

-    private void removeElementListener(Object element) {

-        Model.getPump().removeModelEventListener(this, element);

-    }

-

-    @SuppressWarnings("deprecation")

-    @Deprecated

-    public Project getProject() {

-        return ArgoFigUtil.getProject(this);

-    }

-

-    public DiagramSettings getSettings() {

-        return settings;

-    }

-

-    public void renderingChanged() {

-  

-    }

-

-    @SuppressWarnings("deprecation")

-    @Deprecated

-    public void setProject(Project project) {

-        // unimplemented

-    }

-

-    public void setSettings(DiagramSettings theSettings) {

-        settings = theSettings;

-    }

-

-    /**

-     * Setter for the UID

-     * @param newId the new UID

-     */

-    public void setItemUID(ItemUID newId) {

-        itemUid = newId;

-    }

-

-    /**

-     * Getter for the UID

-     * @return the UID

-     */

-    public ItemUID getItemUID() {

-        return itemUid;

-    }

-    

-

-    /**

-     * Setting the owner of the Fig must be done in the constructor and not

-     * changed afterwards for all ArgoUML figs.

-     * 

-     * @param owner owning UML element

-     * @deprecated for 0.27.3 by tfmorris. Set owner in constructor. This method

-     *             is implemented in GEF, so we'll leave this implementation

-     *             here to block any attempts to use it within ArgoUML.

-     */

-    @SuppressWarnings("deprecation")

-    @Deprecated

-    public void setOwner(Object owner) {

-        if (owner != getOwner()) {

-            throw new UnsupportedOperationException(

-                    "Owner must be set in constructor and left unchanged");

-        }

+        super(element, theSettings);

     }

-

 } 


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEnumeration2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEnumeration2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEnumeration2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigEnumeration2.java	2009-08-07 14:44:24-0700
@@ -24,44 +24,18 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Dimension;

 import java.awt.Rectangle;

-import java.beans.PropertyChangeEvent;

-import java.util.HashSet;

-import java.util.Set;

-

-import javax.swing.Action;

-

-import org.argouml.model.AssociationChangeEvent;

-import org.argouml.model.AttributeChangeEvent;

-import org.argouml.model.Model;

-import org.argouml.ui.ArgoJMenu;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ui.EnumLiteralsCompartmentContainer;

-import org.argouml.uml.diagram.ui.FigEnumLiteralsCompartment;

-import org.argouml.uml.ui.foundation.core.ActionAddEnumerationLiteral;

-import org.tigris.gef.base.Selection;

+import org.argouml.uml.diagram.static_structure.ui.FigEnumeration;

 

 /**

  * Class to display graphics for a UML Enumeration in a diagram.

  * It depends on FigDataType for most of its behavior.<p>

  * 

  */

-class FigEnumeration2 extends FigDataType2 

-    implements EnumLiteralsCompartmentContainer {

-

-    /**

-     * Serial version (generated)

-     */

-    private static final long serialVersionUID = 3333154292883077250L;

-

-    /**

-     * The Fig that represents the literals compartment.

-     */

-    private FigEnumLiteralsCompartment literalsCompartment;

-

+class FigEnumeration2 extends FigEnumeration {

     /**

-     * Construct a new AbstractFigComponent.

+     * Construct a new FigEnumeration.

      * 

      * @param owner owning UML element

      * @param bounds position and size

@@ -70,235 +44,5 @@
     public FigEnumeration2(Object owner, Rectangle bounds,

             DiagramSettings settings) {

         super(owner, bounds, settings);

-

-        enableSizeChecking(true);

-        setSuppressCalcBounds(false);

-

-        addFig(getLiteralsCompartment()); // This creates the compartment.

-        setEnumLiteralsVisible(true);

-        literalsCompartment.populate();

-

-        setBounds(getBounds());

-    }

-

-    @Override

-    protected String getKeyword() {

-        return "enumeration";

-    }

-    

-    /*

-     * @see org.argouml.uml.diagram.static_structure.ui.FigDataType#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionEnumeration(this);

-    }

-

-    @Override

-    public Object clone() {

-        FigEnumeration2 clone = (FigEnumeration2) super.clone();

-        clone.literalsCompartment = 

-            (FigEnumLiteralsCompartment) literalsCompartment.clone();

-        return clone;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.static_structure.ui.FigClassifierBox#buildAddMenu()

-     */

-    @Override

-    protected ArgoJMenu buildAddMenu() {

-        ArgoJMenu addMenu = super.buildAddMenu();

-        

-        Action addEnumerationLiteral = new ActionAddEnumerationLiteral();

-        addEnumerationLiteral.setEnabled(isSingleTarget());

-        addMenu.add(addEnumerationLiteral);

-        return addMenu;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    protected void modelChanged(PropertyChangeEvent mee) {

-        super.modelChanged(mee);

-        if (mee instanceof AssociationChangeEvent 

-                || mee instanceof AttributeChangeEvent) {

-            renderingChanged();

-            updateListeners(getOwner(), getOwner());

-        }

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#renderingChanged()

-     */

-    @Override

-    public void renderingChanged() {

-        super.renderingChanged();

-        if (getOwner() != null) {

-            updateEnumLiterals();

-        }

-    }

-    

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateListeners(java.lang.Object)

-     */

-    @Override

-    protected void updateListeners(Object oldOwner, Object newOwner) {

-        Set<Object[]> l = new HashSet<Object[]>();

-        if (newOwner != null) {

-            // add the listeners to the newOwner

-            l.add(new Object[] {newOwner, null});

-            // and its stereotypes

-            for (Object stereo : Model.getFacade().getStereotypes(newOwner)) {

-                l.add(new Object[] {stereo, null});                

-            }

-            // and its features

-            for (Object feat : Model.getFacade().getFeatures(newOwner)) {

-                l.add(new Object[] {feat, null});

-                // and the stereotypes of its features

-                for (Object stereo : Model.getFacade().getStereotypes(feat)) {

-                    l.add(new Object[] {stereo, null});

-                }

-            }

-            // and its enumerationLiterals

-            for (Object literal : Model.getFacade().getEnumerationLiterals(

-                    newOwner)) {

-                l.add(new Object[] {literal, null});

-            }

-        }

-        // And now add listeners to them all:

-        updateElementListeners(l);

-

-    }

-

-    /**

-     * Update (i.e. redraw) the compartment with the literals.

-     */

-    protected void updateEnumLiterals() {

-        if (!literalsCompartment.isVisible()) {

-            return;

-        }

-        literalsCompartment.populate();

-

-        // TODO: make setBounds, calcBounds and updateBounds consistent

-        setBounds(getBounds());

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.static_structure.ui.FigDataType#getMinimumSize()

-     */

-    @Override

-    public Dimension getMinimumSize() {

-        // Start with the minimum for our parent

-        Dimension aSize = super.getMinimumSize();

-

-        if (literalsCompartment != null) {

-            aSize = addChildDimensions(aSize, literalsCompartment);

-        }

-        

-        return aSize;

-    }

-    

-    /*

-     * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)

-     */

-    @Override

-    protected void setStandardBounds(final int x, final int y, final int width,

-            final int height) {

-

-        // Save our old boundaries so it can be used in property message later

-        Rectangle oldBounds = getBounds();

-

-        int w = Math.max(width, getMinimumSize().width);

-        int h = Math.max(height, getMinimumSize().height);

-        

-        // set bounds of big box

-        getBigPort().setBounds(x, y, w, h);

-        borderFig.setBounds(x, y, w, h);

-        

-        int currentHeight = 0;

-

-        if (getStereotypeFig().isVisible()) {

-            int stereotypeHeight = getStereotypeFig().getMinimumSize().height;

-            getStereotypeFig().setBounds(

-                    x,

-                    y,

-                    w,

-                    stereotypeHeight);

-            currentHeight += stereotypeHeight;

-        }

-

-        int nameHeight = getNameFig().getMinimumSize().height;

-        getNameFig().setBounds(x, y + currentHeight, w, nameHeight);

-        currentHeight += nameHeight;

-

-        int visibleCompartments = getOperationsFig().isVisible() ? 1 : 0;

-        if (getLiteralsCompartment().isVisible()) {

-            visibleCompartments++;

-            int literalsHeight = 

-                getLiteralsCompartment().getMinimumSize().height;

-            literalsHeight = Math.max(literalsHeight, 

-                    (h - currentHeight) / visibleCompartments);

-            getLiteralsCompartment().setBounds(

-                    x + LINE_WIDTH,

-                    y + currentHeight,

-                    w - LINE_WIDTH,

-                    literalsHeight);

-            currentHeight += literalsHeight;

-        }

-        

-        if (getOperationsFig().isVisible()) {

-            int operationsHeight = getOperationsFig().getMinimumSize().height;

-            operationsHeight = Math.max(operationsHeight, h - currentHeight);

-            getOperationsFig().setBounds(

-                    x,

-                    y + currentHeight,

-                    w,

-                    operationsHeight);

-            currentHeight += operationsHeight;

-        }

-

-        // Now force calculation of the bounds of the figure, update the edges

-        // and trigger anyone who's listening to see if the "bounds" property

-        // has changed.

-

-        calcBounds();

-        updateEdges();

-        firePropChange("bounds", oldBounds, getBounds());

-    }

-

-    /**

-     * @return the Fig for the EnumerationLiterals compartment

-     */

-    public FigEnumLiteralsCompartment getLiteralsCompartment() {

-        // Set bounds will be called from our superclass constructor before

-        // our constructor has run, so make sure this gets set up if needed.

-        if (literalsCompartment == null) {

-            literalsCompartment = new FigEnumLiteralsCompartment(getOwner(),

-                    DEFAULT_COMPARTMENT_BOUNDS, getSettings());

-        }

-        return literalsCompartment;

-    }

-    

-    /**

-     * @return true if the literals compartment is visible

-     */

-    public boolean isEnumLiteralsVisible() {

-        return literalsCompartment.isVisible();

-    }

-

-    /**

-     * @param isVisible true will show the enumeration literal compartment

-     */

-    public void setEnumLiteralsVisible(boolean isVisible) {

-        setCompartmentVisible(literalsCompartment, isVisible);

-    }

-    

-    /**

-     * @return the bounds of the EnumerationLiterals compartment

-     */

-    public Rectangle getEnumLiteralsBounds() {

-        return literalsCompartment.getBounds();

     }

-    

 } 


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigException2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigException2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigException2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigException2.java	2009-08-07 14:44:24-0700
@@ -27,12 +27,9 @@
 import java.awt.Rectangle;

 

 import org.argouml.uml.diagram.DiagramSettings;

-import org.tigris.gef.base.Selection;

 

 /**

  * Fig representing an Exception.

- * 

- * @author Tom Morris

  */

 class FigException2 extends FigSignal2 {

 

@@ -47,9 +44,4 @@
             DiagramSettings settings) {

         super(owner, bounds, settings);

     }

-    

-    @Override

-    public Selection makeSelection() {

-        return new SelectionException(this);

-    }

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigGeneralization2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigGeneralization2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigGeneralization2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigGeneralization2.java	2009-08-07 14:44:24-0700
@@ -24,73 +24,14 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Font;

-import java.awt.Graphics;

-import java.awt.Rectangle;

-import java.beans.PropertyChangeEvent;

-

-import org.argouml.model.AttributeChangeEvent;

-import org.argouml.model.Model;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ui.ArgoFigText;

 import org.argouml.uml.diagram.ui.FigEdgeModelElement;

-import org.argouml.uml.diagram.ui.FigTextGroup;

-import org.argouml.uml.diagram.ui.PathItemPlacement;

-import org.tigris.gef.presentation.ArrowHeadTriangle;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigText;

 

 /**

  * The Fig for a Generalization.

- * 

- * @author [email protected], [email protected]

  */

 class FigGeneralization2 extends FigEdgeModelElement {

 

-    private static final int TEXT_HEIGHT = 20;

-

-    private static final int DISCRIMINATOR_WIDTH = 90;

-

-    /*

-     * The serialVersionUID (generated by Eclipse)

-     */

-    private static final long serialVersionUID = 3983170503390943894L;

-

-

-    /**

-     * Group for the FigTexts concerning the name and stereotype of the

-     * association itself.

-     */

-    private FigTextGroup middleGroup;

-    

-    /**

-     * Text box for discriminator.

-     */

-    private FigText discriminator;

-

-    private ArrowHeadTriangle endArrow;

-

-    private void initialize() {

-        // UML spec for Generalizations doesn't call for name

-

-	discriminator.setFilled(false);

-	discriminator.setLineWidth(0);

-	discriminator.setReturnAction(FigText.END_EDITING);

-	discriminator.setTabAction(FigText.END_EDITING);

-	

-        middleGroup.addFig(discriminator);

-        middleGroup.addFig(getStereotypeFig());        

-	

-	addPathItem(middleGroup, 

-	        new PathItemPlacement(this, middleGroup, 50, -10));

-

-        endArrow = new ArrowHeadTriangle();

-	endArrow.setFillColor(FILL_COLOR);

-	setDestArrowHead(endArrow);

-	

-	setBetweenNearestPoints(true);

-    }

-

     /**

      * Construct a new generalization edge with the given model element as the

      * owner.

@@ -100,109 +41,5 @@
      */

     public FigGeneralization2(Object owner, DiagramSettings settings) {

         super(owner, settings);

-        discriminator = new ArgoFigText(owner, new Rectangle(X0, Y0,

-                DISCRIMINATOR_WIDTH, TEXT_HEIGHT), settings, false);

-        middleGroup = new FigTextGroup(owner, settings);

-        

-        

-        initialize();

-        fixup(owner);

-        addListener(owner);

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#canEdit(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    protected boolean canEdit(Fig f) {

-        return false;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    protected void modelChanged(PropertyChangeEvent e) {

-        // Name & stereotypes get updated by superclass

-        super.modelChanged(e);

-        // Update the discriminator if it changed

-        if (e instanceof AttributeChangeEvent

-                && "discriminator".equals(e.getPropertyName())) {

-            updateDiscriminatorText();

-        }

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#updateListeners(java.lang.Object, java.lang.Object)

-     */

-    @Override

-    protected void updateListeners(Object oldOwner, Object newOwner) {

-        if (oldOwner != null) {

-            removeElementListener(oldOwner);

-        }

-        if (newOwner != null) {

-            addListener(newOwner);

-        }

-    }

-

-    private void addListener(Object owner) {

-        addElementListener(owner, new String[] {"remove", "discriminator"});

-    }

-

-    /**

-     * Updates the discriminator text. Called if the model is changed

-     * and on construction time.

-     */

-    public void updateDiscriminatorText() {

-  	Object generalization = getOwner();

-  	if (generalization == null) {

-	    return;

-  	}

-  	String disc = 

-            (String) Model.getFacade().getDiscriminator(generalization);

-  	if (disc == null) {

-	    disc = "";

-  	}

-  	discriminator.setFont(getSettings().getFont(Font.PLAIN));

-  	discriminator.setText(disc);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#paint(java.awt.Graphics)

-     */

-    @Override

-    public void paint(Graphics g) {

-        endArrow.setLineColor(getLineColor());

-        super.paint(g);

-    }

-

-    /**

-     * Fix up bad figs.

-     * <p>

-     * Due to errors in earlier releases of argouml it can happen that there is

-     * a generalization without a child or parent.

-     * <p>

-     * TODO: Move into XSL. We should not remove from the graph model while

-     * we're writing to it or we have a possible cause of concurrent

-     * modification exception.

-     * 

-     * @param owner

-     */

-    private void fixup(Object owner) {

-        if (Model.getFacade().isAGeneralization(owner)) {

-            Object subType = Model.getFacade().getSpecific(owner);

-            Object superType = Model.getFacade().getGeneral(owner);

-

-            if (subType == null || superType == null) {

-                // TODO: We should warn the user we have removed something - tfm

-                removeFromDiagram();

-        	return;

-            }

-            updateDiscriminatorText(); // show it

-        } else if (owner != null) {

-            throw new IllegalStateException(

-                    "FigGeneralization has an illegal owner of "

-                    + owner.getClass().getName());

-        }

     }

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigInterface2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigInterface2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigInterface2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigInterface2.java	2009-08-07 14:44:24-0700
@@ -24,17 +24,10 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Dimension;

 import java.awt.Rectangle;

 

-import org.apache.log4j.Logger;

-import org.argouml.model.Model;

-import org.argouml.ui.targetmanager.TargetManager;

-import org.argouml.uml.diagram.ArgoDiagram;

 import org.argouml.uml.diagram.DiagramSettings;

 import org.argouml.uml.diagram.static_structure.ui.FigClassifierBox;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

 

 /**

  * Class to display graphics for a UML Interface in a diagram.

@@ -44,37 +37,6 @@
  */

 class FigInterface2 extends FigClassifierBox {

 

-    private static final Logger LOG = Logger.getLogger(FigInterface2.class);

-

-    /**

-     * Initialization common to multiple constructors.  This can be merged back

-     * into the last constructor when the deprecated ones have been removed.

-     */

-    private void initialize() {

-        getStereotypeFig().setKeyword("interface");

-

-        // Put all the bits together, suppressing bounds calculations until

-        // we're all done for efficiency.

-        enableSizeChecking(false);

-        setSuppressCalcBounds(true);

-        

-        Dimension size = new Dimension(0, 0);

-        

-        addFig(getBigPort());

-        addFig(getStereotypeFig());

-        addChildDimensions(size, getStereotypeFig());

-        addFig(getNameFig());

-        addChildDimensions(size, getNameFig());

-        addFig(getOperationsFig());

-        addChildDimensions(size, getOperationsFig());

-        addFig(borderFig);

-

-        setSuppressCalcBounds(false);

-

-        // Set the bounds of the figure to the total of the above 

-        enableSizeChecking(true);

-        setBounds(X0, Y0, size.width, size.height);

-    }

 

     /**

      * Construct an Interface fig

@@ -86,177 +48,5 @@
     public FigInterface2(Object owner, Rectangle bounds, 

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        initialize();

-    }

-    

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionInterface(this);

-    }

-

-

-    /**

-     * Gets the minimum size permitted for an interface on the diagram.<p>

-     *

-     * Parts of this are hardcoded.<p>

-     *

-     * @return  the size of the minimum bounding box.

-     */

-    @Override

-    public Dimension getMinimumSize() {

-        // Use "aSize" to build up the minimum size. Start with the size of the

-        // name compartment and build up.

-

-        Dimension aSize = getNameFig().getMinimumSize();

-

-        aSize.height += NAME_V_PADDING * 2;

-        aSize.height = Math.max(NAME_FIG_HEIGHT, aSize.height);

-

-        // If we have a stereotype displayed, then allow some space for that

-        // (width and height)

-        aSize = addChildDimensions(aSize, getStereotypeFig());

-        aSize = addChildDimensions(aSize, getOperationsFig());

-

-        // we want to maintain a minimum width for Interfaces

-        aSize.width = Math.max(WIDTH, aSize.width);

-

-        return aSize;

-    }

-

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setEnclosingFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setEnclosingFig(Fig encloser) {

-        Fig oldEncloser = getEnclosingFig();

-

-        if (encloser == null

-                || (encloser != null

-                && !Model.getFacade().isAInstance(encloser.getOwner()))) {

-            super.setEnclosingFig(encloser);

-        }

-        if (!(Model.getFacade().isAModelElement(getOwner()))) {

-            return;

-        }

-        /* If this fig is not visible, do not adapt the UML model!

-         * This is used for deleting. See issue 3042.

-         */

-        if  (!isVisible()) {

-            return;

-        }

-        Object me = getOwner();

-        Object m = null;

-

-        try {

-            // If moved into an Package

-            if (encloser != null

-                    && oldEncloser != encloser

-                    && Model.getFacade().isAPackage(encloser.getOwner())) {

-                Model.getCoreHelper().setNamespace(me, encloser.getOwner());

-            }

-

-            // If default Namespace is not already set

-            if (Model.getFacade().getNamespace(me) == null

-                    && (TargetManager.getInstance().getTarget()

-                    instanceof ArgoDiagram)) {

-                m =

-                    ((ArgoDiagram) TargetManager.getInstance().getTarget())

-                        .getNamespace();

-                Model.getCoreHelper().setNamespace(me, m);

-            }

-        } catch (Exception e) {

-            LOG.error("could not set package due to:" + e

-                    + "' at " + encloser, e);

-        }

-

-        // The next if-clause is important for the Deployment-diagram

-        // it detects if the enclosing fig is a component, in this case

-        // the container will be set for the owning Interface

-        if (encloser != null

-                && (Model.getFacade().isAComponent(encloser.getOwner()))) {

-            moveIntoComponent(encloser);

-            super.setEnclosingFig(encloser);

-        }

     }

-

-    /**

-     * USED BY PGML.tee.

-     * @return the class name and bounds together with compartment

-     * visibility.

-     */

-    @Override

-    public String classNameAndBounds() {

-        return super.classNameAndBounds()

-                + "operationsVisible=" + isOperationsVisible();

-    }

-

-    /**

-     * Sets the bounds, but the size will be at least the one returned by

-     * {@link #getMinimumSize()}, unless checking of size is disabled.<p>

-     *

-     * If the required height is bigger, then the additional height is

-     * equally distributed among all figs (i.e. compartments), such that the

-     * cumulated height of all visible figs equals the demanded height<p>.

-     *

-     * Some of this has "magic numbers" hardcoded in.<p>

-     *

-     * @param x  Desired X coordinate of upper left corner

-     *

-     * @param y  Desired Y coordinate of upper left corner

-     *

-     * @param w  Desired width of the FigInterface

-     *

-     * @param h  Desired height of the FigInterface

-     */

-    @Override

-    protected void setStandardBounds(final int x, final int y, final int w,

-            final int h) {

-

-        // Save our old boundaries (needed later), and get minimum size

-        // info. 

-        Rectangle oldBounds = getBounds();

-

-        // set bounds of big box

-        getBigPort().setBounds(x, y, w, h);

-        borderFig.setBounds(x, y, w, h);

-

-        int currentHeight = 0;

-

-        if (getStereotypeFig().isVisible()) {

-            int stereotypeHeight = getStereotypeFig().getMinimumSize().height;

-            getStereotypeFig().setBounds(

-                    x,

-                    y,

-                    w,

-                    stereotypeHeight);

-            currentHeight = stereotypeHeight;

-        }

-

-        int nameHeight = getNameFig().getMinimumSize().height;

-        getNameFig().setBounds(x, y + currentHeight, w, nameHeight);

-        currentHeight += nameHeight;

-

-        if (getOperationsFig().isVisible()) {

-            int operationsY = y + currentHeight;

-            int operationsHeight = (h + y) - operationsY - 1;

-            getOperationsFig().setBounds(

-                    x,

-                    operationsY,

-                    w,

-                    operationsHeight);

-        }

-

-        // Now force calculation of the bounds of the figure, update the edges

-        // and trigger anyone who's listening to see if the "bounds" property

-        // has changed.

-

-        calcBounds();

-        updateEdges();

-        firePropChange("bounds", oldBounds, getBounds());

-    }

-

-}
\ No newline at end of file
+}


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigLink2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigLink2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigLink2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigLink2.java	2009-08-07 14:44:24-0700
@@ -1,4 +1,4 @@
-// $Id: FigLink.java 17045 2009-04-05 16:52:52Z mvw $

+// $Id: FigLink2.java 17045 2009-04-05 16:52:52Z mvw $

 // Copyright (c) 1996-2009 The Regents of the University of California. All

 // Rights Reserved. Permission to use, copy, modify, and distribute this

 // software and its documentation without fee, and without a written

@@ -24,12 +24,8 @@
 

 package org.argouml.structure2.diagram;

 

-import org.argouml.model.Model;

 import org.argouml.uml.diagram.DiagramSettings;

 import org.argouml.uml.diagram.ui.FigEdgeModelElement;

-import org.argouml.uml.diagram.ui.FigTextGroup;

-import org.argouml.uml.diagram.ui.PathItemPlacement;

-import org.tigris.gef.presentation.Fig;

 

 /**

  * Class to display graphics for a UML Link in a diagram. <p>

@@ -47,20 +43,6 @@
  */

 class FigLink2 extends FigEdgeModelElement {

 

-    /*

-     * Text group to contain name & stereotype

-     */

-    private FigTextGroup middleGroup; 

-

-    private void initialize() {

-        middleGroup.addFig(getNameFig());

-        addPathItem(middleGroup,

-                new PathItemPlacement(this, middleGroup, 50, 25));

-        getNameFig().setUnderline(true);

-	getFig().setLineColor(LINE_COLOR);

-	setBetweenNearestPoints(true);

-    }

-

     /**

      * Create a Fig representing a Link

      * 

@@ -69,83 +51,5 @@
      */

     public FigLink2(Object element, DiagramSettings settings) {

         super(element, settings);

-        middleGroup = new FigTextGroup(element, settings);

-        initialize();

-    }

-

-    /*

-     * Nothing is editable, since a Link takes its identity 

-     * from the Association.

-     * 

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#canEdit(

-     * org.tigris.gef.presentation.Fig)

-     */

-    protected boolean canEdit(Fig f) { return false; }

-

-    /*

-     * Listen also to the association, of which the link is an instantiation, 

-     * since we want to update the rendering when 

-     * the association name changes.

-     * 

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#updateListeners(

-     * java.lang.Object, java.lang.Object)

-     */

-    protected void updateListeners(Object oldOwner, Object newOwner) {

-        if (oldOwner != null) {

-            removeElementListener(oldOwner);

-            Object oldAssociation = Model.getFacade().getAssociation(oldOwner);

-            if (oldAssociation != null) {

-                removeElementListener(oldAssociation);

-            }

-        }

-        if (newOwner != null) {

-            addElementListener(newOwner, 

-                    new String[] {"remove", "name", "association"});

-            Object newAssociation = Model.getFacade().getAssociation(newOwner);

-            if (newAssociation != null) {

-                addElementListener(newAssociation, "name");

-            }

-        }

     }

-

-    /**

-     * Generate the notation for the modelelement and stuff it into the text Fig

-     */

-    protected void updateNameText() {

-        if (getOwner() == null) {

-            return;

-        }

-        String nameString = "";

-        Object association = Model.getFacade().getAssociation(getOwner());

-        if (association != null) {

-            nameString = Model.getFacade().getName(association);

-            if (nameString == null) {

-                nameString = "";

-            }

-        }

-        getNameFig().setText(nameString);

-        calcBounds();

-        setBounds(getBounds());

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#getDestination()

-     */

-    protected Object getDestination() {

-        if (getOwner() != null) {

-            return Model.getCommonBehaviorHelper().getDestination(getOwner());

-        }

-        return null;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#getSource()

-     */

-    protected Object getSource() {

-        if (getOwner() != null) {

-            return Model.getCommonBehaviorHelper().getSource(getOwner());

-        }

-        return null;

-    }

-

-} /* end class FigLink */

+}


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigMNode2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigMNode2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigMNode2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigMNode2.java	2009-08-07 14:44:24-0700
@@ -25,19 +25,13 @@
 package org.argouml.structure2.diagram;

 

 import java.awt.Rectangle;

-import java.awt.event.MouseEvent;

-import java.util.Vector;

-

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.deployment.ui.AbstractFigNode;

-import org.tigris.gef.presentation.FigText;

+import org.argouml.uml.diagram.deployment.ui.FigMNode;

 

 /**

  * Class to display graphics for a UML Node in a diagram.

- *

- * @author [email protected]

  */

-class FigMNode2 extends AbstractFigNode {

+class FigMNode2 extends FigMNode {

     

     /**

      * Construct a new FigMNode.

@@ -50,25 +44,4 @@
             DiagramSettings settings) {

         super(owner, bounds, settings);

     }

-    

-    @Override

-    protected void textEditStarted(FigText ft) {

-        if (ft == getNameFig()) {

-            showHelp("parsing.help.fig-node");

-        }

-    }

-

-    /*

-     * @see org.tigris.gef.ui.PopupGenerator#getPopUpActions(java.awt.event.MouseEvent)

-     */

-    @Override

-    public Vector getPopUpActions(MouseEvent me) {

-        Vector popUpActions = super.getPopUpActions(me);

-        // Modifiers ...

-        popUpActions.add(

-                popUpActions.size() - getPopupAddOffset(),

-                buildModifierPopUp(ABSTRACT | LEAF | ROOT));

-        return popUpActions;

-    }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeAssociation2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeAssociation2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeAssociation2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeAssociation2.java	2009-08-07 14:44:24-0700
@@ -24,69 +24,15 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Color;

-import java.awt.Dimension;

 import java.awt.Rectangle;

-import java.util.Collection;

-import java.util.Iterator;

-import java.util.List;

-

-import org.argouml.model.Model;

-import org.argouml.model.RemoveAssociationEvent;

-import org.argouml.model.UmlChangeEvent;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ui.FigNodeModelElement;

-import org.tigris.gef.base.LayerPerspective;

-import org.tigris.gef.graph.GraphEdgeRenderer;

-import org.tigris.gef.graph.MutableGraphModel;

-import org.tigris.gef.presentation.FigDiamond;

-import org.tigris.gef.presentation.FigEdge;

-import org.tigris.gef.presentation.FigNode;

-import org.tigris.gef.presentation.FigText;

+import org.argouml.uml.diagram.ui.FigNodeAssociation;

 

 /**

  * Class to display graphics for N-ary association (association node),

  * i.e. the diamond. <p>

- * 

- * TODO: Improve the location of the stereotypes!

- *

- * @author [email protected]

  */

-class FigNodeAssociation2 extends FigNodeModelElement {

-    

-    private static final int X = 0;

-    private static final int Y = 0;

-

-    private FigDiamond head;

-

-    private void initFigs() {

-        setEditable(false);

-        setBigPort(new FigDiamond(0, 0, 70, 70, DEBUG_COLOR, DEBUG_COLOR));

-        head = new FigDiamond(0, 0, 70, 70, LINE_COLOR, FILL_COLOR);

-

-        getNameFig().setFilled(false);

-        getNameFig().setLineWidth(0);

-//      The following does not seem to work - centered the Fig instead.

-//        getNameFig().setJustificationByName("center");

-

-        getStereotypeFig().setBounds(X + 10, Y + NAME_FIG_HEIGHT + 1, 

-                0, NAME_FIG_HEIGHT);

-        getStereotypeFig().setFilled(false);

-        getStereotypeFig().setLineWidth(0);

-

-        // add Figs to the FigNode in back-to-front order

-        addFig(getBigPort());

-        addFig(head);

-        if (!Model.getFacade().isAAssociationClass(getOwner())) {

-            addFig(getNameFig());

-            addFig(getStereotypeFig());

-        }

-

-        setBlinkPorts(false); //make port invisible unless mouse enters

-        Rectangle r = getBounds();

-        setBounds(r);

-        setResizable(true);

-    }

+class FigNodeAssociation2 extends FigNodeAssociation {

     

     /**

      * Construct a new FigNodeAssociation.

@@ -98,241 +44,6 @@
     public FigNodeAssociation2(Object owner, Rectangle bounds,

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        initFigs();

-    }

-

-    /*

-     * @see java.lang.Object#clone()

-     */

-    @Override

-    public Object clone() {

-        FigNodeAssociation2 figClone = (FigNodeAssociation2) super.clone();

-        Iterator it = figClone.getFigs().iterator();

-        figClone.setBigPort((FigDiamond) it.next());

-        figClone.head = (FigDiamond) it.next();

-        figClone.setNameFig((FigText) it.next());

-        return figClone;

-    }

-

-

-    /**

-     * Called when a model event is received from model subsystem.

-     * handles when a n-ary association becomes a binary association.

-     *

-     * @param mee the event

-     */

-    @Override

-    protected void updateLayout(UmlChangeEvent mee) {

-        super.updateLayout(mee);

-        if (mee.getSource() == getOwner()

-                && mee instanceof RemoveAssociationEvent

-                && "connection".equals(mee.getPropertyName())

-                && Model.getFacade().getConnections(getOwner()).size() == 2) {

-            reduceToBinary();

-        }

-    }

-

-    /**

-     * Called when deletion of an association end reduces the number of ends

-     * of an association down to only two. This Fig which represent the diamond

-     * node of a n-ary association needs to be replaced by a FigAssociation

-     * representing the binary relationship.

-     */

-    private void reduceToBinary() {

-        final Object association = getOwner();

-        assert (Model.getFacade().getConnections(association).size() == 2);

-        

-        // Detach any non-associationend edges (such as comment edges) already

-        // attached before this association node is removed.

-        // They'll later be re-attached to the new FigAssociation

-        final Collection<FigEdge> existingEdges = getEdges();

-        for (Iterator<FigEdge> it = existingEdges.iterator(); it.hasNext(); ) {

-            FigEdge edge = it.next();

-            if (edge instanceof FigAssociationEnd2) {

-                it.remove();

-            } else {

-                removeFigEdge(edge);

-            }

-        }

-        

-        // Now we can remove ourself (which will also remove the

-        // attached association ends edges)

-        final LayerPerspective lay = (LayerPerspective) getLayer();

-        final MutableGraphModel gm = (MutableGraphModel) lay.getGraphModel();

-        gm.removeNode(association);

-        removeFromDiagram();

-        

-        // Create the new FigAssociation edge to replace the node

-        final GraphEdgeRenderer renderer =

-            lay.getGraphEdgeRenderer();

-        final FigAssociation2 figEdge = (FigAssociation2) renderer.getFigEdgeFor(

-                gm, lay, association, null);

-        lay.add(figEdge);

-        gm.addEdge(association);

-        

-        // Add the non-associationend edges (such as comment edges) that were

-        // originally attached to this and attach them to the new

-        // FigAssociation and make sure they are positioned correctly.

-        for (FigEdge edge : existingEdges) {

-            figEdge.makeEdgePort();

-            if (edge.getDestFigNode() == this) {

-                edge.setDestFigNode(figEdge.getEdgePort());

-                edge.setDestPortFig(figEdge.getEdgePort());

-            }

-            if (edge.getSourceFigNode() == this) {

-                edge.setSourceFigNode(figEdge.getEdgePort());

-                edge.setSourcePortFig(figEdge.getEdgePort());

-            }

-        }

-        figEdge.computeRoute();

-    }

-    

-    /*

-     * Makes sure that the edges stick to the outline of the fig.

-     * @see org.tigris.gef.presentation.Fig#getGravityPoints()

-     */

-    @Override

-    public List getGravityPoints() {

-        return getBigPort().getGravityPoints();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color)

-     */

-    @Override

-    public void setLineColor(Color col) {

-        head.setLineColor(col);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineColor()

-     */

-    @Override

-    public Color getLineColor() {

-        return head.getLineColor();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setFillColor(java.awt.Color)

-     */

-    @Override

-    public void setFillColor(Color col) {

-        head.setFillColor(col);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getFillColor()

-     */

-    @Override

-    public Color getFillColor() {

-        return head.getFillColor();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setFilled(boolean)

-     */

-    @Override

-    public void setFilled(boolean f) {

-    }

-

-    @Override

-    public boolean isFilled() {

-        return true;

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setLineWidth(int)

-     */

-    @Override

-    public void setLineWidth(int w) {

-        head.setLineWidth(w);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineWidth()

-     */

-    @Override

-    public int getLineWidth() {

-        return head.getLineWidth();

-    }

-

-    @Override

-    protected void setStandardBounds(int x, int y, int w, int h) {

-        Rectangle oldBounds = getBounds();

-

-        Rectangle nm = getNameFig().getBounds();

-        /* Center the NameFig, since center justification 

-         * does not seem to work. */

-        getNameFig().setBounds(x + (w - nm.width) / 2, 

-                y + h / 2 - nm.height / 2, 

-                nm.width, nm.height);

-        // TODO: Replace magic numbers with constants

-        if (getStereotypeFig().isVisible()) {

-            /* TODO: Test this. */

-            getStereotypeFig().setBounds(x, y + h / 2 - 20, w, 15);

-            int stereotypeHeight = getStereotypeFig().getMinimumSize().height;

-            getStereotypeFig().setBounds(

-                    x,

-                    y,

-                    w,

-                    stereotypeHeight);

-        }

-        

-        head.setBounds(x, y, w, h);

-        getBigPort().setBounds(x, y, w, h);

-

-        calcBounds(); //_x = x; _y = y; _w = w; _h = h;

-        firePropChange("bounds", oldBounds, getBounds());

-        updateEdges();

-    }

-

-    @Override

-    public Dimension getMinimumSize() {

-        Dimension aSize = getNameFig().getMinimumSize();

-        if (getStereotypeFig().isVisible()) {

-            Dimension stereoMin = getStereotypeFig().getMinimumSize();

-            aSize.width = Math.max(aSize.width, stereoMin.width);

-            aSize.height += stereoMin.height;

-        }

-        aSize.width = Math.max(70, aSize.width);

-        int size = Math.max(aSize.width, aSize.height);

-        aSize.width = size;

-        aSize.height = size;

-        

-        return aSize;

-    }

-    

-    

-    /**

-     * 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() {

-        FigEdgeAssociationClass2 figEdgeLink = null;

-        final List edges = getFigEdges();

-

-        if (edges != null) {

-            for (Iterator it = edges.iterator(); it.hasNext()

-                    && figEdgeLink == null;) {

-                Object o = it.next();

-                if (o instanceof FigEdgeAssociationClass2) {

-                    figEdgeLink = (FigEdgeAssociationClass2) o;

-                }

-            }

-        }

-

-        if (figEdgeLink != null) {

-            FigNode figClassBox = figEdgeLink.getDestFigNode();

-            if (!(figClassBox instanceof FigClassAssociationClass2)) {

-                figClassBox = figEdgeLink.getSourceFigNode();

-            }

-            figEdgeLink.removeFromDiagramImpl();

-            ((FigClassAssociationClass2) figClassBox).removeFromDiagramImpl();

-        }

-

-        super.removeFromDiagramImpl();

     }

 

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeInstance2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeInstance2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeInstance2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigNodeInstance2.java	2009-08-07 14:44:24-0700
@@ -25,23 +25,13 @@
 package org.argouml.structure2.diagram;

 

 import java.awt.Rectangle;

-import java.util.ArrayList;

-import java.util.Collection;

-

-import org.argouml.model.Model;

-import org.argouml.notation.NotationProviderFactory2;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.deployment.ui.AbstractFigNode;

-import org.argouml.uml.diagram.ui.FigEdgeModelElement;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

+import org.argouml.uml.diagram.deployment.ui.FigNodeInstance;

 

 /**

  * Class to display graphics for a UML NodeInstance in a diagram.<p>

- *

- * @author [email protected]

  */

-class FigNodeInstance2 extends AbstractFigNode {

+class FigNodeInstance2 extends FigNodeInstance {

     

     /**

      * Construct a new FigNodeInstance.

@@ -53,86 +43,5 @@
     public FigNodeInstance2(Object owner, Rectangle bounds,

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        getNameFig().setUnderline(true);

-    }

-    

-    @Override

-    protected int getNotationProviderType() {

-        return NotationProviderFactory2.TYPE_NODEINSTANCE;

-    }

-

-    @Override

-    public Object clone() {

-        Object clone = super.clone();

-        return clone;

-    }

-

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionNodeInstance(this);

     }

-    

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setEnclosingFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setEnclosingFig(Fig encloser) {

-        if (getOwner() != null) {

-            Object nod = getOwner();

-            if (encloser != null) {

-                Object comp = encloser.getOwner();

-                if (Model.getFacade().isAComponentInstance(comp)) {

-                    if (Model.getFacade().getComponentInstance(nod) != comp) {

-                        Model.getCommonBehaviorHelper()

-                                .setComponentInstance(nod, comp);

-                        super.setEnclosingFig(encloser);

-                    }

-                } else if (Model.getFacade().isANode(comp)) {

-                    super.setEnclosingFig(encloser);

-                }

-            } else if (encloser == null) {

-                if (isVisible()

-                        // If we are not visible most likely

-                        // we're being deleted.

-                        // TODO: This indicates a more fundamental problem that

-                        // should be investigated - tfm - 20061230

-                        && Model.getFacade().getComponentInstance(nod) != null) {

-                    Model.getCommonBehaviorHelper()

-                            .setComponentInstance(nod, null);

-                    super.setEnclosingFig(encloser);

-                }

-            }

-        }

-

-        if (getLayer() != null) {

-            // elementOrdering(figures);

-            Collection contents = new ArrayList(getLayer().getContents());

-            for (Object o : contents) {

-                if (o instanceof FigEdgeModelElement) {

-                    FigEdgeModelElement figedge = (FigEdgeModelElement) o;

-                    figedge.getLayer().bringToFront(figedge);

-                }

-            }

-        }

-    }

-

-     /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateListeners(java.lang.Object)

-     */

-    @Override

-    protected void updateListeners(Object oldOwner, Object newOwner) {

-        super.updateListeners(oldOwner, newOwner);

-        if (newOwner != null) {

-            for (Object classifier 

-                    : Model.getFacade().getClassifiers(newOwner)) {

-                addElementListener(classifier, "name");

-            }

-        }

-    }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigObject2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigObject2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigObject2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigObject2.java	2009-08-07 14:44:24-0700
@@ -1,4 +1,4 @@
-// $Id: FigObject.java 17045 2009-04-05 16:52:52Z mvw $

+// $Id: FigObject2.java 17045 2009-04-05 16:52:52Z mvw $

 // Copyright (c) 1996-2009 The Regents of the University of California. All

 // Rights Reserved. Permission to use, copy, modify, and distribute this

 // software and its documentation without fee, and without a written

@@ -24,47 +24,15 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Color;

-import java.awt.Dimension;

 import java.awt.Rectangle;

-import java.util.Iterator;

-

-import org.argouml.model.Model;

-import org.argouml.notation.NotationProviderFactory2;

 import org.argouml.uml.diagram.DiagramSettings;

 import org.argouml.uml.diagram.ui.FigNodeModelElement;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigRect;

-import org.tigris.gef.presentation.FigText;

 

 /**

  * Class to display graphics for a UML Object in a diagram.

- *

- * @author 5eichler

  */

 class FigObject2 extends FigNodeModelElement {

 

-    private FigRect cover;

-

-    private void initFigs() {

-        setBigPort(new FigRect(X0, Y0, 90, 50, DEBUG_COLOR, DEBUG_COLOR));

-        cover = new FigRect(X0, Y0, 90, 50, LINE_COLOR, FILL_COLOR);

-        getNameFig().setLineWidth(0);

-        getNameFig().setFilled(false);

-        getNameFig().setUnderline(true);

-        Dimension nameMin = getNameFig().getMinimumSize();

-        getNameFig().setBounds(X0, Y0, nameMin.width + 20, nameMin.height);

-

-        // add Figs to the FigNode in back-to-front order

-        addFig(getBigPort());

-        addFig(cover);

-        addFig(getNameFig());

-

-        Rectangle r = getBounds();

-        setBounds(r.x, r.y, nameMin.width, nameMin.height);

-    }

-

     /**

      * Construct a new FigObject.

      * 

@@ -72,177 +40,10 @@
      * @param bounds position and size

      * @param settings render settings

      */

-    public FigObject2(Object owner, Rectangle bounds, DiagramSettings settings) {

+    public FigObject2(

+            final Object owner,

+            final Rectangle bounds,

+            final DiagramSettings settings) {

         super(owner, bounds, settings);

-        initFigs();

-    }

-    

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#getNotationProviderType()

-     */

-    @Override

-    protected int getNotationProviderType() {

-        return NotationProviderFactory2.TYPE_OBJECT;

-    }

-

-    /*

-     * @see java.lang.Object#clone()

-     */

-    @Override

-    public Object clone() {

-        FigObject2 figClone = (FigObject2) super.clone();

-        Iterator it = figClone.getFigs().iterator();

-        figClone.setBigPort((FigRect) it.next());

-        figClone.cover = (FigRect) it.next();

-        figClone.setNameFig((FigText) it.next());

-        return figClone;

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color)

-     */

-    @Override

-    public void setLineColor(Color col) {

-        cover.setLineColor(col);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineColor()

-     */

-    @Override

-    public Color getLineColor() {

-        return cover.getLineColor();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setFillColor(java.awt.Color)

-     */

-    @Override

-    public void setFillColor(Color col) {

-        cover.setFillColor(col);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getFillColor()

-     */

-    @Override

-    public Color getFillColor() {

-        return cover.getFillColor();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setFilled(boolean)

-     */

-    @Override

-    public void setFilled(boolean f) {

-        cover.setFilled(f);

-    }

-

-

-    @Override

-    public boolean isFilled() {

-        return cover.isFilled();

     }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setLineWidth(int)

-     */

-    @Override

-    public void setLineWidth(int w) {

-        cover.setLineWidth(w);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getLineWidth()

-     */

-    @Override

-    public int getLineWidth() {

-        return cover.getLineWidth();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionObject(this);

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#getMinimumSize()

-     */

-    @Override

-    public Dimension getMinimumSize() {

-        Dimension nameMin = getNameFig().getMinimumSize();

-

-        int w = nameMin.width + 10;

-        int h = nameMin.height + 5;

-        

-        w = Math.max(60, w);

-        return new Dimension(w, h);

-    }

-

-    /*

-     * Override setBounds to keep shapes looking right.

-     *

-     * @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)

-     */

-    @Override

-    protected void setStandardBounds(int x, int y, int w, int h) {

-        if (getNameFig() == null) {

-            return;

-        }

-

-        Rectangle oldBounds = getBounds();

-

-        Dimension nameMin = getNameFig().getMinimumSize();

-

-        getBigPort().setBounds(x, y, w, h);

-        cover.setBounds(x, y, w, h);

-        getNameFig().setBounds(x, y, nameMin.width + 10, nameMin.height + 4);

-

-        //_bigPort.setBounds(x+1, y+1, w-2, h-2);

-        _x = x; _y = y; _w = w; _h = h;

-

-        firePropChange("bounds", oldBounds, getBounds());

-        calcBounds(); //_x = x; _y = y; _w = w; _h = h;

-        updateEdges();

-    }

-

-    /*

-     * @see org.tigris.gef.presentation.Fig#setEnclosingFig(org.tigris.gef.presentation.Fig)

-     */

-    @Override

-    public void setEnclosingFig(Fig encloser) {

-	assert Model.getFacade().isAObject(getOwner());

-

-        Object owner = getOwner();

-

-        if (encloser != null

-                && (Model.getFacade()

-                        .isAComponentInstance(encloser.getOwner()))) {

-            Model.getCommonBehaviorHelper()

-                    .setComponentInstance(owner, encloser.getOwner());

-            super.setEnclosingFig(encloser);

-

-        } else if (Model.getFacade().getComponentInstance(owner) != null) {

-            Model.getCommonBehaviorHelper().setComponentInstance(owner, null);

-            super.setEnclosingFig(null);

-        }

-        

-        

-        if (encloser != null

-                && (Model.getFacade()

-                        .isAComponent(encloser.getOwner()))) {

-

-            moveIntoComponent(encloser);

-            super.setEnclosingFig(encloser);

-        } else if (encloser != null

-                && Model.getFacade().isANode(encloser.getOwner())) {

-            super.setEnclosingFig(encloser);

-        } else if (encloser == null) {

-            super.setEnclosingFig(null);

-        }

-    }

-

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigPermission2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigPermission2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigPermission2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigPermission2.java	2009-08-07 14:44:24-0700
@@ -25,6 +25,7 @@
 package org.argouml.structure2.diagram;

 

 import org.argouml.uml.diagram.DiagramSettings;

+import org.argouml.uml.diagram.ui.FigPermission;

 

 /**

  * The Fig for a permission, which is a form of dependency.

@@ -37,7 +38,7 @@
  * 

  * @author Markus Klink

  */

-class FigPermission2 extends FigDependency2 {

+class FigPermission2 extends FigPermission {

     

     /**

      * Construct a Fig.

@@ -48,6 +49,5 @@
     public FigPermission2(Object owner, DiagramSettings settings) {

         super(owner, settings);

     }

-

 }

 


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigSignal2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigSignal2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigSignal2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigSignal2.java	2009-08-07 14:44:24-0700
@@ -25,42 +25,13 @@
 package org.argouml.structure2.diagram;

 

 import java.awt.Rectangle;

-import java.awt.event.MouseEvent;

-import java.beans.PropertyChangeEvent;

-import java.util.Vector;

-

-import org.argouml.model.AssociationChangeEvent;

-import org.argouml.model.AttributeChangeEvent;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.static_structure.ui.FigClassifierBoxWithAttributes;

-import org.tigris.gef.base.Selection;

+import org.argouml.uml.diagram.static_structure.ui.FigSignal;

 

 /**

  * Class to display graphics for a UML Signal in a diagram.

- * <p>

- * A Signal may have attributes - the UML standard document 

- * contains an example diagram showing this.

- * <p>

- * A Signal may have operations.

- * 

- * @author Tom Morris

  */

-class FigSignal2 extends FigClassifierBoxWithAttributes {

-

-    private void constructFigs() {

-        getStereotypeFig().setKeyword("signal");

-

-        addFig(getBigPort());

-        addFig(getStereotypeFig());

-        addFig(getNameFig());

-        addFig(getOperationsFig());

-        addFig(getAttributesFig());

-        addFig(borderFig);

-

-        // by default, do not show operations nor attributes:

-        setOperationsVisible(false);

-        setAttributesVisible(false);

-    }

+class FigSignal2 extends FigSignal {

 

     /**

      * Construct a Fig representing a Signal.

@@ -69,42 +40,11 @@
      * @param bounds position and size

      * @param settings render settings

      */

-    public FigSignal2(Object owner, Rectangle bounds, DiagramSettings settings) {

+    public FigSignal2(

+            final Object owner,

+            final Rectangle bounds,

+            final DiagramSettings settings) {

         super(owner, bounds, settings);

-        constructFigs();

     }

     

-    /*

-     * @see org.argouml.uml.diagram.static_structure.ui.FigDataType#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionSignal(this);

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.static_structure.ui.FigClassifierBox#getPopUpActions(java.awt.event.MouseEvent)

-     */

-    @Override

-    public Vector getPopUpActions(MouseEvent me) {

-        Vector popUpActions = super.getPopUpActions(me);

-        

-        // TODO: Do we have anything to add here?

-

-        return popUpActions;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    protected void modelChanged(PropertyChangeEvent mee) {

-        super.modelChanged(mee);

-        if (mee instanceof AssociationChangeEvent 

-                || mee instanceof AttributeChangeEvent) {

-            renderingChanged();

-            updateListeners(getOwner(), getOwner());

-        }

-    }

-

 } 


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigStereotypeDeclaration2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigStereotypeDeclaration2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigStereotypeDeclaration2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigStereotypeDeclaration2.java	2009-08-07 14:44:24-0700
@@ -24,60 +24,15 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Dimension;

 import java.awt.Rectangle;

-import java.awt.event.MouseEvent;

-import java.beans.PropertyChangeEvent;

-import java.util.HashSet;

-import java.util.Set;

-import java.util.Vector;

-

-import javax.swing.Action;

-

-import org.argouml.model.AssociationChangeEvent;

-import org.argouml.model.AttributeChangeEvent;

-import org.argouml.model.Model;

-import org.argouml.ui.ArgoJMenu;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ui.ActionAddNote;

-import org.argouml.uml.diagram.ui.ActionCompartmentDisplay;

-import org.argouml.uml.diagram.ui.ActionEdgesDisplay;

-import org.argouml.uml.diagram.ui.CompartmentFigText;

-import org.argouml.uml.diagram.ui.FigCompartmentBox;

-import org.argouml.uml.ui.foundation.extension_mechanisms.ActionNewTagDefinition;

-import org.tigris.gef.base.Selection;

+import org.argouml.uml.diagram.static_structure.ui.FigStereotypeDeclaration;

 

 /**

  * Class to display a Stereotype declaration figure using

  * Classifier box notation.<p>

- *

- * TODO: This is just a placeholder right now! - tfm

  */

-class FigStereotypeDeclaration2 extends FigCompartmentBox {

-

-    private static final long serialVersionUID = -2702539988691983863L;

-

-    private void constructFigs() {

-        getStereotypeFig().setKeyword("stereotype");

-

-        // Put all the bits together, suppressing bounds calculations until

-        // we're all done for efficiency.

-        enableSizeChecking(false);

-        setSuppressCalcBounds(true);

-        addFig(getBigPort());

-        addFig(getStereotypeFig());

-        addFig(getNameFig());

-

-        // TODO: Need named Tags and Constraints compartments here

-//        addFig(tagsFig);

-//        addFig(constraintsFig);

-

-        addFig(getBorderFig());

-

-        setSuppressCalcBounds(false);

-        // Set the bounds of the figure to the total of the above (hardcoded)

-        setBounds(X0, Y0, WIDTH, STEREOHEIGHT + NAME_FIG_HEIGHT);

-    }

+class FigStereotypeDeclaration2 extends FigStereotypeDeclaration {

 

     /**

      * Construct a Fig for a Stereotype on a diagram.

@@ -89,177 +44,5 @@
     public FigStereotypeDeclaration2(Object owner, Rectangle bounds,

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        constructFigs();

-        enableSizeChecking(true);

-    }

-    

-    /*

-     * @see org.tigris.gef.presentation.Fig#makeSelection()

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionStereotype(this);

-    }

-

-    /**

-     * Build a collection of menu items relevant for a right-click

-     * popup menu on a Stereotype.

-     * {@inheritDoc}

-     */

-    @Override

-    public Vector getPopUpActions(MouseEvent me) {

-        Vector popUpActions = super.getPopUpActions(me);

-

-        // Add...

-        ArgoJMenu addMenu = new ArgoJMenu("menu.popup.add");

-        // TODO: Add Tags & Constraints

-//        addMenu.add(TargetManager.getInstance().getAddAttributeAction());

-//        addMenu.add(TargetManager.getInstance().getAddOperationAction());

-        addMenu.add(new ActionAddNote());

-        addMenu.add(new ActionNewTagDefinition());

-        addMenu.add(ActionEdgesDisplay.getShowEdges());

-        addMenu.add(ActionEdgesDisplay.getHideEdges());

-        popUpActions.add(popUpActions.size() - getPopupAddOffset(), addMenu);

-

-        // Show ...

-        ArgoJMenu showMenu = new ArgoJMenu("menu.popup.show");

-        for (Action action : ActionCompartmentDisplay.getActions()) {

-            showMenu.add(action);

-        }

-        if (showMenu.getComponentCount() > 0) {

-            popUpActions.add(popUpActions.size() - getPopupAddOffset(),

-                    showMenu);

-        }

-

-        // Modifiers ...

-        popUpActions.add(popUpActions.size() - getPopupAddOffset(),

-                buildModifierPopUp(ABSTRACT | LEAF | ROOT));

-

-        // Visibility ...

-        popUpActions.add(popUpActions.size() - getPopupAddOffset(),

-                buildVisibilityPopUp());

-

-        return popUpActions;

-    }

-

-    /**

-     * Gets the minimum size permitted for a class on the diagram.<p>

-     *

-     * @return  the size of the minimum bounding box.

-     */

-    @Override

-    public Dimension getMinimumSize() {

-        Dimension aSize = getNameFig().getMinimumSize();

-        

-        //TODO: Why does this differ from the other Figs?

-        aSize = addChildDimensions(aSize, getStereotypeFig());

-

-        // TODO: Allow space for each of the Tags & Constraints we have

-

-        // we want to maintain a minimum width for the class

-        aSize.width = Math.max(WIDTH, aSize.width);

-

-        return aSize;

-    }

-

-    /**

-     * Sets the bounds, but the size will be at least the one returned by

-     * {@link #getMinimumSize()}, unless checking of size is disabled.<p>

-     *

-     * @param x  Desired X coordinate of upper left corner

-     *

-     * @param y  Desired Y coordinate of upper left corner

-     *

-     * @param w  Desired width of the fig

-     *

-     * @param h  Desired height of the fig

-     *

-     * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)

-     */

-    @Override

-    protected void setStandardBounds(final int x, final int y,

-            final int w, final int h) {

-        Rectangle oldBounds = getBounds();

-

-        // set bounds of big box

-        getBigPort().setBounds(x, y, w, h);

-        getBorderFig().setBounds(x, y, w, h);

-

-        int currentHeight = 0;

-

-        if (getStereotypeFig().isVisible()) {

-            int stereotypeHeight = getStereotypeFig().getMinimumSize().height;

-            getStereotypeFig().setBounds(

-                    x,

-                    y,

-                    w,

-                    stereotypeHeight);

-            currentHeight = stereotypeHeight;

-        }

-

-        int nameHeight = getNameFig().getMinimumSize().height;

-        getNameFig().setBounds(x, y + currentHeight, w, nameHeight);

-        currentHeight += nameHeight;

-

-        // TODO: Compute size of Tags and Constraints

-

-

-        // Now force calculation of the bounds of the figure, update the edges

-        // and trigger anyone who's listening to see if the "bounds" property

-        // has changed.

-

-        calcBounds();

-        updateEdges();

-        firePropChange("bounds", oldBounds, getBounds());

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.static_structure.ui.FigCompartmentBox#unhighlight()

-     */

-    @Override

-    protected CompartmentFigText unhighlight() {

-        CompartmentFigText fc = super.unhighlight();

-        if (fc == null) {

-            // TODO: Try unhighlighting our child compartments

-//            fc = unhighlight(getAttributesFig());

-        }

-        return fc;

-    }

-

-    /**

-     * Handles changes to the model. Takes into account the event that

-     * occurred. If you need to update the whole fig, consider using

-     * renderingChanged.

-     * {@inheritDoc}

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    protected void modelChanged(PropertyChangeEvent mee) {

-        super.modelChanged(mee);

-        if (mee instanceof AssociationChangeEvent 

-                || mee instanceof AttributeChangeEvent) {

-            renderingChanged();

-            updateListeners(getOwner(), getOwner());

-            damage();

-        }

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateListeners(java.lang.Object)

-     */

-    @Override

-    protected void updateListeners(Object oldOwner, Object newOwner) {

-        

-        Set<Object[]> listeners = new HashSet<Object[]>();

-        if (newOwner != null) {

-            listeners.add(new Object[] {newOwner, null});

-            // register for tagdefinitions:

-            for (Object td : Model.getFacade().getTagDefinitions(newOwner)) {

-                listeners.add(new Object[] {td,

-                    new String[] {"name", "tagType", "multiplicity"}});

-            }

-            /* TODO: constraints, ... */

-        }

-        updateElementListeners(listeners);

     }

 }


Modified: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigUseCase2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigUseCase2.java?view=diff&pathrev=17229&r1=17228&r2=17229
==============================================================================
--- trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigUseCase2.java	(original)
+++ trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/FigUseCase2.java	2009-08-07 14:44:24-0700
@@ -24,44 +24,9 @@
 

 package org.argouml.structure2.diagram;

 

-import java.awt.Color;

-import java.awt.Dimension;

-import java.awt.Point;

 import java.awt.Rectangle;

-import java.awt.event.InputEvent;

-import java.awt.event.MouseEvent;

-import java.beans.PropertyChangeEvent;

-import java.util.ArrayList;

-import java.util.Collection;

-import java.util.HashSet;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Set;

-import java.util.Vector;

-

-import javax.swing.Action;

-

-import org.argouml.model.AssociationChangeEvent;

-import org.argouml.model.AttributeChangeEvent;

-import org.argouml.model.Model;

-import org.argouml.ui.ArgoJMenu;

-import org.argouml.ui.targetmanager.TargetManager;

 import org.argouml.uml.diagram.DiagramSettings;

-import org.argouml.uml.diagram.ExtensionsCompartmentContainer;

-import org.argouml.uml.diagram.ui.ActionAddExtensionPoint;

-import org.argouml.uml.diagram.ui.ActionAddNote;

-import org.argouml.uml.diagram.ui.ActionCompartmentDisplay;

-import org.argouml.uml.diagram.ui.CompartmentFigText;

-import org.argouml.uml.diagram.ui.FigNodeModelElement;

-import org.tigris.gef.base.Editor;

-import org.tigris.gef.base.Globals;

-import org.tigris.gef.base.Selection;

-import org.tigris.gef.presentation.Fig;

-import org.tigris.gef.presentation.FigCircle;

-import org.tigris.gef.presentation.FigGroup;

-import org.tigris.gef.presentation.FigLine;

-import org.tigris.gef.presentation.FigRect;

-import org.tigris.gef.presentation.FigText;

+import org.argouml.uml.diagram.use_case.ui.FigUseCase;

 

 /**

  * A fig to display use cases on use case diagrams.<p>

@@ -108,139 +73,9 @@
  * origin is at our top left corner, and the Y coordinates are

  * reversed.<p>

  */

-class FigUseCase2 extends FigNodeModelElement

-    implements ExtensionsCompartmentContainer {

-

-    /**

-     * The minimum padding allowed above and below the rectangle for

-     * the use case name and extension points to the top of the use

-     * case oval itself.<p>

-     */

-    private static final int MIN_VERT_PADDING = 4;

-    

-    // Space between ellipse and stereotype underneath

-    private static final int STEREOTYPE_PADDING = 0;

-    

-

-    /**

-     * Space above and below the line separating name from extension

-     * points. The line takes a further 1 pixel.<p>

-     */

-    private static final int SPACER = 2;

-

-    /**

-     * UML use cases do not really have ports, so just define one big

-     * one so that users can drag edges to or from any point in the

-     * icon.<p>

-     */

-    private FigMyCircle bigPort;

-

-    /**

-     * We don't use _bigPort for the actual graphics of the oval. We

-     * define an identical oval that sits on top of it.<p>

-     */

-    private FigMyCircle cover;

-

-    /**

-     * The line separating name and extension points.<p>

-     */

-    private FigLine epSep;

+class FigUseCase2 extends FigUseCase {

 

     /**

-     * The vector of graphics for extension points (if any). First one

-     * is the rectangle for the entire extension points box.<p>

-     */

-    private FigGroup epVec;

-

-    /**

-     * The rectangle for the entire extension point box.<p>

-     */

-    private FigRect epBigPort;

-

-    /**

-     * Text highlighted by mouse actions on the diagram. Assumed to

-     * belong to the extension point compartment.<p>

-     */

-    private CompartmentFigText highlightedFigText;

-

-    /**

-     * Initialization which is common to multiple constructors.<p>

-     * 

-     * There should be no size calculations here, nor color setting,

-     * since not all attributes are set yet (like e.g. fill color).

-     */

-    private void initialize() {        

-        // Create all the things we need

-

-        // First the main port ellipse and the cover of identical size that

-        // will realize it. Use arbitrary dimensions for now.

-

-        bigPort = new FigMyCircle(0, 0, 100, 60);

-        cover = new FigMyCircle(0, 0, 100, 60);

-

-        // Mark the text, but not the box as filled, mark that the name may

-        // use multi-line text (a bit odd - how do we enter a multi-line

-        // name?).

-        

-        /* TODO: The above comment hints that the ReturnAction 

-         * should be INSERT, not END_EDITING. */

-

-        getNameFig().setTextFilled(false);

-        getNameFig().setFilled(false);

-        getNameFig().setLineWidth(0);

-        getNameFig().setReturnAction(FigText.END_EDITING);

-

-        // The separator, again with arbitrary bounds for now.

-

-        epSep = new FigLine(0, 30, 100, 100);

-        epSep.setLineWidth(LINE_WIDTH);

-

-        epSep.setVisible(false);

-

-        // The surrounding box for the extension points, again with arbitrary

-        // bounds for now (but made the same width as the name field, so the

-        // name field width will dominate size calculations, but there is a

-        // space to double click in for a new EP. It is not filled, nor has it

-        // a surrounding line. Its bounds, which allow for one line (which is

-        // empty) are the same as for the name box at this stage.

-

-        epBigPort =

-	    new FigRect(0, 30, getNameFig().getBounds().width, 20);

-

-        epBigPort.setFilled(false);

-        epBigPort.setLineWidth(0);

-        epBigPort.setVisible(false);

-

-        // The group for the extension points. The first entry in the group

-        // is the overall surrounding box itself. The group is not filled, nor

-        // has any line. The first entry we add is the epBigPort

-

-        epVec = new FigGroup();

-

-        epVec.setFilled(false);

-        epVec.setLineWidth(0);

-        epVec.setVisible(false);

-

-        epVec.addFig(epBigPort);

-

-        setBigPort(bigPort);

-

-        // add Figs to the FigNode in back-to-front order

-        addFig(bigPort);

-        addFig(cover);

-        addFig(getNameFig());

-        addFig(getStereotypeFig());

-        addFig(epSep);

-        addFig(epVec);

-

-        updateExtensionPoint();

-        

-        // Having built the figure, getBounds finds the enclosing rectangle,

-        // which we set as our bounds.

-        setBounds(getBounds());

-    }

-    

-    /**

      * Construct a use case figure with the given owner, bounds, and rendering 

      * settings.  This constructor is used by the PGML parser.

      * 

@@ -251,1000 +86,5 @@
     public FigUseCase2(Object owner, Rectangle bounds, 

             DiagramSettings settings) {

         super(owner, bounds, settings);

-        initialize();

-        if (bounds != null) {

-            setLocation(bounds.x, bounds.y);

-        }

-    }

-

-    /**

-     * The text string to be used as the default name of the new use

-     * case fig. However this seems in general to be immediately

-     * overwritten - presumably somewhere in the creation code for the

-     * object, which choses to define a name.<p>

-     *

-     * <em>Note</em>. Good UML would probably prefer a name starting

-     * with a capital and no spaces!<p>

-     *

-     * @return  The desired text of the default name.

-     */

-    @Override

-    public String placeString() {

-        return "new Use Case";

-    }

-

-    /**

-     * Make a copy of the current fig.<p>

-     *

-     * Uses the generic superclass clone which gives a list of all

-     * the figs. Then initialize our instance variables from this

-     * list.<p>

-     *

-     * @return  A new copy of the the current fig.

-     */

-    @Override

-    public Object clone() {

-        FigUseCase2 figClone = (FigUseCase2) super.clone();

-        Iterator it = figClone.getFigs().iterator();

-

-        figClone.bigPort = (FigMyCircle) it.next();

-        figClone.cover = (FigMyCircle) it.next();

-        figClone.setNameFig((FigText) it.next());

-        it.next();

-        figClone.epSep = (FigLine) it.next();

-        figClone.epVec = (FigGroup) it.next();

-

-        return figClone;

-    }

-

-    /**

-     * Build a collection of menu items relevant for a right-click

-     * popup menu on a Use Case.<p>

-     *

-     * Adds to the generic pop up items from the parent.<p>

-     *

-     * @param me  The mouse event that generated this popup.

-     *

-     * @return    A collection of menu items

-     */

-    @Override

-    public Vector getPopUpActions(MouseEvent me) {

-        /* Check if multiple items are selected: */

-        boolean ms = TargetManager.getInstance().getTargets().size() > 1;

-

-        // Get the parent vector first

-        Vector popUpActions = super.getPopUpActions(me);

-

-        // Add menu to add an extension point or note. Placed one before last,

-        // so the "Properties" entry is always last.

-        ArgoJMenu addMenu = new ArgoJMenu("menu.popup.add");

-

-        if (!ms) {

-            addMenu.add(ActionAddExtensionPoint.singleton());

-        }

-        addMenu.add(new ActionAddNote());

-

-        popUpActions.add(popUpActions.size() - getPopupAddOffset(), addMenu);

-

-        // Modifier menu. Placed one before last, so the "Properties" entry is

-        // always last.

-        popUpActions.add(popUpActions.size() - getPopupAddOffset(),

-                buildModifierPopUp(LEAF | ROOT));

-

-        return popUpActions;

-    }

-

-    /**

-     * Show menu to display/hide the extension point compartment.

-     * @return the menu

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#buildShowPopUp()

-     */

-    @Override

-    protected ArgoJMenu buildShowPopUp() {

-        ArgoJMenu showMenu = super.buildShowPopUp();

-        Iterator i = ActionCompartmentDisplay.getActions().iterator();

-        while (i.hasNext()) {

-            showMenu.add((Action) i.next());

-        }

-        return showMenu;

-    }

-

-    /**

-     * USED BY PGML.tee.

-     * @return the class name and bounds together with compartment

-     * visibility.

-     */

-    @Override

-    public String classNameAndBounds() {

-        return super.classNameAndBounds()

-                + "extensionPointVisible=" + isExtensionPointVisible();

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ExtensionsCompartmentContainer#isExtensionPointVisible()

-     */

-    public boolean isExtensionPointVisible() {

-        return epVec.isVisible();

-    }

-

-    /**

-     * Set the visibility of the extension point compartment. This is

-     * called from outside this class when the user sets visibility

-     * explicitly through the style panel or the context sensitive

-     * pop-up menu.<p>

-     *

-     * We don't change the size of the use case, so we just have to

-     * mark the extension point elements' visibility.

-     * {@link #setBounds(int, int, int, int)} will do the relayout

-     * (with name in the middle) for us.<p>

-     *

-     * @param isVisible  <code>true</code> if the compartment should be shown,

-     *                   <code>false</code> otherwise.

-     *

-     * @see org.argouml.uml.diagram.ExtensionsCompartmentContainer#setExtensionPointVisible(boolean)

-     */

-    public void setExtensionPointVisible(boolean isVisible) {

-        if (epVec.isVisible() && (!isVisible)) {

-            setExtensionPointVisibleInternal(false);

-        } else if ((!epVec.isVisible()) && isVisible) {

-            setExtensionPointVisibleInternal(true);

-        }

-        /* Move the stereotype out of the way: */

-        updateStereotypeText();

-    }

-

-    private void setExtensionPointVisibleInternal(boolean visible) {

-        // Record our current bounds for later use

-        Rectangle oldBounds = getBounds();

-

-        // Tell GEF that we are starting to make a change. Loop through the

-        // epVec marking each element as not visible.

-        for (Fig fig : (List<Fig>) epVec.getFigs()) {

-            fig.setVisible(visible);

-        }

-

-        // Mark the vector itself and the separator as not displayed

-        epVec.setVisible(visible);

-        epSep.setVisible(visible);

-

-        // Redo the bounds and then tell GEF the change has finished

-        setBounds(oldBounds.x, oldBounds.y,

-                oldBounds.width,

-                oldBounds.height);

-        endTrans();

-    }

-

-    /**

-     * Creates a set of handles for dragging generalization/specializations

-     *   or associations.<p>

-     *

-     * @return  The new selection object (a GEF entity).

-     */

-    @Override

-    public Selection makeSelection() {

-        return new SelectionUseCase(this);

-    }

-

-    /**

-     * Compute the minimum acceptable size of the use case.<p>

-     *

-     * We work out the minimum size of the text box, and from that the radii

-     *   of the enclosing ellipse.<p>

-     *

-     * @return  The dimensions of the smallest size bounding box of the use

-     *          case.

-     */

-    @Override

-    public Dimension getMinimumSize() {

-

-        Dimension textSize = getTextSize();

-

-        Dimension size = calcEllipse(textSize, MIN_VERT_PADDING);

-

-        return new Dimension(Math.max(size.width, 100),

-			     Math.max(size.height, 60));

-    }

-

-    /**

-     * A private utility routine to calculate the minimum size of the

-     *   rectangle to hold the name and extension points (if displayed).<p>

-     *

-     * @return  The dimensions of the rectangle

-     */

-    private Dimension getTextSize() {

-        Dimension minSize = getNameFig().getMinimumSize();

-

-        // Now allow for the extension points, if they are displayed

-        if (epVec.isVisible()) {

-

-            // Allow for a separator (spacer each side + 1 pixel width line)

-            minSize.height += 2 * SPACER + 1;

-

-            // Loop through all the extension points, to find the widest

-            List<CompartmentFigText> figs = getEPFigs();

-            for (CompartmentFigText f : figs) {

-                int elemWidth = f.getMinimumSize().width;

-                minSize.width = Math.max(minSize.width, elemWidth);

-            }

-

-            // Height allows one row for each extension point

-            int rowHeight = Math.max(ROWHEIGHT, minSize.height);

-            minSize.height += rowHeight * Math.max(1, figs.size());

-        }

-

-        return minSize;

-    }

-

-    /**

-     * A private utility to calculate the bounding oval for the given

-     * rectangular text box.<p>

-     *

-     * To sufficiently constrain the problem, we define that there is a gap

-     * given by the parameter <code>vertPadding</code> above the top of the

-     * box to the top of the oval.<p>

-     *

-     * All computations are done in double, and then converted to integer at

-     * the end.<p>

-     *

-     * @param rectSize     The dimensions of the rectangle to be bounded

-     *

-     * @param vertPadding  The padding between the top of the box and the top

-     *                     of the ellipse.

-     *

-     * @return             The dimensions of the required oval.

-     */

-    private Dimension calcEllipse(Dimension rectSize, int vertPadding) {

-

-        // Work out the radii of the ellipse, a and b. The top right corner of

-        // the ellipse (Cartesian coordinates, centred on the origin) will be

-        // at (x,y)

-

-        double a;

-        double b = rectSize.height / 2.0 + vertPadding;

-

-        double x = rectSize.width / 2.0;

-        double y = rectSize.height / 2.0;

-

-        // Formula for a is described in the overall class description.

-

-        a = (x * b) / Math.sqrt(b * b - y * y);

-

-        // Result as integers, rounded up. We ensure that the radii are

-        // integers for convenience.

-

-        return new Dimension(((int) (Math.ceil(a)) * 2),

-			     ((int) (Math.ceil(b)) * 2));

-    }

-

-    /**

-     * Change the boundary of the use case.<p>

-     *

-     * If we are called with less than the minimum size, we impose the

-     *   minimum size.<p>

-     *

-     * We place the name and extension points at the centre of the

-     *   rectangle.<p>

-     *

-     * Set the bounds of all components of the Fig.<p>

-     *

-     * @param x  X coordinate of upper left corner

-     *

-     * @param y  Y coordinate of upper left corner

-     *

-     * @param w  width of bounding box

-     *

-     * @param h  height of bounding box

-     */

-    @Override

-    protected void setBoundsImpl(int x, int y, int w, int h) {

-

-        // Remember where we are at present, so we can tell GEF later. Then

-        // check we are as big as the minimum size

-        Rectangle oldBounds = getBounds();

-        Dimension minSize = getMinimumSize();

-

-        int newW = (minSize.width > w) ? minSize.width : w;

-        int newH = (minSize.height > h) ? minSize.height : h;

-        

-        newH = newH - (getStereotypeFig().getHeight() + STEREOTYPE_PADDING);

-

-        // Work out the size of the name and extension point rectangle, and

-        // hence the vertical padding

-        Dimension textSize = getTextSize();

-        int vPadding = (newH - textSize.height) / 2;

-

-        // Adjust the alignment of the name.

-        Dimension nameSize = getNameFig().getMinimumSize();

-

-        getNameFig().setBounds(x + ((newW - nameSize.width) / 2),

-			       y + vPadding,

-			       nameSize.width,

-			       nameSize.height);

-

-        // Place extension points if they are showing

-        if (epVec.isVisible()) {

-

-            // currY tracks the current vertical position of each element. The

-            // separator is _SPACER pixels below the name. Its length is

-            // calculated from the formula for an ellipse.

-            int currY = y + vPadding + nameSize.height + SPACER;

-            int sepLen =

-		2 * (int) (calcX(newW / 2.0,

-				  newH / 2.0,

-				  newH / 2.0 - (currY - y)));

-

-            epSep.setShape(x + (newW - sepLen) / 2,

-			    currY,

-			    x + (newW + sepLen) / 2,

-			    currY);

-

-            // Extension points are 1 pixel for the line and _SPACER gap below

-            // the separator

-            currY += 1 + SPACER;

-

-            // Move the extension point figures. For

-            // now we assume that extension points are the width of the overall

-            // text rectangle (true unless the name is wider than any EP).

-            updateFigGroupSize(

-               	   x + ((newW - textSize.width) / 2),

-               	   currY,

-               	   textSize.width,

-               	   (textSize.height - nameSize.height - SPACER * 2 - 1));

-        }

-

-        // Set the bounds of the bigPort and cover

-        bigPort.setBounds(x, y, newW, newH);

-        cover.setBounds(x, y, newW, newH);

-

-        // Record the changes in the instance variables of our parent, tell GEF

-        // and trigger the edges to reconsider themselves.

-        _x = x;

-        _y = y;

-        _w = newW;

-        _h = newH + getStereotypeFig().getHeight() + STEREOTYPE_PADDING;

-        

-        positionStereotypes();

-

-        firePropChange("bounds", oldBounds, getBounds());

-        updateEdges();

-    }

-

-    /**

-     * Calculates the new size of the FigGroup (based on its extensionpoints)

-     * after calculation new bounds for all sub-figs, considering their minimal

-     * sizes; FigGroup need not be displayed; no update event is fired.

-     * This used to be a duplicate method from FigEditableCompartment. <p>

-     * 

-     * TODO: Follow the improvements done to 

-     * the similar code in FigEditableCompartment. 

-     *

-     * @param x

-     *            x

-     * @param y

-     *            y

-     * @param w

-     *            w

-     * @param h

-     *            h

-     */

-    protected void updateFigGroupSize(int x, int y, int w,

-            int h) {

-        int newW = w;

-        int n = epVec.getFigs().size() - 1;

-        int newH =

-            isCheckSize() ? Math.max(h, ROWHEIGHT * Math.max(1, n) + 2)

-                : h;

-

-        // set new bounds for all included figs

-        Iterator figs = epVec.getFigs().iterator();

-        figs.next(); // skip epBigPort

-        Fig fi;

-        int fw, fh;

-        int yy = y;

-        while (figs.hasNext()) {

-            fi = (Fig) figs.next();

-            fw = fi.getMinimumSize().width;

-            fh = fi.getMinimumSize().height;

-            if (!isCheckSize() && fw > newW - 2) {

-                fw = newW - 2;

-            }

-            fi.setBounds(x + 1, yy + 1, fw, fh/* - 2*/);

-            if (isCheckSize() && newW < fw + 2) {

-                newW = fw + 2;

-            }

-            yy += fh;

-        }

-        epBigPort.setBounds(x, y, newW, newH);

-        // calculate the rectangle containing all FigText objects:

-        epVec.calcBounds();

-    }

-

-    /**

-     * Private utility routine to work out the (positive) x coordinate of a

-     * point on an oval, given the radii and y coordinate.<p>

-     *

-     * @param a  radius in X direction

-     * @param b  radius in Y direction

-     * @param y  Y coordinate

-     * @return   Positive X coordinate for the given Y coordinate

-     */

-    private double calcX(double a, double b, double y) {

-        return (a * Math.sqrt(b * b - y * y)) / b;

-    }

-

-    /**

-     * Set the line colour for the use case oval.<p>

-     *

-     * This involves setting the <code>cover</code> oval, not the bigPort.

-     * Calling the super method would cause all FigGroup elements

-     * to follow suit - which is not wanted.

-     *

-     * @param col The colour desired.

-     */

-    @Override

-    public void setLineColor(Color col) {

-        if (cover != null) {

-            cover.setLineColor(col);

-            epSep.setLineColor(col);

-        }

-    }

-

-    /**

-     * Get the line colour for the use case oval.<p>

-     *

-     * This involves getting the <code>cover</code> oval colour, not the bigPort.

-     * 

-     * @return  The colour in use.

-     */

-    @Override

-    public Color getLineColor() {

-        return cover.getLineColor();

-    }

-

-    /**

-     * Set the fill colour for the use case oval.<p>

-     *

-     * This involves setting the <code>cover</code> oval, not the bigPort.

-     * Calling the super method would cause all FigGroup elements

-     * to follow suit - which is not wanted.

-     *

-     * @param col  The colour desired.

-     */

-    @Override

-    public void setFillColor(Color col) {

-        if (cover != null) {

-            cover.setFillColor(col);

-        }

-    }

-

-    /**

-     * Get the line colour for the use case oval.<p>

-     *

-     * This involves getting the <code>cover</code> oval colour, not the bigPort.

-     *

-     * @return  The colour in use.

-     */

-    @Override

-    public Color getFillColor() {

-        return cover.getFillColor();

-    }

-

-    /**

-     * Set whether the use case oval is to be filled.<p>

-     *

-     * This involves setting the <code>cover</code> oval, not the bigPort.<p>

-     * Calling the super method would cause all FigGroup elements

-     * to be filled, too - which is not wanted for e.g. the stereotype figs.

-     * See issue 5581.

-     *

-     * @param f  <code>true</code> if the oval is to be filled,

-     *           <code>false</code> if not.

-     */

-    @Override

-    public void setFilled(boolean f) {

-        if (cover != null) {

-            cover.setFilled(f);

-        }

-    }

-

-    /**

-     * Get whether the use case oval is to be filled.<p>

-     *

-     * This involves getting the <code>cover</code> oval, not the bigPort.<p>

-     *

-     * @return  <code>true</code> if the oval is to be filled,

-     *          <code>false</code> if not.

-     */

-    @Override

-    public boolean isFilled() {

-        return cover.isFilled();

-    }

-

-    /**

-     * Set the line width for the use case oval.<p>

-     *

-     * This involves setting the <code>cover</code> oval, not the bigPort.

-     * Calling the super method would cause all FigGroup elements

-     * to be filled, too - which is not wanted for e.g. the stereotype figs.

-     *

-     * @param w  The line width desired.

-     */

-    @Override

-    public void setLineWidth(int w) {

-        if (cover != null) {

-            cover.setLineWidth(w);

-        }

-    }

-

-    /**

-     * Get the line width for the use case oval.<p>

-     *

-     * This involves getting the <code>cover</code> oval colour, not the bigPort.<p>

-     *

-     * @return  The line width set.

-     */

-    @Override

-    public int getLineWidth() {

-        return cover.getLineWidth();

-    }

-

-    /**

-     * FigMyCircle is a FigCircle with corrected connectionPoint method:

-     *   this methods calculates where a connected edge ends.<p>

-     */

-    public static class FigMyCircle extends FigCircle {

-        /**

-         * Constructor just invokes the parent constructor.<p>

-         *

-         * @param x       X coordinate of the upper left corner of the bounding

-         *                box.

-         *

-         * @param y       Y coordinate of the upper left corner of the bounding

-         *                box.

-         *

-         * @param w       Width of the bounding box.

-         *

-         * @param h       Height of the bounding box.

-         *

-         * @param lColor  Line colour of the fig.

-         *

-         * @param fColor  Fill colour of the fig.

-         */

-        public FigMyCircle(int x, int y, int w, int h,

-			   Color lColor,

-			   Color fColor) {

-            super(x, y, w, h, lColor, fColor);

-        }

-

-        /**

-         * Constructor just invokes the parent constructor.<p>

-         *

-         * @param x       X coordinate of the upper left corner of the bounding

-         *                box.

-         *

-         * @param y       Y coordinate of the upper left corner of the bounding

-         *                box.

-         *

-         * @param w       Width of the bounding box.

-         *

-         * @param h       Height of the bounding box.

-         */

-        public FigMyCircle(int x, int y, int w, int h) {

-            super(x, y, w, h);

-        }

-

-        /**

-         * Compute the border point of the ellipse that is on the edge

-         *   between the stored upper left corner and the given parameter.<p>

-         *

-         * @param anotherPt  The remote point to which an edge is drawn.

-         *

-         * @return           The connection point on the boundary of the

-         *                   ellipse.

-         */

-        @Override

-        public Point connectionPoint(Point anotherPt) {

-            double rx = _w / 2;

-            double ry = _h / 2;

-            double dx = anotherPt.x - (_x + rx);

-            double dy = anotherPt.y - (_y + ry);

-            double dd = ry * ry * dx * dx + rx * rx * dy * dy;

-            double mu = rx * ry / Math.sqrt(dd);

-

-            Point res =

-		new Point((int) (mu * dx + _x + rx),

-			  (int) (mu * dy + _y + ry));

-            return res;

-        }

-

-        /**

-         * The UID.

-         */

-        private static final long serialVersionUID = 2616728355472635182L;

-    }

-

-    ///////////////////////////////////////////////////////////////////////////

-    //

-    // Event handlers

-    //

-    ///////////////////////////////////////////////////////////////////////////

-

-    /**

-     * React to a mouse key being pressed.<p>

-     *

-     * @param me  The mouse action that caused us to be invoked.

-     */

-    @Override

-    public void mousePressed(MouseEvent me) {

-

-        // Deal with anything from the parent first

-        super.mousePressed(me);

-

-        // If we are currently selected, turn off the draggable buttons at each

-        // side, and unhighlight any currently selected extension points.

-        Editor ce = Globals.curEditor();

-        if (ce != null) {

-            Selection sel = ce.getSelectionManager().findSelectionFor(this);

-            if (sel instanceof SelectionUseCase) {

-                ((SelectionUseCase) sel).hideButtons();

-            }

-        }

-

-        unhighlight();

-

-        // Display extension point properties if necessary. Look to see if the

-        // mouse (2x2 pixels) hit the extension point compartment. Use a flag

-        // to track this.

-        Rectangle r = new Rectangle(me.getX() - 1, me.getY() - 1, 2, 2);

-        Fig f = hitFig(r);

-

-

-        if (f == epVec) {

-

-            // Work out which extension point this corresponds to. Each EP

-            // takes ROWHEIGHT pixels, so take the difference between the

-            // centre of the mouse (me.getY() - 1) and the top of the epVec

-            // (f.getY()) and integer divide by ROWHEIGHT.

-            int i = (me.getY() - f.getY() - 1) / ROWHEIGHT;

-

-            List<CompartmentFigText> figs = getEPFigs();

-            

-            // If we are in the range of the EP list size (avoids any nasty

-            // boundary overflows), we can select that EP entry. Make this

-            // entry the target Fig, and note that we do have a

-            // target.             

-            if ((i >= 0) && (i < figs.size())) {

-                highlightedFigText = figs.get(i);

-                highlightedFigText.setHighlighted(true);

-            }

-        }

-    }

-

-    /**

-     * React to a mouse key being clicked.<p>

-     *

-     * @param me  The mouse action that caused us to be invoked.

-     */

-    @Override

-    public void mouseClicked(MouseEvent me) {

-	super.mouseClicked(me);

-

-	if (me.isConsumed()) {

-	    return;

-	}

-

-	if (!isExtensionPointVisible() || me.getY() < epSep.getY1()) {

-	    getNameFig().mouseClicked(me);

-	} else if (me.getClickCount() >= 2

-		   && !(me.isPopupTrigger()

-			|| me.getModifiers() == InputEvent.BUTTON3_MASK)) {

-	    createContainedModelElement(epVec, me);

-	}

-    }

-

-    /**

-     * Deal with the mouse leaving the fig. Unhighlight the fig.<p>

-     *

-     * @param me  The mouse action that caused us to be invoked.

-     */

-    @Override

-    public void mouseExited(MouseEvent me) {

-        super.mouseExited(me);

-        unhighlight();

-    }

-

-    /**

-     * Create a new "feature" (extension point) in the use case fig.<p>

-     *

-     * Extension points are not strictly features, but that is a historical

-     *   accident of naming. This creates a new entry in the extension point

-     *   vector.<p>

-     *

-     * @param fg  The fig group to which this applies (which must be the

-     *            extension point vector).

-     *

-     * @param ie  The input event that triggered us. In the current

-     *            implementation a mouse double click.

-     */

-    protected void createContainedModelElement(FigGroup fg, InputEvent ie) {

-

-        // Give up if we don't have an owner

-        if (getOwner() == null) {

-            return;

-        }

-

-        // Invoke the relevant action method to create an empty extension

-        // point, then start the editor, assuming we successfully created an

-        // extension point.

-        ActionAddExtensionPoint.singleton().actionPerformed(null);

-

-        CompartmentFigText ft =

-            (CompartmentFigText) fg.getFigs().get(fg.getFigs().size() - 1);

-

-        if (ft != null) {

-            ft.startTextEditor(ie);

-            ft.setHighlighted(true);

-

-            highlightedFigText = ft;

-        }

-        ie.consume();

-    }

-

-    /**

-     * Private utility to unhighlight any currently selected extension

-     * point.<p>

-     *

-     * @return  The extension point that was unhighlighted.

-     */

-    private CompartmentFigText unhighlight() {

-

-        // Loop through the list of extension points, until we find a

-        // highlighted one.

-        for (CompartmentFigText ft : getEPFigs()) {

-            if (ft.isHighlighted()) {

-                ft.setHighlighted(false);

-                highlightedFigText = null;

-                return ft;

-            }

-        }

-

-        // None were highlighted

-        return null;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)

-     */

-    @Override

-    protected void modelChanged(PropertyChangeEvent mee) {

-

-        // Let our superclass sort itself out first

-        super.modelChanged(mee);

-        if (mee instanceof AssociationChangeEvent 

-                || mee instanceof AttributeChangeEvent) {

-            renderingChanged();

-            updateListeners(getOwner(), getOwner());

-        }

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateListeners(java.lang.Object, java.lang.Object)

-     */

-    @Override

-    protected void updateListeners(Object oldOwner, Object newOwner) {

-        Set<Object[]> l = new HashSet<Object[]>();

-        /* Let's register for events from all modelelements

-         * that change the name or body text: 

-         */

-        if (newOwner != null) {

-            /* Register for name changes, added extensionpoints

-             * and abstract makes the text italic.

-             * All Figs need to listen to "remove", too: */

-            l.add(new Object[] {newOwner, 

-                                new String[] {"remove", "name", "isAbstract", 

-                                    "extensionPoint", "stereotype"}});

-            

-            // register for extension points:

-            for (Object ep : Model.getFacade().getExtensionPoints(newOwner)) {

-                l.add(new Object[] {ep, new String[] {"location", "name"}});

-            }

-            

-            for (Object st : Model.getFacade().getStereotypes(newOwner)) {

-                l.add(new Object[] {st, "name"});

-            }

-        }

-        updateElementListeners(l);

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#renderingChanged()

-     */

-    @Override

-    public void renderingChanged() {

-        super.renderingChanged();

-        if (getOwner() != null) {

-            updateExtensionPoint();

-        }

-    }

-

-    /**

-     * Updates the extensionpoints in the fig. <p>

-     * 

-     * A difference in behaviour of this function

-     * compared to the similar 

-     * FigEditableCompartment.populate()

-     * is that the extensionpoints 

-     * are not ordered, while features are.

-     */

-    protected void updateExtensionPoint() {

-        // Give up if we have no owner

-        Object useCase = getOwner();

-        if (useCase == null) {

-            return;

-        }

-

-        // Note our current bounds

-        Rectangle oldBounds = getBounds();

-

-        // Loop through all the extension points. epCount keeps track of the

-        // fig's index as we go through the extension points.

-        Collection eps =

-	    Model.getFacade().getExtensionPoints(useCase);

-        int epCount = 1;

-

-        if ((eps != null) && (eps.size() > 0)) {

-            int xpos = epBigPort.getX();

-            int ypos = epBigPort.getY();

-

-            // Take each EP and its corresponding fig in turn

-            Iterator iter = eps.iterator();

-            List<CompartmentFigText> figs = getEPFigs();

-            List<CompartmentFigText> toBeRemoved = 

-                new ArrayList<CompartmentFigText>(figs);

-

-            while (iter.hasNext()) {

-                CompartmentFigText epFig = null;

-                Object ep = iter.next();

-

-                /* Find the fig for this ep: */

-                for (CompartmentFigText candidate : figs) {

-                    if (candidate.getOwner() == ep) {

-                        epFig = candidate;

-                        break;

-                    }

-                }

-                

-                // If we don't have a fig for this EP, we'll need to add

-                // one. We set the bounds, but they will be reset later.

-                if (epFig == null) {

-                     epFig = new CompartmentFigText(ep, new Rectangle(

-                            xpos,

-			    ypos + (epCount - 1) * ROWHEIGHT,

-			    0,

-			    ROWHEIGHT),

-			    getSettings());

-                    

-                    epFig.setFilled(false);

-                    epFig.setLineWidth(0);

-                    epFig.setTextColor(getTextColor());

-                    epFig.setJustification(FigText.JUSTIFY_LEFT);

-                    epFig.setReturnAction(FigText.END_EDITING);

-

-                    epVec.addFig(epFig);

-                } else {

-                    /* This one is still usable, so let's not remove it: */

-                    toBeRemoved.remove(epFig);

-                }

-

-                // Now put the text in

-                // We must handle the case where the text is null

-                String epText = epFig.getNotationProvider().toString(ep, 

-                        getNotationSettings());

-                if (epText == null) {

-                    epText = "";

-                }

-                epFig.setText(epText);

-

-                epCount++;

-            }

-

-            // Remove any spare figs we have if there are now fewer extension

-            // points than figs

-            for (Fig f : toBeRemoved) {

-                epVec.removeFig(f);    

-            }

-        }

-

-        // Now recalculate all the bounds, using our old bounds.

-        setBounds(oldBounds.x, oldBounds.y, oldBounds.width, oldBounds.height);

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateNameText()

-     */

-    @Override

-    protected void updateNameText() {

-        Object useCase = getOwner();

-        if (useCase == null) {

-            return;

-        }

-        Rectangle oldBounds = getBounds();

-        // Now things to do with the use case itself. Put the use case in

-        // italics if it is abstract, otherwise ordinary font.

-

-        super.updateNameText();

-        setBounds(oldBounds.x, oldBounds.y, oldBounds.width, oldBounds.height);

-    }

-

-    /*

-     * Makes sure that the edges stick to the ellipse fig of the usecase. <p>

-     * 

-     * TODO: This function is called way too many times - I count 6x when

-     * simply clicking on this usecase, and 20x when clicking on the button

-     * on selection at the right hand side of a usecase.

-     * Once this problem is solved, try increasing the "maxPoint" 4-fold,

-     * to make edge attachment when dragging much smoother.

-     *

-     * @see org.tigris.gef.presentation.Fig#getGravityPoints()

-     */

-    @Override

-    public List<Point> getGravityPoints() {

-        final int maxPoints = 30;

-        List<Point> ret = new ArrayList<Point>(maxPoints);

-        int cx = bigPort.getCenter().x;

-        int cy = bigPort.getCenter().y;

-        int radiusx = Math.round(bigPort.getWidth() / 2) + 1;

-        int radiusy = Math.round(bigPort.getHeight() / 2) + 1;

-        Point point = null;

-        for (int i = 0; i < maxPoints; i++) {

-            point =

-                new Point((int) (cx

-				 + (Math.cos(2 * Math.PI / maxPoints * i)

-				    * radiusx)),

-                    (int) (cy

-				 + (Math.sin(2 * Math.PI / maxPoints * i)

-				    * radiusy)));

-            ret.add(point);

-        }

-        return ret;

-    }

-

-    /*

-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateStereotypeText()

-     */

-    @Override

-    protected void updateStereotypeText() {

-        super.updateStereotypeText();

-        if (getOwner() == null) {

-            return;

-        }

-        positionStereotypes();

-        damage();

-    }

-    

-    private void positionStereotypes() {

-        if (((FigGroup) getStereotypeFig()).getFigCount() > 0) {

-            getStereotypeFig().setBounds(

-        	    (getX() + getWidth() / 2

-        		    - getStereotypeFig().getWidth() / 2),

-        	    (getY() + bigPort.getHeight() + STEREOTYPE_PADDING),

-                    getStereotypeFig().getWidth(),

-                    getStereotypeFig().getHeight());

-        } else {

-            getStereotypeFig().setBounds(0, 0, 0, 0);

-        }

-    }

-

-    /**

-     * Get a list of the extension point Figs <em>without</em> the first fig

-     * which is the bigport fig.

-     * 

-     * @return a list of the extension point Figs

-     */

-    private List<CompartmentFigText> getEPFigs() {

-        List<CompartmentFigText> l = 

-            new ArrayList<CompartmentFigText>(epVec.getFigs());

-        l.remove(0);

-        return l;

     }

 }


Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionActor.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionActor.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionClass.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionComponent.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionComponentInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionComponentInstance.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionDataType.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionDataType.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionEnumeration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionEnumeration.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionException.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionException.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionInterface.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionNode.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionNode.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionNodeInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionNodeInstance.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionObject.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionObject.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionSignal.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionSignal.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionStereotype.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionStereotype.java?view=markup&pathrev=17228

Removed: trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionUseCase.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-structure2/src/org/argouml/structure2/diagram/SelectionUseCase.java?view=markup&pathrev=17228


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

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.