Interface PreviewModel
-
public interface PreviewModel
The Preview Model contains all items and all preview properties.Items are the visual elements built from the
Graph
byItemBuilder
implementations and can be retrieved from this class. Each item has a type and default types areItem.NODE
,Item.EDGE
,Item.NODE_LABEL
andItem.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()
CanvasSize
getGraphicsCanvasSize()
Computes the graphics canvas size.Item
getItem(String type, Object source)
Returns the item attached tosource
and with the typetype
.Item[]
getItems(Object source)
Returns all items attached tosource
.Item[]
getItems(String type)
Returns all items withtype
as type.Renderer[]
getManagedEnabledRenderers()
ReturnsmanagedRenderers
Renderers that are enabled, or null ifmanagedRenderers
is null.ManagedRenderer[]
getManagedRenderers()
Returns currently managed renderers, or null.PreviewProperties
getProperties()
Returns the preview properties attached to this model.void
setManagedRenderers(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 withtype
as type.Default types are
Item.NODE
,Item.EDGE
,Item.NODE_LABEL
andItem.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.
Node
orEdge
). Multiple items can be created from the same source object. For instance bothItem.NODE
andItem.NODE_LABEL
have the node object as source.- Parameters:
source
- the item's source- Returns:
- all items with
source
as source
-
getItem
Item getItem(String type, Object source)
Returns the item attached tosource
and with the typetype
.The source is the graph object behind the item (e.g.
Node
orEdge
) and the type a default or a custom type.Default types are
Item.NODE
,Item.EDGE
,Item.NODE_LABEL
andItem.EDGE_LABEL
.- Parameters:
type
- the item's typesource
- the item's source object- Returns:
- the item or
null
if not found
-
getManagedRenderers
ManagedRenderer[] getManagedRenderers()
Returns currently managed renderers, or null.
If
managedRenderers
is 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
managedRenderers
is set to null, all renderers will be executed when rendering, in default implementation order.- Parameters:
managedRenderers
- Managed renderers for future renderings
-
getManagedEnabledRenderers
Renderer[] getManagedEnabledRenderers()
ReturnsmanagedRenderers
Renderers that are enabled, or null ifmanagedRenderers
is null.- Returns:
- Enabled renderers or null
-
getEnabledMouseListeners
PreviewMouseListener[] getEnabledMouseListeners()
-
getGraphicsCanvasSize
CanvasSize getGraphicsCanvasSize()
Computes the graphics canvas size.- Returns:
- the graphics canvas size
-
-