|
i-net Clear Reports | |||||||
| 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
javax.swing.JPanel
com.inet.viewer.SwingReportView
public class SwingReportView
The Swing implementation of ReportView, a container for a NavigationView, a ReportScrollView, and a StatusBar. By
default, the SwingReportView consists of a SwingNavigationView containing a group tree, search view, etc., on the
left, a SwingReportScrollView on the right, and a SwingStatusBar below both. It offers various methods of page
navigation and settings
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();
| Field Summary |
|---|
| Method Summary | |
|---|---|
Progress |
export()
Exports the report connected to this report view. |
Progress |
export(int format,
java.lang.String filename)
Exports the report connected to this report view into the given file. |
Progress |
export(java.util.Properties exportProperties)
Exports the report connected to this report view into the given file. |
NavigationView |
extractNavigationView()
Removes the navigation view GUI component from the ReportView and returns it. |
StatusBar |
extractStatusBar()
Removes the status bar GUI component from the ReportView and returns it. |
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. |
java.awt.Component |
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. |
int |
getCurrentPage()
Returns the number of the "current page" being displayed in this ReportView. |
javax.print.attribute.HashPrintRequestAttributeSet |
getDefaultAttributeSet(int fromPage,
int toPage)
Creates and returns a HashPrintRequestAttributeSet for the given page(s) with the default printing attributes. |
int |
getLoadingStatus()
Fetches the current "loading status" of this report view. |
int |
getMouseActionMode()
Returns the currently selected mode for mouse actions such as clicking and dragging in this ReportView. |
NavigationView |
getNavigationView()
Returns this ReportView's NavigationView, that is, the element containing this ReportView's SearchView, GroupView and/or IndexView. |
RenderData |
getReportData()
Returns the RenderData object belonging to this ReportView. |
java.lang.String |
getReportTitle()
Returns the title of this report if it is known. |
ReportViewer |
getReportViewer()
Returns the parent ReportViewer for this component. |
StatusBar |
getStatusBar()
Returns this ReportView's StatusBar, the element which can display messages or progress bars. |
int |
getTotalPages()
Returns the total number of pages this report has. |
int |
getViewMode()
Returns which type of layout view this ReportView is to take. |
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. |
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. |
void |
goToPage(int pageNumber)
Causes the page indicated by the parameter pageNum to be displayed in this ReportView. |
boolean |
hasGroupTree()
Returns whether or not this report view is set to show a group tree. |
boolean |
isDrilldownEnabled()
Returns whether this report view should allow drill downs on its groups if it has any. |
boolean |
isExportEnabled()
Returns if at least one export format is enabled for this ReportView. |
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). |
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. |
Progress |
print(int fromPage,
int toPage,
boolean showPrintDialog)
Prints the current report in the page range with or without any dialogs. |
Progress |
print(int fromPage,
int toPage,
java.awt.print.PrinterJob pjob)
Prints the current report to a PrinterJob without any dialogs. |
Progress |
print(java.awt.print.PrinterJob printerJob,
javax.print.attribute.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(java.awt.Component component)
Inserts the given component at the position of the navigation view. |
void |
replaceStatusBar(java.awt.Component component)
Inserts the given component at the position of the status bar. |
void |
setAutoRefresh(int millis)
Sets the auto-refresh time for this report view. |
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 |
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 |
showError(java.lang.Throwable th)
Displays an error box showing the Throwable's error message. |
static boolean |
showPrintDialog(java.awt.Component parentComponent,
java.awt.print.PrinterJob printerJob,
javax.print.attribute.HashPrintRequestAttributeSet attributeSet)
Shows the viewer print dialog. |
| Method Detail |
|---|
public void showError(java.lang.Throwable th)
showError in interface ReportViewth - Throwable to display in an error box. Best if this Throwable is a ViewerException.public NavigationView getNavigationView()
getNavigationView in interface ReportViewpublic StatusBar getStatusBar()
getStatusBar in interface ReportViewpublic StatusBar extractStatusBar()
extractStatusBar in interface ReportViewpublic NavigationView extractNavigationView()
extractNavigationView in interface ReportViewpublic void reload()
reload in interface ReportViewReportView.refresh()public void refresh()
refresh in interface ReportViewReportView.reload()public void nextPage()
nextPage in interface ReportViewpublic void prevPage()
prevPage in interface ReportViewpublic void goToPage(int pageNumber)
goToPage in interface ReportViewpageNumber - Number of page (starting at 1) to be displayed in this ReportView.public void goToLastPage()
goToLastPage in interface ReportViewpublic void setViewMode(int i)
setViewMode in interface ReportViewi - Layout type to display in this ReportView.ReportView.VIEW_DOUBLE_CONTINUOUS,
ReportView.VIEW_DOUBLE_PAGE,
ReportView.VIEW_SINGLE_PAGE,
ReportView.VIEW_SINGLE_CONTINUOUS
public javax.print.attribute.HashPrintRequestAttributeSet getDefaultAttributeSet(int fromPage,
int toPage)
getDefaultAttributeSet in interface ReportViewfromPage - 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.
HashPrintRequestAttributeSet
public Progress print(int fromPage,
int toPage,
boolean showPrintDialog)
print in interface ReportViewfromPage - 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 - if true, a print dialog is showing.
ReportView.print(int, int, PrinterJob),
PrinterJobProgress
public Progress print(int fromPage,
int toPage,
java.awt.print.PrinterJob pjob)
print in interface ReportViewfromPage - 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.
ReportView.print(int,int,boolean),
PrinterJobProgress
public Progress print(java.awt.print.PrinterJob printerJob,
javax.print.attribute.PrintRequestAttributeSet attributeSet)
print in interface ReportViewprinterJob - 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.
ReportView.getDefaultAttributeSet(int, int),
PrinterJobProgress
public static boolean showPrintDialog(java.awt.Component parentComponent,
java.awt.print.PrinterJob printerJob,
javax.print.attribute.HashPrintRequestAttributeSet attributeSet)
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.
ViewerException - if no print services are available.getDefaultAttributeSet(int, int),
PrinterJob.pageDialog(PrintRequestAttributeSet)public Progress export()
export in interface ReportViewExportProgress
public Progress export(int format,
java.lang.String filename)
export in interface ReportViewformat - The export format in that the report will be exported.filename - Name of the file in that the report will be exported.
ExportProgress,
ReportView.EXPORT_CSV,
ReportView.EXPORT_DATA,
ReportView.EXPORT_HTML,
ReportView.EXPORT_PDF,
ReportView.EXPORT_PS,
ReportView.EXPORT_PS2,
ReportView.EXPORT_PS3,
ReportView.EXPORT_RTF,
ReportView.EXPORT_SVG,
ReportView.EXPORT_TXT,
ReportView.EXPORT_XLS,
ReportView.EXPORT_XMLpublic Progress export(java.util.Properties exportProperties)
export in interface ReportViewexportProperties - Properties for the export, including format, file and other properties if they are available for the selected format.
ExportProgresspublic boolean isExportEnabled()
isExportEnabled in interface ReportViewpublic void setMouseActionMode(int hand)
setMouseActionMode in interface ReportViewhand - Mouse mode to be used in the ReportView.ReportView.MODE_HAND,
ReportView.MODE_SNAPSHOT,
ReportView.MODE_TEXTpublic boolean hasGroupTree()
hasGroupTree in interface ReportViewpublic void setHasGroupTree(boolean hasGroupTree)
setHasGroupTree in interface ReportViewhasGroupTree - Is this report view to show a group tree?ReportView.getNavigationView(),
ReportView.extractNavigationView()public void setZoomFactor(float factor)
ReportView.setAutomaticZoomType(int)
setZoomFactor in interface ReportViewfactor - Factor to zoom to - 1.0 as 100%, 2.0 as 200%, etc.ReportView.MIN_ZOOM_FACTOR,
ReportView.MAX_ZOOM_FACTOR,
ReportView.setAutomaticZoomType(int)public void setAutomaticZoomType(int type)
setAutomaticZoomType in interface ReportViewtype - Zoom type to use when displaying the ReportView.ReportView.ZOOM_MANUAL,
ReportView.ZOOM_TO_FULLPAGE,
ReportView.ZOOM_TO_PAGEHEIGHT,
ReportView.ZOOM_TO_PAGEWIDTH,
ReportView.getAutomaticZoomType()public float getZoomFactor()
getZoomFactor in interface ReportViewpublic int getCurrentPage()
getCurrentPage in interface ReportViewpublic int getTotalPages()
getTotalPages in interface ReportViewReportView.TOTAL_PAGE_COUNT_UNKNOWNpublic java.awt.Component getComponent()
myFrame.add(viewer.getComponent())
getComponent in interface ViewerComponentpublic void replaceStatusBar(java.awt.Component component)
replaceStatusBar in interface ReportViewcomponent - Component to position at the status bar position, null if the status bar is simply to be removed.public void replaceNavigationView(java.awt.Component component)
replaceNavigationView in interface ReportViewcomponent - Component to position at the navigation view position, null if the navigation view is simply to be removedpublic int getViewMode()
getViewMode in interface ReportViewReportView.setViewMode(int),
ReportView.VIEW_DOUBLE_CONTINUOUS,
ReportView.VIEW_DOUBLE_PAGE,
ReportView.VIEW_SINGLE_PAGE,
ReportView.VIEW_SINGLE_CONTINUOUSpublic int getAutomaticZoomType()
getAutomaticZoomType in interface ReportViewReportView.ZOOM_MANUAL,
ReportView.ZOOM_TO_PAGEHEIGHT,
ReportView.ZOOM_TO_PAGEWIDTH,
ReportView.ZOOM_TO_FULLPAGE,
ReportView.setAutomaticZoomType(int)public int getMouseActionMode()
getMouseActionMode in interface ReportViewReportView.MODE_HAND,
ReportView.MODE_SNAPSHOT,
ReportView.MODE_TEXTpublic RenderData getReportData()
getReportData in interface ReportViewpublic ReportViewer getReportViewer()
getReportViewer in interface ReportViewpublic java.lang.String getReportTitle()
getReportTitle in interface ReportViewRenderData.setReportTitle(String)public int getLoadingStatus()
getLoadingStatus in interface ReportViewReportView.STATUS_CANCELED,
ReportView.STATUS_FINISHED,
ReportView.STATUS_INITIALIZED,
ReportView.STATUS_LOADINGpublic void setAutoRefresh(int millis)
millis 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.
setAutoRefresh in interface ReportViewmillis - number of milliseconds for auto-refresh cycle, 0 to turn off auto-refreshpublic boolean isDrilldownEnabled()
ReportView.setDrilldownEnabled(boolean)
and/or as a ViewerSettings entry.
isDrilldownEnabled in interface ReportViewpublic void setDrilldownEnabled(boolean enabled)
setDrilldownEnabled in interface ReportViewenabled - true if it is to be enabledpublic boolean isPageLimitExceeded()
isPageLimitExceeded in interface ReportViewpublic void setPageLimitExceeded(boolean pageLimitExceeded)
pageLimitExceeded - true if page limit was exceeded
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||