Interface PreviewController
-
public interface PreviewControllerController 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 PreviewModelgetModel()Returns the current preview model in the current workspace.PreviewModelgetModel(Workspace workspace)Returns the preview model inworkspace.Renderer[]getRegisteredRenderers()UsesLookupto retrieve registered renderer providers but replaces default renderers with plugins that extend them.RenderTargetgetRenderTarget(String name)Creates a new render target of the given type.RenderTargetgetRenderTarget(String name, Workspace workspace)Creates a new render target of the given type in the preview model contained byworkspace.booleanisAnyPluginRendererRegistered()Returns true if any renderer plugin is registered.voidrefreshPreview()Refreshes the current preview model.voidrefreshPreview(Workspace workspace)Refreshes the preview model inworkspace.voidrender(RenderTarget target)Renders the current preview model totarget.voidrender(RenderTarget target, Renderer[] renderers)Renders the current preview model totarget.voidrender(RenderTarget target, Renderer[] renderers, Workspace workspace)Renders the preview model inworkspacetotarget.voidrender(RenderTarget target, Workspace workspace)Renders the preview model inworkspacetotarget.booleansendMouseEvent(PreviewMouseEvent event)Sends aPreviewMouseEventto the current workspace, if any.booleansendMouseEvent(PreviewMouseEvent event, Workspace workspace)Sends aPreviewMouseEventto the given workspace.voidsetGlobalCanvasSize(boolean globalCanvasSize)Sets the canvas size parameter.
-
-
-
Method Detail
-
refreshPreview
void refreshPreview(Workspace workspace)
Refreshes the preview model inworkspace.This task built all items from
ItemBuilderimplementations, 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
ItemBuilderimplementations, 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
managedRenderersis null, this task looks for allRendererimplementations 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 inworkspacetotarget.If preview model
managedRenderersis null, this task looks for allRendererimplementations 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
managedRenderersand uses the givenRendererarray, 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 inworkspacetotarget.This task overrides the preview model
managedRenderersand uses the givenRendererarray, 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_TARGETandRenderTarget.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
nullifnameis 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_TARGETandRenderTarget.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
nullifnameis unknown
-
getRegisteredRenderers
Renderer[] getRegisteredRenderers()
UsesLookupto 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 aPreviewMouseEventto 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 aPreviewMouseEventto the given workspace.- Parameters:
event- PreviewMouseEventworkspace- workspace- Returns:
- True if the event was consumed, false otherwise
-
setGlobalCanvasSize
void setGlobalCanvasSize(boolean globalCanvasSize)
Sets the canvas size parameter.If true, the
PreviewModel.getGraphicsCanvasSize()will return the canvas boundaries based on the full graph. If false, it will be based on the visible graph.The default is false
- Parameters:
globalCanvasSize- global canvas size parameter
-
-