Package com.structurizr.view
Class ThemeUtils
java.lang.Object
com.structurizr.view.ThemeUtils
Some utility methods for exporting themes to JSON.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinlineTheme(com.structurizr.Workspace workspace, File file) Inlines the element and relationship styles from the specified file, adding the styles into the workspace and overriding any properties already set.static voidloadThemes(com.structurizr.Workspace workspace) Loads the element and relationship styles from the themes defined in the workspace, into the workspace itself.static voidloadThemes(com.structurizr.Workspace workspace, int timeoutInMilliseconds) Loads the element and relationship styles from the themes defined in the workspace, into the workspace itself.static StringtoJson(com.structurizr.Workspace workspace) Serializes the theme (element and relationship styles) in the specified workspace to a JSON string.static voidSerializes the theme (element and relationship styles) in the specified workspace to a file, as a JSON string.
-
Constructor Details
-
ThemeUtils
public ThemeUtils()
-
-
Method Details
-
toJson
Serializes the theme (element and relationship styles) in the specified workspace to a file, as a JSON string.- Parameters:
workspace- a Workspace objectfile- a File representing the JSON definition- Throws:
Exception- if something goes wrong
-
toJson
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
Loads 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. This uses a default timeout value of 10000ms.- Parameters:
workspace- a Workspace object- Throws:
Exception- if something goes wrong
-
loadThemes
public static void loadThemes(com.structurizr.Workspace workspace, int timeoutInMilliseconds) throws Exception Loads 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 objecttimeoutInMilliseconds- the timeout in milliseconds- Throws:
Exception- if something goes wrong
-
inlineTheme
Inlines the element and relationship styles from the specified file, adding the styles into the workspace and overriding any properties already set.- Parameters:
workspace- the Workspace to load the theme intofile- a File object representing a theme (a JSON file)- Throws:
Exception- if something goes wrong
-