Class ToggleNodeVisibility
- java.lang.Object
-
- de.aristaflow.adept2.core.changeoperations.ToggleNodeVisibility
-
public class ToggleNodeVisibility extends Object
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.
-
-
Constructor Summary
Constructors Constructor Description ToggleNodeVisibility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isInHiddenBlock(Template template, int nodeID)
Returns true if the node is in an invisible block of the template.static boolean
isPossible(ChangeableInstance instance, int nodeID, boolean hidden)
Checks if it is valid to change the visibility of a node in the given instance.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.static boolean
isPossible(Template template, int nodeID, boolean hidden)
Checks if it is valid to change the visibility of a node in the template.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.static void
performOperation(ChangeableInstance instance, int nodeID, boolean hidden)
Sets the visibility state of the node in the given instance.static void
performOperation(ChangeableInstance instance, int nodeID, boolean hidden, UpdateManager updateManager)
Sets the visibility state of the node in the given instance.static void
performOperation(ChangeableTemplate template, int nodeID, boolean hidden)
Sets the visibility state of the node in the given template.static void
performOperation(ChangeableTemplate template, int nodeID, boolean hidden, UpdateManager updateManager)
Sets the visibility state of the node in the given template.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.
-
-
-
Field Detail
-
PROPERTY_VISIBILITY
public static final String PROPERTY_VISIBILITY
- See Also:
- Constant Field Values
-
HIDDEN
public static final String HIDDEN
- See Also:
- Constant Field Values
-
logger
protected static final Logger logger
a Logger
-
-
Method Detail
-
isPossible
public static boolean isPossible(Template template, int nodeID, boolean hidden)
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
public static boolean isPossible(ChangeableInstance instance, int nodeID, boolean hidden)
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
public static void performOperation(ChangeableTemplate template, int nodeID, boolean hidden)
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
public static void performOperation(ChangeableInstance instance, int nodeID, boolean hidden)
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
public static boolean isInHiddenBlock(Template template, int nodeID)
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
-
-