Package com.bc.ceres.swing.selection
Class AbstractSelectionContext
java.lang.Object
com.bc.ceres.core.ExtensibleObject
com.bc.ceres.swing.selection.AbstractSelectionContext
- All Implemented Interfaces:
Extensible,SelectionChangeEmitter,SelectionContext,SelectionSource
- Direct Known Subclasses:
ComboBoxSelectionContext,DefaultSelectionContext,ListSelectionContext,TableSelectionContext,TreeSelectionContext
A handy base class for implementations of the
SelectionContext interface.
Clients only need to implement the methods SelectionSource.getSelection()
and SelectionContext.setSelection(Selection).
No particular selection operations are implemented, e.g. canDeleteSelection(),
canInsert(java.awt.datatransfer.Transferable), canSelectAll(),
all return false.
- Since:
- Ceres 0.10
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractSelectionContext(Object selectionSource) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a selection change listener to this emitter.booleanbooleancanInsert(Transferable contents) Tests whether the current contents (e.g.booleanvoidDeletes the current selection.protected voidfireSelectionChange(Selection selection) Gets all registered selection change listeners.voidinsert(Transferable transferable) Inserts a selection represented by the givenTransferableinto this context.voidRemoves a selection change listener from this emitter.voidSelects all items.Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.bc.ceres.core.Extensible
getExtensionMethods inherited from interface com.bc.ceres.swing.selection.SelectionContext
setSelectionMethods inherited from interface com.bc.ceres.swing.selection.SelectionSource
getSelection
-
Constructor Details
-
AbstractSelectionContext
protected AbstractSelectionContext() -
AbstractSelectionContext
-
-
Method Details
-
canInsert
Description copied from interface:SelectionContextTests whether the current contents (e.g. from clipboard, drag and drop) can be inserted into this selection context.- Specified by:
canInsertin interfaceSelectionContext- Parameters:
contents- The contents.- Returns:
trueif the given contents can be inserted into this context.- See Also:
-
insert
Description copied from interface:SelectionContextInserts a selection represented by the givenTransferableinto this context.- Specified by:
insertin interfaceSelectionContext- Parameters:
transferable- The transferable object.- Throws:
IOException- if an I/O error occursUnsupportedFlavorException- See Also:
-
canDeleteSelection
public boolean canDeleteSelection()- Specified by:
canDeleteSelectionin interfaceSelectionContext- Returns:
trueif the current selection can be deleted.- See Also:
-
deleteSelection
public void deleteSelection()Description copied from interface:SelectionContextDeletes the current selection.- Specified by:
deleteSelectionin interfaceSelectionContext- See Also:
-
canSelectAll
public boolean canSelectAll()- Specified by:
canSelectAllin interfaceSelectionContext- Returns:
trueif all items can be selected.- See Also:
-
selectAll
public void selectAll()Description copied from interface:SelectionContextSelects all items.- Specified by:
selectAllin interfaceSelectionContext- See Also:
-
addSelectionChangeListener
Description copied from interface:SelectionChangeEmitterAdds a selection change listener to this emitter.- Specified by:
addSelectionChangeListenerin interfaceSelectionChangeEmitter- Parameters:
listener- The listener.
-
removeSelectionChangeListener
Description copied from interface:SelectionChangeEmitterRemoves a selection change listener from this emitter.- Specified by:
removeSelectionChangeListenerin interfaceSelectionChangeEmitter- Parameters:
listener- The listener.
-
getSelectionChangeListeners
Description copied from interface:SelectionChangeEmitterGets all registered selection change listeners.- Specified by:
getSelectionChangeListenersin interfaceSelectionChangeEmitter- Returns:
- An array containing all registered listeners.
-
fireSelectionChange
-