private SegmentColored getSegment(StringBounder stringBounder) { final SegmentColored segment = p1.getLiveThicknessAt(stringBounder, getStartingY()); final SegmentColored segment2 = p1.getLiveThicknessAt( stringBounder, getStartingY() + comp.getPreferredHeight(stringBounder)); return segment.merge(segment2); }
@Override public final double getPreferredWidth(StringBounder stringBounder) { final double preferredWidth = comp.getPreferredWidth(stringBounder); if (position == NotePosition.OVER_SEVERAL) { assert p1 != p2; final double diff1 = p2.getParticipantBox().getMaxX(stringBounder) - p1.getParticipantBox().getMinX(); if (diff1 > preferredWidth) { return diff1; } } return preferredWidth; }
Frontier prepareMessage(ConstraintSet constraintSet, InGroupablesStack inGroupablesStack) { final Arrow graphic = createArrow(); final double arrowYStartLevel = graphic.getArrowYStartLevel(getStringBounder()); final double arrowYEndLevel = graphic.getArrowYEndLevel(getStringBounder()); for (LifeEvent lifeEvent : getMessage().getLiveEvents()) { beforeMessage(lifeEvent, arrowYStartLevel); } final double length = graphic.getArrowOnlyWidth(getStringBounder()); incFreeY(graphic.getPreferredHeight(getStringBounder())); double marginActivateAndDeactive = 0; if (getMessage().isActivateAndDeactive()) { marginActivateAndDeactive = 30; incFreeY(marginActivateAndDeactive); } getDrawingSet().addEvent(getMessage(), graphic); final LivingParticipantBox livingParticipantBox = getLivingParticipantBox(); if (messageArrow.getType().isRightBorder()) { constraintSet .getConstraint(livingParticipantBox.getParticipantBox(), constraintSet.getLastborder()) .ensureValue(length); } else { constraintSet .getConstraint(constraintSet.getFirstBorder(), livingParticipantBox.getParticipantBox()) .ensureValue(length); } for (LifeEvent lifeEvent : getMessage().getLiveEvents()) { afterMessage(getStringBounder(), lifeEvent, arrowYEndLevel + marginActivateAndDeactive); } assert graphic instanceof InGroupable; if (graphic instanceof InGroupable) { inGroupablesStack.addElement((InGroupable) graphic); inGroupablesStack.addElement(livingParticipantBox); } return getFreeY(); }
@Override public double getStartingX(StringBounder stringBounder) { final SegmentColored segment = getSegment(stringBounder); final int xStart; if (position == NotePosition.LEFT) { xStart = (int) (segment.getSegment().getPos1() - getPreferredWidth(stringBounder)); } else if (position == NotePosition.RIGHT) { xStart = (int) (segment.getSegment().getPos2()); } else if (position == NotePosition.OVER) { xStart = (int) (p1.getParticipantBox().getCenterX(stringBounder) - getPreferredWidth(stringBounder) / 2); } else if (position == NotePosition.OVER_SEVERAL) { final double centre = (p1.getParticipantBox().getCenterX(stringBounder) + p2.getParticipantBox().getCenterX(stringBounder)) / 2.0; xStart = (int) (centre - getPreferredWidth(stringBounder) / 2.0); } else { throw new IllegalStateException(); } return xStart + delta; }
public double getRightShift(double y) { if (p1 == null) { return 0; } return p1.getLifeLine().getRightShift(y) + 5; }