Ejemplo n.º 1
0
 public boolean concurrentState() {
   final Group cur = getCurrentGroup();
   if (cur != null && cur.getType() == GroupType.CONCURRENT_STATE) {
     super.endGroup();
   }
   final Group conc1 =
       getOrCreateGroup(
           "CONC" + UniqueSequence.getValue(),
           "",
           null,
           GroupType.CONCURRENT_STATE,
           getCurrentGroup());
   conc1.setDashed(true);
   if (cur != null && cur.getType() == GroupType.STATE) {
     cur.moveEntitiesTo(conc1);
     super.endGroup();
     final Group conc2 =
         getOrCreateGroup(
             "CONC" + UniqueSequence.getValue(),
             "",
             null,
             GroupType.CONCURRENT_STATE,
             getCurrentGroup());
     conc2.setDashed(true);
   }
   return true;
 }
  private CommandExecutionResult executeInternal(
      RegexResult line0, AbstractEntityDiagram diagram, Url url, BlocLines lines) {

    final String pos = line0.get("POSITION", 0);

    final Code code = Code.of(line0.get("ENTITY", 0));
    final String member = line0.get("ENTITY", 1);
    if (code == null) {
      return CommandExecutionResult.error("Nothing to note to");
    }
    final IEntity cl1 = diagram.getOrCreateLeaf(code, null, null);
    final Position position =
        Position.valueOf(StringUtils.goUpperCase(pos))
            .withRankdir(diagram.getSkinParam().getRankdir());

    final Code codeTip = code.addSuffix("$$$" + position.name());
    IEntity tips = diagram.getLeafsget(codeTip);
    if (tips == null) {
      tips = diagram.getOrCreateLeaf(codeTip, LeafType.TIPS, null);
      final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
      final Link link;
      if (position == Position.RIGHT) {
        link = new Link(cl1, (IEntity) tips, type, Display.NULL, 1);
      } else {
        link = new Link((IEntity) tips, cl1, type, Display.NULL, 1);
      }
      diagram.addLink(link);
    }
    tips.putTip(member, lines.toDisplay());

    // final IEntity note = diagram.createLeaf(UniqueSequence.getCode("GMN"), Display.create(s),
    // LeafType.NOTE,
    // null);
    // note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
    // if (url != null) {
    // note.addUrl(url);
    // }
    //
    // final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir(
    // diagram.getSkinParam().getRankdir());
    // final Link link;
    //
    // final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getDashed();
    // if (position == Position.RIGHT) {
    // link = new Link(cl1, note, type, null, 1);
    // link.setHorizontalSolitary(true);
    // } else if (position == Position.LEFT) {
    // link = new Link(note, cl1, type, null, 1);
    // link.setHorizontalSolitary(true);
    // } else if (position == Position.BOTTOM) {
    // link = new Link(cl1, note, type, null, 2);
    // } else if (position == Position.TOP) {
    // link = new Link(note, cl1, type, null, 2);
    // } else {
    // throw new IllegalArgumentException();
    // }
    // diagram.addLink(link);
    return CommandExecutionResult.ok();
  }
Ejemplo n.º 3
0
 @Override
 public void endGroup() {
   final Group cur = getCurrentGroup();
   if (cur != null && cur.getType() == GroupType.CONCURRENT_STATE) {
     super.endGroup();
   }
   super.endGroup();
 }