public EntityImageUseCase(ILeaf entity, ISkinParam skinParam) { super(entity, skinParam); final Stereotype stereotype = entity.getStereotype(); final TextBlock tmp = new BodyEnhanced( entity.getDisplay(), FontParam.USECASE, skinParam, HorizontalAlignment.CENTER, stereotype, true, false); if (stereotype == null || stereotype.getLabel() == null) { this.desc = tmp; } else { final TextBlock stereo = TextBlockUtils.create( Display.getWithNewlines(stereotype.getLabel()), new FontConfiguration( SkinParamUtils.getFont(getSkinParam(), FontParam.ACTOR_STEREOTYPE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.ACTOR_STEREOTYPE, null), getSkinParam().getHyperlinkColor()), HorizontalAlignment.CENTER, skinParam); this.desc = TextBlockUtils.mergeTB(stereo, tmp, HorizontalAlignment.CENTER); } this.url = entity.getUrl99(); }
public EntityImageLollipopInterface(ILeaf entity, ISkinParam skinParam) { super(entity, skinParam); final Stereotype stereotype = entity.getStereotype(); this.desc = entity .getDisplay() .create( new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype), HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); }
public EntityImageActivity(ILeaf entity, ISkinParam skinParam, Bibliotekon bibliotekon) { super(entity, skinParam); this.bibliotekon = bibliotekon; final Stereotype stereotype = entity.getStereotype(); this.desc = entity .getDisplay() .create( new FontConfiguration(getSkinParam(), FontParam.ACTIVITY, stereotype), HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); }
@Override protected CommandExecutionResult executeArg(RegexResult arg) { String ent1 = arg.get("ENT1", 1); String ent2 = arg.get("ENT2", 1); if (ent1 == null) { return executeArgSpecial1(arg); } if (ent2 == null) { return executeArgSpecial2(arg); } ent1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent1); ent2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ent2); if (getSystem().isGroup(ent1) && getSystem().isGroup(ent2)) { return executePackageLink(arg); } if (getSystem().isGroup(ent1) || getSystem().isGroup(ent2)) { return CommandExecutionResult.error("Package can be only linked to other package"); } final ILeaf cl1 = (ILeaf) getSystem().getOrCreateClass(ent1); final ILeaf cl2 = (ILeaf) getSystem().getOrCreateClass(ent2); if (arg.get("ENT1", 0) != null) { final LeafType type = LeafType.getLeafType(arg.get("ENT1", 0)); if (type != LeafType.OBJECT) { cl1.muteToType(type); } } if (arg.get("ENT2", 0) != null) { final LeafType type = LeafType.getLeafType(arg.get("ENT2", 0)); if (type != LeafType.OBJECT) { cl2.muteToType(type); } } if (arg.get("ENT1", 2) != null) { cl1.setStereotype( new Stereotype( arg.get("ENT1", 2), getSystem().getSkinParam().getCircledCharacterRadius(), getSystem().getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null))); } if (arg.get("ENT2", 2) != null) { cl2.setStereotype( new Stereotype( arg.get("ENT2", 2), getSystem().getSkinParam().getCircledCharacterRadius(), getSystem().getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null))); } final LinkType linkType = getLinkType(arg); final Direction dir = getDirection(arg); final int queue; if (dir == Direction.LEFT || dir == Direction.RIGHT) { queue = 1; } else { queue = getQueueLength(arg); } // if (dir != null && linkType.isExtendsOrAgregationOrCompositionOrPlus()) { // dir = dir.getInv(); // } String firstLabel = arg.get("FIRST_LABEL", 0); String secondLabel = arg.get("SECOND_LABEL", 0); String labelLink = null; if (arg.get("LABEL_LINK", 0) != null) { labelLink = arg.get("LABEL_LINK", 0); if (firstLabel == null && secondLabel == null) { final Pattern p1 = Pattern.compile("^\"([^\"]+)\"([^\"]+)\"([^\"]+)\"$"); final Matcher m1 = p1.matcher(labelLink); if (m1.matches()) { firstLabel = m1.group(1); labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m1.group(2).trim()).trim(); secondLabel = m1.group(3); } else { final Pattern p2 = Pattern.compile("^\"([^\"]+)\"([^\"]+)$"); final Matcher m2 = p2.matcher(labelLink); if (m2.matches()) { firstLabel = m2.group(1); labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m2.group(2).trim()).trim(); secondLabel = null; } else { final Pattern p3 = Pattern.compile("^([^\"]+)\"([^\"]+)\"$"); final Matcher m3 = p3.matcher(labelLink); if (m3.matches()) { firstLabel = null; labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m3.group(1).trim()) .trim(); secondLabel = m3.group(2); } } } } labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink); } LinkArrow linkArrow = LinkArrow.NONE; if ("<".equals(labelLink)) { linkArrow = LinkArrow.BACKWARD; labelLink = null; } else if (">".equals(labelLink)) { linkArrow = LinkArrow.DIRECT_NORMAL; labelLink = null; } else if (labelLink != null && labelLink.startsWith("< ")) { linkArrow = LinkArrow.BACKWARD; labelLink = labelLink.substring(2).trim(); } else if (labelLink != null && labelLink.startsWith("> ")) { linkArrow = LinkArrow.DIRECT_NORMAL; labelLink = labelLink.substring(2).trim(); } else if (labelLink != null && labelLink.endsWith(" >")) { linkArrow = LinkArrow.DIRECT_NORMAL; labelLink = labelLink.substring(0, labelLink.length() - 2).trim(); } else if (labelLink != null && labelLink.endsWith(" <")) { linkArrow = LinkArrow.BACKWARD; labelLink = labelLink.substring(0, labelLink.length() - 2).trim(); } Link link = new Link( cl1, cl2, linkType, labelLink, queue, firstLabel, secondLabel, getSystem().getLabeldistance(), getSystem().getLabelangle()); if (dir == Direction.LEFT || dir == Direction.UP) { link = link.getInv(); } link.setLinkArrow(linkArrow); addLink(link, arg.get("HEADER", 0)); return CommandExecutionResult.ok(); }
public void addLeaf(ILeaf entity) { leafs.put(entity.getCode(), entity); }
@Override protected CommandExecutionResult executeArg( AbstractClassOrObjectDiagram diagram, RegexResult arg) { Code ent1 = Code.of(arg.get("ENT1", 1)); Code ent2 = Code.of(arg.get("ENT2", 1)); if (ent1 == null) { return executeArgSpecial1(diagram, arg); } if (ent2 == null) { return executeArgSpecial2(diagram, arg); } ent1 = ent1.eventuallyRemoveStartingAndEndingDoubleQuote(); ent2 = ent2.eventuallyRemoveStartingAndEndingDoubleQuote(); if (diagram.isGroup(ent1) && diagram.isGroup(ent2)) { return executePackageLink(diagram, arg); } final IEntity cl1 = diagram.isGroup(ent1) ? diagram.getGroup( Code.of( StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 1)))) : diagram.getOrCreateLeaf(ent1, null, null); final IEntity cl2 = diagram.isGroup(ent2) ? diagram.getGroup( Code.of( StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 1)))) : diagram.getOrCreateLeaf(ent2, null, null); if (arg.get("ENT1", 0) != null) { final LeafType type = LeafType.getLeafType(arg.get("ENT1", 0)); if (type != LeafType.OBJECT) { ((ILeaf) cl1).muteToType(type, null); } } if (arg.get("ENT2", 0) != null) { final LeafType type = LeafType.getLeafType(arg.get("ENT2", 0)); if (type != LeafType.OBJECT) { ((ILeaf) cl2).muteToType(type, null); } } if (arg.get("ENT1", 2) != null) { cl1.setStereotype( new Stereotype( arg.get("ENT1", 2), diagram.getSkinParam().getCircledCharacterRadius(), diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null))); } if (arg.get("ENT2", 2) != null) { cl2.setStereotype( new Stereotype( arg.get("ENT2", 2), diagram.getSkinParam().getCircledCharacterRadius(), diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null))); } final LinkType linkType = getLinkType(arg); final Direction dir = getDirection(arg); final int queue; if (dir == Direction.LEFT || dir == Direction.RIGHT) { queue = 1; } else { queue = getQueueLength(arg); } String firstLabel = arg.get("FIRST_LABEL", 0); String secondLabel = arg.get("SECOND_LABEL", 0); String labelLink = null; if (arg.get("LABEL_LINK", 0) != null) { labelLink = arg.get("LABEL_LINK", 0); if (firstLabel == null && secondLabel == null) { final Pattern p1 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)[%g]([^%g]+)[%g]$"); final Matcher m1 = p1.matcher(labelLink); if (m1.matches()) { firstLabel = m1.group(1); labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m1.group(2).trim()).trim(); secondLabel = m1.group(3); } else { final Pattern p2 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)$"); final Matcher m2 = p2.matcher(labelLink); if (m2.matches()) { firstLabel = m2.group(1); labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m2.group(2).trim()).trim(); secondLabel = null; } else { final Pattern p3 = MyPattern.cmpile("^([^%g]+)[%g]([^%g]+)[%g]$"); final Matcher m3 = p3.matcher(labelLink); if (m3.matches()) { firstLabel = null; labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m3.group(1).trim()) .trim(); secondLabel = m3.group(2); } } } } labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink); } LinkArrow linkArrow = LinkArrow.NONE; if ("<".equals(labelLink)) { linkArrow = LinkArrow.BACKWARD; labelLink = null; } else if (">".equals(labelLink)) { linkArrow = LinkArrow.DIRECT_NORMAL; labelLink = null; } else if (labelLink != null && labelLink.startsWith("< ")) { linkArrow = LinkArrow.BACKWARD; labelLink = labelLink.substring(2).trim(); } else if (labelLink != null && labelLink.startsWith("> ")) { linkArrow = LinkArrow.DIRECT_NORMAL; labelLink = labelLink.substring(2).trim(); } else if (labelLink != null && labelLink.endsWith(" >")) { linkArrow = LinkArrow.DIRECT_NORMAL; labelLink = labelLink.substring(0, labelLink.length() - 2).trim(); } else if (labelLink != null && labelLink.endsWith(" <")) { linkArrow = LinkArrow.BACKWARD; labelLink = labelLink.substring(0, labelLink.length() - 2).trim(); } Link link = new Link( cl1, cl2, linkType, Display.getWithNewlines(labelLink), queue, firstLabel, secondLabel, diagram.getLabeldistance(), diagram.getLabelangle()); if (dir == Direction.LEFT || dir == Direction.UP) { link = link.getInv(); } link.setLinkArrow(linkArrow); applyStyle(arg.getLazzy("ARROW_STYLE", 0), link); addLink(diagram, link, arg.get("HEADER", 0)); return CommandExecutionResult.ok(); }