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 voidaddSelectionChangeListener(SelectionChangeListener listener)Adds a selection change listener to this emitter.booleancanDeleteSelection()booleancanInsert(Transferable contents)Tests whether the current contents (e.g.booleancanSelectAll()voiddeleteSelection()Deletes the current selection.FigureCollectiongetFigureCollection()FigureEditorgetFigureEditor()FigureSelectiongetFigureSelection()SelectiongetSelection()SelectionChangeListener[]getSelectionChangeListeners()Gets all registered selection change listeners.voidinsert(Transferable contents)Inserts a selection represented by the givenTransferableinto this context.voidremoveSelectionChangeListener(SelectionChangeListener listener)Removes a selection change listener from this emitter.voidselectAll()Selects all items.voidsetSelection(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:
getSelectionin 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:SelectionContextSets a new selection.- Specified by:
setSelectionin interfaceSelectionContext- Parameters:
selection- The new selection.
-
addSelectionChangeListener
public void addSelectionChangeListener(SelectionChangeListener listener)
Description copied from interface:SelectionChangeEmitterAdds a selection change listener to this emitter.- Specified by:
addSelectionChangeListenerin interfaceSelectionChangeEmitter- Parameters:
listener- The listener.
-
removeSelectionChangeListener
public void removeSelectionChangeListener(SelectionChangeListener listener)
Description copied from interface:SelectionChangeEmitterRemoves a selection change listener from this emitter.- Specified by:
removeSelectionChangeListenerin interfaceSelectionChangeEmitter- Parameters:
listener- The listener.
-
getSelectionChangeListeners
public SelectionChangeListener[] getSelectionChangeListeners()
Description copied from interface:SelectionChangeEmitterGets all registered selection change listeners.- Specified by:
getSelectionChangeListenersin interfaceSelectionChangeEmitter- Returns:
- An array containing all registered listeners.
-
insert
public void insert(Transferable contents) throws IOException, UnsupportedFlavorException
Description copied from interface:SelectionContextInserts a selection represented by the givenTransferableinto this context.- Specified by:
insertin 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:
canDeleteSelectionin interfaceSelectionContext- 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- See Also:
SelectionContext.canDeleteSelection()
-
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- Parameters:
contents- The contents.- Returns:
trueif the given contents can be inserted into this context.- See Also:
SelectionContext.insert(Transferable)
-
selectAll
public void selectAll()
Description copied from interface:SelectionContextSelects all items.- Specified by:
selectAllin interfaceSelectionContext- See Also:
SelectionContext.canSelectAll()
-
canSelectAll
public boolean canSelectAll()
- Specified by:
canSelectAllin interfaceSelectionContext- Returns:
trueif all items can be selected.- See Also:
SelectionContext.selectAll()
-
-