Class FigureSelectionContext
- java.lang.Object
-
- com.bc.ceres.core.ExtensibleObject
-
- com.bc.ceres.swing.figure.support.FigureSelectionContext
-
- All Implemented Interfaces:
Extensible
,SelectionChangeEmitter
,SelectionContext
,SelectionSource
public class FigureSelectionContext extends ExtensibleObject implements SelectionContext
-
-
Constructor Summary
Constructors Constructor Description FigureSelectionContext(FigureEditor figureEditor)
FigureSelectionContext(FigureEditor figureEditor, FigureCollection figureCollection, FigureSelection figureSelection)
-
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.boolean
canDeleteSelection()
boolean
canInsert(Transferable contents)
Tests whether the current contents (e.g.boolean
canSelectAll()
void
deleteSelection()
Deletes the current selection.FigureCollection
getFigureCollection()
FigureEditor
getFigureEditor()
FigureSelection
getFigureSelection()
Selection
getSelection()
SelectionChangeListener[]
getSelectionChangeListeners()
Gets all registered selection change listeners.void
insert(Transferable contents)
Inserts a selection represented by the givenTransferable
into this context.void
removeSelectionChangeListener(SelectionChangeListener listener)
Removes a selection change listener from this emitter.void
selectAll()
Selects all items.void
setSelection(Selection selection)
Sets a new selection.-
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
-
FigureSelectionContext
public FigureSelectionContext(FigureEditor figureEditor)
-
FigureSelectionContext
public FigureSelectionContext(FigureEditor figureEditor, FigureCollection figureCollection, FigureSelection figureSelection)
-
-
Method Detail
-
getFigureEditor
public FigureEditor getFigureEditor()
-
getFigureCollection
public FigureCollection getFigureCollection()
-
getFigureSelection
public FigureSelection getFigureSelection()
-
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()
-
setSelection
public void setSelection(Selection selection)
Description copied from interface:SelectionContext
Sets a new selection.- Specified by:
setSelection
in interfaceSelectionContext
- Parameters:
selection
- The new selection.
-
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.
-
insert
public void insert(Transferable contents) throws IOException, UnsupportedFlavorException
Description copied from interface:SelectionContext
Inserts a selection represented by the givenTransferable
into this context.- Specified by:
insert
in interfaceSelectionContext
- Parameters:
contents
- 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)
-
canDeleteSelection
public boolean canDeleteSelection()
- Specified by:
canDeleteSelection
in interfaceSelectionContext
- 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
- See Also:
SelectionContext.canDeleteSelection()
-
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
- Parameters:
contents
- The contents.- Returns:
true
if the given contents can be inserted into this context.- See Also:
SelectionContext.insert(Transferable)
-
selectAll
public void selectAll()
Description copied from interface:SelectionContext
Selects all items.- Specified by:
selectAll
in interfaceSelectionContext
- See Also:
SelectionContext.canSelectAll()
-
canSelectAll
public boolean canSelectAll()
- Specified by:
canSelectAll
in interfaceSelectionContext
- Returns:
true
if all items can be selected.- See Also:
SelectionContext.selectAll()
-
-