public void drawU(UGraphic ug) {
    final StringBounder stringBounder = ug.getStringBounder();
    final Component comp = getComponent(stringBounder);
    final Dimension2D dim = comp.getPreferredDimension(stringBounder);
    final Area area = new Area(dim.getWidth(), dim.getHeight());
    tile.drawU(ug);
    final Real p = getNotePosition(stringBounder);

    comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug);
  }
Пример #2
0
 @Override
 protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
   final StringBounder stringBounder = ug.getStringBounder();
   final double xStart = getStartingX(stringBounder);
   ug = ug.apply(new UTranslate(xStart, getStartingY()));
   final Dimension2D dimensionToUse =
       new Dimension2DDouble(
           getPreferredWidth(stringBounder), comp.getPreferredHeight(stringBounder));
   if (url != null) {
     ug.startUrl(url);
   }
   comp.drawU(ug, new Area(dimensionToUse), context);
   if (url != null) {
     ug.closeAction();
   }
 }
Пример #3
0
 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);
 }
Пример #4
0
 public void drawU(
     UGraphic ug,
     double xTheoricalPosition,
     double yTheoricalPosition,
     double marginWidth,
     double marginHeight) {
   ug = ug.apply(new UTranslate(xTheoricalPosition, yTheoricalPosition));
   comp.drawU(ug, new Area(getDimension(ug.getStringBounder())), new SimpleContext2D(false));
 }
Пример #5
0
 @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;
 }
Пример #6
0
  protected final void afterMessage(StringBounder stringBounder, LifeEvent n, final double pos) {
    final Participant p = n.getParticipant();
    final LifeLine line = drawingSet.getLivingParticipantBox(p).getLifeLine();

    if (n.getType() == LifeEventType.ACTIVATE || n.getType() == LifeEventType.CREATE) {
      return;
    }

    if (n.getType() == LifeEventType.DESTROY) {
      final Component comp =
          drawingSet
              .getSkin()
              .createComponent(ComponentType.DESTROY, drawingSet.getSkinParam(), null);
      final double delta = comp.getPreferredHeight(stringBounder) / 2;
      final LifeDestroy destroy =
          new LifeDestroy(
              pos - delta, drawingSet.getLivingParticipantBox(p).getParticipantBox(), comp);
      drawingSet.addEvent(n, destroy);
    } else if (n.getType() != LifeEventType.DEACTIVATE) {
      throw new IllegalStateException();
    }

    line.addSegmentVariation(LifeSegmentVariation.SMALLER, pos, n.getSpecificBackColor());
  }
 public Real getMaxX(StringBounder stringBounder) {
   final Component comp = getComponent(stringBounder);
   final Dimension2D dim = comp.getPreferredDimension(stringBounder);
   return getNotePosition(stringBounder).addFixed(dim.getWidth());
 }
 public double getPreferredHeight(StringBounder stringBounder) {
   final Component comp = getComponent(stringBounder);
   final Dimension2D dim = comp.getPreferredDimension(stringBounder);
   return Math.max(tile.getPreferredHeight(stringBounder), dim.getHeight());
 }
Пример #9
0
 @Override
 public final double getPreferredHeight(StringBounder stringBounder) {
   return comp.getPreferredHeight(stringBounder);
 }
Пример #10
0
 private Real getNotePosition(StringBounder stringBounder) {
   final Component comp = getComponent(stringBounder);
   final Dimension2D dim = comp.getPreferredDimension(stringBounder);
   return livingSpace.getPosC(stringBounder).addFixed(-dim.getWidth());
 }
Пример #11
0
 public void drawU(UGraphic ug) {
   comp.drawU(ug, new Area(calculateDimension(ug.getStringBounder())), new SimpleContext2D(false));
 }
Пример #12
0
 public Dimension2D calculateDimension(StringBounder stringBounder) {
   final double height = comp.getPreferredHeight(stringBounder);
   final double width = comp.getPreferredWidth(stringBounder);
   return new Dimension2DDouble(width, height);
 }