Package diva.canvas.interactor
Class BasicSelectionRenderer
- java.lang.Object
-
- diva.canvas.interactor.BasicSelectionRenderer
-
- All Implemented Interfaces:
SelectionRenderer
public class BasicSelectionRenderer extends java.lang.Object implements SelectionRenderer
A basic implementation of a selection renderer. This implementation wraps each selected figure in an instance of a FigureDecorator. The figure decorator is obtained by cloning a prototype decorator, accessible through the get/setFigureDecorator() methods. The default prototype is an instance of BasicHighlighter. Often, the prototype decorator will be set to instances of one of the Manipulator classes.- Version:
- $Id$
- Author:
- John Reekie
-
-
Constructor Summary
Constructors Constructor Description BasicSelectionRenderer()
Create a new selection renderer with the default prototype decorator.BasicSelectionRenderer(FigureDecorator d)
Create a new renderer with the given prototype decorator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FigureDecorator
getDecorator()
Get the prototype decorator.boolean
isRenderedSelected(Figure figure)
Test if the given figure is currently rendered selected.void
renderDeselected(Figure figure)
Set the rendering of the figure as deselected.void
renderSelected(Figure figure)
Set the rendering of the figure as selected.void
setDecorator(FigureDecorator d)
Set the prototype decorator.
-
-
-
Constructor Detail
-
BasicSelectionRenderer
public BasicSelectionRenderer()
Create a new selection renderer with the default prototype decorator.
-
BasicSelectionRenderer
public BasicSelectionRenderer(FigureDecorator d)
Create a new renderer with the given prototype decorator.
-
-
Method Detail
-
getDecorator
public FigureDecorator getDecorator()
Get the prototype decorator.
-
isRenderedSelected
public boolean isRenderedSelected(Figure figure)
Test if the given figure is currently rendered selected.- Specified by:
isRenderedSelected
in interfaceSelectionRenderer
-
renderDeselected
public void renderDeselected(Figure figure)
Set the rendering of the figure as deselected. The figure has the decorator unwrapped off it and is inserted back into its parent figure container, if there is one. If the figure is not rendered selected, do nothing.- Specified by:
renderDeselected
in interfaceSelectionRenderer
-
renderSelected
public void renderSelected(Figure figure)
Set the rendering of the figure as selected. If the figure is already rendered selected, just repaint. Otherwise create a new BasicHighlighter, and wrap the figure in the decorator, inserting the decorator into the figure's parent.- Specified by:
renderSelected
in interfaceSelectionRenderer
-
setDecorator
public void setDecorator(FigureDecorator d)
Set the prototype decorator.
-
-