svn commit: r17208 - trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2009-08-01 12:40:20-0700
New Revision: 17208
Added:
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigActor2.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponent2.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponentInstance2.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigMNode2.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigNodeInstance2.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigObject2.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigUseCase2.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionActor.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponent.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponentInstance.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNode.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNodeInstance.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionObject.java
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionUseCase.java
Modified:
trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/UMLClassDiagram2.java
Log:
Introduce remaining Figs available from class diagram
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigActor2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigActor2.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigActor2.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,377 @@
+// $Id: FigActor.java 17117 2009-04-14 06:29:08Z tfmorris $
+// 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.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;
+
+/**
+ * Class to display graphics for an Actor in a diagram.
+ */
+public class FigActor2 extends FigNodeModelElement {
+
+ /**
+ * 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.
+ *
+ * @param owner model element that owns this fig
+ * @param bounds position and size
+ * @param settings rendering settings
+ */
+ 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;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponent2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponent2.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponent2.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,127 @@
+// $Id: FigComponent.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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.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
+ */
+public class FigComponent2 extends AbstractFigComponent {
+
+ /**
+ * Construct a new FigComponent.
+ *
+ * @param owner owning UML element
+ * @param bounds position and size
+ * @param settings render settings
+ */
+ public FigComponent2(Object owner, Rectangle bounds,
+ 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;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponentInstance2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponentInstance2.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigComponentInstance2.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,182 @@
+// $Id: FigComponentInstance.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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.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
+ */
+public class FigComponentInstance2 extends AbstractFigComponent {
+
+ /**
+ * Construct a new FigComponentInstance.
+ *
+ * @param owner owning UML element
+ * @param bounds position and size
+ * @param settings render settings
+ */
+ 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);
+ }
+ }
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigMNode2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigMNode2.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigMNode2.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,74 @@
+// $Id: FigMNode.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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.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;
+
+/**
+ * Class to display graphics for a UML Node in a diagram.
+ *
+ * @author [email protected]
+ */
+public class FigMNode2 extends AbstractFigNode {
+
+ /**
+ * Construct a new FigMNode.
+ *
+ * @param owner owning UML element
+ * @param bounds position and size
+ * @param settings render settings
+ */
+ public FigMNode2(Object owner, Rectangle bounds,
+ 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;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigNodeInstance2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigNodeInstance2.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigNodeInstance2.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,138 @@
+// $Id: FigNodeInstance.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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.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;
+
+/**
+ * Class to display graphics for a UML NodeInstance in a diagram.<p>
+ *
+ * @author [email protected]
+ */
+public class FigNodeInstance2 extends AbstractFigNode {
+
+ /**
+ * Construct a new FigNodeInstance.
+ *
+ * @param owner owning UML element
+ * @param bounds position and size
+ * @param settings render settings
+ */
+ 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");
+ }
+ }
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigObject2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigObject2.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigObject2.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,248 @@
+// $Id: FigObject.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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.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
+ */
+public 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.
+ *
+ * @param owner owning UML element
+ * @param bounds position and size
+ * @param settings render settings
+ */
+ public FigObject2(Object owner, Rectangle bounds, 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);
+ }
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigUseCase2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigUseCase2.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/FigUseCase2.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,1250 @@
+// $Id: FigUseCase.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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.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;
+
+/**
+ * A fig to display use cases on use case diagrams.<p>
+ *
+ * Realised as a solid oval containing the name of the use
+ * case. Optionally may be split into two compartments, with the lower
+ * compartment displaying the extension points for the use case.<p>
+ *
+ * Implements all interfaces through its superclasses.<p>
+ *
+ * There is some coordinate geometry to be done to fit rectangular
+ * text boxes inside an ellipse. The rectangular text box contains the
+ * name and any extension points if shown, and is deemed to be of
+ * height <em>2h</em> and width <em>2w</em>. We allow a margin of
+ * <em>p</em> above the top and below the bottom of the box, so we
+ * know the height of the ellipse, <em>2b</em> = <em>2h</em> +
+ * <em>2p</em>.<p>
+ *
+ * The formula for an ellipse of width <em>2a</em> and height
+ * <em>2b</em>, centred on the origin, is<p>
+ *
+ * <em>x</em>^2/<em>a</em>^2 + <em>y</em>^2/<em>b</em>^2 = 1.<p>
+ *
+ * We know that a corner of the rectangle is at coordinate
+ * (<em>w</em>,<em>h</em>), since the rectangle must also be centered
+ * on the origin to fit within the ellipse. Substituting these values
+ * for <em>x</em> and <em>y</em> in the formula above, we can compute
+ * <em>a</em>, half the width of the ellipse, since we know
+ * <em>b</em>.<p>
+ *
+ * <em>a</em> = <em>wb</em>/sqrt(<em>b</em>^2 - <em>h</em>^2).<p>
+ *
+ * But <em>b</em> was defined in terms of the height of the rectangle
+ * plus agreed padding at the top, so we can write.<p>
+ *
+ * <em>a</em> = (<em>wh</em> + <em>wb</em>)/
+ * sqrt(2<em>hp</em> + <em>p</em>^2)<p>
+ *
+ * Given we now know <em>a</em> and <em>b</em>, we can find the
+ * coordinates of any partition line required between use case name
+ * and extension points.<p>
+ *
+ * Finally we need to transform our coordinates, to recognise that the
+ * origin is at our top left corner, and the Y coordinates are
+ * reversed.<p>
+ */
+public 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;
+
+ /**
+ * 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.
+ *
+ * @param owner owning model element
+ * @param bounds position and size
+ * @param settings rendering settings
+ */
+ 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;
+ }
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionActor.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionActor.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionActor.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,132 @@
+// $Id: SelectionActor.java 15549 2008-08-11 18:59:23Z mvw $
+// Copyright (c) 1996-2008 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.diagram;
+
+import javax.swing.Icon;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ * @author [email protected]
+ */
+class SelectionActor extends SelectionNodeClarifiers2 {
+
+ /**
+ * The icon for an association.
+ */
+ private static Icon associationIcon =
+ ResourceLoaderWrapper.lookupIconResource("Association");
+
+ private static Icon generalizationIcon =
+ ResourceLoaderWrapper.lookupIconResource("Generalization");
+
+ private static Icon icons[] =
+ {generalizationIcon,
+ generalizationIcon,
+ associationIcon,
+ associationIcon,
+ null,
+ };
+
+// TODO: I18N required
+ private static String instructions[] =
+ {"Add a more general Actor",
+ "Add a more specialized Actor",
+ "Add an associated use case",
+ "Add an associated use case",
+ null,
+ "Move object(s)",
+ };
+
+ private static Object edgeType[] =
+ {Model.getMetaTypes().getGeneralization(),
+ Model.getMetaTypes().getGeneralization(),
+ Model.getMetaTypes().getAssociation(),
+ Model.getMetaTypes().getAssociation(),
+ null,
+ };
+
+ /**
+ * Construct a new SelectionActor for the given Fig.
+ *
+ * @param f The given Fig.
+ */
+ public SelectionActor(Fig f) {
+ super(f);
+ }
+
+ @Override
+ protected Icon[] getIcons() {
+ if (Model.getModelManagementHelper().isReadOnly(
+ getContent().getOwner())) {
+ return new Icon[] {null, generalizationIcon, null, null, null };
+ }
+ return icons;
+ }
+
+ @Override
+ protected String getInstructions(int index) {
+ return instructions[index - BASE];
+ }
+
+ @Override
+ protected Object getNewEdgeType(int index) {
+ return edgeType[index - BASE];
+ }
+
+ @Override
+ protected Object getNewNodeType(int index) {
+ if (index == TOP || index == BOTTOM) {
+ return Model.getMetaTypes().getActor();
+ } else {
+ return Model.getMetaTypes().getUseCase();
+ }
+ }
+
+ @Override
+ protected Object getNewNode(int index) {
+ if (index == 0) {
+ index = getButton();
+ }
+ if (index == TOP || index == BOTTOM) {
+ return Model.getUseCasesFactory().createActor();
+ } else {
+ return Model.getUseCasesFactory().createUseCase();
+ }
+ }
+
+ @Override
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == LEFT) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponent.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponent.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,114 @@
+// $Id: SelectionComponent.java 15548 2008-08-11 18:58:02Z mvw $
+// Copyright (c) 1996-2008 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.diagram;
+
+import javax.swing.Icon;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ * The selection buttons for a component.
+ *
+ */
+class SelectionComponent extends SelectionNodeClarifiers2 {
+
+ private static Icon dep =
+ ResourceLoaderWrapper.lookupIconResource("Dependency");
+
+ private static Icon depRight =
+ ResourceLoaderWrapper.lookupIconResource("DependencyRight");
+
+ /*
+ * North, South, West, East, South-West
+ */
+ private static Icon icons[] =
+ {dep,
+ dep,
+ depRight,
+ depRight,
+ null,
+ };
+
+ // TODO: I18N required
+ private static String instructions[] =
+ {"Add a component",
+ "Add a component",
+ "Add a component",
+ "Add a component",
+ null,
+ "Move object(s)",
+ };
+
+
+ /**
+ * Construct a new SelectionComponent for the given Fig.
+ *
+ * @param f The given Fig.
+ */
+ public SelectionComponent(Fig f) {
+ super(f);
+ }
+
+ @Override
+ protected Icon[] getIcons() {
+ if (Model.getModelManagementHelper().isReadOnly(
+ getContent().getOwner())) {
+ return new Icon[] {null, dep, depRight, null, null };
+ }
+ return icons;
+ }
+
+ @Override
+ protected String getInstructions(int index) {
+ return instructions[index - BASE];
+ }
+
+ @Override
+ protected Object getNewEdgeType(int index) {
+ return Model.getMetaTypes().getDependency();
+ }
+
+ @Override
+ protected Object getNewNode(int index) {
+ return Model.getCoreFactory().createComponent();
+ }
+
+ @Override
+ protected Object getNewNodeType(int index) {
+ return Model.getMetaTypes().getComponent();
+ }
+
+ @Override
+ protected boolean isReverseEdge(int index) {
+ if (index == LEFT || index == BOTTOM) {
+ return true;
+ }
+ return false;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponentInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponentInstance.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionComponentInstance.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,109 @@
+// $Id: SelectionComponentInstance.java 15549 2008-08-11 18:59:23Z mvw $
+// Copyright (c) 1996-2008 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.diagram;
+
+import javax.swing.Icon;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ * @author [email protected]
+ */
+class SelectionComponentInstance extends SelectionNodeClarifiers2 {
+
+ private static Icon dep =
+ ResourceLoaderWrapper.lookupIconResource("Dependency");
+
+ private static Icon depRight =
+ ResourceLoaderWrapper.lookupIconResource("DependencyRight");
+
+ private static Icon icons[] =
+ {dep,
+ dep,
+ depRight,
+ depRight,
+ null,
+ };
+
+ // TODO: I18N required
+ private static String instructions[] =
+ {"Add a component-instance",
+ "Add a component-instance",
+ "Add a component-instance",
+ "Add a component-instance",
+ null,
+ "Move object(s)",
+ };
+
+ /**
+ * Construct a new SelectionComponentInstanceInstance for the given Fig.
+ *
+ * @param f The given Fig.
+ */
+ public SelectionComponentInstance(Fig f) { super(f); }
+
+
+ @Override
+ protected Icon[] getIcons() {
+ if (Model.getModelManagementHelper().isReadOnly(
+ getContent().getOwner())) {
+ return new Icon[] {null, dep, depRight, null, null };
+ }
+ return icons;
+ }
+
+ @Override
+ protected String getInstructions(int index) {
+ return instructions[index - BASE];
+ }
+
+ @Override
+ protected Object getNewEdgeType(int index) {
+ return Model.getMetaTypes().getDependency();
+ }
+
+ @Override
+ protected Object getNewNode(int index) {
+ return Model.getCommonBehaviorFactory().createComponentInstance();
+ }
+
+ @Override
+ protected Object getNewNodeType(int index) {
+ return Model.getMetaTypes().getComponentInstance();
+ }
+
+ @Override
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == LEFT) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNode.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNode.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNode.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,103 @@
+// $Id: SelectionNode.java 12670 2007-05-26 21:06:27Z tfmorris $
+// Copyright (c) 1996-2007 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.diagram;
+
+import javax.swing.Icon;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ * @author [email protected]
+ */
+class SelectionNode extends SelectionNodeClarifiers2 {
+
+ private static Icon associationIcon =
+ ResourceLoaderWrapper.lookupIconResource("Association");
+
+ private static Icon icons[] =
+ {associationIcon,
+ associationIcon,
+ associationIcon,
+ associationIcon,
+ null,
+ };
+
+ // TODO: I18N required
+ private static String instructions[] =
+ {"Add a node",
+ "Add a node",
+ "Add a node",
+ "Add a node",
+ null,
+ "Move object(s)",
+ };
+
+ /**
+ * Construct a new SelectionNode for the given Fig.
+ *
+ * @param f The given Fig.
+ */
+ public SelectionNode(Fig f) {
+ super(f);
+ }
+
+ @Override
+ protected Icon[] getIcons() {
+ return icons;
+ }
+
+ @Override
+ protected String getInstructions(int index) {
+ return instructions[index - BASE];
+ }
+
+ @Override
+ protected Object getNewEdgeType(int index) {
+ return Model.getMetaTypes().getAssociation();
+ }
+
+ @Override
+ protected Object getNewNode(int index) {
+ return Model.getCoreFactory().createNode();
+ }
+
+ @Override
+ protected Object getNewNodeType(int index) {
+ return Model.getMetaTypes().getNode();
+ }
+
+ @Override
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == LEFT) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNodeInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNodeInstance.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionNodeInstance.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,106 @@
+// $Id: SelectionNodeInstance.java 15597 2008-08-20 20:27:20Z tfmorris $
+// Copyright (c) 1996-2007 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.diagram;
+
+import javax.swing.Icon;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ * @author [email protected]
+ */
+class SelectionNodeInstance extends SelectionNodeClarifiers2 {
+
+ private static Icon linkIcon =
+ ResourceLoaderWrapper.lookupIconResource("Link");
+
+ private static Icon icons[] =
+ {linkIcon,
+ linkIcon,
+ linkIcon,
+ linkIcon,
+ null,
+ };
+
+ // TODO: I18N required
+ private static String instructions[] =
+ {"Add a component",
+ "Add a component",
+ "Add a component",
+ "Add a component",
+ null,
+ "Move object(s)",
+ };
+
+
+ /**
+ * Construct a new SelectionNodeInstance for the given Fig.
+ *
+ * @param f The given Fig.
+ */
+ public SelectionNodeInstance(Fig f) { super(f); }
+
+ @Override
+ protected Icon[] getIcons() {
+ if (Model.getModelManagementHelper().isReadOnly(
+ getContent().getOwner())) {
+ return new Icon[6];
+ }
+ return icons;
+ }
+
+ @Override
+ protected String getInstructions(int index) {
+ return instructions[index - BASE];
+ }
+
+ @Override
+ protected Object getNewEdgeType(int index) {
+ return Model.getMetaTypes().getLink();
+ }
+
+ @Override
+ protected Object getNewNode(int index) {
+ return Model.getCommonBehaviorFactory().createNodeInstance();
+ }
+
+ @Override
+ protected Object getNewNodeType(int index) {
+ return Model.getMetaTypes().getNodeInstance();
+ }
+
+ @Override
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == LEFT) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionObject.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionObject.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionObject.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,109 @@
+// $Id: SelectionObject.java 15597 2008-08-20 20:27:20Z tfmorris $
+// Copyright (c) 1996-2007 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.diagram;
+
+import javax.swing.Icon;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ * @author [email protected]
+ */
+class SelectionObject extends SelectionNodeClarifiers2 {
+
+ private static Icon linkIcon =
+ ResourceLoaderWrapper.lookupIconResource("Link");
+
+ private static Icon icons[] =
+ {linkIcon,
+ linkIcon,
+ linkIcon,
+ linkIcon,
+ null,
+ };
+
+ // TODO: I18N required
+ private static String instructions[] =
+ {"Add an object",
+ "Add an object",
+ "Add an object",
+ "Add an object",
+ null,
+ "Move object(s)",
+ };
+
+
+
+ /**
+ * Construct a new SelectionObject for the given Fig.
+ *
+ * @param f The given Fig.
+ */
+ public SelectionObject(Fig f) {
+ super(f);
+ }
+
+ @Override
+ protected Icon[] getIcons() {
+ if (Model.getModelManagementHelper().isReadOnly(
+ getContent().getOwner())) {
+ return new Icon[6];
+ }
+ return icons;
+ }
+
+ @Override
+ protected String getInstructions(int index) {
+ return instructions[index - BASE];
+ }
+
+ @Override
+ protected Object getNewEdgeType(int index) {
+ return Model.getMetaTypes().getLink();
+ }
+
+ @Override
+ protected Object getNewNode(int index) {
+ return Model.getCommonBehaviorFactory().createObject();
+ }
+
+ @Override
+ protected Object getNewNodeType(int index) {
+ return Model.getMetaTypes().getObject();
+ }
+
+ @Override
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == LEFT) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
Added: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionUseCase.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionUseCase.java?view=markup&pathrev=17208
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/SelectionUseCase.java 2009-08-01 12:40:20-0700
@@ -0,0 +1,126 @@
+// $Id: SelectionUseCase.java 15549 2008-08-11 18:59:23Z mvw $
+// Copyright (c) 1996-2008 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
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.class2.diagram;
+
+import javax.swing.Icon;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ * @author [email protected]
+ */
+class SelectionUseCase extends SelectionNodeClarifiers2 {
+
+ private static Icon inherit =
+ ResourceLoaderWrapper.lookupIconResource("Generalization");
+ private static Icon assoc =
+ ResourceLoaderWrapper.lookupIconResource("Association");
+
+ private static Icon icons[] =
+ {inherit,
+ inherit,
+ assoc,
+ assoc,
+ null,
+ };
+
+ // TODO: I18N required
+ private static String instructions[] =
+ {"Add a more general use case",
+ "Add a more specialized use case",
+ "Add an associated actor",
+ "Add an associated actor",
+ null,
+ "Move object(s)",
+ };
+
+ private static Object edgeType[] =
+ {Model.getMetaTypes().getGeneralization(),
+ Model.getMetaTypes().getGeneralization(),
+ Model.getMetaTypes().getAssociation(),
+ Model.getMetaTypes().getAssociation(),
+ null,
+ };
+
+
+ /**
+ * Construct a new SelectionUseCase for the given Fig.
+ *
+ * @param f The given Fig.
+ */
+ public SelectionUseCase(Fig f) {
+ super(f);
+ }
+
+ @Override
+ protected Icon[] getIcons() {
+ if (Model.getModelManagementHelper().isReadOnly(
+ getContent().getOwner())) {
+ return new Icon[] {null, inherit, null, null, null };
+ }
+ return icons;
+ }
+
+ @Override
+ protected String getInstructions(int index) {
+ return instructions[index - BASE];
+ }
+
+ @Override
+ protected Object getNewEdgeType(int index) {
+ return edgeType[index - BASE];
+ }
+
+ @Override
+ protected Object getNewNode(int index) {
+ if (index == 0) {
+ index = getButton();
+ }
+ if (index == TOP || index == BOTTOM) {
+ return Model.getUseCasesFactory().createUseCase();
+ }
+ return Model.getUseCasesFactory().createActor();
+ }
+
+ @Override
+ protected Object getNewNodeType(int index) {
+ if (index == TOP || index == BOTTOM) {
+ return Model.getMetaTypes().getUseCase();
+ }
+ return Model.getMetaTypes().getActor();
+ }
+
+ @Override
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM) {
+ return true;
+ }
+ return false;
+ }
+
+}
Modified: trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/UMLClassDiagram2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/UMLClassDiagram2.java?view=diff&pathrev=17208&r1=17207&r2=17208
==============================================================================
--- trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/UMLClassDiagram2.java (original)
+++ trunk/src/argouml-core-diagrams-class2/src/org/argouml/class2/diagram/UMLClassDiagram2.java 2009-08-01 12:40:20-0700
@@ -35,18 +35,11 @@
import org.argouml.i18n.Translator;
import org.argouml.model.Model;
import org.argouml.uml.diagram.DiagramSettings;
-import org.argouml.uml.diagram.deployment.ui.FigComponent;
-import org.argouml.uml.diagram.deployment.ui.FigComponentInstance;
-import org.argouml.uml.diagram.deployment.ui.FigMNode;
-import org.argouml.uml.diagram.deployment.ui.FigNodeInstance;
-import org.argouml.uml.diagram.deployment.ui.FigObject;
import org.argouml.uml.diagram.static_structure.ClassDiagramGraphModel;
import org.argouml.uml.diagram.ui.ModeCreateDependency;
import org.argouml.uml.diagram.ui.ModeCreatePermission;
import org.argouml.uml.diagram.ui.ModeCreateUsage;
import org.argouml.uml.diagram.ui.UMLDiagram;
-import org.argouml.uml.diagram.use_case.ui.FigActor;
-import org.argouml.uml.diagram.use_case.ui.FigUseCase;
import org.argouml.uml.ui.foundation.core.ActionAddAttribute;
import org.argouml.uml.ui.foundation.core.ActionAddOperation;
import org.argouml.util.ToolBarUtility;
@@ -689,19 +682,19 @@
} else if (Model.getFacade().isASignal(droppedObject)) {
figNode = new FigSignal2(droppedObject, bounds, settings);
} else if (Model.getFacade().isAActor(droppedObject)) {
- figNode = new FigActor(droppedObject, bounds, settings);
+ figNode = new FigActor2(droppedObject, bounds, settings);
} else if (Model.getFacade().isAUseCase(droppedObject)) {
- figNode = new FigUseCase(droppedObject, bounds, settings);
+ figNode = new FigUseCase2(droppedObject, bounds, settings);
} else if (Model.getFacade().isAObject(droppedObject)) {
- figNode = new FigObject(droppedObject, bounds, settings);
+ figNode = new FigObject2(droppedObject, bounds, settings);
} else if (Model.getFacade().isANodeInstance(droppedObject)) {
- figNode = new FigNodeInstance(droppedObject, bounds, settings);
+ figNode = new FigNodeInstance2(droppedObject, bounds, settings);
} else if (Model.getFacade().isAComponentInstance(droppedObject)) {
- figNode = new FigComponentInstance(droppedObject, bounds, settings);
+ figNode = new FigComponentInstance2(droppedObject, bounds, settings);
} else if (Model.getFacade().isANode(droppedObject)) {
- figNode = new FigMNode(droppedObject, bounds, settings);
+ figNode = new FigMNode2(droppedObject, bounds, settings);
} else if (Model.getFacade().isAComponent(droppedObject)) {
- figNode = new FigComponent(droppedObject, bounds, settings);
+ figNode = new FigComponent2(droppedObject, bounds, settings);
}
if (figNode != null) {
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2378324
To unsubscribe from this discussion, e-mail: [[email protected]].