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
public class DefaultFigureSelection extends DefaultFigureCollection implements FigureSelection
-
-
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 Constructor Description DefaultFigureSelection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaddFigureImpl(int index, Figure figure)The default implementation throws an [@code IllegalStateException}.protected Figure[]addFiguresImpl(Figure[] figures)FigureSelectionclone()Creates and returns a copy of this selection.TransferablecreateTransferable(boolean copy)Creates a transferable representation of this selection.voiddraw(Rendering rendering)Draws this figure using the given rendering.<E> EgetExtension(Class<E> extensionType)Gets the extension for this object corresponding to a specified extension type.Handle[]getHandles()Gets the handles associated with the current selection stage.StringgetPresentationName()Returns a localized, human-readable description of this selection, suitable for use in a change log or menu entry, for example.HandlegetSelectedHandle()ObjectgetSelectedValue()Gets the selected value.Object[]getSelectedValues()Gets the selected values of a multiple selection.intgetSelectionStage()Gets the current selection stage.booleanisEmpty()booleanisSelectable()The default implementation returnsfalse.booleanisSelected()Tests if the figure is selected.voidlostOwnership(Clipboard clipboard, Transferable contents)Notifies this object that it is no longer the clipboard owner.Figure[]removeAllFigures()Removes all child figures from this figure.protected booleanremoveFigureImpl(Figure figure)The default implementation throws an [@code IllegalStateException}.protected Figure[]removeFiguresImpl()voidsetSelected(boolean selected)Sets the selected state.voidsetSelectedHandle(Handle handle)voidsetSelectionStage(int selectionStage)Sets the current selection stage.StringtoString()-
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
-
-
-
-
Method Detail
-
getExtension
public <E> E getExtension(Class<E> extensionType)
Description copied from interface:ExtensibleGets the extension for this object corresponding to a specified extension type.- Specified by:
getExtensionin interfaceExtensible- Parameters:
extensionType- the extension type.- Returns:
- the extension for this object corresponding to the specified type,
or
nullif an extension of typeextensionTypecannot be delivered.
-
getSelectionStage
public int getSelectionStage()
Description copied from interface:FigureSelectionGets the current selection stage. The maximum selection stage is given by the selected figure(s).- Specified by:
getSelectionStagein interfaceFigureSelection- Returns:
- The current selection stage.
- See Also:
Figure.getMaxSelectionStage(),Figure.createHandles(int)
-
setSelectionStage
public void setSelectionStage(int selectionStage)
Description copied from interface:FigureSelectionSets the current selection stage. The maximum selection stage is given by the selected figure(s).- Specified by:
setSelectionStagein interfaceFigureSelection- Parameters:
selectionStage- The current selection stage.
-
getHandles
public Handle[] getHandles()
Description copied from interface:FigureSelectionGets 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:
getHandlesin interfaceFigureSelection- Returns:
- The handles associated with the current selection stage.
- See Also:
FigureSelection.getSelectionStage()
- For a single selection, the handles are the ones created by the selected figure's
-
getSelectedHandle
public Handle getSelectedHandle()
- Specified by:
getSelectedHandlein interfaceFigureSelection
-
setSelectedHandle
public void setSelectedHandle(Handle handle)
- Specified by:
setSelectedHandlein interfaceFigureSelection
-
isSelectable
public boolean isSelectable()
Description copied from class:AbstractFigureThe default implementation returnsfalse.- Specified by:
isSelectablein interfaceFigure- Overrides:
isSelectablein classDefaultFigureCollection- Returns:
- Always
false.
-
isSelected
public boolean isSelected()
Description copied from interface:FigureTests if the figure is selected.- Specified by:
isSelectedin interfaceFigure- Overrides:
isSelectedin classDefaultFigureCollection- Returns:
true, if so.
-
setSelected
public void setSelected(boolean selected)
Description copied from interface:FigureSets the selected state.- Specified by:
setSelectedin interfaceFigure- Overrides:
setSelectedin classDefaultFigureCollection- Parameters:
selected- The selected state.
-
getPresentationName
public String getPresentationName()
Description copied from interface:SelectionReturns a localized, human-readable description of this selection, suitable for use in a change log or menu entry, for example.- Specified by:
getPresentationNamein interfaceSelection- Returns:
- A presentation name for this selection.
-
getSelectedValue
public Object getSelectedValue()
Description copied from interface:SelectionGets the selected value. The method returnsnullif this selectionis empty.- Specified by:
getSelectedValuein interfaceSelection- Returns:
- The selected value, or
null.
-
getSelectedValues
public Object[] getSelectedValues()
Description copied from interface:SelectionGets the selected values of a multiple selection. The method returns an empty array if this selectionis empty.- Specified by:
getSelectedValuesin interfaceSelection- Returns:
- The array of selected values.
-
isEmpty
public boolean isEmpty()
-
createTransferable
public Transferable createTransferable(boolean copy)
Description copied from interface:SelectionCreates a transferable representation of this selection.- Specified by:
createTransferablein interfaceSelection- Parameters:
copy- Iftrue, the returnedTransferableshould hold a copy-of rather than a reference-to the selection.- Returns:
- A transferable representation of this selection or
nullif this is not possible.
-
addFigureImpl
protected boolean addFigureImpl(int index, Figure figure)Description copied from class:AbstractFigureThe default implementation throws an [@code IllegalStateException}.- Overrides:
addFigureImplin classDefaultFigureCollection- Parameters:
index- The index.figure- The figure.- Returns:
- Does never return normally.
-
addFiguresImpl
protected Figure[] addFiguresImpl(Figure[] figures)
- Overrides:
addFiguresImplin classAbstractFigure
-
removeFigureImpl
protected boolean removeFigureImpl(Figure figure)
Description copied from class:AbstractFigureThe default implementation throws an [@code IllegalStateException}.- Overrides:
removeFigureImplin classDefaultFigureCollection- Parameters:
figure- The figure.- Returns:
- Does never return normally.
-
removeFiguresImpl
protected Figure[] removeFiguresImpl()
- Overrides:
removeFiguresImplin classDefaultFigureCollection
-
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:
lostOwnershipin interfaceClipboardOwner- Parameters:
clipboard- the clipboard that is no longer ownedcontents- the contents which this owner had placed on the clipboard
-
clone
public FigureSelection clone()
Description copied from interface:SelectionCreates and returns a copy of this selection.
-
removeAllFigures
public Figure[] removeAllFigures()
Description copied from interface:FigureRemoves all child figures from this figure.- Specified by:
removeAllFiguresin interfaceFigure- Overrides:
removeAllFiguresin classAbstractFigure- Returns:
- The array of child figures that actually have been removed.
-
-