Package com.bc.ceres.swing.selection
Interface SelectionContext
-
- All Superinterfaces:
Extensible
,SelectionChangeEmitter
,SelectionSource
- All Known Subinterfaces:
FigureEditor
- All Known Implementing Classes:
AbstractSelectionContext
,ComboBoxSelectionContext
,DefaultFigureEditor
,DefaultSelectionContext
,FigureSelectionContext
,ListSelectionContext
,TableSelectionContext
,TreeSelectionContext
public interface SelectionContext extends SelectionSource, Extensible
A selection context is aselection source
with additional capabilities, e.g. insert, delete and select all. It can be seen as the environment in which selections reside and originate, e.g. a GUI table, list, tree, or a drawing of figures.This interface may be directly implemented by clients, although it is advised to extend
AbstractSelectionContext
, since this interface may evolve in the future.- Since:
- Ceres 0.10
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canDeleteSelection()
boolean
canInsert(Transferable contents)
Tests whether the current contents (e.g.boolean
canSelectAll()
void
deleteSelection()
Deletes the current selection.void
insert(Transferable transferable)
Inserts a selection represented by the givenTransferable
into this context.void
selectAll()
Selects all items.void
setSelection(Selection selection)
Sets a new selection.-
Methods inherited from interface com.bc.ceres.core.Extensible
getExtension
-
Methods inherited from interface com.bc.ceres.swing.selection.SelectionChangeEmitter
addSelectionChangeListener, getSelectionChangeListeners, removeSelectionChangeListener
-
Methods inherited from interface com.bc.ceres.swing.selection.SelectionSource
getSelection
-
-
-
-
Method Detail
-
setSelection
void setSelection(Selection selection)
Sets a new selection.- Parameters:
selection
- The new selection.
-
canInsert
boolean canInsert(Transferable contents)
Tests whether the current contents (e.g. from clipboard, drag and drop) can be inserted into this selection context.- Parameters:
contents
- The contents.- Returns:
true
if the given contents can be inserted into this context.- See Also:
insert(Transferable)
-
insert
void insert(Transferable transferable) throws IOException, UnsupportedFlavorException
Inserts a selection represented by the givenTransferable
into this context.- Parameters:
transferable
- The transferable object.- Throws:
IOException
- if an I/O error occursUnsupportedFlavorException
- See Also:
canInsert(java.awt.datatransfer.Transferable)
,Selection.createTransferable(boolean)
,ClipboardOwner.lostOwnership(java.awt.datatransfer.Clipboard, java.awt.datatransfer.Transferable)
-
canDeleteSelection
boolean canDeleteSelection()
- Returns:
true
if the current selection can be deleted.- See Also:
deleteSelection()
-
deleteSelection
void deleteSelection()
Deletes the current selection.- See Also:
canDeleteSelection()
-
canSelectAll
boolean canSelectAll()
- Returns:
true
if all items can be selected.- See Also:
selectAll()
-
selectAll
void selectAll()
Selects all items.- See Also:
canSelectAll()
-
-