Class 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 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.
      • 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.