public class DefaultFolderNodeConverter extends Object implements IFolderNodeConverter
IFolderNodeConverter
interface that is used by the FoldingManager
's
FolderNodeConverter
property.
This class has a couple of properties that can be adjusted to customize the behavior. Also, it contains a number of callback methods for conveniently overriding the implementation in custom sub classes.
Constructor and Description |
---|
DefaultFolderNodeConverter()
Initializes a new instance of this class with default values.
|
DefaultFolderNodeConverter(INodeDefaults collapsedDefaults)
Initializes a new instance of this class using the values provided by the
collapsedDefaults parameter. |
Modifier and Type | Method and Description |
---|---|
protected ILabelModelParameter |
createLabelLayoutParameter(IFoldingView foldingView,
ILabel localLabel,
ILabel masterLabel)
Callback factory method that creates the
ILabelModelParameter for use in
initializeFolderNodeLabels(FolderNodeState, IFoldingView, INode, INode) . |
protected ILabelStyle |
createLabelStyle(IFoldingView foldingView,
ILabel localLabel,
ILabel masterLabel)
Callback factory method that creates the
ILabelStyle for use in
initializeFolderNodeLabels(FolderNodeState, IFoldingView, INode, INode) . |
protected INodeStyle |
createNodeStyle(IFoldingView foldingView,
INode viewNode,
INode masterNode)
Callback factory method that creates the
INodeStyle for use in
initializeFolderNodeStyle(FolderNodeState, IFoldingView, INode, INode) . |
protected IPortLocationModelParameter |
createPortLocationParameter(IFoldingView foldingView,
IPort localPort,
IPort masterPort)
Callback factory method that creates the
IPortLocationModelParameter for use in
initializeFolderNodePorts(FolderNodeState, IFoldingView, INode, INode) . |
protected IPortStyle |
createPortStyle(IFoldingView foldingView,
IPort localPort,
IPort masterPort)
Callback factory method that creates the
IPortStyle for use in
initializeFolderNodePorts(FolderNodeState, IFoldingView, INode, INode) . |
SizeD |
getFolderNodeSize()
|
INodeStyle |
getFolderNodeStyle()
Gets the
INodeStyle to use for the collapsed group nodes. |
ILabelModelParameter |
getLabelLayoutParameter()
Gets the
ILabelModelParameter to use for the first label of the collapsed group node. |
ILabelStyle |
getLabelStyle()
Gets the
ILabelStyle to use for the first label of the collapsed group nodes. |
IPortLocationModelParameter |
getPortLocationParameter()
Gets the
IPortLocationModelParameter to use for the ports at the collapsed group node that represent
the ports of the master group node in the
collapsed state. |
IPortStyle |
getPortStyle()
Gets the
IPortStyle to use for the ports at the collapsed group node that represent
the ports of the master group node in the
collapsed state. |
protected void |
initializeFolderNodeLabels(FolderNodeState state,
IFoldingView foldingView,
INode viewNode,
INode masterNode)
Callback method that initializes the initial labels of the collapsed group node.
|
protected void |
initializeFolderNodeLayout(FolderNodeState state,
IFoldingView foldingView,
INode viewNode,
INode masterNode)
Callback method that initializes the
Layout of the collapsed group node. |
protected void |
initializeFolderNodePorts(FolderNodeState state,
IFoldingView foldingView,
INode viewNode,
INode masterNode)
Called by
initializeFolderNodeState(FolderNodeState, IFoldingView, INode, INode) to initialize the appearance
of the representatives of the master ports at the
collapsed group node. |
void |
initializeFolderNodeState(FolderNodeState state,
IFoldingView foldingView,
INode viewNode,
INode masterNode)
Implements the
IFolderNodeConverter.initializeFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
method and initializes the appearance of the collapsed group node. |
protected void |
initializeFolderNodeStyle(FolderNodeState state,
IFoldingView foldingView,
INode viewNode,
INode masterNode)
Callback method that initializes the
style property of the collapsed group node. |
boolean |
isCopyingFirstLabelEnabled()
Gets a value indicating whether the first label of the
master group node
should be recreated for the collapsed group node instance. |
boolean |
isLabelLayoutParameterCloningEnabled()
Gets a value indicating whether the
LabelLayoutParameter instance should be assigned
as a ICloneable.clone() clone or not. |
boolean |
isLabelStyleCloningEnabled()
Gets a value indicating whether the
LabelStyle instance should be assigned as a
ICloneable.clone() clone or not. |
boolean |
isNodeStyleCloningEnabled()
Gets a value indicating whether the
FolderNodeStyle instance should be assigned as a
ICloneable.clone() clone or not. |
boolean |
isPortLocationParameterCloningEnabled()
Gets a value indicating whether the
PortLocationParameter instance should be
assigned as a clone or not. |
boolean |
isPortStyleCloningEnabled()
Gets a value indicating whether the
PortStyle instance should be assigned as a
ICloneable.clone() clone or not. |
void |
setCopyingFirstLabelEnabled(boolean value)
Sets a value indicating whether the first label of the
master group node
should be recreated for the collapsed group node instance. |
void |
setFolderNodeSize(SizeD value)
|
void |
setFolderNodeStyle(INodeStyle value)
Sets the
INodeStyle to use for the collapsed group nodes. |
void |
setLabelLayoutParameter(ILabelModelParameter value)
Sets the
ILabelModelParameter to use for the first label of the collapsed group node. |
void |
setLabelLayoutParameterCloningEnabled(boolean value)
Sets a value indicating whether the
LabelLayoutParameter instance should be assigned
as a ICloneable.clone() clone or not. |
void |
setLabelStyle(ILabelStyle value)
Sets the
ILabelStyle to use for the first label of the collapsed group nodes. |
void |
setLabelStyleCloningEnabled(boolean value)
Sets a value indicating whether the
LabelStyle instance should be assigned as a
ICloneable.clone() clone or not. |
void |
setNodeStyleCloningEnabled(boolean value)
Sets a value indicating whether the
FolderNodeStyle instance should be assigned as a
ICloneable.clone() clone or not. |
void |
setPortLocationParameter(IPortLocationModelParameter value)
Sets the
IPortLocationModelParameter to use for the ports at the collapsed group node that represent
the ports of the master group node in the
collapsed state. |
void |
setPortLocationParameterCloningEnabled(boolean value)
Sets a value indicating whether the
PortLocationParameter instance should be
assigned as a clone or not. |
void |
setPortStyle(IPortStyle value)
Sets the
IPortStyle to use for the ports at the collapsed group node that represent
the ports of the master group node in the
collapsed state. |
void |
setPortStyleCloningEnabled(boolean value)
Sets a value indicating whether the
PortStyle instance should be assigned as a
ICloneable.clone() clone or not. |
protected void |
synchronizeLabels(FolderNodeState state,
IFoldingView foldingView,
INode viewNode,
INode masterNode)
Called by
updateFolderNodeState(FolderNodeState, IFoldingView, INode, INode) to synchronize the first label if
CopyingFirstLabelEnabled is enabled. |
void |
updateFolderNodeState(FolderNodeState state,
IFoldingView foldingView,
INode viewNode,
INode masterNode)
Implements the
IFolderNodeConverter.updateFolderNodeState(FolderNodeState, IFoldingView, INode, INode) method
and changes the folder node appearance. |
public DefaultFolderNodeConverter()
public DefaultFolderNodeConverter(INodeDefaults collapsedDefaults)
collapsedDefaults
parameter.protected ILabelModelParameter createLabelLayoutParameter(IFoldingView foldingView, ILabel localLabel, ILabel masterLabel)
ILabelModelParameter
for use in
initializeFolderNodeLabels(FolderNodeState, IFoldingView, INode, INode)
.foldingView
- The folding view instance.localLabel
- The local label in the view whose LayoutParameter
should be initialized. May be null
if the label layout parameter is requested for the label creation.masterLabel
- The label that is being represented by the folding label.LabelLayoutParameter
or a ICloneable.clone()
of
it depending on the LabelLayoutParameterCloningEnabled
property. This
method may return null
to indicate that the default label layout parameter should not be changed.protected ILabelStyle createLabelStyle(IFoldingView foldingView, ILabel localLabel, ILabel masterLabel)
ILabelStyle
for use in
initializeFolderNodeLabels(FolderNodeState, IFoldingView, INode, INode)
.foldingView
- The folding view instance.localLabel
- The local label in the view whose Style
should be initialized. May be null
if the
label style is requested for the label creation.masterLabel
- The label that is being represented by the folding label.LabelStyle
or a ICloneable.clone()
of it depending on the LabelStyleCloningEnabled
property. This method may return null
to indicate that the default style should not be changed.protected INodeStyle createNodeStyle(IFoldingView foldingView, INode viewNode, INode masterNode)
INodeStyle
for use in
initializeFolderNodeStyle(FolderNodeState, IFoldingView, INode, INode)
.foldingView
- The folding view instance.viewNode
- The local folder node in the view whose Style
should be initialized.masterNode
- The node that is being represented by the folder node.FolderNodeStyle
or a ICloneable.clone()
of it
depending on the NodeStyleCloningEnabled
property. This method may return null
to indicate that the default style should not be changed.protected IPortLocationModelParameter createPortLocationParameter(IFoldingView foldingView, IPort localPort, IPort masterPort)
IPortLocationModelParameter
for use in
initializeFolderNodePorts(FolderNodeState, IFoldingView, INode, INode)
.foldingView
- The folding view instance.localPort
- The local port in the view whose LocationParameter
should be initialized.masterPort
- The port that is being represented by the folding port.PortLocationParameter
or a ICloneable.clone()
of
it depending on the PortLocationParameterCloningEnabled
property. This
method may return null
to indicate that the default port location parameter should not be changed.protected IPortStyle createPortStyle(IFoldingView foldingView, IPort localPort, IPort masterPort)
IPortStyle
for use in
initializeFolderNodePorts(FolderNodeState, IFoldingView, INode, INode)
.foldingView
- The folding view instance.localPort
- The local port in the view whose Style
should be initialized.masterPort
- The port that is being represented by the folding port.PortStyle
or a ICloneable.clone()
of it depending on the PortStyleCloningEnabled
property. This method may return null
to indicate that the default style should not be changed.public final SizeD getFolderNodeSize()
Layout
of the collapsed group node that will be assigned during
the creation
of the
appearance of the collapsed group node.
Since the Layout
of an expanded
group node normally
encompasses the child nodes, it will have quite a large size. Since the contents of a collapsed group node are not
visible, there is no need for the collapsed group node to encompass the area of its children. Thus the size can be
different and most of the time should be smaller. Setting this property to non-null
values will make the initial
layout of the collapsed node become the given size assigned. The default is null
initializeFolderNodeLayout(FolderNodeState, IFoldingView, INode, INode)
,
setFolderNodeSize(SizeD)
public final INodeStyle getFolderNodeStyle()
INodeStyle
to use for the collapsed
group nodes.
Depending on the NodeStyleCloningEnabled
property this implementation will assign a
ICloneable.clone()
to the property or this instance. The default is null
A value of null
will leave the style property unmodified.
setFolderNodeStyle(INodeStyle)
public final ILabelModelParameter getLabelLayoutParameter()
ILabelModelParameter
to use for the first label of the collapsed group node.
This will only affect the folder node if the CopyingFirstLabelEnabled
property is
set to true
. The default is null
A value of null
will leave the label model parameter property unmodified.
isCopyingFirstLabelEnabled()
,
initializeFolderNodeLabels(FolderNodeState, IFoldingView, INode, INode)
,
setLabelLayoutParameter(ILabelModelParameter)
public final ILabelStyle getLabelStyle()
ILabelStyle
to use for the first label of the collapsed group nodes.
This will only affect the collapsed group node if the CopyingFirstLabelEnabled
property is set to true
. The default is null
A value of null
will leave the style property unmodified.
isCopyingFirstLabelEnabled()
,
setLabelStyle(ILabelStyle)
public final IPortLocationModelParameter getPortLocationParameter()
IPortLocationModelParameter
to use for the ports at the collapsed group node that represent
the ports of the master group node
in the
collapsed state.
Since the appearance of the collapsed group node may totally differ from the appearance of the expanded group node, the
appearance of the ports may also be different. This property can be used to assign a different specific location
parameter to the ports if the node is in collapsed state. A value of null
will leave the location parameter
property unmodified. The default is null
createPortLocationParameter(IFoldingView, IPort, IPort)
,
setPortLocationParameter(IPortLocationModelParameter)
public final IPortStyle getPortStyle()
IPortStyle
to use for the ports at the collapsed group node that represent
the ports of the master group node
in the
collapsed state.
Since the appearance of the collapsed group node may totally differ from the appearance of the expanded group node, the
appearance of the ports may also be different. This property can be used to assign a different specific style to the
ports if the node is in collapsed state. A value of null
will leave the style property unmodified. The default
is null
createPortStyle(IFoldingView, IPort, IPort)
,
setPortStyle(IPortStyle)
protected void initializeFolderNodeLabels(FolderNodeState state, IFoldingView foldingView, INode viewNode, INode masterNode)
This will try to copy the first label of the master node if CopyingFirstLabelEnabled
is enabled. It will call createLabelStyle(IFoldingView, ILabel, ILabel)
and createLabelLayoutParameter(IFoldingView, ILabel, ILabel)
and use the returned style and layout parameter if they are non-null
when adding the label
on the folder node.
state
- The node view state whose labels should be synchronized.foldingView
- The folding view instance that has triggered the initializeFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
call.viewNode
- The collapsed group node in the view that may be changed using the FolderNodeState
.masterNode
- The master node that the folder node represents.getLabelStyle()
,
getLabelLayoutParameter()
protected void initializeFolderNodeLayout(FolderNodeState state, IFoldingView foldingView, INode viewNode, INode masterNode)
Layout
of the collapsed group node.
This implementation will set the bounds
of the nodes in such a way that the size
will be that of the FolderNodeSize
property (if non-null
) but not smaller than the
minimum
size that is reported by a potential INodeSizeConstraintProvider
for INode
s that has been found in the ILookup
of the viewNode
.
state
- The node view state whose layout should be synchronized.foldingView
- The folding view instance.viewNode
- The local collapsed group node to change.masterNode
- The master node that is represented by the local group node.protected void initializeFolderNodePorts(FolderNodeState state, IFoldingView foldingView, INode viewNode, INode masterNode)
initializeFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
to initialize the appearance
of the representatives
of the master ports at the
collapsed group node.
This method will call createPortStyle(IFoldingView, IPort, IPort)
and createPortLocationParameter(IFoldingView, IPort, IPort)
for each port at the group node and assign the returned style and location parameter if they are non-null
.
state
- The node view state whose ports should be synchronized.foldingView
- The folding view instance.viewNode
- The local group node.masterNode
- The master group node.public void initializeFolderNodeState(FolderNodeState state, IFoldingView foldingView, INode viewNode, INode masterNode)
IFolderNodeConverter.initializeFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
method and initializes the appearance of the collapsed group node.
This method calls initializeFolderNodeStyle(FolderNodeState, IFoldingView, INode, INode)
,
initializeFolderNodeLabels(FolderNodeState, IFoldingView, INode, INode)
,
initializeFolderNodeLayout(FolderNodeState, IFoldingView, INode, INode)
, and
initializeFolderNodePorts(FolderNodeState, IFoldingView, INode, INode)
.
initializeFolderNodeState
in interface IFolderNodeConverter
state
- The folder node state to initialize.foldingView
- The graph instance for which the folder node has been created.viewNode
- The folder node instance in the viewmasterNode
- The node that represents the IFoldingView.getMasterItem(com.yworks.yfiles.graph.IModelItem)
of the viewstate to
change.IFolderNodeConverter.updateFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
protected void initializeFolderNodeStyle(FolderNodeState state, IFoldingView foldingView, INode viewNode, INode masterNode)
style property
of the collapsed group node.
This implementation calls createNodeStyle(IFoldingView, INode, INode)
and assigns
the style to the group node if a non-null
value has been returned.
state
- The node view state whose style should be synchronized.foldingView
- The folding view instance that has triggered the initializeFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
call.viewNode
- The local node in the view that may be changed using the FolderNodeState
.masterNode
- The master node that the local folder node represents.FoldingManager.getFolderNodeState(INode)
public final boolean isCopyingFirstLabelEnabled()
master group node
should be recreated for the collapsed group node instance.
This setting can be used to initially create a copy of the first label of the master group node (if any) and
subsequently synchronize the Text
property with the master's node label text. Set it to true
if the first label should be copied; false
otherwise. The default is false
.
getLabelStyle()
,
getLabelLayoutParameter()
,
setCopyingFirstLabelEnabled(boolean)
public final boolean isLabelLayoutParameterCloningEnabled()
LabelLayoutParameter
instance should be assigned
as a ICloneable.clone()
clone or not.true
if the label layout parameter should be cloned; false
otherwise. The default is false
setLabelLayoutParameterCloningEnabled(boolean)
public final boolean isLabelStyleCloningEnabled()
LabelStyle
instance should be assigned as a
ICloneable.clone()
clone or not.true
if the label style should be cloned; false
otherwise. The default is false
setLabelStyleCloningEnabled(boolean)
public final boolean isNodeStyleCloningEnabled()
FolderNodeStyle
instance should be assigned as a
ICloneable.clone()
clone or not.true
if the folder node style should be cloned; false
otherwise. The default is false
setNodeStyleCloningEnabled(boolean)
public final boolean isPortLocationParameterCloningEnabled()
PortLocationParameter
instance should be
assigned as a clone
or not.true
if the port location parameter should be cloned; false
otherwise. The default is false
setPortLocationParameterCloningEnabled(boolean)
public final boolean isPortStyleCloningEnabled()
PortStyle
instance should be assigned as a
ICloneable.clone()
clone or not.true
if the port style should be cloned; false
otherwise. The default is false
setPortStyleCloningEnabled(boolean)
public final void setCopyingFirstLabelEnabled(boolean value)
master group node
should be recreated for the collapsed group node instance.
This setting can be used to initially create a copy of the first label of the master group node (if any) and
subsequently synchronize the Text
property with the master's node label text. Set it to true
if the first label should be copied; false
otherwise. The default is false
.
value
- The CopyingFirstLabelEnabled to set.getLabelStyle()
,
getLabelLayoutParameter()
,
isCopyingFirstLabelEnabled()
public final void setFolderNodeSize(SizeD value)
Layout
of the collapsed group node that will be assigned during
the creation
of the
appearance of the collapsed group node.
Since the Layout
of an expanded
group node normally
encompasses the child nodes, it will have quite a large size. Since the contents of a collapsed group node are not
visible, there is no need for the collapsed group node to encompass the area of its children. Thus the size can be
different and most of the time should be smaller. Setting this property to non-null
values will make the initial
layout of the collapsed node become the given size assigned. The default is null
value
- The FolderNodeSize to set.initializeFolderNodeLayout(FolderNodeState, IFoldingView, INode, INode)
,
getFolderNodeSize()
public final void setFolderNodeStyle(INodeStyle value)
INodeStyle
to use for the collapsed
group nodes.
Depending on the NodeStyleCloningEnabled
property this implementation will assign a
ICloneable.clone()
to the property or this instance. The default is null
A value of null
will leave the style property unmodified.
value
- The FolderNodeStyle to set.getFolderNodeStyle()
public final void setLabelLayoutParameter(ILabelModelParameter value)
ILabelModelParameter
to use for the first label of the collapsed group node.
This will only affect the folder node if the CopyingFirstLabelEnabled
property is
set to true
. The default is null
A value of null
will leave the label model parameter property unmodified.
value
- The LabelLayoutParameter to set.isCopyingFirstLabelEnabled()
,
initializeFolderNodeLabels(FolderNodeState, IFoldingView, INode, INode)
,
getLabelLayoutParameter()
public final void setLabelLayoutParameterCloningEnabled(boolean value)
LabelLayoutParameter
instance should be assigned
as a ICloneable.clone()
clone or not.value
- true
if the label layout parameter should be cloned; false
otherwise. The default is false
isLabelLayoutParameterCloningEnabled()
public final void setLabelStyle(ILabelStyle value)
ILabelStyle
to use for the first label of the collapsed group nodes.
This will only affect the collapsed group node if the CopyingFirstLabelEnabled
property is set to true
. The default is null
A value of null
will leave the style property unmodified.
value
- The LabelStyle to set.isCopyingFirstLabelEnabled()
,
getLabelStyle()
public final void setLabelStyleCloningEnabled(boolean value)
LabelStyle
instance should be assigned as a
ICloneable.clone()
clone or not.value
- true
if the label style should be cloned; false
otherwise. The default is false
isLabelStyleCloningEnabled()
public final void setNodeStyleCloningEnabled(boolean value)
FolderNodeStyle
instance should be assigned as a
ICloneable.clone()
clone or not.value
- true
if the folder node style should be cloned; false
otherwise. The default is false
isNodeStyleCloningEnabled()
public final void setPortLocationParameter(IPortLocationModelParameter value)
IPortLocationModelParameter
to use for the ports at the collapsed group node that represent
the ports of the master group node
in the
collapsed state.
Since the appearance of the collapsed group node may totally differ from the appearance of the expanded group node, the
appearance of the ports may also be different. This property can be used to assign a different specific location
parameter to the ports if the node is in collapsed state. A value of null
will leave the location parameter
property unmodified. The default is null
value
- The PortLocationParameter to set.createPortLocationParameter(IFoldingView, IPort, IPort)
,
getPortLocationParameter()
public final void setPortLocationParameterCloningEnabled(boolean value)
PortLocationParameter
instance should be
assigned as a clone
or not.value
- true
if the port location parameter should be cloned; false
otherwise. The default is false
isPortLocationParameterCloningEnabled()
public final void setPortStyle(IPortStyle value)
IPortStyle
to use for the ports at the collapsed group node that represent
the ports of the master group node
in the
collapsed state.
Since the appearance of the collapsed group node may totally differ from the appearance of the expanded group node, the
appearance of the ports may also be different. This property can be used to assign a different specific style to the
ports if the node is in collapsed state. A value of null
will leave the style property unmodified. The default
is null
value
- The PortStyle to set.createPortStyle(IFoldingView, IPort, IPort)
,
getPortStyle()
public final void setPortStyleCloningEnabled(boolean value)
PortStyle
instance should be assigned as a
ICloneable.clone()
clone or not.value
- true
if the port style should be cloned; false
otherwise. The default is false
isPortStyleCloningEnabled()
protected void synchronizeLabels(FolderNodeState state, IFoldingView foldingView, INode viewNode, INode masterNode)
updateFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
to synchronize the first label if
CopyingFirstLabelEnabled
is enabled.
This will adjust the label text property or remove the label if there is no master label.
state
- The node view state whose labels should be synchronized.foldingView
- The folding view.viewNode
- The local node instance.masterNode
- The master node.public void updateFolderNodeState(FolderNodeState state, IFoldingView foldingView, INode viewNode, INode masterNode)
IFolderNodeConverter.updateFolderNodeState(FolderNodeState, IFoldingView, INode, INode)
method
and changes the folder node appearance.
This method calls synchronizeLabels(FolderNodeState, IFoldingView, INode, INode)
, only.
updateFolderNodeState
in interface IFolderNodeConverter
state
- The folder node state to update.foldingView
- The graph instance for which the folder node can be changed.viewNode
- The folder node instance in the viewmasterNode
- The node that represents the IFoldingView.getMasterItem(com.yworks.yfiles.graph.IModelItem)
of the viewstate to
change.IFolderNodeConverter.initializeFolderNodeState(FolderNodeState, IFoldingView, INode, INode)