Class DefaultFigureSelection

All Implemented Interfaces:
Extensible, Figure, FigureCollection, FigureSelection, Selection, Restorable, ClipboardOwner, Cloneable

public class DefaultFigureSelection extends DefaultFigureCollection implements FigureSelection
  • Constructor Details

    • DefaultFigureSelection

      public DefaultFigureSelection()
  • Method Details

    • getExtension

      public <E> E getExtension(Class<E> extensionType)
      Description copied from interface: Extensible
      Gets the extension for this object corresponding to a specified extension type.
      Specified by:
      getExtension in interface Extensible
      Parameters:
      extensionType - the extension type.
      Returns:
      the extension for this object corresponding to the specified type, or null if an extension of type extensionType cannot be delivered.
    • getSelectionStage

      public int getSelectionStage()
      Description copied from interface: FigureSelection
      Gets the current selection stage. The maximum selection stage is given by the selected figure(s).
      Specified by:
      getSelectionStage in interface FigureSelection
      Returns:
      The current selection stage.
      See Also:
    • setSelectionStage

      public void setSelectionStage(int selectionStage)
      Description copied from interface: FigureSelection
      Sets the current selection stage. The maximum selection stage is given by the selected figure(s).
      Specified by:
      setSelectionStage in interface FigureSelection
      Parameters:
      selectionStage - The current selection stage.
    • getHandles

      public Handle[] getHandles()
      Description copied from interface: FigureSelection
      Gets the handles associated with the current selection stage.
      1. For a single selection, the handles are the ones created by the selected figure's Figure.createHandles(int) factory method.
      2. For a multiple selection, the handles are the ones created by this figure selection's Figure.createHandles(int) factory method.
      3. If the selection is empty, an empty handle array is returned.
      Specified by:
      getHandles in interface FigureSelection
      Returns:
      The handles associated with the current selection stage.
      See Also:
    • getSelectedHandle

      public Handle getSelectedHandle()
      Specified by:
      getSelectedHandle in interface FigureSelection
    • setSelectedHandle

      public void setSelectedHandle(Handle handle)
      Specified by:
      setSelectedHandle in interface FigureSelection
    • isSelectable

      public boolean isSelectable()
      Description copied from class: AbstractFigure
      The default implementation returns false.
      Specified by:
      isSelectable in interface Figure
      Overrides:
      isSelectable in class DefaultFigureCollection
      Returns:
      Always false.
    • isSelected

      public boolean isSelected()
      Description copied from interface: Figure
      Tests if the figure is selected.
      Specified by:
      isSelected in interface Figure
      Overrides:
      isSelected in class DefaultFigureCollection
      Returns:
      true, if so.
    • setSelected

      public void setSelected(boolean selected)
      Description copied from interface: Figure
      Sets the selected state.
      Specified by:
      setSelected in interface Figure
      Overrides:
      setSelected in class DefaultFigureCollection
      Parameters:
      selected - The selected state.
    • getPresentationName

      public String getPresentationName()
      Description copied from interface: Selection
      Returns a localized, human-readable description of this selection, suitable for use in a change log or menu entry, for example.
      Specified by:
      getPresentationName in interface Selection
      Returns:
      A presentation name for this selection.
    • getSelectedValue

      public Object getSelectedValue()
      Description copied from interface: Selection
      Gets the selected value. The method returns null if this selection is empty.
      Specified by:
      getSelectedValue in interface Selection
      Returns:
      The selected value, or null.
    • getSelectedValues

      public Object[] getSelectedValues()
      Description copied from interface: Selection
      Gets the selected values of a multiple selection. The method returns an empty array if this selection is empty.
      Specified by:
      getSelectedValues in interface Selection
      Returns:
      The array of selected values.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Selection
      Returns:
      true if this selection is empty.
    • createTransferable

      public Transferable createTransferable(boolean copy)
      Description copied from interface: Selection
      Creates a transferable representation of this selection.
      Specified by:
      createTransferable in interface Selection
      Parameters:
      copy - If true, the returned Transferable should hold a copy-of rather than a reference-to the selection.
      Returns:
      A transferable representation of this selection or null if this is not possible.
    • addFigureImpl

      protected boolean addFigureImpl(int index, Figure figure)
      Description copied from class: AbstractFigure
      The default implementation throws an [@code IllegalStateException}.
      Overrides:
      addFigureImpl in class DefaultFigureCollection
      Parameters:
      index - The index.
      figure - The figure.
      Returns:
      Does never return normally.
    • addFiguresImpl

      protected Figure[] addFiguresImpl(Figure[] figures)
      Overrides:
      addFiguresImpl in class AbstractFigure
    • removeFigureImpl

      protected boolean removeFigureImpl(Figure figure)
      Description copied from class: AbstractFigure
      The default implementation throws an [@code IllegalStateException}.
      Overrides:
      removeFigureImpl in class DefaultFigureCollection
      Parameters:
      figure - The figure.
      Returns:
      Does never return normally.
    • removeFiguresImpl

      protected Figure[] removeFiguresImpl()
      Overrides:
      removeFiguresImpl in class DefaultFigureCollection
    • lostOwnership

      public void lostOwnership(Clipboard clipboard, Transferable contents)
      Notifies this object that it is no longer the clipboard owner. This method will be called when another application or another object within this application asserts ownership of the clipboard.
      Specified by:
      lostOwnership in interface ClipboardOwner
      Parameters:
      clipboard - the clipboard that is no longer owned
      contents - the contents which this owner had placed on the clipboard
    • clone

      public FigureSelection clone()
      Description copied from interface: Selection
      Creates and returns a copy of this selection.
      Specified by:
      clone in interface Figure
      Specified by:
      clone in interface Selection
      Overrides:
      clone in class DefaultFigureCollection
      Returns:
      A clone of this figure.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • removeAllFigures

      public Figure[] removeAllFigures()
      Description copied from interface: Figure
      Removes all child figures from this figure.
      Specified by:
      removeAllFigures in interface Figure
      Overrides:
      removeAllFigures in class AbstractFigure
      Returns:
      The array of child figures that actually have been removed.
    • draw

      public void draw(Rendering rendering)
      Description copied from interface: Figure
      Draws this figure using the given rendering.
      Specified by:
      draw in interface Figure
      Overrides:
      draw in class DefaultFigureCollection
      Parameters:
      rendering - The rendering used to draw the figure.