Class PumlStyler

java.lang.Object
org.chenile.workflow.puml.PumlStyler

public class PumlStyler extends Object
Allows for styling the State Diagrams in Plant UML. Style of a state or transition is determined by the expression. The actual style is applied on the rule using PUML stereotypes.
  • Field Details

  • Constructor Details

    • PumlStyler

      public PumlStyler()
  • Method Details

    • load

      public void load(InputStream inputStream) throws Exception
      Use a json file to load the properties.
      Parameters:
      inputStream - the input stream from the json file
      Throws:
      Exception - if an error is encountered while processing the file
    • addRule

      public void addRule(PumlStyler.StyleRule rule)
    • addRules

      public void addRules(InputStream inputStream) throws Exception
      Throws:
      Exception
    • clear

      public void clear()
    • getStateStyle

      public String getStateStyle(Map<String,String> md)
      In Plant UML state diagrams, if we have to change the style for a state then we have to write a construct that looks like below:
      state A #White##[bold]Black

      In this example, White is the background color and Black is the border color. Bold is the line style of the border line.

      This method emits the styling string (in the form "#White##[bold]Black" or a blank string if no styling string is specified for the given metadata.
      Parameters:
      md - metadata
      Returns:
      a styling string of the form indicated above.
    • getConnectionStyle

      public String getConnectionStyle(Map<String,String> md)
      In Plant UML state diagrams, if we have to change the style for a connection between two states, we have to write a construct that looks like below:
      A -[thickness=x,#white]-> B
      This method emits the styling string (in the form "[thickness=2,#white]" or a blank string if no styling string is specified for the given metadata.
      Parameters:
      md - metadata
      Returns:
      a styling string of the form indicated above.
    • printEventText

      public String printEventText(String text, Map<String,String> md)
      Renders the text with optional style.
      Parameters:
      text - the event to render
      Returns:
      the decorated eventId. If a metadata called label is present, then the text returned is the value of the label.
    • printStateText

      public String printStateText(String text, Map<String,String> md)
    • findMatchingStyle

      private PumlStyler.StyleRule findMatchingStyle(Map<String,String> md)
    • generateStereoTypes

      public String generateStereoTypes()