Package org.cytoscape.view.vizmap
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 Summary
Modifier and TypeMethodDescriptionvoid
addVisualMappingFunction
(VisualMappingFunction<?, ?> mapping) Add a new VisualMappingFunction to this VisualStyle.void
addVisualPropertyDependency
(VisualPropertyDependency<?> dependency) Add a new VisualPropertyDependency.void
apply
(CyRow row, View<? extends CyIdentifiable> view) Apply Visual Property values only to the given View Object (node or edge).void
apply
(CyNetworkView networkView) Apply Visual Style to the entire network view.void
Apply Visual Style to a column view.<V> Map<VisualProperty<?>,
Object> Returns all default values that were set in this style.Returns all VisualMappingFunctions in this style.Get all dependencies for this style.<V> V
getDefaultValue
(VisualProperty<V> vp) Returns default value for the VisualProperty.getTitle()
Returns name of this visual style.<V> VisualMappingFunction<?,
V> Get current VisualMappingFunction for the VisualProperty.void
Remove a VisualMappingFunction for the VisualProperty.void
removeVisualPropertyDependency
(VisualPropertyDependency<?> dependency) Remove a VisualPropertyDependency.<V,
S extends V>
voidsetDefaultValue
(VisualProperty<V> vp, S value) Set default value for the VisualProperty.void
Set new title for this VisualStyle.
-
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
Set new title for this VisualStyle.- Parameters:
title
- New title of this VisualStyle.
-
addVisualMappingFunction
Add a new VisualMappingFunction to this VisualStyle.- Parameters:
mapping
- new VisualMappingFunction to be added.- Throws:
NullPointerException
- if the specified mapping is null
-
removeVisualMappingFunction
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
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
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
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
Set default value for the VisualProperty.- Type Parameters:
V
- Data type of VisualPropertyS
- Data type of actual default value. This can be same as V or its child classes.- Parameters:
vp
- target VisualPropertyvalue
- 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
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
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
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
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
Remove a VisualPropertyDependency.- Parameters:
dependency
-
-