Facilitates decorating IModelItems from an IGraph instance.
Remarks
Type Details
- yFiles module
- view
See Also
Constructors
Initializes a new instance of the GraphDecorator class.
Properties
Gets a bends instance that can be used to decorate the IBend instances in the graph that this decorator has been created for.
Property Value
Examples
The bend can be decorated in various ways. addConstant decorates the bend's lookup to return the same instance for each bend.
graph.decorator.bends.handle.addConstant(new ConstantHandle())
addConstant 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.bends.handle.addConstant(
(bend) => bend.tag !== null,
new ConstantHandle(),
)
addFactory 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.bends.handle.addFactory((bend) => new CustomHandle(bend))
graph.decorator.bends.handle.addFactory(
(bend) => bend.tag !== null,
(bend) => new CustomHandle(bend),
)
addWrapperFactory 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.bends.handle.addWrapperFactory(
(bend, original) => new HandleWrapper(bend!, original),
)
graph.decorator.bends.handle.addWrapperFactory(
(bend) => bend.tag !== null,
(bend, original) => new HandleWrapper(bend!, original),
)
Finally hide 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.bends.handle.hide()
graph.decorator.bends.handle.hide((bend) => bend.tag !== null)
Gets an edges instance that can be used to decorate the IEdge instances in the graph that this decorator has been created for.
Property Value
Examples
The edge can be decorated in various ways. addConstant decorates the edge's lookup to return the same instance for each edge.
graph.decorator.edges.selectionRenderer.addConstant(
new ConstantSelection(),
)
addConstant 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.edges.selectionRenderer.addConstant(
(edge) => edge.tag !== null,
new ConstantSelection(),
)
addFactory 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.edges.selectionRenderer.addFactory(
(edge) => new CustomSelection(edge),
)
graph.decorator.edges.selectionRenderer.addFactory(
(edge) => edge.tag !== null,
(edge) => new CustomSelection(edge),
)
addWrapperFactory 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.edges.selectionRenderer.addWrapperFactory(
(edge, original) => new SelectionWrapper(edge, original),
)
graph.decorator.edges.selectionRenderer.addWrapperFactory(
(edge) => edge.tag !== null,
(edge, original) => new SelectionWrapper(edge, original),
)
Finally hide 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.edges.selectionRenderer.hide()
graph.decorator.edges.selectionRenderer.hide((edge) => edge.tag !== null)
Gets a labels instance that can be used to decorate the ILabel instances in the graph that this decorator has been created for.
Property Value
Examples
The label can be decorated in various ways. addConstant decorates the label's lookup to return the same instance for each label.
graph.decorator.labels.editLabelHelper.addConstant(
new ConstantEditLabelHelper(),
)
addConstant 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.labels.editLabelHelper.addConstant(
(label) => label.tag !== null,
new ConstantEditLabelHelper(),
)
addFactory 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.labels.editLabelHelper.addFactory(
(label) => new CustomEditLabelHelper(label),
)
graph.decorator.labels.editLabelHelper.addFactory(
(label) => label.tag !== null,
(label) => new CustomEditLabelHelper(label),
)
addWrapperFactory 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.labels.editLabelHelper.addWrapperFactory(
(label, original) => new EditLabelHelperWrapper(label!, original),
)
graph.decorator.labels.editLabelHelper.addWrapperFactory(
(label) => label.tag !== null,
(label, original) => new EditLabelHelperWrapper(label!, original),
)
Finally hide 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.labels.editLabelHelper.hide()
graph.decorator.labels.editLabelHelper.hide((label) => label.tag !== null)
Gets a nodes instance that can be used to decorate the INode instances in the graph that this decorator has been created for.
Property Value
Examples
The node can be decorated in various ways. addConstant decorates the node's lookup to return the same instance for each node.
graph.decorator.nodes.sizeConstraintProvider.addConstant(
new ConstantSizeConstraintProvider(),
)
addConstant 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.nodes.sizeConstraintProvider.addConstant(
(node) => node.tag !== null,
new ConstantSizeConstraintProvider(),
)
addFactory 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.nodes.sizeConstraintProvider.addFactory(
(node) => new CustomSizeConstraintProvider(node),
)
graph.decorator.nodes.sizeConstraintProvider.addFactory(
(node) => node.tag !== null,
(node) => new CustomSizeConstraintProvider(node),
)
addWrapperFactory 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.nodes.sizeConstraintProvider.addWrapperFactory(
(node, originalProvider) =>
new SizeConstraintProviderWrapper(node, originalProvider),
)
graph.decorator.nodes.sizeConstraintProvider.addWrapperFactory(
(node) => node.tag !== null,
(node, originalProvider) =>
new SizeConstraintProviderWrapper(node, originalProvider),
)
Finally hide 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.nodes.sizeConstraintProvider.hide()
graph.decorator.nodes.sizeConstraintProvider.hide(
(node) => node.tag !== null,
)
Gets a ports instance that can be used to decorate the IPort instances in the graph that this decorator has been created for.
Property Value
Examples
The port can be decorated in various ways. addConstant decorates the port's lookup to return the same instance for each port.
graph.decorator.ports.handleProvider.addConstant(
new ConstantHandleProvider(),
)
addConstant 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.ports.handleProvider.addConstant(
(port) => port.tag !== null,
new ConstantHandleProvider(),
)
addFactory 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.ports.handleProvider.addFactory(
(port) => new CustomHandleProvider(port),
)
graph.decorator.ports.handleProvider.addFactory(
(port) => port.tag !== null,
(port) => new CustomHandleProvider(port),
)
addWrapperFactory 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.ports.handleProvider.addWrapperFactory(
(port, original) => new HandleProviderWrapper(port!, original),
)
graph.decorator.ports.handleProvider.addWrapperFactory(
(port) => port.tag !== null,
(port, original) => new HandleProviderWrapper(port!, original),
)
Finally hide 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.ports.handleProvider.hide()
graph.decorator.ports.handleProvider.hide((port) => port.tag !== null)