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
public abstract class AbstractSelection extends ExtensibleObject implements Selection
A handy base class for implementations of theSelection
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSelection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractSelection
clone()
Creates and returns a copy of this selection.Transferable
createTransferable(boolean snapshot)
The default implementation returnsnull
.String
getPresentationName()
The default implementation returns an empty string.Object[]
getSelectedValues()
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
-
-
-
-
Method Detail
-
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 selectionis empty
.- Specified by:
getSelectedValues
in interfaceSelection
- Returns:
- The array of selected values.
-
isEmpty
public boolean isEmpty()
-
getPresentationName
public String getPresentationName()
The default implementation returns an empty string.- Specified by:
getPresentationName
in interfaceSelection
- Returns:
- An empty string.
-
createTransferable
public Transferable createTransferable(boolean snapshot)
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
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.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
-
-