Class InertData

All Implemented Interfaces:
Serializable

public class InertData extends ServerSideFeature
Server-side feature defining whether a node is inert, and if it should ignore inheriting inert state from parent. By default, a node is not inert, and it will inherit the inert state from the parent. If the node lacks the inert feature, then it will be just inheriting the state from parent.

The inert status is only updated when the changes are written to the client side because the inert state changes are applied for upcoming requests from the client side. Thus when an RPC call (like any DOM event) causes a node to become inert, the inert state does not block any pending executions until changes are written to the client side.

Implementation notes: The inert state changes are collected like with client side changes (markAsDirty), but nothing is actually sent to the client side. This is just to make sure the changes are applied when needed, when writing changes to client side, instead of applying them immediately. By default the elements only have the inert data feature but as "not initialized" state which means that the node is not inert unless parent is inert, and thus it does not ignore parent inert by default. The inert data feature is initialized when the node will be made explicitly inert or to explicitly ignore parent inert data.

See Also:
  • Constructor Details

    • InertData

      public InertData(StateNode node)
      Creates a new feature for the given node.
      Parameters:
      node - the node which supports the feature
  • Method Details

    • setIgnoreParentInert

      public void setIgnoreParentInert(boolean ignoreParentInert)
      Sets whether or not the node should ignore parent's inert state or not. By default the parent state is inherited false.
      Parameters:
      ignoreParentInert - true for ignoring false for not
    • setInertSelf

      public void setInertSelf(boolean inertSelf)
      Sets whether the node itself is inert. By default the node is not inert, unless parent is inert and inhering parent inert is not blocked.
      Parameters:
      inertSelf - true for setting the node explicitly inert, false for not
    • isInertSelf

      public boolean isInertSelf()
      Gets whether the node itself has been set to be inert (regardless of its ancestors' inert setting).
      Returns:
      whether this node has been set inert
    • isIgnoreParentInert

      public boolean isIgnoreParentInert()
      Gets whether the inertness setting of ancestor nodes should be ignored.
      Returns:
      whether this node should ignore its ancestors' inert setting
    • generateChangesFromEmpty

      public void generateChangesFromEmpty()
      Description copied from class: NodeFeature
      Generates all changes that would be needed to take this node from its initial empty state to its current state.
      Overrides:
      generateChangesFromEmpty in class ServerSideFeature
    • collectChanges

      public void collectChanges(Consumer<NodeChange> collector)
      Description copied from class: NodeFeature
      Collects all changes that are recorded for this feature.
      Overrides:
      collectChanges in class ServerSideFeature
      Parameters:
      collector - a consumer accepting node changes
    • isInert

      public boolean isInert()
      Returns whether this node is explicitly inert and if not, then checks parents for the same. The returned value has been updated when the most recent changes have been written to the client side.
      Returns:
      true for inert, false for not