Class DefaultFigureEditor
java.lang.Object
com.bc.ceres.core.ExtensibleObject
com.bc.ceres.swing.figure.support.DefaultFigureEditor
- All Implemented Interfaces:
Extensible
,ViewportAware
,FigureEditor
,InteractorAware
,SelectionChangeEmitter
,SelectionContext
,SelectionSource
A default implementation of a figure editor.
- Since:
- Ceres 0.10
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultFigureEditor
(JComponent editorComponent) DefaultFigureEditor
(JComponent editorComponent, Viewport viewport, UndoContext undoContext, FigureCollection figureCollection, FigureFactory figureFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a selection change listener to this emitter.boolean
boolean
canInsert
(Transferable contents) Tests whether the current contents (e.g.boolean
void
changeFigure
(Figure figure, Object figureMemento, String presentationName) void
deleteFigures
(boolean performDelete, Figure... figures) void
Deletes the current selection.void
Callsvoid
drawFigureCollection
(Rendering rendering) void
drawFigureSelection
(Rendering rendering) void
drawSelectionRectangle
(Rendering rendering) Gets all registered selection change listeners.void
insert
(Transferable contents) Inserts a selection represented by the givenTransferable
into this context.void
insertFigures
(boolean performInsert, Figure... figures) void
Removes a selection change listener from this emitter.void
Selects all items.void
setDefaultLineStyle
(FigureStyle defaultLineStyle) void
setDefaultPolygonStyle
(FigureStyle defaultPolygonStyle) void
setFigureCollection
(FigureCollection figureCollection) void
setFigureFactory
(FigureFactory figureFactory) void
setInteractor
(Interactor interactor) void
setSelection
(Selection selection) Sets a new selection.void
setSelectionRectangle
(Rectangle newRect) 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 Details
-
DefaultFigureEditor
-
DefaultFigureEditor
public DefaultFigureEditor(JComponent editorComponent, Viewport viewport, UndoContext undoContext, FigureCollection figureCollection, FigureFactory figureFactory)
-
-
Method Details
-
getUndoContext
- Specified by:
getUndoContext
in interfaceFigureEditor
-
getEditorComponent
- Specified by:
getEditorComponent
in interfaceFigureEditor
-
insertFigures
- Specified by:
insertFigures
in interfaceFigureEditor
-
deleteFigures
- Specified by:
deleteFigures
in interfaceFigureEditor
-
changeFigure
- Specified by:
changeFigure
in interfaceFigureEditor
-
getSelectionContext
- Specified by:
getSelectionContext
in interfaceFigureEditor
-
getSelectionRectangle
- Specified by:
getSelectionRectangle
in interfaceFigureEditor
-
setSelectionRectangle
- Specified by:
setSelectionRectangle
in interfaceFigureEditor
-
getFigureCollection
- Specified by:
getFigureCollection
in interfaceFigureEditor
-
setFigureCollection
-
getFigureSelection
- Specified by:
getFigureSelection
in interfaceFigureEditor
-
getFigureFactory
- Specified by:
getFigureFactory
in interfaceFigureEditor
-
setFigureFactory
-
getSelection
- Specified by:
getSelection
in interfaceSelectionSource
- Returns:
- The current selection. The selection may be empty, but never
null
. - See Also:
-
setSelection
Description copied from interface:SelectionContext
Sets a new selection.- Specified by:
setSelection
in interfaceSelectionContext
- Parameters:
selection
- The new selection.
-
addSelectionChangeListener
Description copied from interface:SelectionChangeEmitter
Adds a selection change listener to this emitter.- Specified by:
addSelectionChangeListener
in interfaceSelectionChangeEmitter
- Parameters:
listener
- The listener.
-
removeSelectionChangeListener
Description copied from interface:SelectionChangeEmitter
Removes a selection change listener from this emitter.- Specified by:
removeSelectionChangeListener
in interfaceSelectionChangeEmitter
- Parameters:
listener
- The listener.
-
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
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:
-
canDeleteSelection
public boolean canDeleteSelection()- Specified by:
canDeleteSelection
in interfaceSelectionContext
- Returns:
true
if the current selection can be deleted.- See Also:
-
deleteSelection
public void deleteSelection()Description copied from interface:SelectionContext
Deletes the current selection.- Specified by:
deleteSelection
in interfaceSelectionContext
- See Also:
-
canInsert
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:
-
selectAll
public void selectAll()Description copied from interface:SelectionContext
Selects all items.- Specified by:
selectAll
in interfaceSelectionContext
- See Also:
-
canSelectAll
public boolean canSelectAll()- Specified by:
canSelectAll
in interfaceSelectionContext
- Returns:
true
if all items can be selected.- See Also:
-
getInteractor
- Specified by:
getInteractor
in interfaceInteractorAware
-
setInteractor
- Specified by:
setInteractor
in interfaceFigureEditor
-
getViewport
- Specified by:
getViewport
in interfaceViewportAware
- Returns:
- The viewport.
-
getDefaultLineStyle
- Specified by:
getDefaultLineStyle
in interfaceFigureEditor
-
setDefaultLineStyle
-
getDefaultPolygonStyle
- Specified by:
getDefaultPolygonStyle
in interfaceFigureEditor
-
setDefaultPolygonStyle
-
draw
CallsdrawFigureCollection(rendering); drawFigureSelection(rendering); drawSelectionRectangle(rendering);
- Parameters:
rendering
- The rendering.
-
drawFigureCollection
-
drawFigureSelection
-
drawSelectionRectangle
-