Class ToggleNodeVisibility
java.lang.Object
de.aristaflow.adept2.core.changeoperations.ToggleNodeVisibility
Change operation, which allows to hide nodes in the process graph. Edges with
hidden nodes are marked with dots in the middle.
The purpose of the change operation is to hide the fact that the visibility is
simply controlled using UserAttributes at the moment.
Call isPossible first to check if the visibility-toggling is valid,
than call perform operation to execute the change.
TODO Refactor; use a common interface for change operations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisInHiddenBlock(Template template, int nodeID) Returns true if the node is in an invisible block of the template.static booleanisPossible(ChangeableInstance instance, int nodeID, boolean hidden) Checks if it is valid to change the visibility of a node in the given instance.static booleanisPossible(ChangeableInstance instance, int nodeID, boolean hidden, CheckReport checkReport) Checks if it is valid to change the visibility of a node in the given instance.static booleanisPossible(Template template, int nodeID, boolean hidden) Checks if it is valid to change the visibility of a node in the template.static booleanisPossible(Template template, int nodeID, boolean hidden, CheckReport checkReport) /** Checks if it is valid to change the visibility of a node in the template.static voidperformOperation(ChangeableInstance instance, int nodeID, boolean hidden) Sets the visibility state of the node in the given instance.static voidperformOperation(ChangeableInstance instance, int nodeID, boolean hidden, UpdateManager updateManager) Sets the visibility state of the node in the given instance.static voidperformOperation(ChangeableTemplate template, int nodeID, boolean hidden) Sets the visibility state of the node in the given template.static voidperformOperation(ChangeableTemplate template, int nodeID, boolean hidden, UpdateManager updateManager) Sets the visibility state of the node in the given template.protected static voidperformOperation(ChangePrimitives processGraph, Node node, boolean hidden, UpdateManager updateManager) Worker method to do the structural changes for both changeable templates and changeable instances.
-
Field Details
-
PROPERTY_VISIBILITY
- See Also:
-
HIDDEN
- See Also:
-
logger
a Logger
-
-
Constructor Details
-
ToggleNodeVisibility
public ToggleNodeVisibility()
-
-
Method Details
-
isPossible
Checks if it is valid to change the visibility of a node in the template.- Parameters:
template- the template where the method is performed onnodeID- the ID of the nodehidden- the new value for the "hidden" flag- Returns:
- true if toggling the visibility is valid
-
isPossible
public static boolean isPossible(Template template, int nodeID, boolean hidden, CheckReport checkReport) /** Checks if it is valid to change the visibility of a node in the template. If it is not valid the reasons are stored in the checkReport.- Parameters:
template- the template where the method is performed onhidden- the new value for the "hidden" flagnodeID- the ID of the nodecheckReport- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- true if toggling the visibility is valid
-
isPossible
Checks if it is valid to change the visibility of a node in the given instance.- Parameters:
instance- the changeable instance where the method is performed onnodeID- the ID of the nodehidden- the new value for the "hidden" flag- Returns:
- true if toggling the visibility is valid
-
isPossible
public static boolean isPossible(ChangeableInstance instance, int nodeID, boolean hidden, CheckReport checkReport) Checks if it is valid to change the visibility of a node in the given instance. If it is not possible the reasons are stored in the checkReport.- Parameters:
instance- the changeable instance where the method is performed onnodeID- the ID of the nodehidden- the new value for the "hidden" flagcheckReport- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- true if toggling the visibility is valid
-
performOperation
Sets the visibility state of the node in the given template. A value of true forhidden, hides the node.- Parameters:
template- the related templatenodeID- the ID of the nodehidden- true to hide the node, false otherwise.
-
performOperation
public static void performOperation(ChangeableTemplate template, int nodeID, boolean hidden, UpdateManager updateManager) Sets the visibility state of the node in the given template. A value of true forhidden, hides the node.- Parameters:
template- the related templatenodeID- the ID of the nodehidden- true to hide the node, false otherwise.updateManager- The UpdateManager where modifications are logged, may be null
-
performOperation
Sets the visibility state of the node in the given instance. A value of true forhidden, hides the node.- Parameters:
instance- the related changeable instancenodeID- the ID of the nodehidden- true to hide the node, false otherwise.
-
performOperation
public static void performOperation(ChangeableInstance instance, int nodeID, boolean hidden, UpdateManager updateManager) Sets the visibility state of the node in the given instance. A value of true forhidden, hides the node.- Parameters:
instance- the related changeable instancenodeID- the ID of the nodehidden- true to hide the node, false otherwise.updateManager- The UpdateManager where modifications are logged, may be null
-
performOperation
protected static void performOperation(ChangePrimitives processGraph, Node node, boolean hidden, UpdateManager updateManager) Worker method to do the structural changes for both changeable templates and changeable instances.- Parameters:
processGraph- an instance of type ChangeableTemplate or ChangeableInstancenode- the node objecthidden- true to hide the node, false otherwise.updateManager- The UpdateManager where modifications are logged, may be null
-
isInHiddenBlock
Returns true if the node is in an invisible block of the template.- Parameters:
template- the template the check is performed onnodeID- the node to check- Returns:
- true, if the node is in an invisible block
-