Interface PreviewController
-
public interface PreviewController
Controller that maintain the preview models, one per workspace.This controller is a service and can therefore be found in Lookup:
PreviewController gc = Lookup.getDefault().lookup(PreviewController.class);
- Author:
- Yudi Xue, Mathieu Bastian
- See Also:
PreviewModel
,Item
,Renderer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PreviewModel
getModel()
Returns the current preview model in the current workspace.PreviewModel
getModel(Workspace workspace)
Returns the preview model inworkspace
.Renderer[]
getRegisteredRenderers()
UsesLookup
to retrieve registered renderer providers but replaces default renderers with plugins that extend them.RenderTarget
getRenderTarget(String name)
Creates a new render target of the given type.RenderTarget
getRenderTarget(String name, Workspace workspace)
Creates a new render target of the given type in the preview model contained byworkspace
.boolean
isAnyPluginRendererRegistered()
Returns true if any renderer plugin is registered.void
refreshPreview()
Refreshes the current preview model.void
refreshPreview(Workspace workspace)
Refreshes the preview model inworkspace
.void
render(RenderTarget target)
Renders the current preview model totarget
.void
render(RenderTarget target, Renderer[] renderers)
Renders the current preview model totarget
.void
render(RenderTarget target, Renderer[] renderers, Workspace workspace)
Renders the preview model inworkspace
totarget
.void
render(RenderTarget target, Workspace workspace)
Renders the preview model inworkspace
totarget
.boolean
sendMouseEvent(PreviewMouseEvent event)
Sends aPreviewMouseEvent
to the current workspace, if any.boolean
sendMouseEvent(PreviewMouseEvent event, Workspace workspace)
Sends aPreviewMouseEvent
to the given workspace.
-
-
-
Method Detail
-
refreshPreview
void refreshPreview(Workspace workspace)
Refreshes the preview model inworkspace
.This task built all items from
ItemBuilder
implementations, refresh graph dimensions and call allRenderer.preProcess()
method.- Parameters:
workspace
- the workspace to get the preview model from
-
refreshPreview
void refreshPreview()
Refreshes the current preview model.This task built all items from
ItemBuilder
implementations, refresh graph dimensions and call allRenderer.preProcess()
method.
-
getModel
PreviewModel getModel()
Returns the current preview model in the current workspace.- Returns:
- the current preview model
-
getModel
PreviewModel getModel(Workspace workspace)
Returns the preview model inworkspace
.- Parameters:
workspace
- the workspace to lookup- Returns:
- the preview model in
workspace
-
render
void render(RenderTarget target)
Renders the current preview model totarget
.If preview model
managedRenderers
is null, this task looks for allRenderer
implementations in their default order. Then all items in the preview model are rendered.- Parameters:
target
- the target to render items to
-
render
void render(RenderTarget target, Workspace workspace)
Renders the preview model inworkspace
totarget
.If preview model
managedRenderers
is null, this task looks for allRenderer
implementations in their default order. Then all items in the preview model are rendered.- Parameters:
target
- the target to render items toworkspace
- the workspace to get the preview model from
-
render
void render(RenderTarget target, Renderer[] renderers)
Renders the current preview model totarget
.This task overrides the preview model
managedRenderers
and uses the givenRenderer
array, respecting the array order. Then all items in the preview model are rendered.- Parameters:
target
- the target to render items torenderers
- renderers to use
-
render
void render(RenderTarget target, Renderer[] renderers, Workspace workspace)
Renders the preview model inworkspace
totarget
.This task overrides the preview model
managedRenderers
and uses the givenRenderer
array, respecting the array order. Then all items in the preview model are rendered.- Parameters:
target
- the target to render items torenderers
- renderers to useworkspace
- the workspace to get the preview model from
-
getRenderTarget
RenderTarget getRenderTarget(String name)
Creates a new render target of the given type.Default render targets names are
RenderTarget.G2D_TARGET
,RenderTarget.SVG_TARGET
andRenderTarget.PDF_TARGET
.Render targets usually need some parameters when built. Parameters values should simply be put in the
PreviewProperties
.- Parameters:
name
- the name of the render target- Returns:
- a new render target or
null
ifname
is unknown
-
getRenderTarget
RenderTarget getRenderTarget(String name, Workspace workspace)
Creates a new render target of the given type in the preview model contained byworkspace
.Default render targets names are
RenderTarget.G2D_TARGET
,RenderTarget.SVG_TARGET
andRenderTarget.PDF_TARGET
.Render targets usually need some parameters when built. Parameters values should simply be put in the
PreviewProperties
.- Parameters:
name
- the name of the render targetworkspace
- the workspace to get the preview model from- Returns:
- a new render target or
null
ifname
is unknown
-
getRegisteredRenderers
Renderer[] getRegisteredRenderers()
UsesLookup
to retrieve registered renderer providers but replaces default renderers with plugins that extend them.- Returns:
- Registered renderers replacing default renderers with their extension plugins in case they exist
- See Also:
Renderer
-
isAnyPluginRendererRegistered
boolean isAnyPluginRendererRegistered()
Returns true if any renderer plugin is registered.- Returns:
- True if any plugin renderer is found in the system
-
sendMouseEvent
boolean sendMouseEvent(PreviewMouseEvent event)
Sends aPreviewMouseEvent
to the current workspace, if any.- Parameters:
event
- PreviewMouseEvent- Returns:
- True if the event was consumed, false otherwise
-
sendMouseEvent
boolean sendMouseEvent(PreviewMouseEvent event, Workspace workspace)
Sends aPreviewMouseEvent
to the given workspace.- Parameters:
event
- PreviewMouseEventworkspace
- workspace- Returns:
- True if the event was consumed, false otherwise
-
-