use of net.sf.sdedit.message.ConstructorMessage in project abstools by abstools.
the class Fragment method computeLayoutInformation.
/**
* @see net.sf.sdedit.drawable.Drawable#computeLayoutInformation()
*/
public void computeLayoutInformation() {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for (SequenceElement element : includedElements) {
int left = element.getLeft();
int right = element.getLeft() + element.getWidth();
if (element instanceof Arrow) {
Message msg = ((Arrow) element).getMessage();
if (msg instanceof ConstructorMessage) {
if (msg.getCallee().getPosition() < msg.getCaller().getPosition()) {
left = msg.getCallee().getHead().getLeft();
} else {
right = msg.getCallee().getHead().getLeft() + msg.getCallee().getHead().getWidth();
}
}
if (((Arrow) element).getStroke() != ArrowStroke.NONE) {
right += element.getRightEndpoint().getWidth();
}
// nothing to add for pseudo arrows (primitive messages)
// with
// ArrowStroke.NONE
}
min = Math.min(min, left);
max = Math.max(max, right);
}
int width = max - min;
int padding = diagram.getConfiguration().getFragmentPadding();
int margin = diagram.getConfiguration().getFragmentMargin();
setLeft(min - padding - level * padding);
setWidth(2 * level * padding + width + 2 * padding + margin);
}
Aggregations