Package com.bc.ceres.swing.selection
Class AbstractSelection
java.lang.Object
com.bc.ceres.core.ExtensibleObject
com.bc.ceres.swing.selection.AbstractSelection
- All Implemented Interfaces:
Extensible
,Selection
,ClipboardOwner
,Cloneable
- Direct Known Subclasses:
DefaultSelection
A handy base class for implementations of the
Selection
interface.
Clients only need to implement Selection.getSelectedValue()
for single selection modes. For multiple selections,
getSelectedValues()
will need to be overridden.
- Since:
- Ceres 0.10
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a copy of this selection.createTransferable
(boolean snapshot) The default implementation returnsnull
.The default implementation returns an empty string.Object[]
Gets the selected values of a multiple selection.boolean
isEmpty()
void
lostOwnership
(Clipboard clipboard, Transferable contents) Notifies this object that it is no longer the clipboard owner.Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.bc.ceres.core.Extensible
getExtension
Methods inherited from interface com.bc.ceres.swing.selection.Selection
getSelectedValue
-
Constructor Details
-
AbstractSelection
protected AbstractSelection()
-
-
Method Details
-
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() -
getPresentationName
The default implementation returns an empty string.- Specified by:
getPresentationName
in interfaceSelection
- Returns:
- An empty string.
-
createTransferable
The default implementation returnsnull
.- Specified by:
createTransferable
in interfaceSelection
- Parameters:
snapshot
- Iftrue
, the returnedTransferable
should hold a copy-of rather than a reference-to the selection.- Returns:
null
by default.
-
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.The default implementation does nothing.
- 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.
-