Author: bobtarling
Date: 2011-04-23 04:49:56-0700
New Revision: 19269
Modified:
trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/BaseDisplayState.java
trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigBaseNode.java
trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigNotation.java
Log:
Fire message up the Fig structure via calcBounds when the notation text expands
Modified: trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/BaseDisplayState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/BaseDisplayState.java?view=diff&pathrev=19269&r1=19268&r2=19269
==============================================================================
--- trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/BaseDisplayState.java (original)
+++ trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/BaseDisplayState.java 2011-04-23 04:49:56-0700
@@ -17,7 +17,6 @@
import java.awt.Dimension;
import java.awt.Rectangle;
import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import org.argouml.notation2.NotationType;
import org.argouml.uml.diagram.DiagramSettings;
@@ -25,7 +24,7 @@
import org.tigris.gef.presentation.FigGroup;
abstract class BaseDisplayState extends FigGroup
- implements StereotypeDisplayer, NameDisplayer, PropertyChangeListener {
+ implements StereotypeDisplayer, NameDisplayer {
private final DiagramElement bigPort;
private final DiagramElement nameDisplay;
@@ -47,7 +46,6 @@
bigPort = createBigPort(rect, lineColor, fillColor);
addFig((Fig) bigPort);
addFig((Fig) getNameDisplay());
- ((Fig) nameDisplay).addPropertyChangeListener(this);
setBounds(rect);
}
@@ -123,15 +121,15 @@
final Dimension nameDim = getNameDisplay().getMinimumSize();
int width = nameDim.width;
int height = nameDim.height;
- if (getStereotypeDisplay() != null) {
- final Dimension stereoDim = getStereotypeDisplay().getMinimumSize();
- width += Math.max(stereoDim.width, nameDim.width);
- height += (stereoDim.height - 2);
- }
+// if (getStereotypeDisplay() != null) {
+// final Dimension stereoDim = getStereotypeDisplay().getMinimumSize();
+// width += Math.max(stereoDim.width, nameDim.width);
+// height += (stereoDim.height - 2);
+// }
int w = width + getRightMargin() + getLeftMargin();
final int h = height + getTopMargin() + getBottomMargin();
- w = Math.max(w, MIN_WIDTH); // the width needs to be > the height
+ w = Math.max(w, MIN_WIDTH);
return new Dimension(w, h);
}
@@ -220,4 +218,24 @@
oldBounds.height);
setBounds(newBounds);
}
+
+
+ /**
+ * This is called to rearrange the contents of the Fig when a childs
+ * minimum size means it will no longer fit. If this group also has
+ * a parent and it will no longer fit that parent then control is
+ * delegated to that parent.
+ */
+ public void calcBounds() {
+ final Dimension min = getMinimumSize();
+ if (getGroup() != null
+ && (getBounds().height < min.height
+ || getBounds().width < min.width)) {
+ ((FigGroup) getGroup()).calcBounds();
+ } else {
+ int maxw = Math.max(getWidth(), min.width);
+ int maxh = Math.max(getHeight(), min.height);
+ setSize(maxw, maxh);
+ }
+ }
}
Modified: trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigBaseNode.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigBaseNode.java?view=diff&pathrev=19269&r1=19268&r2=19269
==============================================================================
--- trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigBaseNode.java (original)
+++ trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigBaseNode.java 2011-04-23 04:49:56-0700
@@ -17,6 +17,7 @@
import java.awt.Rectangle;
import org.argouml.uml.diagram.DiagramSettings;
+import org.tigris.gef.presentation.FigGroup;
import org.tigris.gef.presentation.FigNode;
/**
@@ -120,4 +121,23 @@
oldBounds.height);
setBounds(newBounds);
}
+
+ /**
+ * This is called to rearrange the contents of the Fig when a childs
+ * minimum size means it will no longer fit. If this group also has
+ * a parent and it will no longer fit that parent then control is
+ * delegated to that parent.
+ */
+ public void calcBounds() {
+ final Dimension min = getMinimumSize();
+ if (getGroup() != null
+ && (getBounds().height < min.height
+ || getBounds().width < min.width)) {
+ ((FigGroup) getGroup()).calcBounds();
+ } else {
+ int maxw = Math.max(getWidth(), min.width);
+ int maxh = Math.max(getHeight(), min.height);
+ setSize(maxw, maxh);
+ }
+ }
}
Modified: trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigNotation.java?view=diff&pathrev=19269&r1=19268&r2=19269
==============================================================================
--- trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigNotation.java (original)
+++ trunk/src/argouml-core-diagrams-activity2/src/org/argouml/activity2/diagram/FigNotation.java 2011-04-23 04:49:56-0700
@@ -23,6 +23,7 @@
import org.argouml.notation2.NotationTextEvent;
import org.argouml.notation2.NotationType;
import org.argouml.uml.diagram.DiagramSettings;
+import org.tigris.gef.presentation.FigGroup;
import org.tigris.gef.presentation.FigText;
/**
@@ -122,10 +123,11 @@
// TODO: setText in GEF should call setBounds instead of directly
// changing x, y, w, h - then we will have an event generated
// correctly in GEF
- firePropChange("bounds", oldBounds, getBounds());
- if (!oldBounds.equals(getBounds())) {
- LOG.info("notation Fig firing bounds changed");
- firePropChange("bounds changed", oldBounds, getBounds());
+ final FigGroup group = (FigGroup) getGroup();
+ if (group != null
+ && ( oldBounds.width < getBounds().width
+ || oldBounds.height < getBounds().height)) {
+ group.calcBounds();
}
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2723331
To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.