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.
  • Field Details

  • Constructor Details

    • ToggleNodeVisibility

      public ToggleNodeVisibility()
  • Method Details

    • 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 on
      nodeID - the ID of the node
      hidden - 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 on
      hidden - the new value for the "hidden" flag
      nodeID - the ID of the node
      checkReport - 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 on
      nodeID - the ID of the node
      hidden - 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 on
      nodeID - the ID of the node
      hidden - the new value for the "hidden" flag
      checkReport - 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 for hidden, hides the node.
      Parameters:
      template - the related template
      nodeID - the ID of the node
      hidden - 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 for hidden, hides the node.
      Parameters:
      template - the related template
      nodeID - the ID of the node
      hidden - 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 for hidden, hides the node.
      Parameters:
      instance - the related changeable instance
      nodeID - the ID of the node
      hidden - 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 for hidden, hides the node.
      Parameters:
      instance - the related changeable instance
      nodeID - the ID of the node
      hidden - 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 ChangeableInstance
      node - the node object
      hidden - 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 on
      nodeID - the node to check
      Returns:
      true, if the node is in an invisible block