Class mxStyleUtils
java.lang.Object
com.mxgraph.util.mxStyleUtils
Contains various style helper methods for use with mxGraph.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddStylename(String style, String stylename) Adds the specified stylename to the given style if it does not already contain the stylename.static StringgetStylename(String style) Returns the stylename in a style of the form stylename[;key=value] or an empty string if the given style does not contain a stylename.static String[]getStylenames(String style) Returns the stylenames in a style of the form stylename[;key=value] or an empty array if the given style does not contain any stylenames.static intindexOfStylename(String style, String stylename) Returns the index of the given stylename in the given style.static StringremoveAllStylenames(String style) Removes all stylenames from the given style and returns the updated style.static StringremoveStylename(String style, String stylename) Removes all occurrences of the specified stylename in the given style and returns the updated style.static voidsetCellStyleFlags(mxIGraphModel model, Object[] cells, String key, int flag, Boolean value) Sets or toggles the flag bit for the given key in the cell's styles.static voidsetCellStyles(mxIGraphModel model, Object[] cells, String key, String value) Assigns the value for the given key in the styles of the given cells, or removes the key from the styles if the value is null.static StringAdds or removes the given key, value pair to the style and returns the new style.static StringsetStyleFlag(String style, String key, int flag, Boolean value) Sets or removes the given key from the specified style and returns the new style.
-
Constructor Details
-
mxStyleUtils
public mxStyleUtils()
-
-
Method Details
-
getStylename
Returns the stylename in a style of the form stylename[;key=value] or an empty string if the given style does not contain a stylename.- Parameters:
style- String of the form stylename[;key=value].- Returns:
- Returns the stylename from the given formatted string.
-
getStylenames
Returns the stylenames in a style of the form stylename[;key=value] or an empty array if the given style does not contain any stylenames.- Parameters:
style- String of the form stylename[;stylename][;key=value].- Returns:
- Returns the stylename from the given formatted string.
-
indexOfStylename
-
addStylename
-
removeStylename
-
removeAllStylenames
-
setCellStyles
Assigns the value for the given key in the styles of the given cells, or removes the key from the styles if the value is null.- Parameters:
model- Model to execute the transaction in.cells- Array of cells to be updated.key- Key of the style to be changed.value- New value for the given key.
-
setStyle
Adds or removes the given key, value pair to the style and returns the new style. If value is null or zero length then the key is removed from the style.- Parameters:
style- String of the formstylename[;key=value].key- Key of the style to be changed.value- New value for the given key.- Returns:
- Returns the new style.
-
setCellStyleFlags
public static void setCellStyleFlags(mxIGraphModel model, Object[] cells, String key, int flag, Boolean value) Sets or toggles the flag bit for the given key in the cell's styles. If value is null then the flag is toggled.mxUtils.setCellStyleFlags(graph.getModel(), cells, mxConstants.STYLE_FONTSTYLE, mxConstants.FONT_BOLD, null);Toggles the bold font style.- Parameters:
model- Model that contains the cells.cells- Array of cells to change the style for.key- Key of the style to be changed.flag- Integer for the bit to be changed.value- Optional boolean value for the flag.
-
setStyleFlag
Sets or removes the given key from the specified style and returns the new style. If value is null then the flag is toggled.- Parameters:
style- String of the form stylename[;key=value].key- Key of the style to be changed.flag- Integer for the bit to be changed.value- Optional boolean value for the given flag.
-