|
ReportMill 8.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.reportmill.RMViewer
The RMViewer class is a JComponent subclass that can be used in Swing applications to display and/or print an RMDocument. You might use it like this to simply print a document:
new RMViewer(aDocument).print();
Or you might want to allocate one and add it to a Swing component hierarchy:
RMViewer viewer = new RMViewer(); JScrollPane scrollPane = new JScrollPane(viewer); myFrame.getContentPane().add(scrollPane, Border.CENTER); viewer.setDocument(new RMDocument(aSource));
- See Also:
- Serialized Form
Nested Class Summary
Nested classes inherited from class javax.swing.JComponent javax.swing.JComponent.AccessibleJComponent
Field Summary static java.awt.ColorGridColor
static java.awt.ColorMarginColor
Fields inherited from class javax.swing.JComponent TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component 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 RMViewer()
Creates a new RMViewer with an empty document in it.RMViewer(java.lang.Object aSource)
Creates a new RMViewer from the given source.
Method Summary RMPointconvertPointFromShape(RMPoint aPoint, RMShape aShape)
Returns a point converted from the coordinate space of the given shape to viewer coords.RMPointconvertPointToShape(RMPoint aPoint, RMShape aShape)
Returns a point converted from viewer coords to the coordinate space of the given shape.RMRectconvertRectFromShape(RMRect aRect, RMShape aShape)
Returns a rect converted from the coordinate space of the given shape to viewer coords.RMRectconvertRectToShape(RMRect aRect, RMShape aShape)
Returns a rect converted from viewer coords to the coordinate space of the given shape.voiddocShapeBoundsChanged(RMDocument aDoc, RMShape aShape)
Doc listener method - called by editor when making bounds changes.voiddocShapeNeedsRepaint(RMDocument aDoc, RMShape aShape)
Doc listener method - called before a shape makes a visual change.voiddocUndoerAddDirtyObject(RMDocument aDoc, com.reportmill.base.RMObject anObj)
Doc listener method - RMViewer ignores it, but RMEditor calls setUndoSelectedObjects.static voidflushGraphics()
This method repaints the total bounds of shapes that have previously been registered by shapeNeedsRepaint.java.awt.print.BookgetBook()
Returns a java.awt.print.Book, suitable for AWT printing.RMRectgetDirtyRect()
Returns the dirty rect of shapes currently registered with shapeNeedsRepaint (and clears _dirtyShapes).RMDocumentgetDocument()
Returns the RMDocument associated with this viewer.RMRectgetDocumentBounds()
Returns the bounds of the viewer document.java.lang.StringgetFilename()
Returns filename associated with viewer's document (or null if the document didn't come from a file).java.awt.DimensiongetMinimumSize()
Standard minimum size method.RMRectgetPageBounds()
Returns the bounds of the viewer document's selected page.bytegetPageLayout()
Returns the page layout of the viewer's document.java.awt.DimensiongetPreferredSize()
Returns the optimal size of the viewer.java.awt.RenderingHintsgetRenderingHints()
Returns the rendering hings used to paint the view.RMShapegetSelectedPage()
Returns the currently selected page shape.intgetSelectedPageIndex()
Returns the index of the current visiable document page.RMShapegetShapeAtPoint(RMPoint aPoint, boolean goDeep)
Returns the first shape hit by the given point.com.reportmill.shape.RMShapePaintergetShapePainter()
Returns the object that is actually responsible for paining shapes in the viewer.booleangetShapeRepaintEnabled()
Returns whether changes to shapes cause repaints.com.reportmill.base.RMUndoergetUndoer()
Returns the undoer associated with the viewer's document.floatgetZoomFactor()
Returns the viewer's zoom factor (1 by default).voidmouseDragged(java.awt.event.MouseEvent anEvent)
Handle mouse dragged event.voidmouseMoved(java.awt.event.MouseEvent anEvent)
Handle mouse moved event.voidmousePressed(java.awt.event.MouseEvent anEvent)
Handle mouse pressed event.voidmouseReleased(java.awt.event.MouseEvent anEvent)
Handle mouse released event.voidpageBack()
Selects the previous page.voidpageForward()
Selects the next page.voidpaintComponent(java.awt.Graphics g)
Overrides JComponent implementation to paint viewer shapes and page, margin, grid, etc.voidpaintComponentAbove(java.awt.Graphics2D g)
Provides a hook for subclasses to paint above standard viewer drawing.voidperformActionURLClick(java.lang.String aURL)
Viewer callback - called when shape with URL is clicked (opens URL).voidprint()
This method tells the RMViewer to print by running the print dialog (configured to the default printer).voidprint(java.lang.String aPrinterName, boolean runPanel)
This method tells the RMViewer to print to the printer with the given printer name (use null for default printer).voidrepaint(RMRect aRect)
Requests a repaint for the area represented by the given rect.voidrunZoomPanel()
Runs a dialog panel to request a percentage zoom (which is then set with setZoomFactor).voidsetDocument(RMDocument aDoc)
Sets the RMDocument associated with this viewer.voidsetSelectedPageIndex(int anIndex)
Sets the page of viewer's document that is visible (by index).voidsetShapePainter(com.reportmill.shape.RMShapePainter aPainter)
Sets the object that is actually responsible for paining shapes in the viewer.voidsetShapeRepaintEnabled(boolean aFlag)
Sets whether changes to shapes cause repaints.voidsetZoomFactor(float aFactor)
Sets the viewer's zoom factor (1 for 100%).voidundoerAddChildToShape(RMShape aShape, RMShape aParent)
Adds a child with undo registration in the viewer's documents's undoer (convenience).voidundoerDisable()
Disable's undo in the viewer's documents's undoer (convenience).voidundoerEnable()
Enable's undo in the viewer's documents's undoer (convenience).booleanundoerHasUndos()
Returns whether undos exist in the viewer's documents's undoer (convenience).voidundoerSetCoalesce(boolean aFlag)
Turns on undo coalescing in the viewer's documents's undoer (convenience).voidundoerSetUndoTitle(java.lang.String aTitle)
Sets the title of the next registered undo in the viewer's documents's undoer (convenience).voidzoomToggleLast()
Sets the viewer's zoom to its previous value.
Methods inherited from class javax.swing.JComponent addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
Methods inherited from class java.awt.Container add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
Methods inherited from class java.lang.Object equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Field Detail GridColor
public static java.awt.Color GridColor
MarginColor
public static java.awt.Color MarginColor
Constructor Detail RMViewer
public RMViewer()
- Creates a new RMViewer with an empty document in it.
RMViewer
public RMViewer(java.lang.Object aSource)
- Creates a new RMViewer from the given source. aSource is used to get an RMDocument and can be many different things: String file path, File object, InputStream, byte array, URL or even an RMDocument.
Method Detail getDocument
public RMDocument getDocument()
- Returns the RMDocument associated with this viewer.
setDocument
public void setDocument(RMDocument aDoc)
- Sets the RMDocument associated with this viewer.
getSelectedPage
public RMShape getSelectedPage()
- Returns the currently selected page shape.
getFilename
public java.lang.String getFilename()
- Returns filename associated with viewer's document (or null if the document didn't come from a file).
getPageLayout
public byte getPageLayout()
- Returns the page layout of the viewer's document.
getSelectedPageIndex
public int getSelectedPageIndex()
- Returns the index of the current visiable document page.
setSelectedPageIndex
public void setSelectedPageIndex(int anIndex)
- Sets the page of viewer's document that is visible (by index).
pageForward
public void pageForward()
- Selects the next page.
pageBack
public void pageBack()
- Selects the previous page.
getDocumentBounds
public RMRect getDocumentBounds()
- Returns the bounds of the viewer document.
getPageBounds
public RMRect getPageBounds()
- Returns the bounds of the viewer document's selected page.
getShapeAtPoint
public RMShape getShapeAtPoint(RMPoint aPoint, boolean goDeep)
- Returns the first shape hit by the given point.
getZoomFactor
public float getZoomFactor()
- Returns the viewer's zoom factor (1 by default).
setZoomFactor
public void setZoomFactor(float aFactor)
- Sets the viewer's zoom factor (1 for 100%).
zoomToggleLast
public void zoomToggleLast()
- Sets the viewer's zoom to its previous value.
runZoomPanel
public void runZoomPanel()
- Runs a dialog panel to request a percentage zoom (which is then set with setZoomFactor).
convertPointFromShape
public RMPoint convertPointFromShape(RMPoint aPoint, RMShape aShape)
- Returns a point converted from the coordinate space of the given shape to viewer coords.
convertPointToShape
public RMPoint convertPointToShape(RMPoint aPoint, RMShape aShape)
- Returns a point converted from viewer coords to the coordinate space of the given shape.
convertRectFromShape
public RMRect convertRectFromShape(RMRect aRect, RMShape aShape)
- Returns a rect converted from the coordinate space of the given shape to viewer coords.
convertRectToShape
public RMRect convertRectToShape(RMRect aRect, RMShape aShape)
- Returns a rect converted from viewer coords to the coordinate space of the given shape.
repaint
public void repaint(RMRect aRect)
- Requests a repaint for the area represented by the given rect.
getShapePainter
public com.reportmill.shape.RMShapePainter getShapePainter()
- Returns the object that is actually responsible for paining shapes in the viewer.
setShapePainter
public void setShapePainter(com.reportmill.shape.RMShapePainter aPainter)
- Sets the object that is actually responsible for paining shapes in the viewer.
getRenderingHints
public java.awt.RenderingHints getRenderingHints()
- Returns the rendering hings used to paint the view.
paintComponent
public void paintComponent(java.awt.Graphics g)
- Overrides JComponent implementation to paint viewer shapes and page, margin, grid, etc.
paintComponentAbove
public void paintComponentAbove(java.awt.Graphics2D g)
- Provides a hook for subclasses to paint above standard viewer drawing.
mousePressed
public void mousePressed(java.awt.event.MouseEvent anEvent)
- Handle mouse pressed event.
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent anEvent)
- Handle mouse dragged event.
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent anEvent)
- Handle mouse released event.
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent anEvent)
- Handle mouse moved event.
performActionURLClick
public void performActionURLClick(java.lang.String aURL)
- Viewer callback - called when shape with URL is clicked (opens URL).
getMinimumSize
public java.awt.Dimension getMinimumSize()
- Standard minimum size method.
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Returns the optimal size of the viewer.
getUndoer
public com.reportmill.base.RMUndoer getUndoer()
- Returns the undoer associated with the viewer's document.
undoerSetUndoTitle
public void undoerSetUndoTitle(java.lang.String aTitle)
- Sets the title of the next registered undo in the viewer's documents's undoer (convenience).
undoerDisable
public void undoerDisable()
- Disable's undo in the viewer's documents's undoer (convenience).
undoerEnable
public void undoerEnable()
- Enable's undo in the viewer's documents's undoer (convenience).
undoerSetCoalesce
public void undoerSetCoalesce(boolean aFlag)
- Turns on undo coalescing in the viewer's documents's undoer (convenience).
undoerHasUndos
public boolean undoerHasUndos()
- Returns whether undos exist in the viewer's documents's undoer (convenience).
undoerAddChildToShape
public void undoerAddChildToShape(RMShape aShape, RMShape aParent)
- Adds a child with undo registration in the viewer's documents's undoer (convenience).
getShapeRepaintEnabled
public boolean getShapeRepaintEnabled()
- Returns whether changes to shapes cause repaints.
setShapeRepaintEnabled
public void setShapeRepaintEnabled(boolean aFlag)
- Sets whether changes to shapes cause repaints.
docShapeNeedsRepaint
public void docShapeNeedsRepaint(RMDocument aDoc, RMShape aShape)
- Doc listener method - called before a shape makes a visual change. Provides a mechanism to efficiently repaint the portion of the viewer that currently displays a shape. Registers the area covered by the shape now and at event end, to efficiently repaint shapes in transition as well.
- Specified by:
docShapeNeedsRepaintin interfaceRMDocument.DocListener
docShapeBoundsChanged
public void docShapeBoundsChanged(RMDocument aDoc, RMShape aShape)
- Doc listener method - called by editor when making bounds changes.
- Specified by:
docShapeBoundsChangedin interfaceRMDocument.DocListener
docUndoerAddDirtyObject
public void docUndoerAddDirtyObject(RMDocument aDoc, com.reportmill.base.RMObject anObj)
- Doc listener method - RMViewer ignores it, but RMEditor calls setUndoSelectedObjects.
- Specified by:
docUndoerAddDirtyObjectin interfaceRMDocument.DocListener
flushGraphics
public static void flushGraphics()
- This method repaints the total bounds of shapes that have previously been registered by shapeNeedsRepaint. This should only be used internally.
getDirtyRect
public RMRect getDirtyRect()
- Returns the dirty rect of shapes currently registered with shapeNeedsRepaint (and clears _dirtyShapes).
public void print()
- This method tells the RMViewer to print by running the print dialog (configured to the default printer).
public void print(java.lang.String aPrinterName, boolean runPanel)
- This method tells the RMViewer to print to the printer with the given printer name (use null for default printer). It also offers an option to run the printer dialog.
getBook
public java.awt.print.Book getBook()
- Returns a java.awt.print.Book, suitable for AWT printing.
Overview Package Class Tree Deprecated Index Help ReportMill 8.0 API PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD