@Override
 protected CommandExecutionResult executeArg(ClassDiagram diagram, List<String> arg) {
   final String s = arg.get(0);
   if ("none".equalsIgnoreCase(s)) {
     diagram.setNamespaceSeparator(null);
   } else {
     diagram.setNamespaceSeparator(s);
   }
   return CommandExecutionResult.ok();
 }
Exemplo n.º 2
0
  public XmiClassDiagramStar(ClassDiagram classDiagram) throws ParserConfigurationException {
    this.classDiagram = classDiagram;
    final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

    final DocumentBuilder builder = factory.newDocumentBuilder();
    this.document = builder.newDocument();
    document.setXmlVersion("1.0");
    document.setXmlStandalone(true);

    final Element xmi = document.createElement("XMI");
    xmi.setAttribute("xmi.version", "1.1");
    xmi.setAttribute("xmlns:UML", "href://org.omg/UML/1.3");
    document.appendChild(xmi);

    final Element header = document.createElement("XMI.header");
    xmi.appendChild(header);

    final Element metamodel = document.createElement("XMI.metamodel");
    metamodel.setAttribute("xmi.name", "UML");
    metamodel.setAttribute("xmi.version", "1.3");
    header.appendChild(metamodel);

    final Element content = document.createElement("XMI.content");
    xmi.appendChild(content);

    // <UML:Model xmi.id="UMLModel.4" name="Design Model"
    // visibility="public" isSpecification="false" isRoot="false"
    // isLeaf="false" isAbstract="false">
    final Element model = document.createElement("UML:Model");
    model.setAttribute("xmi.id", "model1");
    model.setAttribute("name", "PlantUML");
    content.appendChild(model);

    // <UML:Namespace.ownedElement>
    this.ownedElement = document.createElement("UML:Namespace.ownedElement");
    model.appendChild(ownedElement);

    for (final Entity ent : classDiagram.entities().values()) {
      // if (fileFormat == FileFormat.XMI_ARGO && isStandalone(ent) == false) {
      // continue;
      // }
      final Element cla = createEntityNode(ent);
      ownedElement.appendChild(cla);
      done.add(ent);
    }

    // if (fileFormat != FileFormat.XMI_STANDARD) {
    for (final Link link : classDiagram.getLinks()) {
      addLink(link);
    }
    // }
  }
Exemplo n.º 3
0
 @Override
 protected CommandExecutionResult executeArg(ClassDiagram diagram, List<String> arg) {
   final Code code = Code.of(arg.get(0));
   final String stereotype = arg.get(1);
   final IEntity entity = diagram.getOrCreateLeaf(code, null, null);
   entity.setStereotype(
       new Stereotype(
           stereotype,
           diagram.getSkinParam().getCircledCharacterRadius(),
           diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null, false),
           diagram.getSkinParam().getIHtmlColorSet()));
   return CommandExecutionResult.ok();
 }
Exemplo n.º 4
0
 private boolean isStandalone(IEntity ent) {
   for (final Link link : classDiagram.getLinks()) {
     if (link.getEntity1() == ent || link.getEntity2() == ent) {
       return false;
     }
   }
   return true;
 }
 @Override
 protected CommandExecutionResult executeArg(ClassDiagram diagram, RegexResult arg) {
   diagram.setAllowMixing(true);
   return CommandExecutionResult.ok();
 }