Interface VisualProperty<T>

Type Parameters:
T - the dataType of the VisualProperty, i.e. what kind of objects are the values
All Known Implementing Classes:
AbstractVisualProperty, ArrowShapeVisualProperty, BooleanVisualProperty, CellFormatVisualProperty, DefaultVisualizableVisualProperty, DoubleVisualProperty, EdgeBendVisualProperty, EdgeStackingVisualProperty, FontVisualProperty, IntegerVisualProperty, LabelBackgroundShapeVisualProperty, LineTypeVisualProperty, NodeShapeVisualProperty, NullVisualProperty, ObjectPositionVisualProperty, PaintVisualProperty, StringVisualProperty, TableModeVisualProperty

public interface VisualProperty<T>
An object which represents a type of visual entity, such as node color, size, etc. Visual Property itself does NOT have any hierarchy/dependency. It will be implemented in VisualLexicon.

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 Summary

    Modifier and Type
    Method
    Description
    static <T, V extends Comparable<V>>
    Comparator<View<T>>
    Utility method for sorting collections of Views according to the value of a VisualProperty.
    The default value of this property.
    Returns a short string suitable for presentation to humans.
    Returns a short string used to identify this visual property and suitable for serializing to XML and other text formats.
    Returns the Range of this VisualProperty.
    VisualProperty is always associated with a data type.
    Returns an object of type T given a string serialized from the getSerializableString(T value) method.
    boolean
    In some cases, default value from visual style is not suitable, such as x, y, z location of nodes.
    Returns a string of the specified value suitable for serializing to XML other text output.
  • Method Details

    • getRange

      Range<T> getRange()
      Returns the Range of this VisualProperty.
      Returns:
      the Range of this VisualProperty.
    • getDefault

      T getDefault()
      The default value of this property. This value is immutable.
      Returns:
      The default value of this property.
    • getIdString

      String getIdString()
      Returns a short string used to identify this visual property and suitable for serializing to XML and other text formats.
      Returns:
      A short string used to identify this visual property and suitable for serialization.
    • getDisplayName

      String getDisplayName()
      Returns a short string suitable for presentation to humans. Should not be used for serialization.
      Returns:
      A short string suitable for presentation to humans.
    • toSerializableString

      String toSerializableString(T value)
      Returns a string of the specified value suitable for serializing to XML other text output.
      Parameters:
      value - the specified value.
      Returns:
      a string of the specified value suitable for serializing to XML other text output.
    • parseSerializableString

      T parseSerializableString(String value)
      Returns an object of type T given a string serialized from the getSerializableString(T value) method.
      Parameters:
      value - a string serialized from the getSerializableString(T value) method.
      Returns:
      an object of type T given a string serialized from the getSerializableString(T value) method.
    • shouldIgnoreDefault

      boolean shouldIgnoreDefault()
      In some cases, default value from visual style is not suitable, such as x, y, z location of nodes. If this flag is on, it will be ignored and it will be controlled by mapping only.
      Returns:
      true if the default value should be ignored (as with x,y,z locations) and false otherwise.
    • getTargetDataType

      Class<? extends CyIdentifiable> getTargetDataType()
      VisualProperty is always associated with a data type. For example, EDGE_COLOR is associated with CyEdge data object. In that case, this returns Class<CyEdge>. For now, return data types are CyNode, CyEdge, and CyNetwork.
      Returns:
      target data type of this visual property. CyNode, CyEdge, or CyNetwork.
    • comparing

      static <T, V extends Comparable<V>> Comparator<View<T>> comparing(VisualProperty<V> vp)
      Utility method for sorting collections of Views according to the value of a VisualProperty. The VisualProperty value type must implement Comparable. Null values are sorted first.

      Example:
       // sort node views by z-order
       List<View<CyNode>> nodeViews = new ArrayList<>(networkView.getNodeViews());
       nodeViews.sort(VisualProperty.comparing(BasicVisualLexicon.NODE_Z_LOCATION));
       
      Since:
      3.9