Class ThemeUtils

java.lang.Object
com.structurizr.view.ThemeUtils

public final class ThemeUtils extends Object
Some utility methods for exporting themes to JSON.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    loadThemes(com.structurizr.Workspace workspace)
    Loads (and inlines) the element and relationship styles from the themes defined in the workspace, into the workspace itself.
    static String
    toJson(com.structurizr.Workspace workspace)
    Serializes the theme (element and relationship styles) in the specified workspace to a JSON string.
    static void
    toJson(com.structurizr.Workspace workspace, File file)
    Serializes the theme (element and relationship styles) in the specified workspace to a file, as a JSON string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ThemeUtils

      public ThemeUtils()
  • Method Details

    • toJson

      public static void toJson(com.structurizr.Workspace workspace, File file) throws Exception
      Serializes the theme (element and relationship styles) in the specified workspace to a file, as a JSON string.
      Parameters:
      workspace - a Workspace object
      file - a File representing the JSON definition
      Throws:
      Exception - if something goes wrong
    • toJson

      public static String toJson(com.structurizr.Workspace workspace) throws Exception
      Serializes the theme (element and relationship styles) in the specified workspace to a JSON string.
      Parameters:
      workspace - a Workspace instance
      Returns:
      a JSON string
      Throws:
      Exception - if something goes wrong
    • loadThemes

      public static void loadThemes(com.structurizr.Workspace workspace) throws Exception
      Loads (and inlines) the element and relationship styles from the themes defined in the workspace, into the workspace itself. This implementation simply copies the styles from all themes into the workspace.
      Parameters:
      workspace - a Workspace object
      Throws:
      Exception - if something goes wrong