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 theSelectioninterface.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 protectedAbstractSelection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractSelectionclone()Creates and returns a copy of this selection.TransferablecreateTransferable(boolean snapshot)The default implementation returnsnull.StringgetPresentationName()The default implementation returns an empty string.Object[]getSelectedValues()Gets the selected values of a multiple selection.booleanisEmpty()voidlostOwnership(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: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()
-
getPresentationName
public String getPresentationName()
The default implementation returns an empty string.- Specified by:
getPresentationNamein interfaceSelection- Returns:
- An empty string.
-
createTransferable
public Transferable createTransferable(boolean snapshot)
The default implementation returnsnull.- Specified by:
createTransferablein interfaceSelection- Parameters:
snapshot- Iftrue, the returnedTransferableshould hold a copy-of rather than a reference-to the selection.- Returns:
nullby 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:
lostOwnershipin interfaceClipboardOwner- Parameters:
clipboard- the clipboard that is no longer ownedcontents- the contents which this owner had placed on the clipboard
-
-