Interface VisualStyle


public interface VisualStyle
A VisualStyle is a collection of VisualMappingFunctions and default values that define how a set of attributes is mapped to visual properties of View objects.

Module: vizmap-api

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

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>vizmap-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

    • getTitle

      String getTitle()
      Returns name of this visual style. This should NOT be used as the ID of this Visual Style. Just for GUI components and may not be unique.

      Title of Visual Style is a mutable field and may NOT be unique.

      Returns:
      title of this visual style
    • setTitle

      void setTitle(String title)
      Set new title for this VisualStyle.
      Parameters:
      title - New title of this VisualStyle.
    • addVisualMappingFunction

      void addVisualMappingFunction(VisualMappingFunction<?,?> mapping)
      Add a new VisualMappingFunction to this VisualStyle.
      Parameters:
      mapping - new VisualMappingFunction to be added.
      Throws:
      NullPointerException - if the specified mapping is null
    • removeVisualMappingFunction

      void removeVisualMappingFunction(VisualProperty<?> vp)
      Remove a VisualMappingFunction for the VisualProperty. One visual property can be associated with only one mapping function, so this always removes correct one.
      Parameters:
      vp - VisualMappingFunction associated with this VisualProperty will be removed.
    • getVisualMappingFunction

      <V> VisualMappingFunction<?,V> getVisualMappingFunction(VisualProperty<V> vp)
      Get current VisualMappingFunction for the VisualProperty.
      Type Parameters:
      V - Data type of VisualProperty.
      Parameters:
      vp - visual property associated with the target mapping.
      Returns:
      mapping function for the VisualProperty. If no mapping is available, this value is null.
    • getAllVisualMappingFunctions

      Collection<VisualMappingFunction<?,?>> getAllVisualMappingFunctions()
      Returns all VisualMappingFunctions in this style.
      Returns:
      All mappings for this style.
    • getDefaultValue

      <V> V getDefaultValue(VisualProperty<V> vp)
      Returns default value for the VisualProperty. This is style's default value, not same as VisualProperty default. If VisualMappingFunction is not available for this VisualProperty, this default value will be used in the view model.
      Type Parameters:
      V - Data type of VisualProperty
      Parameters:
      vp - target VisualProperty
      Returns:
      Style's default value for the VisualProperty.
    • getAllDefaultValues

      <V> Map<VisualProperty<?>,Object> getAllDefaultValues()
      Returns all default values that were set in this style. These are the style's default values, not same as VisualProperty default.
      Returns:
      All default values for this style.
      Since:
      3.10
    • setDefaultValue

      <V, S extends V> void setDefaultValue(VisualProperty<V> vp, S value)
      Set default value for the VisualProperty.
      Type Parameters:
      V - Data type of VisualProperty
      S - Data type of actual default value. This can be same as V or its child classes.
      Parameters:
      vp - target VisualProperty
      value - Value to be set as default. This can be child type of V. For example, if V is Number, S can be Double, Integer, etc.
    • apply

      void apply(CyNetworkView networkView)
      Apply Visual Style to the entire network view.
      Parameters:
      networkView - The view that the visual property should be applied to.
      Throws:
      NullPointerException - if the specified networkView is null
    • apply

      void apply(View<CyColumn> columnView)
      Apply Visual Style to a column view.
      Parameters:
      networkView - The view that the visual property should be applied to.
      Throws:
      NullPointerException - if the specified networkView is null
    • apply

      void apply(CyRow row, View<? extends CyIdentifiable> view)
      Apply Visual Property values only to the given View Object (node or edge). If you need to update only few set of node/edge views, then this is more efficient.
      Parameters:
      row - Data table row for the view's model. This is necessary for applying mapped values.
      view - The view that the visual property should be applied to.
    • getAllVisualPropertyDependencies

      Set<VisualPropertyDependency<?>> getAllVisualPropertyDependencies()
      Get all dependencies for this style.
      Returns:
      set of dependencies associated with this style.
    • addVisualPropertyDependency

      void addVisualPropertyDependency(VisualPropertyDependency<?> dependency)
      Add a new VisualPropertyDependency. If the VisualStyle already contains a dependency with the same id, the passed dependency is not added.
      Parameters:
      dependency - new dependency to be added
    • removeVisualPropertyDependency

      void removeVisualPropertyDependency(VisualPropertyDependency<?> dependency)
      Parameters:
      dependency -