Author: bobtarling
Date: 2008-06-21 04:47:58-0700
New Revision: 15018
Modified:
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java
Log:
BogdanS Latest patch to 5130
Modified: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java?view=diff&rev=15018&p1=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java&p2=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java&r1=15017&r2=15018
==============================================================================
--- trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java (original)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java 2008-06-21 04:47:58-0700
@@ -74,6 +74,9 @@
// TODO: Do we need this? Is this the same as emptyFig.getHeight()?
private int offset = 0;
+ // the Y position of the lower most FigMessage
+ private int yMax = 0;
+
/**
* Constructor
*/
@@ -167,8 +170,9 @@
FigMessage createMessage = getFirstCreateFigMessage();
if (createMessage != null) {
int y = createMessage.getFirstPoint().y;
- if (y > 0)
- offset = y - headFig.getHeight();
+ if (y > 0) {
+ offset = y - (headFig.getY() + headFig.getHeight() / 2);
+ }
} else {
offset = 0;
}
@@ -202,34 +206,44 @@
* 10 pixels of the lifeline.
*/
public Dimension getMinimumSize() {
+ if (getEdges().size() > 0) {
+ return new Dimension(headFig.getMinimumWidth(), yMax - getY() + 10);
+ } else {
+ return new Dimension(headFig.getMinimumWidth(), emptyFig
+ .getHeight()
+ + headFig.getMinimumHeight() + 10);
+ }
+ }
+
+ @Override
+ public void removeFigEdge(FigEdge edge){
+ super.removeFigEdge(edge);
- List<Fig> figs = this.getEdges();
-
- if (figs.size() > 0) {
- // the Y position of the lower most FigMessage
- int yMax = 0;
-
+ // if the removed edge is the last Y positioned message, yMax should be
+ // updated
+ if (edge.getY() == yMax) {
+ List<Fig> figs = this.getEdges();
for (Fig fig : figs) {
if (fig instanceof FigMessage) {
if (fig.getLastPoint().y > yMax) {
- yMax = fig.getY();
+ yMax = getLastPoint().y;
}
}
}
-
- return new Dimension(headFig.getMinimumWidth(), yMax - getY() + 10);
- } else {
- return new Dimension(headFig.getMinimumWidth(), emptyFig
- .getHeight()
- + headFig.getMinimumHeight() + 10);
}
}
-
@Override
public void addFigEdge(FigEdge edge) {
super.addFigEdge(edge);
+
if (edge instanceof FigMessage) {
+
+ // if a new message has been added, yMax should be updated
+ if (edge.getLastPoint().y > yMax) {
+ yMax = edge.getY();
+ }
+
FigMessage mess = (FigMessage) edge;
if (mess.isSelfMessage()) {
mess.convertToArc();
@@ -267,15 +281,7 @@
* Called when a create message is added or moved.
*/
void relocate() {
- updateHeadOffset();
- emptyFig.setBounds(getX(), getY(), getWidth(), offset);
- headFig.setBounds(getX(), getY() + offset,
- getWidth(), headFig.getHeight());
- lifeLineFig.setBounds(getX(), getY() + headFig.getHeight() + offset,
- getWidth(), getHeight() - headFig.getHeight() - offset);
-
- updateEdges();
- forceRepaintShadow();
+ setBounds(getX(), getY(), getWidth(), getHeight());
}
void createActivations() {
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.