Interface PreviewModel
-
public interface PreviewModelThe Preview Model contains all items and all preview properties.Items are the visual elements built from the
GraphbyItemBuilderimplementations and can be retrieved from this class. Each item has a type and default types areItem.NODE,Item.EDGE,Item.NODE_LABELandItem.EDGE_LABEL.A preview model is attached to it's workspace and can be retrieved from the
PreviewController.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PreviewMouseListener[]getEnabledMouseListeners()CanvasSizegetGraphicsCanvasSize()Computes the graphics canvas size.ItemgetItem(String type, Object source)Returns the item attached tosourceand with the typetype.Item[]getItems(Object source)Returns all items attached tosource.Item[]getItems(String type)Returns all items withtypeas type.Renderer[]getManagedEnabledRenderers()ReturnsmanagedRenderersRenderers that are enabled, or null ifmanagedRenderersis null.ManagedRenderer[]getManagedRenderers()Returns currently managed renderers, or null.PreviewPropertiesgetProperties()Returns the preview properties attached to this model.WorkspacegetWorkspace()Returns the workspace this model is attached to.booleanisGlobalCanvasSize()Returnstrueif the canvas size returned bygetGraphicsCanvasSize()is based on the full graph, as opposed to the visible graph.voidsetManagedRenderers(ManagedRenderer[] managedRenderers)Sets an user-defined array of managed renderers to use when rendering.
-
-
-
Method Detail
-
getProperties
PreviewProperties getProperties()
Returns the preview properties attached to this model.- Returns:
- the preview properties
-
getItems
Item[] getItems(String type)
Returns all items withtypeas type.Default types are
Item.NODE,Item.EDGE,Item.NODE_LABELandItem.EDGE_LABEL.- Parameters:
type- the item's type- Returns:
- all items from this type
-
getItems
Item[] getItems(Object source)
Returns all items attached tosource.The source is the graph object behind the item (e.g.
NodeorEdge). Multiple items can be created from the same source object. For instance bothItem.NODEandItem.NODE_LABELhave the node object as source.- Parameters:
source- the item's source- Returns:
- all items with
sourceas source
-
getItem
Item getItem(String type, Object source)
Returns the item attached tosourceand with the typetype.The source is the graph object behind the item (e.g.
NodeorEdge) and the type a default or a custom type.Default types are
Item.NODE,Item.EDGE,Item.NODE_LABELandItem.EDGE_LABEL.- Parameters:
type- the item's typesource- the item's source object- Returns:
- the item or
nullif not found
-
getManagedRenderers
ManagedRenderer[] getManagedRenderers()
Returns currently managed renderers, or null.
If
managedRenderersis set to null, all renderers will be executed when rendering, in default implementation order.- Returns:
- Enabled renderers or null
-
setManagedRenderers
void setManagedRenderers(ManagedRenderer[] managedRenderers)
Sets an user-defined array of managed renderers to use when rendering.
Only the renderers marked as enabled will be executed when rendering, and respecting the array order
If the input array does not contain a managed renderer for some renderer existing implementation, a new not enabled managed renderer will be added to the end of the input array
If
managedRenderersis set to null, all renderers will be executed when rendering, in default implementation order.- Parameters:
managedRenderers- Managed renderers for future renderings
-
getManagedEnabledRenderers
Renderer[] getManagedEnabledRenderers()
ReturnsmanagedRenderersRenderers that are enabled, or null ifmanagedRenderersis null.- Returns:
- Enabled renderers or null
-
getEnabledMouseListeners
PreviewMouseListener[] getEnabledMouseListeners()
-
getGraphicsCanvasSize
CanvasSize getGraphicsCanvasSize()
Computes the graphics canvas size.- Returns:
- the graphics canvas size
-
isGlobalCanvasSize
boolean isGlobalCanvasSize()
Returnstrueif the canvas size returned bygetGraphicsCanvasSize()is based on the full graph, as opposed to the visible graph. The default isfalse: the canvas size is based on the visible graph.- Returns:
- true if canvas size is global, false otherwise
-
getWorkspace
Workspace getWorkspace()
Returns the workspace this model is attached to.- Returns:
- the workspace
-
-