Class ListSelectionContext
- java.lang.Object
-
- com.bc.ceres.core.ExtensibleObject
-
- com.bc.ceres.swing.selection.AbstractSelectionContext
-
- com.bc.ceres.swing.selection.support.ListSelectionContext
-
- All Implemented Interfaces:
Extensible,SelectionChangeEmitter,SelectionContext,SelectionSource
public class ListSelectionContext extends AbstractSelectionContext
-
-
Constructor Summary
Constructors Constructor Description ListSelectionContext(JList list)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanDeleteSelection()booleancanInsert(Transferable contents)Tests whether the current contents (e.g.voiddeleteSelection()Deletes the current selection.JListgetList()SelectiongetSelection()protected voidhandleListSelectionChange(ListSelectionEvent event)voidinsert(Transferable transferable)Inserts a selection represented by the givenTransferableinto this context.voidsetList(JList list)voidsetSelection(Selection selection)Sets a new selection.-
Methods inherited from class com.bc.ceres.swing.selection.AbstractSelectionContext
addSelectionChangeListener, canSelectAll, fireSelectionChange, getSelectionChangeListeners, removeSelectionChangeListener, selectAll
-
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.bc.ceres.core.Extensible
getExtension
-
-
-
-
Constructor Detail
-
ListSelectionContext
public ListSelectionContext(JList list)
-
-
Method Detail
-
getSelection
public Selection getSelection()
- Returns:
- The current selection. The selection may be empty, but never
null. - See Also:
Selection.EMPTY,Selection.isEmpty()
-
setSelection
public void setSelection(Selection selection)
Description copied from interface:SelectionContextSets a new selection.- Parameters:
selection- The new selection.
-
insert
public void insert(Transferable transferable) throws IOException, UnsupportedFlavorException
Description copied from interface:SelectionContextInserts a selection represented by the givenTransferableinto this context.- Specified by:
insertin interfaceSelectionContext- Overrides:
insertin classAbstractSelectionContext- Parameters:
transferable- The transferable object.- Throws:
IOException- if an I/O error occursUnsupportedFlavorException- See Also:
SelectionContext.canInsert(java.awt.datatransfer.Transferable),Selection.createTransferable(boolean),ClipboardOwner.lostOwnership(java.awt.datatransfer.Clipboard, java.awt.datatransfer.Transferable)
-
canInsert
public boolean canInsert(Transferable contents)
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- Overrides:
canInsertin classAbstractSelectionContext- Parameters:
contents- The contents.- Returns:
trueif the given contents can be inserted into this context.- See Also:
SelectionContext.insert(Transferable)
-
canDeleteSelection
public boolean canDeleteSelection()
- Specified by:
canDeleteSelectionin interfaceSelectionContext- Overrides:
canDeleteSelectionin classAbstractSelectionContext- Returns:
trueif the current selection can be deleted.- See Also:
SelectionContext.deleteSelection()
-
deleteSelection
public void deleteSelection()
Description copied from interface:SelectionContextDeletes the current selection.- Specified by:
deleteSelectionin interfaceSelectionContext- Overrides:
deleteSelectionin classAbstractSelectionContext- See Also:
SelectionContext.canDeleteSelection()
-
getList
public JList getList()
-
setList
public void setList(JList list)
-
handleListSelectionChange
protected void handleListSelectionChange(ListSelectionEvent event)
-
-