Interface View<S>

Type Parameters:
S - the base (model-level) object for which this is a View. For example, CyNode or CyEdge. In the future versions, Attributes can be this parameter.
All Superinterfaces:
CyIdentifiable
All Known Subinterfaces:
CyColumnView, CyNetworkView, CyNetworkViewSnapshot, CyTableView, NullCyNetworkView

public interface View<S> extends CyIdentifiable
The base interface that defines methods used to set visual properties for nodes, edges, and networks. Think of it as a row in the view-model table.

Module: viewmodel-api

To use this in your app, include the following dependency in your POM:

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>viewmodel-api</artifactId>
</dependency>

Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
  • Method Details

    • getVisualProperty

      <T> T getVisualProperty(VisualProperty<T> vp)
      Get the actual value for the given visual property.
      Type Parameters:
      T - Object type of the Visual Property (Color, Double, ...)
      Parameters:
      vp - the VisualProperty.
      Returns:
      Value associated with this View and Visual Property pair.
    • isSet

      boolean isSet(VisualProperty<?> vp)
      Indicates whether or not the passed visual property is set with a non-null value.
      Parameters:
      vp - the VisualProperty.
      Returns:
      true if the view has a non-null value for the VisualProperty.
    • isValueLocked

      boolean isValueLocked(VisualProperty<?> vp)
      Returns true if the value of the given VisualProperty or one of its ancestors is locked.
      Parameters:
      vp - the VisualProperty
      Returns:
      true if value of the given VisualProperty value or one of its ancestors is locked.
    • isDirectlyLocked

      boolean isDirectlyLocked(VisualProperty<?> vp)
      Returns true if the given VisualProperty's value has been locked. directly.
      Parameters:
      vp - the VisualProperty
      Returns:
      true if the given VisualProperty's value has been locked.
    • setVisualProperty

      <T, V extends T> void setVisualProperty(VisualProperty<? extends T> vp, V value)
      Assign a value to the given Visual Property of this view.
      Type Parameters:
      T - Data type of the visual property. This can be subclasses of type T.
      V - Value of the visual property. This can be subclasses of T.
      Parameters:
      vp - the VisualProperty (Node Color, Edge Width, etc.)
      value - actual value stored in this visual property.
    • setLockedValue

      <T, V extends T> void setLockedValue(VisualProperty<? extends T> vp, V value)
      Set locked value. This value will be used to bypass the style.
      Type Parameters:
      T - Data type of the visual property. This can be subclasses of type T.
      V - Value of the visual property. This can be subclasses of T.
      Parameters:
      vp - the VisualProperty
      value - the value that will bypass the style
    • clearValueLock

      void clearValueLock(VisualProperty<?> vp)
      Clear value lock for given VisualProperty.
      Parameters:
      vp - the VisualProperty.
    • getModel

      S getModel()
      Get source data structure, such as CyNode, CyEdge, etc.
      Returns:
      Data object of this view.
    • clearVisualProperties

      void clearVisualProperties()
      Clear all VisualProperty values previously set to this view.
    • batch

      default void batch(Consumer<View<S>> viewAction, boolean setDirty)
      Performs the given action on this View object. Any synchronization resources, such as locks, are acquired at the start of the action and held until the action is complete. If this network view supports creating snapshots then the dirty flag is not set until the action is complete.

      The default implementation of this method assumes there are no resources to acquire.

      Parameters:
      viewAction - The action to be performed once on this view.
      setDirty - If false then the dirty flag will not be set when the action completes.
      See Also:
      • CyNetworkView#isDirty()
    • batch

      default void batch(Consumer<View<S>> viewAction)
      Performs the given action on this View object. Any synchronization resources, such as locks, are acquired at the start of the action and held until the action is complete. If this network view supports creating snapshots then the dirty flag is not set until the action is complete.
      Parameters:
      viewAction - The action to be performed once on this view.
      See Also:
      • CyNetworkView#isDirty()