Facilitates decorating IModelItems from an IGraph instance.
Remarks
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.GraphDecorator
See Also
Constructors
Initializes a new instance of the GraphDecorator class.
Properties
Gets a bendDecorator instance that can be used to decorate the IBend instances in the graph that this decorator has been created for.
Examples
The bend can be decorated in various ways. setImplementation decorates the bend's lookup to return the same instance for each bend.
graph.decorator.bendDecorator.handleDecorator.setImplementation(
new ConstantHandle()
)
setImplementation with a predicate decorates the bend's lookup only to return the same instance for each bend for which the predicate returns true
.
graph.decorator.bendDecorator.handleDecorator.setImplementation(
(bend) => bend.tag !== null,
new ConstantHandle()
)
setFactory calls the provided factory method to return a new instance of the queried type created for the given bend or for bends for which the predicate returns true
, respectively:
graph.decorator.bendDecorator.handleDecorator.setFactory(
(bend) => new CustomHandle(bend)
)
graph.decorator.bendDecorator.handleDecorator.setFactory(
(bend) => bend.tag !== null,
(bend) => new CustomHandle(bend)
)
setImplementationWrapper calls the provided factory method to return a new instance of the queried type which wraps the default implementation, once for all bends and once only for bends for which the predicate returns true
.
graph.decorator.bendDecorator.handleDecorator.setImplementationWrapper(
(bend, original) => new HandleWrapper(bend, original)
)
graph.decorator.bendDecorator.handleDecorator.setImplementationWrapper(
(bend) => bend.tag !== null,
(bend, original) => new HandleWrapper(bend, original)
)
graph.decorator.bendDecorator.handleDecorator.setImplementationWrapper(
(bend, original) => new HandleWrapper(bend!, original)
)
graph.decorator.bendDecorator.handleDecorator.setImplementationWrapper(
(bend) => bend.tag !== null,
(bend, original) => new HandleWrapper(bend!, original)
)
Finally hideImplementation hides the default implementation by letting the lookup always return null
for all bends and for bends for which the predicate returns true
, respectively
graph.decorator.bendDecorator.handleDecorator.hideImplementation()
graph.decorator.bendDecorator.handleDecorator.hideImplementation(
(bend) => bend.tag !== null
)
Gets an edgeDecorator instance that can be used to decorate the IEdge instances in the graph that this decorator has been created for.
Examples
The edge can be decorated in various ways. setImplementation decorates the edge's lookup to return the same instance for each edge.
graph.decorator.edgeDecorator.selectionDecorator.setImplementation(
new ConstantSelection()
)
setImplementation with a predicate decorates the edge's lookup only to return the same instance for each edge for which the predicate returns true
.
graph.decorator.edgeDecorator.selectionDecorator.setImplementation(
(edge) => edge.tag !== null,
new ConstantSelection()
)
setFactory calls the provided factory method to return a new instance of the queried type created for the given edge or for edges for which the predicate returns true
, respectively:
graph.decorator.edgeDecorator.selectionDecorator.setFactory(
(edge) => new CustomSelection(edge)
)
graph.decorator.edgeDecorator.selectionDecorator.setFactory(
(edge) => edge.tag !== null,
(edge) => new CustomSelection(edge)
)
setImplementationWrapper calls the provided factory method to return a new instance of the queried type which wraps the default implementation, once for all edges and once only for edges for which the predicate returns true
.
graph.decorator.edgeDecorator.selectionDecorator.setImplementationWrapper(
(edge, original) => new SelectionWrapper(edge, original)
)
graph.decorator.edgeDecorator.selectionDecorator.setImplementationWrapper(
(edge) => edge.tag !== null,
(edge, original) => new SelectionWrapper(edge, original)
)
Finally hideImplementation hides the default implementation by letting the lookup always return null
for all edges and for edges for which the predicate returns true
, respectively
graph.decorator.edgeDecorator.selectionDecorator.hideImplementation()
graph.decorator.edgeDecorator.selectionDecorator.hideImplementation(
(edge) => edge.tag !== null
)
Gets a labelDecorator instance that can be used to decorate the ILabel instances in the graph that this decorator has been created for.
Examples
The label can be decorated in various ways. setImplementation decorates the label's lookup to return the same instance for each label.
graph.decorator.labelDecorator.editLabelHelperDecorator.setImplementation(
new ConstantEditLabelHelper()
)
setImplementation with a predicate decorates the label's lookup only to return the same instance for each label for which the predicate returns true
.
graph.decorator.labelDecorator.editLabelHelperDecorator.setImplementation(
(label) => label.tag !== null,
new ConstantEditLabelHelper()
)
setFactory calls the provided factory method to return a new instance of the queried type created for the given label or for labels for which the predicate returns true
, respectively:
graph.decorator.labelDecorator.editLabelHelperDecorator.setFactory(
(label) => new CustomEditLabelHelper(label)
)
graph.decorator.labelDecorator.editLabelHelperDecorator.setFactory(
(label) => label.tag !== null,
(label) => new CustomEditLabelHelper(label)
)
setImplementationWrapper calls the provided factory method to return a new instance of the queried type which wraps the default implementation, once for all labels and once only for labels for which the predicate returns true
.
graph.decorator.labelDecorator.editLabelHelperDecorator.setImplementationWrapper(
(label, original) => new EditLabelHelperWrapper(label, original)
)
graph.decorator.labelDecorator.editLabelHelperDecorator.setImplementationWrapper(
(label) => label.tag !== null,
(label, original) => new EditLabelHelperWrapper(label, original)
)
graph.decorator.labelDecorator.editLabelHelperDecorator.setImplementationWrapper(
(label, original) => new EditLabelHelperWrapper(label!, original)
)
graph.decorator.labelDecorator.editLabelHelperDecorator.setImplementationWrapper(
(label) => label.tag !== null,
(label, original) => new EditLabelHelperWrapper(label!, original)
)
Finally hideImplementation hides the default implementation by letting the lookup always return null
for all labels and for labels for which the predicate returns true
, respectively
graph.decorator.labelDecorator.editLabelHelperDecorator.hideImplementation()
graph.decorator.labelDecorator.editLabelHelperDecorator.hideImplementation(
(label) => label.tag !== null
)
Gets a nodeDecorator instance that can be used to decorate the INode instances in the graph that this decorator has been created for.
Examples
The node can be decorated in various ways. setImplementation decorates the node's lookup to return the same instance for each node.
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.setImplementation(
new ConstantSizeConstraintProvider()
)
setImplementation with a predicate decorates the node's lookup only to return the same instance for each node for which the predicate returns true
.
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.setImplementation(
(node) => node.tag !== null,
new ConstantSizeConstraintProvider()
)
setFactory calls the provided factory method to return a new instance of the queried type created for the given node or for nodes for which the predicate returns true
, respectively:
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.setFactory(
(node) => new CustomSizeConstraintProvider(node)
)
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.setFactory(
(node) => node.tag !== null,
(node) => new CustomSizeConstraintProvider(node)
)
setImplementationWrapper calls the provided factory method to return a new instance of the queried type which wraps the default implementation, once for all nodes and once only for nodes for which the predicate returns true
.
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.setImplementationWrapper(
(node, originalProvider) =>
new SizeConstraintProviderWrapper(node, originalProvider)
)
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.setImplementationWrapper(
(node) => node.tag !== null,
(node, originalProvider) =>
new SizeConstraintProviderWrapper(node, originalProvider)
)
Finally hideImplementation hides the default implementation by letting the lookup always return null
for all nodes and for nodes for which the predicate returns true
, respectively
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.hideImplementation()
graph.decorator.nodeDecorator.sizeConstraintProviderDecorator.hideImplementation(
(node) => node.tag !== null
)
Gets a portDecorator instance that can be used to decorate the IPort instances in the graph that this decorator has been created for.
Examples
The port can be decorated in various ways. setImplementation decorates the port's lookup to return the same instance for each port.
graph.decorator.portDecorator.handleProviderDecorator.setImplementation(
new ConstantHandleProvider()
)
setImplementation with a predicate decorates the port's lookup only to return the same instance for each port for which the predicate returns true
.
graph.decorator.portDecorator.handleProviderDecorator.setImplementation(
(port) => port.tag !== null,
new ConstantHandleProvider()
)
setFactory calls the provided factory method to return a new instance of the queried type created for the given port or for ports for which the predicate returns true
, respectively:
graph.decorator.portDecorator.handleProviderDecorator.setFactory(
(port) => new CustomHandleProvider(port)
)
graph.decorator.portDecorator.handleProviderDecorator.setFactory(
(port) => port.tag !== null,
(port) => new CustomHandleProvider(port)
)
setImplementationWrapper calls the provided factory method to return a new instance of the queried type which wraps the default implementation, once for all ports and once only for ports for which the predicate returns true
.
graph.decorator.portDecorator.handleProviderDecorator.setImplementationWrapper(
(port, original) => new HandleProviderWrapper(port, original)
)
graph.decorator.portDecorator.handleProviderDecorator.setImplementationWrapper(
(port) => port.tag !== null,
(port, original) => new HandleProviderWrapper(port, original)
)
graph.decorator.portDecorator.handleProviderDecorator.setImplementationWrapper(
(port, original) => new HandleProviderWrapper(port!, original)
)
graph.decorator.portDecorator.handleProviderDecorator.setImplementationWrapper(
(port) => port.tag !== null,
(port, original) => new HandleProviderWrapper(port!, original)
)
Finally hideImplementation hides the default implementation by letting the lookup always return null
for all ports and for ports for which the predicate returns true
, respectively
graph.decorator.portDecorator.handleProviderDecorator.hideImplementation()
graph.decorator.portDecorator.handleProviderDecorator.hideImplementation(
(port) => port.tag !== null
)