Interface CyCustomGraphics<T extends CustomGraphicLayer>
-
- All Known Subinterfaces:
CyCustomGraphics2<T>
public interface CyCustomGraphics<T extends CustomGraphicLayer>
Base interface for all Custom Graphics. Fundamentally, aCyCustomGraphics
object is a container for one or moreCustomGraphicLayer
objects. It is the layer objects that will actually create the graphics that are used by the renderer.Module:
presentation-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>presentation-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getDisplayName()
Display name is a simple description of this image object.float
getFitRatio()
Get the fit ratio for this custom graphic.int
getHeight()
Returns height of current object.Long
getIdentifier()
Immutable session-unique identifier of this custom graphic generated by the custom graphics manager.List<T>
getLayers(CyNetworkView networkView, View<? extends CyIdentifiable> grView)
Get layers that belong to this object.Image
getRenderedImage()
From layers of graphics objects, render a composite scaled Image object.int
getWidth()
Returns width of current object.void
setDisplayName(String displayName)
Set human readable display name.void
setFitRatio(float ratio)
Set the fit ratio for this custom graphic.void
setHeight(int height)
Set height of Custom Graphics.void
setIdentifier(Long id)
Set the session-unique identifier of this custom graphics.void
setWidth(int width)
Set width of Custom Graphics.String
toSerializableString()
Generate a string suitable for serializing the state of this custom graphic.
-
-
-
Method Detail
-
getIdentifier
Long getIdentifier()
Immutable session-unique identifier of this custom graphic generated by the custom graphics manager. If this returns null, the custom graphics manager will generate a new identifier when this custom graphics is added.- Returns:
- Immutable ID as Long.
-
setIdentifier
void setIdentifier(Long id)
Set the session-unique identifier of this custom graphics. This method is used by the renderer to track custom graphics objects for serialization/deserialization. Your implementation should not generate or set this value.- Parameters:
id
- Immutable ID as Long.
-
getDisplayName
String getDisplayName()
Display name is a simple description of this image object. For discrete mappings, this is the name that the user will see.- Returns:
- display name as String.
-
setDisplayName
void setDisplayName(String displayName)
Set human readable display name.- Parameters:
displayName
-
-
toSerializableString
String toSerializableString()
Generate a string suitable for serializing the state of this custom graphic. Note that the first part of this must be the class of the implementing object followed by a comma. This is used by the deserialization logic to recreate the factory objects that are used for discrete mappings. If your implementation doesn't support discrete mappings, just return null. This method is the mirror ofCyCustomGraphicsFactory#parseSerializableString()
.- Returns:
- serialized custom graphic state, or null if discrete mappings aren't supported
-
getLayers
List<T> getLayers(CyNetworkView networkView, View<? extends CyIdentifiable> grView)
Get layers that belong to this object. Get the list of layers to be rendered. Each layer is rendered in list order, which means that the layers at the end of the list are rendered last, and are therefore on top. TheCyNetworkView
andView
graph object view are passed in case there is information about the network that is required to render the layer. For example, a pie chart layer might need to extract data from theCyRow
for this graph object. For other layer types, this can be safely ignored.- Parameters:
networkView
- the network view the Renderer is renderinggrView
- the graph object view the Renderer is rendering (currently only nodes are supported)- Returns:
- List of layer objects
-
getWidth
int getWidth()
Returns width of current object.- Returns:
- the current width
-
getHeight
int getHeight()
Returns height of current object.- Returns:
- the height of the current object
-
setWidth
void setWidth(int width)
Set width of Custom Graphics. This is used by discrete mappers to support the creation of a sample image.- Parameters:
width
-
-
setHeight
void setHeight(int height)
Set height of Custom Graphics. This is used by discrete mappers to support the creation of a sample image.- Parameters:
height
-
-
getFitRatio
float getFitRatio()
Get the fit ratio for this custom graphic. This is used to set the proportion of the node to fill when sizing the graphic. For example, if your custom graphic should leave a border round the fill, set this to <1 -- if you want your cutom graphic to be larger than the node, set this to > 1.- Returns:
- the fit ratio
-
setFitRatio
void setFitRatio(float ratio)
Set the fit ratio for this custom graphic.- Parameters:
ratio
- the fit ratio
-
getRenderedImage
Image getRenderedImage()
From layers of graphics objects, render a composite scaled Image object. Usually, the image returned by this method is used in GUI components (as icons).- Returns:
- rendered image object.
-
-