mxStylesheetCodec

Codec for mxStylesheets.  This class is created and registered dynamically at load time and used implicitely via mxCodec and the mxCodecRegistry.

Summary
mxStylesheetCodecCodec for mxStylesheets.
Functions
encodeEncodes a stylesheet.
getStringValueReturns the string for encoding the given value.
decodeReads a sequence of the following child nodes and attributes:
Variables
allowEvalStatic global switch that specifies if the use of eval is allowed for evaluating text content.

Functions

encode

codec.encode = function(enc,
obj)

Encodes a stylesheet.  See decode for a description of the format.

getStringValue

codec.getStringValue = function(key,
value)

Returns the string for encoding the given value.

decode

codec.decode = function(dec,
node,
into)

Reads a sequence of the following child nodes and attributes:

Child Nodes

addAdds a new style.

Attributes

asName of the style.
extendName of the style to inherit from.

Each node contains another sequence of add and remove nodes with the following attributes:

asName of the style (see mxConstants).
valueValue for the style.

Instead of the value-attribute, one can put Javascript expressions into the node as follows if mxStylesheetCodec.allowEval is true: <add as=”perimeter”>mxPerimeter.RectanglePerimeter</add>

A remove node will remove the entry with the name given in the as-attribute from the style.

Example

<mxStylesheet as="stylesheet">
  <add as="text">
    <add as="fontSize" value="12"/>
  </add>
  <add as="defaultVertex" extend="text">
    <add as="shape" value="rectangle"/>
  </add>
</mxStylesheet>

Variables

allowEval

mxStylesheetCodec.allowEval

Static global switch that specifies if the use of eval is allowed for evaluating text content.  Default is true.  Set this to false if stylesheets may contain user input.

Defines the appearance of the cells in a graph.
codec.encode = function(enc,
obj)
Encodes a stylesheet.
codec.getStringValue = function(key,
value)
Returns the string for encoding the given value.
codec.decode = function(dec,
node,
into)
Reads a sequence of the following child nodes and attributes:
mxStylesheetCodec.allowEval
Static global switch that specifies if the use of eval is allowed for evaluating text content.
XML codec for JavaScript object graphs.
Singleton class that acts as a global registry for codecs.
Defines various global constants.
Close