Class DefaultFigureSelection
java.lang.Object
com.bc.ceres.swing.figure.AbstractFigure
com.bc.ceres.swing.figure.support.DefaultFigureCollection
com.bc.ceres.swing.figure.support.DefaultFigureSelection
- All Implemented Interfaces:
Extensible
,Figure
,FigureCollection
,FigureSelection
,Selection
,Restorable
,ClipboardOwner
,Cloneable
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.bc.ceres.swing.figure.Figure
Figure.Rank
-
Field Summary
Fields inherited from class com.bc.ceres.swing.figure.AbstractFigure
NO_FIGURES, NO_HANDLES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
addFigureImpl
(int index, Figure figure) The default implementation throws an [@code IllegalStateException}.protected Figure[]
addFiguresImpl
(Figure[] figures) clone()
Creates and returns a copy of this selection.createTransferable
(boolean copy) Creates a transferable representation of this selection.void
Draws this figure using the given rendering.<E> E
getExtension
(Class<E> extensionType) Gets the extension for this object corresponding to a specified extension type.Handle[]
Gets the handles associated with the current selection stage.Returns a localized, human-readable description of this selection, suitable for use in a change log or menu entry, for example.Gets the selected value.Object[]
Gets the selected values of a multiple selection.int
Gets the current selection stage.boolean
isEmpty()
boolean
The default implementation returnsfalse
.boolean
Tests if the figure is selected.void
lostOwnership
(Clipboard clipboard, Transferable contents) Notifies this object that it is no longer the clipboard owner.Figure[]
Removes all child figures from this figure.protected boolean
removeFigureImpl
(Figure figure) The default implementation throws an [@code IllegalStateException}.protected Figure[]
void
setSelected
(boolean selected) Sets the selected state.void
setSelectedHandle
(Handle handle) void
setSelectionStage
(int selectionStage) Sets the current selection stage.toString()
Methods inherited from class com.bc.ceres.swing.figure.support.DefaultFigureCollection
addFigureImpl, computeBounds, contains, createHandles, createMemento, dispose, getBounds, getFigure, getFigure, getFigureCount, getFigureIndex, getFigures, getFigures, getMaxSelectionStage, getRank, isCloseTo, isCollection, move, rotate, scale, setMemento
Methods inherited from class com.bc.ceres.swing.figure.AbstractFigure
addChangeListener, addFigure, addFigure, addFigures, addSegment, createScaleHandles, fireFigureChanged, fireFigureChanged, fireFiguresAdded, fireFiguresRemoved, getChangeListeners, getEffectiveStyle, getHandleStyle, getNormalStyle, getSegment, getSelectedHandleStyle, getSelectedStyle, removeChangeListener, removeFigure, removeFigures, removeFiguresImpl, removeSegment, setNormalStyle, setSegment, setSelectable, setSelectedStyle
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.bc.ceres.swing.figure.Figure
addChangeListener, addFigure, addFigure, addFigures, addSegment, contains, createHandles, dispose, getBounds, getChangeListeners, getEffectiveStyle, getFigure, getFigure, getFigureCount, getFigureIndex, getFigures, getFigures, getMaxSelectionStage, getNormalStyle, getRank, getSegment, getSelectedStyle, isCloseTo, isCollection, move, removeChangeListener, removeFigure, removeFigures, removeSegment, rotate, scale, setNormalStyle, setSegment, setSelectedStyle
Methods inherited from interface com.bc.ceres.swing.undo.Restorable
createMemento, setMemento
-
Constructor Details
-
DefaultFigureSelection
public DefaultFigureSelection()
-
-
Method Details
-
getExtension
Description copied from interface:Extensible
Gets the extension for this object corresponding to a specified extension type.- Specified by:
getExtension
in interfaceExtensible
- Parameters:
extensionType
- the extension type.- Returns:
- the extension for this object corresponding to the specified type,
or
null
if an extension of typeextensionType
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 interfaceFigureSelection
- 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 interfaceFigureSelection
- Parameters:
selectionStage
- The current selection stage.
-
getHandles
Description copied from interface:FigureSelection
Gets the handles associated with the current selection stage.- For a single selection, the handles are the ones created by the selected figure's
Figure.createHandles(int)
factory method. - For a multiple selection, the handles are the ones created by this figure selection's
Figure.createHandles(int)
factory method. - If the selection is empty, an empty handle array is returned.
- Specified by:
getHandles
in interfaceFigureSelection
- Returns:
- The handles associated with the current selection stage.
- See Also:
- For a single selection, the handles are the ones created by the selected figure's
-
getSelectedHandle
- Specified by:
getSelectedHandle
in interfaceFigureSelection
-
setSelectedHandle
- Specified by:
setSelectedHandle
in interfaceFigureSelection
-
isSelectable
public boolean isSelectable()Description copied from class:AbstractFigure
The default implementation returnsfalse
.- Specified by:
isSelectable
in interfaceFigure
- Overrides:
isSelectable
in classDefaultFigureCollection
- Returns:
- Always
false
.
-
isSelected
public boolean isSelected()Description copied from interface:Figure
Tests if the figure is selected.- Specified by:
isSelected
in interfaceFigure
- Overrides:
isSelected
in classDefaultFigureCollection
- Returns:
true
, if so.
-
setSelected
public void setSelected(boolean selected) Description copied from interface:Figure
Sets the selected state.- Specified by:
setSelected
in interfaceFigure
- Overrides:
setSelected
in classDefaultFigureCollection
- Parameters:
selected
- The selected state.
-
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 interfaceSelection
- Returns:
- A presentation name for this selection.
-
getSelectedValue
Description copied from interface:Selection
Gets the selected value. The method returnsnull
if this selectionis empty
.- Specified by:
getSelectedValue
in interfaceSelection
- Returns:
- The selected value, or
null
.
-
getSelectedValues
Description copied from interface:Selection
Gets the selected values of a multiple selection. The method returns an empty array if this selectionis empty
.- Specified by:
getSelectedValues
in interfaceSelection
- Returns:
- The array of selected values.
-
isEmpty
public boolean isEmpty() -
createTransferable
Description copied from interface:Selection
Creates a transferable representation of this selection.- Specified by:
createTransferable
in interfaceSelection
- Parameters:
copy
- Iftrue
, the returnedTransferable
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
Description copied from class:AbstractFigure
The default implementation throws an [@code IllegalStateException}.- Overrides:
addFigureImpl
in classDefaultFigureCollection
- Parameters:
index
- The index.figure
- The figure.- Returns:
- Does never return normally.
-
addFiguresImpl
- Overrides:
addFiguresImpl
in classAbstractFigure
-
removeFigureImpl
Description copied from class:AbstractFigure
The default implementation throws an [@code IllegalStateException}.- Overrides:
removeFigureImpl
in classDefaultFigureCollection
- Parameters:
figure
- The figure.- Returns:
- Does never return normally.
-
removeFiguresImpl
- Overrides:
removeFiguresImpl
in classDefaultFigureCollection
-
lostOwnership
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 interfaceClipboardOwner
- Parameters:
clipboard
- the clipboard that is no longer ownedcontents
- the contents which this owner had placed on the clipboard
-
clone
Description copied from interface:Selection
Creates and returns a copy of this selection. -
toString
-
removeAllFigures
Description copied from interface:Figure
Removes all child figures from this figure.- Specified by:
removeAllFigures
in interfaceFigure
- Overrides:
removeAllFigures
in classAbstractFigure
- Returns:
- The array of child figures that actually have been removed.
-
draw
Description copied from interface:Figure
Draws this figure using the given rendering.- Specified by:
draw
in interfaceFigure
- Overrides:
draw
in classDefaultFigureCollection
- Parameters:
rendering
- The rendering used to draw the figure.
-