diva.canvas.interactor
Class BasicSelectionRenderer

java.lang.Object
  extended by diva.canvas.interactor.BasicSelectionRenderer
All Implemented Interfaces:
SelectionRenderer

public class BasicSelectionRenderer
extends 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:
$Revision: 1.14 $
Author:
John Reekie

Constructor Summary
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
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface SelectionRenderer

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 interface SelectionRenderer

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 interface SelectionRenderer

setDecorator

public void setDecorator(FigureDecorator d)
Set the prototype decorator.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.