Class DefaultSelectionManager
- java.lang.Object
-
- com.bc.ceres.swing.selection.support.DefaultSelectionManager
-
- All Implemented Interfaces:
SelectionChangeEmitter
,SelectionManager
,SelectionSource
public class DefaultSelectionManager extends Object implements SelectionManager
A default implementation of theSelectionManager
interface.- Since:
- Ceres 0.10
-
-
Constructor Summary
Constructors Constructor Description DefaultSelectionManager()
DefaultSelectionManager(Object realEventSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSelectionChangeListener(SelectionChangeListener listener)
Adds a selection change listener to this emitter.Clipboard
getClipboard()
Selection
getSelection()
SelectionChangeListener[]
getSelectionChangeListeners()
Gets all registered selection change listeners.SelectionContext
getSelectionContext()
Gets the current selection context.void
removeSelectionChangeListener(SelectionChangeListener listener)
Removes a selection change listener from this emitter.void
setClipboard(Clipboard clipboard)
void
setSelectionContext(SelectionContext newSelectionContext)
Sets a new selection context.
-
-
-
Constructor Detail
-
DefaultSelectionManager
public DefaultSelectionManager()
-
DefaultSelectionManager
public DefaultSelectionManager(Object realEventSource)
-
-
Method Detail
-
getClipboard
public Clipboard getClipboard()
- Specified by:
getClipboard
in interfaceSelectionManager
- Returns:
- The clipboard used by this selection manager.
- See Also:
Toolkit.getSystemClipboard()
,Toolkit.getSystemSelection()
-
setClipboard
public void setClipboard(Clipboard clipboard)
-
getSelectionContext
public SelectionContext getSelectionContext()
Description copied from interface:SelectionManager
Gets the current selection context.- Specified by:
getSelectionContext
in interfaceSelectionManager
- Returns:
- The current selection context, or
null
.
-
setSelectionContext
public void setSelectionContext(SelectionContext newSelectionContext)
Description copied from interface:SelectionManager
Sets a new selection context.- Specified by:
setSelectionContext
in interfaceSelectionManager
- Parameters:
newSelectionContext
- The new selection context, ornull
.
-
getSelection
public Selection getSelection()
- Specified by:
getSelection
in interfaceSelectionSource
- Returns:
- The current selection. The selection may be empty, but never
null
. - See Also:
Selection.EMPTY
,Selection.isEmpty()
-
addSelectionChangeListener
public void addSelectionChangeListener(SelectionChangeListener listener)
Description copied from interface:SelectionChangeEmitter
Adds a selection change listener to this emitter.- Specified by:
addSelectionChangeListener
in interfaceSelectionChangeEmitter
- Parameters:
listener
- The listener.
-
removeSelectionChangeListener
public void removeSelectionChangeListener(SelectionChangeListener listener)
Description copied from interface:SelectionChangeEmitter
Removes a selection change listener from this emitter.- Specified by:
removeSelectionChangeListener
in interfaceSelectionChangeEmitter
- Parameters:
listener
- The listener.
-
getSelectionChangeListeners
public SelectionChangeListener[] getSelectionChangeListeners()
Description copied from interface:SelectionChangeEmitter
Gets all registered selection change listeners.- Specified by:
getSelectionChangeListeners
in interfaceSelectionChangeEmitter
- Returns:
- An array containing all registered listeners.
-
-