public class mxStyleUtils
extends java.lang.Object
Constructor and Description |
---|
mxStyleUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
addStylename(java.lang.String style,
java.lang.String stylename)
Adds the specified stylename to the given style if it does not already
contain the stylename.
|
static java.lang.String |
getStylename(java.lang.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 java.lang.String[] |
getStylenames(java.lang.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 int |
indexOfStylename(java.lang.String style,
java.lang.String stylename)
Returns the index of the given stylename in the given style.
|
static java.lang.String |
removeAllStylenames(java.lang.String style)
Removes all stylenames from the given style and returns the updated
style.
|
static java.lang.String |
removeStylename(java.lang.String style,
java.lang.String stylename)
Removes all occurrences of the specified stylename in the given style and
returns the updated style.
|
static void |
setCellStyleFlags(mxIGraphModel model,
java.lang.Object[] cells,
java.lang.String key,
int flag,
java.lang.Boolean value)
Sets or toggles the flag bit for the given key in the cell's styles.
|
static void |
setCellStyles(mxIGraphModel model,
java.lang.Object[] cells,
java.lang.String key,
java.lang.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 java.lang.String |
setStyle(java.lang.String style,
java.lang.String key,
java.lang.String value)
Adds or removes the given key, value pair to the style and returns the
new style.
|
static java.lang.String |
setStyleFlag(java.lang.String style,
java.lang.String key,
int flag,
java.lang.Boolean value)
Sets or removes the given key from the specified style and returns the
new style.
|
public static java.lang.String getStylename(java.lang.String style)
style
- String of the form stylename[;key=value].public static java.lang.String[] getStylenames(java.lang.String style)
style
- String of the form stylename[;stylename][;key=value].public static int indexOfStylename(java.lang.String style, java.lang.String stylename)
public static java.lang.String addStylename(java.lang.String style, java.lang.String stylename)
public static java.lang.String removeStylename(java.lang.String style, java.lang.String stylename)
public static java.lang.String removeAllStylenames(java.lang.String style)
public static void setCellStyles(mxIGraphModel model, java.lang.Object[] cells, java.lang.String key, java.lang.String value)
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.public static java.lang.String setStyle(java.lang.String style, java.lang.String key, java.lang.String value)
style
- String of the form stylename[;key=value]
.key
- Key of the style to be changed.value
- New value for the given key.public static void setCellStyleFlags(mxIGraphModel model, java.lang.Object[] cells, java.lang.String key, int flag, java.lang.Boolean value)
mxUtils.setCellStyleFlags(graph.getModel(),
cells,
mxConstants.STYLE_FONTSTYLE,
mxConstants.FONT_BOLD, null);
Toggles the bold font style.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.public static java.lang.String setStyleFlag(java.lang.String style, java.lang.String key, int flag, java.lang.Boolean value)
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.Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.