Package com.reportmill.editor
Class RMEditor
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.reportmill.RMViewer
com.reportmill.editor.RMEditor
- All Implemented Interfaces:
RMDocument.DocListener
,ImageObserver
,MenuContainer
,Serializable
- Direct Known Subclasses:
RBEditor
,RMRptEditor
This class subclasses RMViewer to support RMDocument editing.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class com.reportmill.RMViewer
GridColor, MarginColor, PRINT_MODE_RASTER, PRINT_MODE_VECTOR
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPage()
Adds a page to the document after current page.void
Adds a given page to the current document at the given index.void
Adds a page to the document before current page.void
addShapesToShape
(List shapes, RMShape aShape, boolean withCorrection) Adds shapes as children to given shape.void
addShapeToSelectedShapes
(RMShape aShape) Add a shape to the selected shapes list.void
copy()
Standard clipboard copy functionality.void
cut()
Standard clipboard cut functionality.void
delete()
Deletes all the currently selected shapes.void
docUndoerAddDirtyObject
(RMDocument aDoc, RMObject anObj) Doc listener method - RMViewer ignores it, but RMEditor calls setUndoSelectedObjects.Returns the first SuperSelectedShape that accepts children.Returns the first SuperSelected shape that accepts children at a given point.Returns the first super selected shape that accepts children or whose children super select immediately.void
This method finalizes any (potentially cached) changes in progress in the editor (like from text editing).Returns the Map of tags and classes to be used for unarchiving document shapes.getChildShapeAtPoint
(RMShape aShape, RMPoint aPoint) Returns the child of the given shape hit by the given point.Tool method - returns the currently selected tool.Returns the datasource associated with the editor's document.Returns the sample dataset from the document's datasource.void
Called to enabled drag and drop.Returns the shape painter (which is actually an editor shape painter).Returns the even helper object.Returns the description for the editor document for use in open/save panels.Returns extension for editor document.Overrides viewer method to ensure editor is always at least 575x300.Returns the currently selected shape or, if none, the super-selected shape.getSelectedOrSuperSelectedShape
(int anIndex) Returns the currently selected shape at the given index, or the super-selected shape.int
Returns the number of currently selected shapes or simply 1, if a shape is super-selected.Returns the first selected shape.getSelectedShape
(int anIndex) Returns the selected shape at the given index.int
Returns the number of selected shapes.Returns the selected shapes list.Returns the currentlys elected shapes or, if none, the super-selected shape in a list.getShapeAtPoint
(Point2D aPoint) Returns first shape hit by point given in View coords.Returns the first super-selected shape.getSuperSelectedShape
(int anIndex) Returns the super-selected shape at the given index.int
Returns the number of super-selected shapes.Returns the super selected shape list.Returns the text editor (or null if not editing).getTextEditor
(boolean evenIfNotActive) Returns the text editor (even if not editing).getTextEditor
(RMText aText) Returns the text editor, primed for editing the given text shape.boolean
Returns whether the editor is in a state of constant change, like during a mouse drag loop.Returns the window ancestor that the editor component resides in.boolean
Returns whether the select tool is currently selected.boolean
Tool method - Returns whether the select tool is currently selected and if it's currently being used to select.boolean
This gives us tab events, but seems to be deprecated.boolean
Returns whether editor is preview (or viewer) mode.static RMEditor
Returns the editor that was most recently used.void
mouseDragged
(MouseEvent anEvent) Handle mouse dragged event.void
mouseMoved
(MouseEvent anEvent) Handle mouse moved event.void
mousePressed
(MouseEvent anEvent) Handle mouse pressed event.void
mouseReleased
(MouseEvent anEvent) Handle mouse released event.void
RMEditor drawing.void
paintViewportAbove
(Graphics2D g2, JViewport aViewport) Paints editor stuff in viewport, so that it's independent of scroll.void
paste()
Standard clipbard paste functionality.void
Un-SuperSelect currently super selected shape.protected void
Handle key events.protected void
Handle key event super - so RMEditorEvents can get at default behavior.void
redo()
Called to redo the last undo operation in the editor.void
Removes current page from document.void
removePage
(int index) Removes the document page at the given index.void
removeShapeFromSelectedShapes
(RMShape aShape) Remove a shape from the selected shapes list.void
Resets the currently selected tool.void
Causes all the children of the current super selected shape to become selected.void
selectShape
(RMShape aShape) Selects the given shape.void
selectShapes
(List shapes) Selects the shapes in the given list.void
setCurrentTool
(int anIndex) Tool method - sets the currently selected tool to the specific Tool's core tool at the given index.void
setCurrentTool
(Tool aTool) Tool method - sets the currently select tool to the given tool.void
Sets the current tool to the select tool.void
setDataSource
(Object aSource) Sets the datasource associated with the editor's document.void
setDocument
(RMDocument aDoc) Overrides viewer method to add an undoer to document.void
setPreview
(boolean doPreview) Sets whether editor should be in preview (or viewer) mode.void
setSelectedPageIndex
(int index) Override viewer method to reset selected shapes on page change.void
setZoomFactor
(float aFactor) Overrides viewer method to focus zoomed region on selected shapes.void
SuperSelect currently selected shape.void
superSelectShape
(RMShape aShape) Super select a shape.void
undo()
Called to undo the last edit operation in the editor.Methods inherited from class com.reportmill.RMViewer
convertPointFromShape, convertPointToShape, convertRectFromShape, convertRectToShape, docShapeBoundsChanged, docShapeNeedsRepaint, drawsBackground, flushGraphics, getBook, getDirtyRect, getDocument, getDocumentBounds, getFilename, getMinimumSize, getPageBounds, getPageLayout, getPrintingDPI, getPrintingMode, getRenderingHints, getSelectedPage, getSelectedPageIndex, getShapeAtPoint, getShapePainter, getShapeRepaintEnabled, getTransformFromShape, getUndoer, getZoomFactor, pageBack, pageForward, paintComponent, performActionURLClick, print, print, print2, print2, processMouseEvent, processMouseMotionEvent, repaint, runZoomPanel, setPrintingDPI, setPrintingMode, setShapePainter, setShapeRepaintEnabled, setZoomForScreenResolution, undoerAddChildToShape, undoerDisable, undoerEnable, undoerHasUndos, undoerSetCoalesce, undoerSetUndoTitle, updateShapeUnderStack, zoomToggleLast
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
RMEditor
public RMEditor()Creates a new editor. -
RMEditor
Creates an editor initialized with a document from aSource (String(path), File, InputStream, bytes, etc.).
-
-
Method Details
-
mainEditor
Returns the editor that was most recently used. -
setDocument
Overrides viewer method to add an undoer to document.- Overrides:
setDocument
in classRMViewer
-
isPreview
public boolean isPreview()Returns whether editor is preview (or viewer) mode. -
setPreview
public void setPreview(boolean doPreview) Sets whether editor should be in preview (or viewer) mode. -
getValueIsAdjusting
public boolean getValueIsAdjusting()Returns whether the editor is in a state of constant change, like during a mouse drag loop. -
getFileExtension
Returns extension for editor document. -
getFileDescription
Returns the description for the editor document for use in open/save panels. -
getWindow
Returns the window ancestor that the editor component resides in. -
getDragAndDrop
public void getDragAndDrop()Called to enabled drag and drop. -
getTextEditor
Returns the text editor (or null if not editing). -
getTextEditor
Returns the text editor (even if not editing). -
getTextEditor
Returns the text editor, primed for editing the given text shape. -
getSelectedShapeCount
public int getSelectedShapeCount()Returns the number of selected shapes. -
getSelectedShape
Returns the selected shape at the given index. -
getSelectedShape
Returns the first selected shape. -
getSelectedShapes
Returns the selected shapes list. -
getSuperSelectedShapeCount
public int getSuperSelectedShapeCount()Returns the number of super-selected shapes. -
getSuperSelectedShape
Returns the super-selected shape at the given index. -
getSuperSelectedShape
Returns the first super-selected shape. -
getSuperSelectedShapes
Returns the super selected shape list. -
getSelectedOrSuperSelectedShape
Returns the currently selected shape or, if none, the super-selected shape. -
getSelectedShapesOrSuperSelectedShape
Returns the currentlys elected shapes or, if none, the super-selected shape in a list. -
getSelectedOrSuperSelectedShapeCount
public int getSelectedOrSuperSelectedShapeCount()Returns the number of currently selected shapes or simply 1, if a shape is super-selected. -
getSelectedOrSuperSelectedShape
Returns the currently selected shape at the given index, or the super-selected shape. -
selectShape
Selects the given shape. -
selectShapes
Selects the shapes in the given list. -
addShapeToSelectedShapes
Add a shape to the selected shapes list. -
removeShapeFromSelectedShapes
Remove a shape from the selected shapes list. -
superSelectShape
Super select a shape. -
superSelect
public void superSelect()SuperSelect currently selected shape. -
flushEditingChanges
public void flushEditingChanges()This method finalizes any (potentially cached) changes in progress in the editor (like from text editing). -
popSelection
public void popSelection()Un-SuperSelect currently super selected shape. -
getShapeAtPoint
Returns first shape hit by point given in View coords. -
getChildShapeAtPoint
Returns the child of the given shape hit by the given point. -
firstSuperSelectedShapeThatAcceptsChildren
Returns the first SuperSelectedShape that accepts children. -
firstSuperSelectedShapeThatAcceptsChildrenAtPoint
Returns the first SuperSelected shape that accepts children at a given point. -
firstSuperSelectedShapeThatAcceptsChildrenOrChildrenSuperSelectImmediately
Returns the first super selected shape that accepts children or whose children super select immediately. -
cut
public void cut()Standard clipboard cut functionality. -
copy
public void copy()Standard clipboard copy functionality. -
paste
public void paste()Standard clipbard paste functionality. -
selectAll
public void selectAll()Causes all the children of the current super selected shape to become selected. -
delete
public void delete()Deletes all the currently selected shapes. -
addShapesToShape
Adds shapes as children to given shape. -
addPage
public void addPage()Adds a page to the document after current page. -
addPagePrevious
public void addPagePrevious()Adds a page to the document before current page. -
addPage
Adds a given page to the current document at the given index. -
removePage
public void removePage()Removes current page from document. -
removePage
public void removePage(int index) Removes the document page at the given index. -
getCurrentTool
Tool method - returns the currently selected tool. -
setCurrentTool
Tool method - sets the currently select tool to the given tool. -
setCurrentTool
public void setCurrentTool(int anIndex) Tool method - sets the currently selected tool to the specific Tool's core tool at the given index. -
isCurrentToolSelectTool
public boolean isCurrentToolSelectTool()Returns whether the select tool is currently selected. -
setCurrentToolToSelectTool
public void setCurrentToolToSelectTool()Sets the current tool to the select tool. -
isCurrentToolSelectToolAndSelecting
public boolean isCurrentToolSelectToolAndSelecting()Tool method - Returns whether the select tool is currently selected and if it's currently being used to select. -
resetCurrentTool
public void resetCurrentTool()Resets the currently selected tool. -
setSelectedPageIndex
public void setSelectedPageIndex(int index) Override viewer method to reset selected shapes on page change.- Overrides:
setSelectedPageIndex
in classRMViewer
-
setZoomFactor
public void setZoomFactor(float aFactor) Overrides viewer method to focus zoomed region on selected shapes.- Overrides:
setZoomFactor
in classRMViewer
-
getEditorShapePainter
Returns the shape painter (which is actually an editor shape painter). -
paintComponentAbove
RMEditor drawing.- Overrides:
paintComponentAbove
in classRMViewer
-
paintViewportAbove
Paints editor stuff in viewport, so that it's independent of scroll. -
getEvents
Returns the even helper object. -
mouseMoved
Handle mouse moved event.- Overrides:
mouseMoved
in classRMViewer
-
mousePressed
Handle mouse pressed event.- Overrides:
mousePressed
in classRMViewer
-
mouseDragged
Handle mouse dragged event.- Overrides:
mouseDragged
in classRMViewer
-
mouseReleased
Handle mouse released event.- Overrides:
mouseReleased
in classRMViewer
-
processKeyEvent
Handle key events.- Overrides:
processKeyEvent
in classJComponent
-
processKeyEventSuper
Handle key event super - so RMEditorEvents can get at default behavior. -
isManagingFocus
public boolean isManagingFocus()This gives us tab events, but seems to be deprecated.- Overrides:
isManagingFocus
in classJComponent
-
getPreferredSize
Overrides viewer method to ensure editor is always at least 575x300.- Overrides:
getPreferredSize
in classRMViewer
-
getDataSource
Returns the datasource associated with the editor's document. -
setDataSource
Sets the datasource associated with the editor's document. -
getDataSourceDataset
Returns the sample dataset from the document's datasource. -
undo
public void undo()Called to undo the last edit operation in the editor. -
redo
public void redo()Called to redo the last undo operation in the editor. -
docUndoerAddDirtyObject
Doc listener method - RMViewer ignores it, but RMEditor calls setUndoSelectedObjects.- Specified by:
docUndoerAddDirtyObject
in interfaceRMDocument.DocListener
- Overrides:
docUndoerAddDirtyObject
in classRMViewer
-
getArchiverClassMap
Returns the Map of tags and classes to be used for unarchiving document shapes.
-