Search in sources :

Example 1 with Arrow

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);
        }
    }
}
Also used : Arrow(net.sf.sdedit.drawable.Arrow) Fragment(net.sf.sdedit.drawable.Fragment)

Example 2 with Arrow

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);
}
Also used : LoopArrow(net.sf.sdedit.drawable.LoopArrow) Arrow(net.sf.sdedit.drawable.Arrow) LoopArrow(net.sf.sdedit.drawable.LoopArrow) Direction(net.sf.sdedit.util.Direction)

Example 3 with 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());
}
Also used : LoopArrow(net.sf.sdedit.drawable.LoopArrow) Arrow(net.sf.sdedit.drawable.Arrow) LoopArrow(net.sf.sdedit.drawable.LoopArrow) Direction(net.sf.sdedit.util.Direction)

Example 4 with Arrow

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);
}
Also used : Arrow(net.sf.sdedit.drawable.Arrow)

Example 5 with 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();
                }
            }
        }
    }
}
Also used : Arrow(net.sf.sdedit.drawable.Arrow) Drawable(net.sf.sdedit.drawable.Drawable) PanelPaintDevice(net.sf.sdedit.ui.PanelPaintDevice) Point(java.awt.Point) Point(java.awt.Point) Diagram(net.sf.sdedit.diagram.Diagram)

Aggregations

Arrow (net.sf.sdedit.drawable.Arrow)9 Direction (net.sf.sdedit.util.Direction)3 LoopArrow (net.sf.sdedit.drawable.LoopArrow)2 Point (java.awt.Point)1 Diagram (net.sf.sdedit.diagram.Diagram)1 Lifeline (net.sf.sdedit.diagram.Lifeline)1 ArrowStroke (net.sf.sdedit.drawable.ArrowStroke)1 BroadcastArrow (net.sf.sdedit.drawable.BroadcastArrow)1 Drawable (net.sf.sdedit.drawable.Drawable)1 Fragment (net.sf.sdedit.drawable.Fragment)1 PanelPaintDevice (net.sf.sdedit.ui.PanelPaintDevice)1