Search in sources :

Example 1 with AnswerToSelf

use of net.sf.sdedit.message.AnswerToSelf in project abstools by abstools.

the class LoopArrow method init.

private void init() {
    Message message = getMessage();
    Configuration conf = message.getConfiguration();
    xExtent = conf.getSelfMessageHorizontalSpace();
    setWidth(diagram.messagePadding + xExtent + diagram.subLifelineWidth + textWidth());
    isAnswer = message instanceof AnswerToSelf;
    from = message.getCaller().getView();
    to = message.getCallee().getView();
    if (getAlign() == Direction.LEFT) {
        // loop arrows on the left must have a left neighbour
        setLeftEndpoint(message.getCallee().getLeftNeighbour().getView());
        if (message.getCaller().getSideLevel() < message.getCallee().getSideLevel()) {
            setRightEndpoint(message.getCaller().getView());
        } else {
            setRightEndpoint(message.getCallee().getView());
        }
    } else {
        int p = message.getCallee().getPosition();
        if (p < message.getDiagram().getNumberOfLifelines() - 1 && message.getDiagram().getLifelineAt(p + 1).isAlive()) {
            setRightEndpoint(message.getCallee().getRightNeighbour().getView());
        } else {
            setRightEndpoint(message.getDiagram().getPaintDevice().getRightBound());
        }
        if (message.getCaller().getSideLevel() < message.getCallee().getSideLevel()) {
            setLeftEndpoint(message.getCaller().getView());
        } else {
            setLeftEndpoint(message.getCallee().getView());
        }
    }
}
Also used : AnswerToSelf(net.sf.sdedit.message.AnswerToSelf) Message(net.sf.sdedit.message.Message) Configuration(net.sf.sdedit.config.Configuration) Point(java.awt.Point)

Aggregations

Point (java.awt.Point)1 Configuration (net.sf.sdedit.config.Configuration)1 AnswerToSelf (net.sf.sdedit.message.AnswerToSelf)1 Message (net.sf.sdedit.message.Message)1