Package com.bc.ceres.swing.selection
Interface Selection
-
- All Superinterfaces:
ClipboardOwner
,Cloneable
,Extensible
- All Known Subinterfaces:
FigureSelection
- All Known Implementing Classes:
AbstractSelection
,DefaultFigureSelection
,DefaultSelection
public interface Selection extends ClipboardOwner, Cloneable, Extensible
Represents a selection of zero, one or more items, e.g. the selected entries of a table, nodes of a tree view or figures of a drawing.This interface may be implemented by clients.
Selections should always be implemented as imutable objects.
- Since:
- Ceres 0.10
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Selection
clone()
Creates and returns a copy of this selection.Transferable
createTransferable(boolean snapshot)
Creates a transferable representation of this selection.String
getPresentationName()
Returns a localized, human-readable description of this selection, suitable for use in a change log or menu entry, for example.Object
getSelectedValue()
Gets the selected value.Object[]
getSelectedValues()
Gets the selected values of a multiple selection.boolean
isEmpty()
-
Methods inherited from interface java.awt.datatransfer.ClipboardOwner
lostOwnership
-
Methods inherited from interface com.bc.ceres.core.Extensible
getExtension
-
-
-
-
Field Detail
-
EMPTY
static final Selection EMPTY
An empty selection.
-
-
Method Detail
-
getPresentationName
String getPresentationName()
Returns a localized, human-readable description of this selection, suitable for use in a change log or menu entry, for example.- Returns:
- A presentation name for this selection.
-
isEmpty
boolean isEmpty()
- Returns:
true
if this selection is empty.
-
getSelectedValue
Object getSelectedValue()
Gets the selected value. The method returnsnull
if this selectionis empty
.- Returns:
- The selected value, or
null
.
-
getSelectedValues
Object[] getSelectedValues()
Gets the selected values of a multiple selection. The method returns an empty array if this selectionis empty
.- Returns:
- The array of selected values.
-
createTransferable
Transferable createTransferable(boolean snapshot)
Creates a transferable representation of this selection.- Parameters:
snapshot
- 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.
-
clone
Selection clone()
Creates and returns a copy of this selection.- Returns:
- A clone of this selection instance.
-
-