Пример #1
0
 public LabeledBox(
     Lifeline lifeline, String _label, int y, boolean anonymous, boolean underlined) {
   setTop(y);
   this.underlined = underlined;
   this.lifeline = lifeline;
   if (lifeline.isExternal()) {
     label = "";
   } else if (!_label.equals("")) {
     label = _label;
   } else if (anonymous) {
     label = ":" + lifeline.getType();
   } else {
     label = lifeline.getName() + ":" + lifeline.getType();
   }
   Configuration conf = lifeline.getDiagram().getConfiguration();
   headWidth = conf.getHeadWidth();
   headHeight = conf.getHeadHeight();
   padding = conf.getHeadLabelPadding();
   textWidth = lifeline.getDiagram().getPaintDevice().getTextWidth(label);
   shouldDrawShadow = conf.getShouldShadowParticipants();
   if (lifeline.isExternal()) {
     setWidth(lifeline.getDiagram().mainLifelineWidth);
   } else {
     setWidth(2 + Math.max(2 * padding + textWidth, headWidth));
   }
   stroke = lifeline.isAlwaysActive() ? thick : solid;
   setHeight(headHeight + 4);
 }