Class SwingReportView
- All Implemented Interfaces:
ReportView
,ViewerComponent
,ImageObserver
,MenuContainer
,Serializable
,Accessible
To obtain an instance of a SwingReportView, use the methods
SwingReportViewer.addNewReportView(RenderData)
and SwingReportViewer.createReportView(RenderData)
.Also, similarly to SwingReportViewer, a SwingReportView object is highly customizable. It is possible to hide components or place your own components in place of the navigation view or status bar. Here are a couple of examples of what could be done with a SwingReportView:
Hide the navigation view
If your report view does not have a group tree, or does not need a navigation view, you might want to hide the
navigation view. To do this, simply extract it with extractNavigationView()
. This will cause the
navigation view to be hidden. If you should later still want to get a reference to the navigation view object, this
is possible using getNavigationView()
.
"Wrap" the status bar in an own component
Using the methods "extractStatusBar" and "insertAtStatusBarPosition" this is quite simple:
StatusBar oldStatusBar = myView.extractStatusBar(); // We have now extracted the old status bar from the view - it should now no longer be // visible in the report view. Now, we place this status bar into our own component. // Let's say our own component has a green button called "TestGreen". JPanel newStatusBar = new JPanel( new FlowLayout() ); JButton test = new JButton( "TestGreen" ); test.setBackground( Color.GREEN ); newStatusBar.add( woohoo ); newStatusBar.add( oldStatusBar ); // Now we take advantage of the "insertAtStatusBarPosition" method, which places the component // we pass into the old status bar position. myView.insertAtStatusBarPosition( newStatusBar );
Export the report to a file
Once again, this is quite simple using the given "export" method, combined with the various export constants from the interface ReportView:
myView.export( ReportView.EXPORT_PDF, "C:/test.pdf" );
Cause the report to be re-rendered and refreshed
myView.refresh();
- Since:
- 7.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
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 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
Fields inherited from interface com.inet.viewer.ReportView
CURRENT_PAGE, EXPORT_CSV, EXPORT_DATA, EXPORT_HTML, EXPORT_PDF, EXPORT_PS, EXPORT_PS2, EXPORT_PS3, EXPORT_RTF, EXPORT_SVG, EXPORT_TXT, EXPORT_XLS, EXPORT_XML, MAX_ZOOM_FACTOR, MIN_ZOOM_FACTOR, MODE_HAND, MODE_SNAPSHOT, MODE_TEXT, PROP_LOADING_STATUS, PROP_TIMESTAMP, STATUS_CANCELED, STATUS_FINISHED, STATUS_INITIALIZED, STATUS_LOADING, TOTAL_PAGE_COUNT, TOTAL_PAGE_COUNT_UNKNOWN, VIEW_DOUBLE_CONTINUOUS, VIEW_DOUBLE_PAGE, VIEW_IS_AT_END_OF_REPORT, VIEW_MODE, VIEW_SINGLE_CONTINUOUS, VIEW_SINGLE_PAGE, ZOOM_FACTOR, ZOOM_MANUAL, ZOOM_TO_FULLPAGE, ZOOM_TO_PAGEHEIGHT, ZOOM_TO_PAGEWIDTH
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
This cancels the loading of the current report in case it is still loading.export()
Exports the report connected to this report view.Exports the report connected to this report view into the given file.
Export formats creating multiple files, e.g.export
(Properties exportProperties) Exports the report connected to this report view into the given file.
This method use the default value for all not specified properties.Removes the navigation view GUI component from the ReportView and returns it.Removes the status bar GUI component from the ReportView and returns it.int
Returns which type of automatic zoom is used in the report view whenever the ReportView is displayed anew, for example after resizing the display.All public graphical components of the viewer must implement this method, which returns the actual AWT component so that it can be added to containers, etc.
For example, if you have a "ReportViewer" and would like to add it to your own JFrame, simply call:myFrame.add(viewer.getComponent())
int
Returns the number of the "current page" being displayed in this ReportView.getDefaultAttributeSet
(int fromPage, int toPage) Creates and returns a HashPrintRequestAttributeSet for the given page(s) with the default printing attributes.int
Fetches the current "loading status" of this report view.int
Returns the currently selected mode for mouse actions such as clicking and dragging in this ReportView.Returns this ReportView's NavigationView, that is, the element containing this ReportView's SearchView, GroupView and/or IndexView.Returns the RenderData object belonging to this ReportView.Returns the title of this report if it is known.Returns the parent ReportViewer for this component.Returns this ReportView's StatusBar, the element which can display messages or progress bars.int
Returns the total number of pages this report has.int
Returns which type of layout view this ReportView is to take.float
Returns the currently set zoom factor of this ReportView - this is not a percentage value, that is, 1.0 is 1x, 2.0 is 2x view, 0.25 is 1/4 view, etc.void
Navigates directly to the last page in the report - if the current page is already the last page of the report, or if the total page count is not known as of yet (that is, the report is still being rendered), this method does nothing.void
goToPage
(int pageNumber) Causes the page indicated by the parameter pageNum to be displayed in this ReportView.boolean
Returns whether or not this report view is set to show a group tree.boolean
Returns whether this report view should allow drill downs on its groups if it has any.boolean
Returns if at least one export format is enabled for this ReportView.boolean
Returns whether this report view has more pages than the server page limit for a report allows for (causing the later pages to be truncated from the report).boolean
Returns whether this report was suppressed because it has no rows.void
nextPage()
Navigates one step forward in the report - if this is not possible (e.g. the current page is already the last page of the report), this method does nothing.void
prevPage()
Navigates one step back in the report - if this is not possible (e.g. the current page is already the first page of the report), this method does nothing.print
(int fromPage, int toPage, boolean showPrintDialog) Prints the current report in the page range with or without any dialogs.print
(int fromPage, int toPage, PrinterJob pjob) Prints the current report to a PrinterJob without any dialogs.print
(PrinterJob printerJob, PrintRequestAttributeSet attributeSet) Creates a new PrinterJobProgress with the given attributes and start it.void
refresh()
Causes this ReportView to refresh its pages by re-fetching the report data - this causes a re-rendering of the report data.void
reload()
Causes this ReportView to reload its pages and show them again, using the already fetched data if possible - if not, this causes a fetching of the report data.void
replaceNavigationView
(Component component) Inserts the given component at the position of the navigation view.void
replaceStatusBar
(Component component) Inserts the given component at the position of the status bar.void
setAutomaticZoomType
(int type) Sets the type of zoom to use in the report view when the ReportView is displayed anew (for example after resizing the display).void
setAutoRefresh
(int millis) Sets the auto-refresh time for this report view.void
setDrilldownEnabled
(boolean enabled) Sets whether this report view should allow drill downs on its groups if it has any.void
setHasGroupTree
(boolean hasGroupTree) Sets this report view to whether or not it is to show a group tree.void
setMouseActionMode
(int hand) Sets the mode this ReportView is to be in for mouse actions such as clicking and dragging.void
setPageLimitExceeded
(boolean pageLimitExceeded) sets the "page limit exceeded" flag which determines whether the toolbar will display the total page count with a "+".void
setViewMode
(int i) Sets the type of view this ReportView is to take and causes this view to be displayed immediately.void
setZoomFactor
(float factor) Sets the zoom factor to this value.void
Displays an error box showing the Throwable's error message.static boolean
showPrintDialog
(Component parentComponent, PrinterJob printerJob, HashPrintRequestAttributeSet attributeSet) Shows the viewer print dialog.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, 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
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, 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
-
Method Details
-
showError
Displays an error box showing the Throwable's error message. If a ViewerException is thrown, the special messages and properties of the ViewerException are shown. Otherwise, only the getMessage() as well as the stack trace are shown.- Specified by:
showError
in interfaceReportView
- Parameters:
th
- Throwable to display in an error box. Best if this Throwable is a ViewerException.- Since:
- 7.0
-
getStatusBar
Returns this ReportView's StatusBar, the element which can display messages or progress bars.- Specified by:
getStatusBar
in interfaceReportView
- Returns:
- StatusBar belonging to this ReportView
- Since:
- 7.0
-
extractStatusBar
Removes the status bar GUI component from the ReportView and returns it. If the status bar has already been extracted, nothing happens, and in this case this method is equivalent to getStatusBar().- Specified by:
extractStatusBar
in interfaceReportView
- Returns:
- StatusBar of this ReportView
- Since:
- 7.0
-
reload
public void reload()Causes this ReportView to reload its pages and show them again, using the already fetched data if possible - if not, this causes a fetching of the report data.- Specified by:
reload
in interfaceReportView
- Since:
- 7.0
- See Also:
-
refresh
public void refresh()Causes this ReportView to refresh its pages by re-fetching the report data - this causes a re-rendering of the report data. If "promptOnRefresh" is set, this will cause the prompts to be fetched again as well.- Specified by:
refresh
in interfaceReportView
- Since:
- 7.0
- See Also:
-
cancel
public void cancel()This cancels the loading of the current report in case it is still loading. It will cancel the render process on the server as well. The effect is similar to the stop button of the load progress component. If the current loading status isReportView.STATUS_FINISHED
orReportView.STATUS_CANCELED
, this method has no effect.- Specified by:
cancel
in interfaceReportView
- Since:
- 12.0
-
nextPage
public void nextPage()Navigates one step forward in the report - if this is not possible (e.g. the current page is already the last page of the report), this method does nothing.- Specified by:
nextPage
in interfaceReportView
- Since:
- 7.0
-
prevPage
public void prevPage()Navigates one step back in the report - if this is not possible (e.g. the current page is already the first page of the report), this method does nothing.- Specified by:
prevPage
in interfaceReportView
- Since:
- 7.0
-
goToPage
public void goToPage(int pageNumber) Causes the page indicated by the parameter pageNum to be displayed in this ReportView. If this page does not exist in the report, calling this method will do nothing at all. Note this is an asynchronous call - the page will be displayed at some point, but it is not guaranteed that the page is actually visible as soon as this method returns.- Specified by:
goToPage
in interfaceReportView
- Parameters:
pageNumber
- Number of page (starting at 1) to be displayed in this ReportView.- Since:
- 7.0
-
goToLastPage
public void goToLastPage()Navigates directly to the last page in the report - if the current page is already the last page of the report, or if the total page count is not known as of yet (that is, the report is still being rendered), this method does nothing. Note this is an asynchronous call - the page will be displayed at some point, but it is not guaranteed that the page is actually visible as soon as this method returns.- Specified by:
goToLastPage
in interfaceReportView
- Since:
- 7.0
-
setViewMode
public void setViewMode(int i) Sets the type of view this ReportView is to take and causes this view to be displayed immediately. By default, possible values are: ReportView.SINGLE_PAGE - only one page is shown at a time. ReportView.SINGLE_CONTINUOUS - the report can be scrolled through in its entirety, with each page being shown above the next. ReportView.DOUBLE_PAGE - only two pages are shown at a time, next to each other. ReportView.DOUBLE_CONTINUOUS - the report can be scrolled through in its entirety, however showing the pages two by two.- Specified by:
setViewMode
in interfaceReportView
- Parameters:
i
- Layout type to display in this ReportView.- Since:
- 7.0
- See Also:
-
getDefaultAttributeSet
Creates and returns a HashPrintRequestAttributeSet for the given page(s) with the default printing attributes. If the first page was not loaded then it will wait until the first page is available.- Specified by:
getDefaultAttributeSet
in interfaceReportView
- Parameters:
fromPage
- Number of the first page for which to create the HashPrintRequestAttributeSet. The first page of a report has the value 1.toPage
- Number of the last page for which to create the HashPrintRequestAttributeSet. A value of -1 means to create the AttributeSet for all pages starting at startPage.- Returns:
- The list of printing attributes for the given pages.
- Since:
- 7.0
- See Also:
-
print
Prints the current report in the page range with or without any dialogs. If the first page was not loaded then it will wait until the first page is available.- Specified by:
print
in interfaceReportView
- Parameters:
fromPage
- the index of the start page to be printed, the first page is 1.toPage
- the index of the last page to be printed. A value of -1 means all pages.showPrintDialog
- iftrue
, a print dialog is showing.- Returns:
- PrinterJobProgress of the running printing job.
- Since:
- 7.0
- See Also:
-
print
Prints the current report to a PrinterJob without any dialogs. It uses the default PrintRequestAttributeSet of the view. If the first page was not loaded then it will wait until the first page is available.- Specified by:
print
in interfaceReportView
- Parameters:
fromPage
- the index of the start page to be printed, the first page is 1.toPage
- the index of the last page to be printed. A value of -1 means all pages.pjob
- A java.awt.print.PrinterJob object.- Returns:
- PrinterJobProgress of the running printing job.
- Since:
- 7.0
- See Also:
-
print
Creates a new PrinterJobProgress with the given attributes and start it.- Specified by:
print
in interfaceReportView
- Parameters:
printerJob
- The PrinterJob with the target PrintService.attributeSet
- attributeSet A list of attributes that can override values in the report design, for example paper format, paper orientation and page margins.- Returns:
- a PrinterJobProgress
- See Also:
-
showPrintDialog
public static boolean showPrintDialog(Component parentComponent, PrinterJob printerJob, HashPrintRequestAttributeSet attributeSet) Shows the viewer print dialog. This dialog will modify the PrinterJob and the AttributeSet, depending on the user input. The viewer print dialog supports some additional features which are not in Java's cross platform print dialog.- Parameters:
parentComponent
- a parent component, used for showing the dialog as a modal dialog. Can be null.printerJob
- a PrinterJob with the selected PrintService. On output the PrintService is updated. This parameter may not be null.attributeSet
- print attributes that are to be shown in the dialog. Once the dialog is closed, the contents are updated to reflect user choices. This parameter may not be null.- Returns:
- true if the user clicks "print" and false if the user cancels the dialog.
- Throws:
ViewerException
- if no print services are available.- Since:
- 8.0
- See Also:
-
export
Exports the report connected to this report view. At first the export dialog will be displayed. If the user does not cancel the export in the dialog, the export progress will be started after the export dialog has been closed.- Specified by:
export
in interfaceReportView
- Returns:
- ExportProgress of running export
- Since:
- 7.0
- See Also:
-
export
Exports the report connected to this report view into the given file.
Export formats creating multiple files, e.g. HTML and SVG, creating a sub directory with the name of the first file. All files will be saved in that directory expecting the first file.
This method use the default value for all properties expecting the export format. To export a report into a file without preview in the Java viewer we recommend to use the Engine directly instead of using the Viewer API because the Java viewer have to request the first report page in the Java viewer format before it can request the report in the specified export format.- Specified by:
export
in interfaceReportView
- Parameters:
format
- The export format in that the report will be exported.filename
- Name of the file in that the report will be exported.- Returns:
- ExportProgress of running export
- Since:
- 7.0
- See Also:
-
export
Exports the report connected to this report view into the given file.
This method use the default value for all not specified properties. For a complete list of report URL properties see the documentation.
To export a report into a file without preview in the Java viewer we recommend to use the Engine directly instead of using the Viewer API because the Java viewer have to request the first report page in the Java viewer format before it can request the report in the specified export format.- Specified by:
export
in interfaceReportView
- Parameters:
exportProperties
- Properties for the export, including format, file and other properties if they are available for the selected format.- Returns:
- ExportProgress of running export
- Since:
- 7.0
- See Also:
-
isExportEnabled
public boolean isExportEnabled()Returns if at least one export format is enabled for this ReportView.- Specified by:
isExportEnabled
in interfaceReportView
- Returns:
- exportEnabled Export enabled for this report; true if at least one format is enabled, false otherwise
- Since:
- 7.0
-
setMouseActionMode
public void setMouseActionMode(int hand) Sets the mode this ReportView is to be in for mouse actions such as clicking and dragging. By default, possible values are: ReportView.MODE_HAND - Click and drag causes a scrolling of the page along with the mouse movement. ReportView.MODE_TEXT - Click and drag causes a text selection, line by line. ReportView.MODE_SNAPSHOT - Click and drag causes an image snapshot within a box at release of the mouse button.- Specified by:
setMouseActionMode
in interfaceReportView
- Parameters:
hand
- Mouse mode to be used in the ReportView.- Since:
- 7.0
- See Also:
-
hasGroupTree
public boolean hasGroupTree()Returns whether or not this report view is set to show a group tree. If it is false, the report view will not show any group tree. Note this says nothing about whether or not the report actually has groups or not.- Specified by:
hasGroupTree
in interfaceReportView
- Returns:
- Whether this report view is to show a group tree or not if the report should have groups
- Since:
- 7.0
-
setHasGroupTree
public void setHasGroupTree(boolean hasGroupTree) Sets this report view to whether or not it is to show a group tree. If this is false, the report view should not show any group tree, regardless of whether or not its report has groups.- Specified by:
setHasGroupTree
in interfaceReportView
- Parameters:
hasGroupTree
- Is this report view to show a group tree?- Since:
- 7.0
- See Also:
-
setZoomFactor
public void setZoomFactor(float factor) Sets the zoom factor to this value. Only values greater than 0 are allowed. This value is not a percentage value, that is, 2.0 is 2x view, 0.25 is 1/4 view, etc.
If the value is less than MIN_ZOOM_FACTOR, this has the same effect as calling setZoomFactor(MIN_ZOOM_FACTOR).
If the value is greater than MAX_ZOOM_FACTOR, this has the same effect as calling setZoomFactor(MAX_ZOOM_FACTOR).
If you want to zoom relative to the page's size, you shouldn't use this method but ratherReportView.setAutomaticZoomType(int)
- Specified by:
setZoomFactor
in interfaceReportView
- Parameters:
factor
- Factor to zoom to - 1.0 as 100%, 2.0 as 200%, etc.- Since:
- 7.0
- See Also:
-
setAutomaticZoomType
public void setAutomaticZoomType(int type) Sets the type of zoom to use in the report view when the ReportView is displayed anew (for example after resizing the display). By default, possible values are: ReportView.ZOOM_MANUAL - always use the set zoom factor (settable with setZoom(float factor)) ReportView.ZOOM_TO_PAGEWIDTH - always zoom in or out far enough to see the full width of a page. ReportView.ZOOM_TO_PAGEHEIGHT - always zoom in or out far enough to see the full height of a page. ReportView.ZOOM_TO_FULLPAGE - always zoom in or out far enough to see the full page - this is equivalent to ZOOM_TO_PAGEHEIGHT when the page is a portrait view, or to ZOOM_TO_PAGEWIDTH when the page is a landscape view.- Specified by:
setAutomaticZoomType
in interfaceReportView
- Parameters:
type
- Zoom type to use when displaying the ReportView.- Since:
- 7.0
- See Also:
-
getZoomFactor
public float getZoomFactor()Returns the currently set zoom factor of this ReportView - this is not a percentage value, that is, 1.0 is 1x, 2.0 is 2x view, 0.25 is 1/4 view, etc.- Specified by:
getZoomFactor
in interfaceReportView
- Returns:
- The zoom factor currently set for this ReportView.
- Since:
- 7.0
-
getCurrentPage
public int getCurrentPage()Returns the number of the "current page" being displayed in this ReportView. If more than one PageView is visible, this returns the lowest page visible at this time. If no PageView is visible, this returns 0.- Specified by:
getCurrentPage
in interfaceReportView
- Returns:
- Number of the first page currently visible in this ReportView, or 0 if no page is visible.
- Since:
- 7.0
-
getTotalPages
public int getTotalPages()Returns the total number of pages this report has. If the total number of pages is as of yet unknown (for example if the report is still being rendered), this will return TOTAL_PAGE_COUNT_UNKNOWN.- Specified by:
getTotalPages
in interfaceReportView
- Returns:
- Total number of pages in the report, or TOTAL_PAGE_COUNT_UNKNOWN if still unknown.
- Since:
- 7.0
- See Also:
-
getComponent
All public graphical components of the viewer must implement this method, which returns the actual AWT component so that it can be added to containers, etc.
For example, if you have a "ReportViewer" and would like to add it to your own JFrame, simply call:myFrame.add(viewer.getComponent())
- Specified by:
getComponent
in interfaceViewerComponent
- Returns:
- Actual AWT component of this object.
- Since:
- 7.0
-
replaceStatusBar
Inserts the given component at the position of the status bar. If a status bar component is already there (which is by default), the component is replaced by the given component. Note the status bar itself remains referenced (getStatusBar will return the same object even after calling this method), this method simply places adds a java.awt.Component in its place. If the given component is null, the status bar will simply be removed, equivalent to calling extractStatusBar.- Specified by:
replaceStatusBar
in interfaceReportView
- Parameters:
component
- Component to position at the status bar position, null if the status bar is simply to be removed.- Since:
- 7.0
-
getViewMode
public int getViewMode()Returns which type of layout view this ReportView is to take. By default, possible values are: ReportView.SINGLE_PAGE - only one page is shown at a time. (This is the default setting) ReportView.SINGLE_CONTINUOUS - the report can be scrolled through in its entirety, with each page being shown above the next. ReportView.DOUBLE_PAGE - only two pages are shown at a time, next to each other. ReportView.DOUBLE_CONTINUOUS - the report can be scrolled through in its entirety, however showing the pages two by two.- Specified by:
getViewMode
in interfaceReportView
- Returns:
- Layout type used by this ReportView
- Since:
- 7.0
- See Also:
-
getAutomaticZoomType
public int getAutomaticZoomType()Returns which type of automatic zoom is used in the report view whenever the ReportView is displayed anew, for example after resizing the display. By default, possible values are: ReportView.ZOOM_MANUAL - always use the set zoom factor (default setting. Zoom factor is settable with setZoom(float factor)) ReportView.ZOOM_TO_PAGEWIDTH - always zoom in or out far enough to see the full width of a page. ReportView.ZOOM_TO_PAGEHEIGHT - always zoom in or out far enough to see the full height of a page. ReportView.ZOOM_TO_FULLPAGE - always zoom in or out far enough to see the full page - this is equivalent to ZOOM_TO_PAGEHEIGHT when the page is a portrait view, or to ZOOM_TO_PAGEWIDTH when the page is a landscape view.- Specified by:
getAutomaticZoomType
in interfaceReportView
- Returns:
- Currently chosen automatic zoom type used by this ReportView
- Since:
- 7.0
- See Also:
-
getMouseActionMode
public int getMouseActionMode()Returns the currently selected mode for mouse actions such as clicking and dragging in this ReportView. By default, possible values are: ReportView.MODE_HAND - Click and drag causes a scrolling of the page along with the mouse movement. ReportView.MODE_TEXT - Click and drag causes a text selection, line by line. ReportView.MODE_SNAPSHOT - Click and drag causes an image snapshot within a box at release of the mouse button.- Specified by:
getMouseActionMode
in interfaceReportView
- Returns:
- The currently selected mode for mouse actions such as clicking and dragging within this ReportView
- Since:
- 7.0
- See Also:
-
getReportData
Returns the RenderData object belonging to this ReportView. The RenderData object is the source of report data for this ReportView. If this is null, the ReportView has no connection to a RenderData source and should be considered obsolete.- Specified by:
getReportData
in interfaceReportView
- Returns:
- The RenderData object belonging to this ReportView
- Since:
- 7.0
-
getReportViewer
Returns the parent ReportViewer for this component.- Specified by:
getReportViewer
in interfaceReportView
- Returns:
- the parent ReportViewer for this component
- Since:
- 7.0
-
getReportTitle
Returns the title of this report if it is known. If not known, the title returned will be null.- Specified by:
getReportTitle
in interfaceReportView
- Returns:
- The report title of this report if known. Will return null if not known
- Since:
- 7.0
- See Also:
-
getLoadingStatus
public int getLoadingStatus()Fetches the current "loading status" of this report view. By default, possible values are:- ReportView.STATUS_INITIALIZED - means the report view is loading for the first time, no pages have been loaded yet.
- ReportView.STATUS_LOADING - means at least one page has been loaded and the report view is currently fetching the other pages of the report if there are any.
- ReportView.STATUS_FINISHED - means the report has been successfully loaded.
- ReportView.STATUS_CANCELED - means the loading has been canceled by the user.
- Specified by:
getLoadingStatus
in interfaceReportView
- Returns:
- Current loading status of the report view.
- Since:
- 7.0
- See Also:
-
setAutoRefresh
public void setAutoRefresh(int millis) Sets the auto-refresh time for this report view. This will cause this view to be refreshed everymillis
milliseconds. Note that if the report has prompts, its prompts will not be re-requested at each auto-refresh. Also, a refresh will be skipped if the prompt dialog is currently open, if the report is already currently being refreshed, if the report was manually canceled or if it was stopped due to an error.- Specified by:
setAutoRefresh
in interfaceReportView
- Parameters:
millis
- number of milliseconds for auto-refresh cycle, 0 to turn off auto-refresh
-
isDrilldownEnabled
public boolean isDrilldownEnabled()Returns whether this report view should allow drill downs on its groups if it has any. If not, right clicking a group node will not offer "drill down" as an option. The default value for this is "true" unless set differently inReportView.setDrilldownEnabled(boolean)
and/or as a ViewerSettings entry.- Specified by:
isDrilldownEnabled
in interfaceReportView
- Returns:
- whether this report view should allow drill downs on its groups
-
setDrilldownEnabled
public void setDrilldownEnabled(boolean enabled) Sets whether this report view should allow drill downs on its groups if it has any. If not, right clicking a group node will not offer "drill down" as an option. The default value for this is "true" unless set differently as a ViewerSettings entry.- Specified by:
setDrilldownEnabled
in interfaceReportView
- Parameters:
enabled
- true if it is to be enabled
-
isPageLimitExceeded
public boolean isPageLimitExceeded()Returns whether this report view has more pages than the server page limit for a report allows for (causing the later pages to be truncated from the report).- Specified by:
isPageLimitExceeded
in interfaceReportView
- Returns:
- whether this report view has more pages than the server page limit
-
setPageLimitExceeded
public void setPageLimitExceeded(boolean pageLimitExceeded) sets the "page limit exceeded" flag which determines whether the toolbar will display the total page count with a "+".- Parameters:
pageLimitExceeded
- true if page limit was exceeded- Since:
- 10.1
-
isReportSuppressed
public boolean isReportSuppressed()Returns whether this report was suppressed because it has no rows.- Specified by:
isReportSuppressed
in interfaceReportView
- Returns:
- true, if no rows.
-