Class DefaultSelection<T>
- java.lang.Object
-
- com.bc.ceres.core.ExtensibleObject
-
- com.bc.ceres.swing.selection.AbstractSelection
-
- com.bc.ceres.swing.selection.support.DefaultSelection<T>
-
- All Implemented Interfaces:
Extensible
,Selection
,ClipboardOwner
,Cloneable
public class DefaultSelection<T> extends AbstractSelection
A default implementation of theSelection
interface.- Since:
- Ceres 0.10
-
-
Constructor Summary
Constructors Constructor Description DefaultSelection(T... selectedValues)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultSelection<T>
clone()
Creates and returns a copy of this selection.Transferable
createTransferable(boolean snapshot)
The default implementation returnsnull
.boolean
equals(Object o)
String
getPresentationName()
The default implementation returns an empty string.T
getSelectedValue()
Gets the selected value.T[]
getSelectedValues()
Gets the selected values of a multiple selection.int
hashCode()
boolean
isEmpty()
String
toString()
-
Methods inherited from class com.bc.ceres.swing.selection.AbstractSelection
lostOwnership
-
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.bc.ceres.core.Extensible
getExtension
-
-
-
-
Constructor Detail
-
DefaultSelection
public DefaultSelection(T... selectedValues)
-
-
Method Detail
-
getSelectedValue
public T getSelectedValue()
Description copied from interface:Selection
Gets the selected value. The method returnsnull
if this selectionis empty
.- Returns:
- The selected value, or
null
.
-
getSelectedValues
public T[] 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
- Overrides:
getSelectedValues
in classAbstractSelection
- Returns:
- The array of selected values.
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceSelection
- Overrides:
isEmpty
in classAbstractSelection
- Returns:
true
if this selection is empty.
-
getPresentationName
public String getPresentationName()
Description copied from class:AbstractSelection
The default implementation returns an empty string.- Specified by:
getPresentationName
in interfaceSelection
- Overrides:
getPresentationName
in classAbstractSelection
- Returns:
- An empty string.
-
createTransferable
public Transferable createTransferable(boolean snapshot)
Description copied from class:AbstractSelection
The default implementation returnsnull
.- Specified by:
createTransferable
in interfaceSelection
- Overrides:
createTransferable
in classAbstractSelection
- Parameters:
snapshot
- Iftrue
, the returnedTransferable
should hold a copy-of rather than a reference-to the selection.- Returns:
null
by default.
-
clone
public DefaultSelection<T> clone()
Description copied from interface:Selection
Creates and returns a copy of this selection.- Specified by:
clone
in interfaceSelection
- Overrides:
clone
in classAbstractSelection
- Returns:
- A clone of this selection instance.
-
-