Beispiel #1
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);
 }
Beispiel #2
0
  public void drawU(UGraphic ug, Skin skin, ISkinParam skinParam) {
    final StringBounder stringBounder = ug.getStringBounder();

    final double atX = ug.getTranslateX();
    final double atY = ug.getTranslateY();

    ug.translate(getStartingX(stringBounder), 0);

    for (int i = 0; i < events.size(); i++) {
      ComponentType type = ComponentType.ALIVE_BOX_CLOSE_OPEN;
      for (final Iterator<SegmentColored> it = getSegmentsCutted(stringBounder, i).iterator();
          it.hasNext(); ) {
        final SegmentColored seg = it.next();
        final ISkinParam skinParam2 =
            new SkinParamBackcolored(skinParam, seg.getSpecificBackColor());
        if (it.hasNext() == false) {
          type =
              type == ComponentType.ALIVE_BOX_CLOSE_OPEN
                  ? ComponentType.ALIVE_BOX_CLOSE_CLOSE
                  : ComponentType.ALIVE_BOX_OPEN_CLOSE;
        }
        final Component comp = skin.createComponent(type, skinParam2, null);
        type = ComponentType.ALIVE_BOX_OPEN_OPEN;
        final int currentLevel = getLevel(seg.getSegment().getPos1());
        seg.drawU(ug, comp, currentLevel);
      }
    }

    ug.setTranslate(atX, atY);
  }
Beispiel #3
0
 private Collection<SegmentColored> getSegmentsCutted(StringBounder stringBounder, int i) {
   final SegmentColored seg = getSegment(i);
   if (seg != null) {
     return seg.cutSegmentIfNeed(participant.getDelays(stringBounder));
   }
   return Collections.emptyList();
 }
Beispiel #4
0
 @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;
 }