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
public class DefaultFigureEditor extends ExtensibleObject implements FigureEditor
A default implementation of a figure editor.- Since:
- Ceres 0.10
-
-
Constructor Summary
Constructors Constructor Description DefaultFigureEditor(JComponent editorComponent)DefaultFigureEditor(JComponent editorComponent, Viewport viewport, UndoContext undoContext, FigureCollection figureCollection, FigureFactory figureFactory)
-
Method Summary
-
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
-
DefaultFigureEditor
public DefaultFigureEditor(JComponent editorComponent)
-
DefaultFigureEditor
public DefaultFigureEditor(JComponent editorComponent, Viewport viewport, UndoContext undoContext, FigureCollection figureCollection, FigureFactory figureFactory)
-
-
Method Detail
-
getUndoContext
public UndoContext getUndoContext()
- Specified by:
getUndoContextin interfaceFigureEditor
-
getEditorComponent
public JComponent getEditorComponent()
- Specified by:
getEditorComponentin interfaceFigureEditor
-
insertFigures
public void insertFigures(boolean performInsert, Figure... figures)- Specified by:
insertFiguresin interfaceFigureEditor
-
deleteFigures
public void deleteFigures(boolean performDelete, Figure... figures)- Specified by:
deleteFiguresin interfaceFigureEditor
-
changeFigure
public void changeFigure(Figure figure, Object figureMemento, String presentationName)
- Specified by:
changeFigurein interfaceFigureEditor
-
getSelectionContext
public SelectionContext getSelectionContext()
- Specified by:
getSelectionContextin interfaceFigureEditor
-
getSelectionRectangle
public Rectangle getSelectionRectangle()
- Specified by:
getSelectionRectanglein interfaceFigureEditor
-
setSelectionRectangle
public void setSelectionRectangle(Rectangle newRect)
- Specified by:
setSelectionRectanglein interfaceFigureEditor
-
getFigureCollection
public FigureCollection getFigureCollection()
- Specified by:
getFigureCollectionin interfaceFigureEditor
-
setFigureCollection
public void setFigureCollection(FigureCollection figureCollection)
-
getFigureSelection
public FigureSelection getFigureSelection()
- Specified by:
getFigureSelectionin interfaceFigureEditor
-
getFigureFactory
public FigureFactory getFigureFactory()
- Specified by:
getFigureFactoryin interfaceFigureEditor
-
setFigureFactory
public void setFigureFactory(FigureFactory figureFactory)
-
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()
-
getInteractor
public Interactor getInteractor()
- Specified by:
getInteractorin interfaceInteractorAware
-
setInteractor
public void setInteractor(Interactor interactor)
- Specified by:
setInteractorin interfaceFigureEditor
-
getViewport
public Viewport getViewport()
- Specified by:
getViewportin interfaceViewportAware- Returns:
- The viewport.
-
getDefaultLineStyle
public FigureStyle getDefaultLineStyle()
- Specified by:
getDefaultLineStylein interfaceFigureEditor
-
setDefaultLineStyle
public void setDefaultLineStyle(FigureStyle defaultLineStyle)
-
getDefaultPolygonStyle
public FigureStyle getDefaultPolygonStyle()
- Specified by:
getDefaultPolygonStylein interfaceFigureEditor
-
setDefaultPolygonStyle
public void setDefaultPolygonStyle(FigureStyle defaultPolygonStyle)
-
draw
public void draw(Rendering rendering)
CallsdrawFigureCollection(rendering); drawFigureSelection(rendering); drawSelectionRectangle(rendering);
- Parameters:
rendering- The rendering.
-
drawFigureCollection
public void drawFigureCollection(Rendering rendering)
-
drawFigureSelection
public void drawFigureSelection(Rendering rendering)
-
drawSelectionRectangle
public void drawSelectionRectangle(Rendering rendering)
-
-