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 boolean
canDeleteSelection()
boolean
canInsert(Transferable contents)
Tests whether the current contents (e.g.void
deleteSelection()
Deletes the current selection.JList
getList()
Selection
getSelection()
protected void
handleListSelectionChange(ListSelectionEvent event)
void
insert(Transferable transferable)
Inserts a selection represented by the givenTransferable
into this context.void
setList(JList list)
void
setSelection(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:SelectionContext
Sets a new selection.- Parameters:
selection
- The new selection.
-
insert
public void insert(Transferable transferable) throws IOException, UnsupportedFlavorException
Description copied from interface:SelectionContext
Inserts a selection represented by the givenTransferable
into this context.- Specified by:
insert
in interfaceSelectionContext
- Overrides:
insert
in 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:SelectionContext
Tests whether the current contents (e.g. from clipboard, drag and drop) can be inserted into this selection context.- Specified by:
canInsert
in interfaceSelectionContext
- Overrides:
canInsert
in classAbstractSelectionContext
- Parameters:
contents
- The contents.- Returns:
true
if the given contents can be inserted into this context.- See Also:
SelectionContext.insert(Transferable)
-
canDeleteSelection
public boolean canDeleteSelection()
- Specified by:
canDeleteSelection
in interfaceSelectionContext
- Overrides:
canDeleteSelection
in classAbstractSelectionContext
- Returns:
true
if the current selection can be deleted.- See Also:
SelectionContext.deleteSelection()
-
deleteSelection
public void deleteSelection()
Description copied from interface:SelectionContext
Deletes the current selection.- Specified by:
deleteSelection
in interfaceSelectionContext
- Overrides:
deleteSelection
in classAbstractSelectionContext
- See Also:
SelectionContext.canDeleteSelection()
-
getList
public JList getList()
-
setList
public void setList(JList list)
-
handleListSelectionChange
protected void handleListSelectionChange(ListSelectionEvent event)
-
-