use of net.sf.sdedit.drawable.Arrow in project abstools by abstools.
the class FragmentManager method finishFragmentsNotIncluding.
/**
* Sets the closing fragments that do not include the message to which the
* given answer is the answer into finished state.
*
* @param answer
* an answer
*/
public void finishFragmentsNotIncluding(Answer answer) {
ListIterator<Fragment> lic = closingFragments.listIterator();
Arrow arrow = answer.getForwardMessage().getArrow();
while (lic.hasNext()) {
Fragment comment = lic.next();
if (!comment.containsElement(arrow)) {
lic.remove();
finishFragment(comment);
}
}
}
use of net.sf.sdedit.drawable.Arrow in project abstools by abstools.
the class MessageToSelf method updateView.
@Override
public void updateView() {
getDiagram().getPaintDevice().announce(getConfiguration().getSpaceBeforeActivation() + Arrow.getInnerHeight(this) + diagram.arrowSize / 2);
extendLifelines(getConfiguration().getSpaceBeforeSelfMessage());
Direction align = getCallee().getDirection();
if (align == Direction.CENTER) {
// This is true for instantly returning self-messages directed onto
// the root lifeline
align = Direction.RIGHT;
}
Arrow arrow = new LoopArrow(this, ArrowStroke.SOLID, align, v());
setArrow(arrow);
extendLifelines(arrow.getInnerHeight());
getCallee().setActive(true);
getDiagram().getPaintDevice().addSequenceElement(arrow);
}
use of net.sf.sdedit.drawable.Arrow in project abstools by abstools.
the class AnswerToSelf method updateView.
public void updateView() {
getDiagram().getPaintDevice().announce(getConfiguration().getSpaceBeforeAnswerToSelf() + Arrow.getInnerHeight(this) + diagram.arrowSize / 2);
getDiagram().getFragmentManager().finishFragmentsNotIncluding(this);
extendLifelines(getConfiguration().getSpaceBeforeAnswerToSelf());
Direction align = getCaller().getDirection();
Arrow arrow = new LoopArrow(this, ArrowStroke.DASHED, align, v());
arrow.setVisible(getText().length() > 0 || diagram.returnArrowVisible);
setArrow(arrow);
getDiagram().getPaintDevice().addSequenceElement(arrow);
terminate();
extendLifelines(arrow.getInnerHeight());
}
use of net.sf.sdedit.drawable.Arrow in project abstools by abstools.
the class ForwardMessage method updateView.
public void updateView() {
if (!(getCallee().isAlwaysActive())) {
extendLifelines(getConfiguration().getSpaceBeforeActivation());
}
int ih = Arrow.getInnerHeight(this);
getDiagram().getPaintDevice().announce(ih + diagram.arrowSize / 2);
extendLifelines(ih);
if (!getCallee().isAlwaysActive() && isActivating()) {
getCallee().setActive(true);
}
Arrow arrow;
if (getCaller().getPosition() < getCallee().getPosition()) {
arrow = new Arrow(this, ArrowStroke.SOLID, Direction.RIGHT, v() - ih);
} else {
arrow = new Arrow(this, ArrowStroke.SOLID, Direction.LEFT, v() - ih);
}
setArrow(arrow);
getDiagram().getPaintDevice().addSequenceElement(arrow);
}
use of net.sf.sdedit.drawable.Arrow in project abstools by abstools.
the class Tab method scrollToCurrentDrawable.
private void scrollToCurrentDrawable() {
int begin = textArea.getCurrentLineBegin();
Diagram diagram = getDiagram();
if (diagram != null) {
PanelPaintDevice ppd = (PanelPaintDevice) diagram.getPaintDevice();
Drawable drawable = diagram.getDrawableForState(begin);
if (drawable instanceof Arrow) {
Arrow arrow = (Arrow) drawable;
Point textPosition = arrow.getTextPosition();
int x = textPosition != null ? textPosition.x : arrow.getLeft();
float xratio = 1F * x / ppd.getWidth();
int y = drawable.getTop();
float yratio = 1F * y / ppd.getHeight();
zoomPane.scrollToPosition(xratio, yratio);
} else {
if (drawable != null) {
int x = drawable.getLeft();
float xratio = 1F * x / ppd.getWidth();
int y = drawable.getTop();
float yratio = 1F * y / ppd.getHeight();
zoomPane.scrollToPosition(xratio, yratio);
} else {
int caret = textArea.getCaretPosition();
if (textArea.getText().substring(caret).trim().length() == 0) {
zoomPane.scrollToBottom();
}
}
}
}
}
Aggregations