styles.addElementStyle(Tags.ELEMENT).color("#ffffff").background("#438dd5").fontSize(34).width(650).height(400); styles.addElementStyle("Box").shape(Shape.Box); styles.addElementStyle("RoundedBox").shape(Shape.RoundedBox); styles.addElementStyle("Ellipse").shape(Shape.Ellipse); styles.addElementStyle("Circle").shape(Shape.Circle); styles.addElementStyle("Cylinder").shape(Shape.Cylinder); styles.addElementStyle("Web Browser").shape(Shape.WebBrowser); styles.addElementStyle("Mobile Device Portrait").shape(Shape.MobileDevicePortrait).width(400).height(650); styles.addElementStyle("Mobile Device Landscape").shape(Shape.MobileDeviceLandscape); styles.addElementStyle("Pipe").shape(Shape.Pipe); styles.addElementStyle("Folder").shape(Shape.Folder); styles.addElementStyle("Hexagon").shape(Shape.Hexagon); styles.addElementStyle("Robot").shape(Shape.Robot).width(550); styles.addElementStyle("Person").shape(Shape.Person).width(550);
@Test public void test_findRelationshipStyle_ReturnsTheCorrectStyle_WhenStylesAreDefined() { SoftwareSystem element = model.addSoftwareSystem("Name", "Description"); Relationship relationship = element.uses(element, "Uses"); relationship.addTags("Some Tag"); styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000"); styles.addRelationshipStyle("Some Tag").color("#0000ff"); RelationshipStyle style = styles.findRelationshipStyle(relationship); assertEquals("#0000ff", style.getColor()); }
protected String backgroundOf(View view, Element element) { return view.getViewSet().getConfiguration().getStyles().findElementStyle(element).getBackground(); }
financialRiskSystem.addTags("Risk System"); styles.addElementStyle(Tags.ELEMENT).color("#ffffff").fontSize(34); styles.addElementStyle("Risk System").background("#550000").color("#ffffff"); styles.addElementStyle(Tags.SOFTWARE_SYSTEM).width(650).height(400).background("#801515").shape(Shape.RoundedBox); styles.addElementStyle(Tags.PERSON).width(550).background("#d46a6a").shape(Shape.Person); styles.addRelationshipStyle(Tags.RELATIONSHIP).thickness(4).dashed(false).fontSize(32).width(400); styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false); styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true); styles.addRelationshipStyle(TAG_ALERT).color("#ff0000"); styles.addElementStyle("Future State").opacity(30).border(Border.Dashed); styles.addRelationshipStyle("Future State").opacity(30).dashed(true);
@Test public void test_findElementStyle_ReturnsTheCorrectStyle_WhenStylesAreDefined() { SoftwareSystem element = model.addSoftwareSystem("Name", "Description"); element.addTags("Some Tag"); styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000").color("#ffffff"); styles.addElementStyle("Some Tag").color("#0000ff").shape(Shape.RoundedBox); ElementStyle style = styles.findElementStyle(element); assertEquals("#ff0000", style.getBackground()); assertEquals("#0000ff", style.getColor()); assertEquals(Shape.RoundedBox, style.getShape()); }
public RelationshipStyle findRelationshipStyle(Relationship relationship) { RelationshipStyle style = new RelationshipStyle("").color("#707070"); if (relationship != null) { for (String tag : relationship.getTagsAsSet()) { RelationshipStyle relationshipStyle = findRelationshipStyle(tag); if (relationshipStyle != null) { if (relationshipStyle.getColor() != null && relationshipStyle.getColor().trim().length() > 0) { style.setColor(relationshipStyle.getColor()); } } } } return style; }
public RelationshipStyle addRelationshipStyle(String tag) { RelationshipStyle relationshipStyle = null; if (tag != null) { relationshipStyle = new RelationshipStyle(); relationshipStyle.setTag(tag); add(relationshipStyle); } return relationshipStyle; }
@Test public void test_writeView_IncludesStyling_WhenStylesAreAdded() throws Exception { workspace = new Workspace("", ""); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("My software system", ""); Person user = workspace.getModel().addPerson("A user", ""); user.uses(softwareSystem, "Uses"); workspace.getViews().createSystemContextView(softwareSystem, "key", "").addAllElements(); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000"); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.PERSON).background("#00ff00"); workspace.getViews().getConfiguration().getStyles().addRelationshipStyle(Tags.RELATIONSHIP).color("#0000ff"); plantUMLWriter.write(workspace, stringWriter); assertEquals("@startuml(id=key)" + System.lineSeparator() + "scale max 1999x1999" + System.lineSeparator() + "title My software system - System Context" + System.lineSeparator() + "" + System.lineSeparator() + "skinparam {" + System.lineSeparator() + " shadowing false" + System.lineSeparator() + " arrowColor #707070" + System.lineSeparator() + " actorBorderColor #707070" + System.lineSeparator() + " componentBorderColor #707070" + System.lineSeparator() + " rectangleBorderColor #707070" + System.lineSeparator() + " noteBackgroundColor #ffffff" + System.lineSeparator() + " noteBorderColor #707070" + System.lineSeparator() + "}" + System.lineSeparator() + "rectangle \"A user\" <<Person>> as 2 #00ff00" + System.lineSeparator() + "rectangle \"My software system\" <<Software System>> as 1 #ff0000" + System.lineSeparator() + "2 .[#0000ff].> 1 : Uses" + System.lineSeparator() + "@enduml" + System.lineSeparator(), stringWriter.toString()); }
protected void writeRelationship(View view, Relationship relationship, Writer writer) { try { String stereotypeAndDescription = (hasValue(relationship.getTechnology()) ? "<<" + relationship.getTechnology() + ">>\\n" : "") + (hasValue(relationship.getDescription()) ? relationship.getDescription() : ""); writer.write( format("%s .[%s].> %s %s", idOf(relationship.getSource()), view.getViewSet().getConfiguration().getStyles().findRelationshipStyle(relationship).getColor(), idOf(relationship.getDestination()), hasValue(stereotypeAndDescription) ? ": " + stereotypeAndDescription : "" ) ); writer.write(System.lineSeparator()); } catch (IOException e) { e.printStackTrace(); } }
public ElementStyle addElementStyle(String tag) { ElementStyle elementStyle = null; if (tag != null) { elementStyle = new ElementStyle(); elementStyle.setTag(tag); add(elementStyle); } return elementStyle; }
user.uses(softwareSystem, "Uses"); workspace.getViews().createSystemContextView(softwareSystem, "thekey", "").addAllElements(); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000"); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.PERSON).background("#00ff00"); workspace.getViews().getConfiguration().getStyles().addRelationshipStyle(Tags.RELATIONSHIP).color("#0000ff");
styles.addElementStyle(Tags.PERSON).shape(Shape.Person);
protected String plantumlType(View view, Element element) { Shape shape = view.getViewSet().getConfiguration().getStyles().findElementStyle(element).getShape(); switch(shape) { case Box: return element instanceof Component ? "component" : "rectangle"; case Person: return "actor"; case Cylinder: return "database"; case Folder: return "folder"; case Ellipse: case Circle: return "storage"; default: return "rectangle"; } }
@Test public void test_findRelationshipStyle_ReturnsTheDefaultStyle_WhenPassedNull() { RelationshipStyle style = styles.findRelationshipStyle(null); assertEquals("#707070", style.getColor()); }
componentView.addAllComponents(); views.getConfiguration().getStyles().add(new ElementStyle(Tags.ELEMENT, 600, 450, "#dddddd", "#000000", 30)); views.getConfiguration().getStyles().add(new ElementStyle("Internal", null, null, "#041F37", "#ffffff", null)); views.getConfiguration().getStyles().add(new RelationshipStyle(Tags.RELATIONSHIP, 4, "#dddddd", true, Routing.Direct, 25, 300, null)); views.getConfiguration().getStyles().add(new RelationshipStyle("JDBC", 4, "#ff0000", true, Routing.Direct, 25, 300, null));
styles.addElementStyle("Spring PetClinic").background("#6CB33E").color("#ffffff"); styles.addElementStyle(Tags.PERSON).background("#519823").color("#ffffff").shape(Shape.Person); styles.addElementStyle(Tags.CONTAINER).background("#91D366").color("#ffffff"); styles.addElementStyle("Database").shape(Shape.Cylinder); styles.addElementStyle("Spring MVC Controller").background("#D4F3C0").color("#000000"); styles.addElementStyle("Spring Service").background("#6CB33E").color("#000000"); styles.addElementStyle("Spring Repository").background("#95D46C").color("#000000"); styles.addElementStyle("Failover").opacity(25); styles.addRelationshipStyle("Failover").opacity(25).position(70);
styles.addElementStyle(Tags.PERSON).shape(Shape.Person);
protected String plantumlSequenceType(View view, Element element) { Shape shape = view.getViewSet().getConfiguration().getStyles().findElementStyle(element).getShape(); switch(shape) { case Box: return "participant"; case Person: return "actor"; case Cylinder: return "database"; case Folder: return "collections"; case Ellipse: case Circle: return "entity"; default: return "participant"; } }
format("%s -[%s]> %s : %s. %s", idOf(relationship.getRelationship().getSource()), view.getViewSet().getConfiguration().getStyles().findRelationshipStyle(relationship.getRelationship()).getColor(), idOf(relationship.getRelationship().getDestination()), relationship.getOrder(),
styles.addElementStyle(Tags.ELEMENT).color("#000000"); styles.addElementStyle(Tags.PERSON).background("#ffbf00").shape(Shape.Person); styles.addElementStyle(Tags.CONTAINER).background("#facc2E"); styles.addElementStyle(MESSAGE_BUS_TAG).width(1600).shape(Shape.Pipe); styles.addElementStyle(MICROSERVICE_TAG).shape(Shape.Hexagon); styles.addElementStyle(DATASTORE_TAG).background("#f5da81").shape(Shape.Cylinder); styles.addRelationshipStyle(Tags.RELATIONSHIP).routing(Routing.Orthogonal); styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true); styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);