|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.crystaldecisions.report.web.ServerControl
com.crystaldecisions.report.web.viewer.ReportServerControl
com.crystaldecisions.report.web.viewer.CrystalReportViewerBase
com.crystaldecisions.report.web.viewer.CrystalReportViewer
This class allows you to display a report in HTML and manipulate the view of the report. As well as methods to add listeners for specific events within the displayed report, there are methods for setting various options concerning how the report is displayed.
| Field Summary | |
static java.lang.String |
PAGE_TYPE
Specifies view type to be rendered as Page. |
static java.lang.String |
TOOLBAR_TYPE
Specifies view type to be rendered as Toolbar. |
static java.lang.String |
TREE_TYPE
Specifies view type to be rendered as GroupTree. |
| Constructor Summary | |
CrystalReportViewer()
|
|
| Method Summary | |
void |
addDrillDownSubreportEventListener(DrillDownSubreportEventListener listener)
Adds a listener for DrillDownSubreportEvents. |
void |
addNavigateEventListener(NavigateEventListener listener)
Adds a listener for NavigateEvents. |
void |
addToolbarCommandEventListener(ToolbarCommandEventListener listener)
Adds a listener for ToolbarCommandEvents. |
void |
drillDown(IGroupPath groupPath,
java.lang.String groupName)
Performs a drill down to the group in the report specified by the name and the path. |
int |
getGroupTreeWidth()
Returns the current width of the group tree. |
CrHtmlUnitEnum |
getGroupTreeWidthUnit()
Returns whether pixels or percentage is being used to determine the group tree width. |
double |
getPageToTreeRatio()
Deprecated. As of Version 10 in favor of getGroupTreeWidth
and getGroupTreeWidthUnit |
CrPrintMode |
getPrintMode()
Returns the current print mode that will be used when the user clicks the print button. |
Toolbar |
getToolbar()
Returns the Toolbar object. |
ViewInfo |
getViewInfo()
Returns the ViewInfo object.
|
int |
getZoomFactor()
Returns the zoom factor that is currently set. |
boolean |
hasExportButton()
Returns whether the report viewer has an export button. |
boolean |
hasGotoPageButton()
Returns whether the report viewer has a "Go to Page" button. |
boolean |
hasLogo()
Returns whether the report viewer is set to display the company logo. |
boolean |
hasPageBottomToolbar()
Returns whether the viewer displays a bottom toolbar. |
boolean |
hasPageNavigationButtons()
Returns whether the report viewer has page navigation buttons. |
boolean |
hasPrintButton()
Returns whether the report viewer has a print button. |
boolean |
hasRefreshButton()
Returns whether the report viewer has a refresh button. |
boolean |
hasSearchButton()
Returns whether the report viewer has a search button. |
boolean |
hasToggleGroupTreeButton()
Returns whether the report viewer has a button for toggling the display of the group tree. |
boolean |
hasViewList()
Returns whether the report viewer has a view list. |
boolean |
hasZoomFactorList()
Returns whether the report viewer has a zoom factor list. |
boolean |
isBestFitPage()
Returns whether the viewer will ignore the height and width values it is given and try to find the best fit for the report by taking up as much space as it needs to properly display the report. |
boolean |
isDisplayGroupTree()
Returns whether the group tree is displayed. |
boolean |
isDisplayPage()
Returns whether the report page is displayed. |
boolean |
isDisplayToolbar()
Returns whether the toolbar is displayed. |
boolean |
isEnableDrillDown()
Returns whether the user can drill down on the report. |
boolean |
isRenderAsHTML32()
Returns whether the report is rendered as HTML 3.2. |
boolean |
isSeparatePages()
Returns whether each report page is displayed as a separate HTML page. |
boolean |
isShowAllPageIds()
Returns whether PageIds are added to the HTML content.
|
void |
removeDrillDownSubreportEventListener()
Removes a DrillDownSubreportEventListener. |
void |
removeNavigateEventListener()
Removes a NavigateEventListener. |
void |
removeToolbarCommandEventListener()
Removes a ToolbarCommandEventListener. |
void |
searchText(java.lang.String strTextToSearch,
int searchDirection)
Highlights the first occurrence of the specified text in the report and scrolls to it. |
void |
setBestFitPage(boolean bestFitPage)
Specifies whether the viewer should determine the size of the viewer based on the size of the report content to display. |
void |
setDisplayGroupTree(boolean newM_bDisplayGroupTree)
Sets whether to display the group tree. |
void |
setDisplayPage(boolean newM_bDisplayPage)
Sets whether to display the report page. |
void |
setDisplayToolbar(boolean display)
Sets whether to display the Toolbar. |
void |
setEnableDrillDown(boolean enableDrillDown)
Sets whether to enable drill down. |
void |
setGroupTreeWidth(int newGroupTreeWidth)
Sets the width of the group tree. |
void |
setGroupTreeWidthUnit(CrHtmlUnitEnum newGroupTreeWidthUnit)
Sets whether to use pixels or percentage to determine the group tree width. |
void |
setHasExportButton(boolean newM_bHasExportButton)
Sets whether to display the export button. |
void |
setHasGotoPageButton(boolean newM_bHasGotoPageButton)
Sets whether to display the GotoPageButton. |
void |
setHasLogo(boolean newM_bHasLogo)
Sets whether to display the company logo. |
void |
setHasPageBottomToolbar(boolean newHasPageBottomToolbar)
Specifies whether the viewer displays a bottom toolbar. |
void |
setHasPageNavigationButtons(boolean newM_bHasPageNavigationButtons)
Sets whether to display the page navigation buttons. |
void |
setHasPrintButton(boolean newM_bHasPrintButton)
Sets whether to display the print button. |
void |
setHasRefreshButton(boolean newM_bHasRefreshButton)
Sets whether to display the refresh button. |
void |
setHasSearchButton(boolean newM_bHasSearchButton)
Sets whether to include or exclude the search button and associated text box when rendering the report. |
void |
setHasToggleGroupTreeButton(boolean newM_bHasToggleButton)
Sets whether to display the toggle group tree button. |
void |
setHasViewList(boolean newM_bHasViewList)
Sets whether to display the view list. |
void |
setHasZoomFactorList(boolean newM_bHasZoomButton)
Sets whether to display a zoom factor list. |
void |
setPageToTreeRatio(double newM_nPageToTreeRatio)
Deprecated. As of Version 10 in favor of setGroupTreeWidth
and setGroupTreeWidthUnit |
void |
setPrintMode(CrPrintMode printMode)
Sets whether to print using PDF or ActiveX print mode when the user clicks the print button. |
void |
setRenderAsHTML32(boolean newM_bRenderAsHTML32)
Sets whether to render the content as HTML 3.2. |
void |
setSeparatePages(boolean separate)
Sets whether the report is displayed as separate pages or one long page. |
void |
setShowAllPageIds(boolean showAllPageIds)
Sets whether PageIds are added to the HTML content.
|
void |
setZoomFactor(int zoomFactor)
Sets a new zoom factor for displaying the report. |
void |
showFirstPage()
Displays the first page of the report. |
void |
showLastPage()
Displays the last page of the report. |
void |
showNextPage()
Displays the next page of the report. |
void |
showNthPage(int pageNumber)
Displays the specified page of the report. |
void |
showPreviousPage()
Displays the previous page of the report. |
| Methods inherited from class com.crystaldecisions.report.web.ServerControl |
getHeight, getHtmlContent, getLeft, getName, getProductLocale, getTop, getURI, getViewState, getWidth, isIgnoreViewStateOnLoad, isOwnForm, isOwnPage, processHttpRequest, setHeight, setIgnoreViewStateOnLoad, setLeft, setName, setOwnForm, setOwnPage, setProductLocale, setTop, setURI, setViewState, setWidth |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String TOOLBAR_TYPE
Specifies view type to be rendered as Toolbar.
public static final java.lang.String TREE_TYPE
Specifies view type to be rendered as GroupTree.
public static final java.lang.String PAGE_TYPE
Specifies view type to be rendered as Page.
| Constructor Detail |
public CrystalReportViewer()
| Method Detail |
public void addDrillDownSubreportEventListener(DrillDownSubreportEventListener listener)
throws java.util.TooManyListenersException
Adds a listener for DrillDownSubreportEvents.
listener - The DrillDownSubreportEventListener.
java.util.TooManyListenersException - This is thrown if you attempt to add more than
one listener on a particular listener source concurrently.removeDrillDownSubreportEventListener
public void addNavigateEventListener(NavigateEventListener listener)
throws java.util.TooManyListenersException
Adds a listener for NavigateEvents.
listener - The NavigateEventsListener.
java.util.TooManyListenersException - This is thrown if you attempt to add more than
one listener on a particular listener source concurrently.removeNavigateEventListener
public void addToolbarCommandEventListener(ToolbarCommandEventListener listener)
throws java.util.TooManyListenersException
Adds a listener for ToolbarCommandEvents.
listener - The ToolbarCommandEventListener.
java.util.TooManyListenersException - This is thrown if you attempt to add more than
one listener on a particular listener source concurrently.removeToolbarCommandEventListener
public void drillDown(IGroupPath groupPath,
java.lang.String groupName)
Performs a drill down to the group in the report specified by the name and the path.
groupPath - An IGroupPath object
that specifies the
path of the group to drill down on.groupName - A String that specifies the
name of the group to drill down on.public int getGroupTreeWidth()
Returns the current width of the group tree. This value can be either be specified in pixels
or as a percentage, depending on the value returned by getGroupTreeWidthUnit().
int specifying the current width of the group tree.public CrHtmlUnitEnum getGroupTreeWidthUnit()
Returns whether pixels or percentage is being used to determine the group tree width.
CrHtmlUnitEnum object specifying the unit being used to determine
group tree width.CrHtmlUnitEnumpublic double getPageToTreeRatio()
getGroupTreeWidth
and getGroupTreeWidthUnit
public Toolbar getToolbar()
Returns the Toolbar object.
Note: This method is provided so that you can see the default Toolbar in case you want to modify it.
The getToolbar method does not apply to the
interactive viewer.
public ViewInfo getViewInfo()
Returns the ViewInfo object.
The ViewInfo object is used to obtain information for
the client that is not available from the specific listener that
is being used.
For example, if you were using the event handler for
the NavigateEventListener,
you could use the following to access the group name from
the ViewInfo object:
public void navigate (NavigateEvents e){
String groupName = ((CrystalReportViewer) (e.getSource()).getViewInfo().getGroupName();
ViewInfo object.public int getZoomFactor()
Returns the zoom factor that is currently set.
int.hasZoomFactorList,
setHasZoomFactorList,
setZoomFactorpublic boolean hasExportButton()
Returns whether the report viewer has an export button.
true if the viewer has an export button
and false otherwise.setHasExportButtonpublic boolean hasGotoPageButton()
Returns whether the report viewer has a "Go to Page" button.
true if the viewer has a
"Go to Page" button and false otherwise.setHasGotoPageButtonpublic boolean hasLogo()
Returns whether the report viewer is set to display the company logo.
true if the viewer is set to display the
company logo and false otherwise.setHasLogopublic boolean hasPageNavigationButtons()
Returns whether the report viewer has page navigation buttons.
true if the viewer has page navigation buttons
and false otherwise.setHasPageNavigationButtonspublic boolean hasPrintButton()
Returns whether the report viewer has a print button.
true if the viewer has a print button
and false otherwise.setHasPrintButtonpublic boolean hasRefreshButton()
Returns whether the report viewer has a refresh button.
true if the viewer has a refresh button
and false otherwise.setHasRefreshButtonpublic boolean hasSearchButton()
Returns whether the report viewer has a search button.
true if the viewer has a search button
and false otherwise.setHasSearchButtonpublic boolean hasToggleGroupTreeButton()
Returns whether the report viewer has a button for toggling the display of the group tree.
true if the viewer has group tree button
and false otherwise.setHasToggleGroupTreeButton(boolean newM_bHasToggleButton)public boolean hasViewList()
Returns whether the report viewer has a view list.
true if the viewer has a view list
and false otherwise.setHasViewListpublic boolean hasZoomFactorList()
Returns whether the report viewer has a zoom factor list.
true if the viewer has a zoom factor list
and false otherwise.getZoomFactor,
setHasZoomFactorList,
setZoomFactorpublic boolean isBestFitPage()
Returns whether the viewer will ignore the height and width values it is given and try to find the best fit for the report by taking up as much space as it needs to properly display the report.
true if the values of the Height and Width properties are overridden so that
the viewer size expands to fit the report content. False if the values of the Height and Width
properties are used to display the pages. If the viewer content is larger than the specified Height and Width
values, scrollbars will appear in the page to allow all of the content to be viewed.setBestFitPagepublic boolean isDisplayGroupTree()
Returns whether the group tree is displayed.
true if the group tree is displayed
and false otherwise. If the HasToggleGroupTreeButton property is set to True,
the user can choose to display the group tree by selecting this button. To remove the ability to
view the group tree, both the setHasToggleGroupTreeButton and setDisplayGroupTree methods must be set to false.setDisplayGroupTreepublic boolean isDisplayPage()
Returns whether the report page is displayed.
Note: If setDisplayPage if False, the toolbar is not displayed regardless of the value of the setDisplayToolbar method.
true if the report page is displayed
and false otherwise.setDisplayPagepublic boolean isDisplayToolbar()
Returns whether the toolbar is displayed.
Note: If the setDisplayToolbar property is False, the toolbar buttons are not displayed regardless of the values of the "Has Button" properties.
true if the toolbar is displayed
and false otherwise.setDisplayToolbarpublic boolean hasPageBottomToolbar()
Returns whether the viewer displays a bottom toolbar.
boolean that specifies whether the viewer displays a bottom toolbarpublic boolean isEnableDrillDown()
Returns whether the user can drill down on the report.
true if the user can drill down on the report
and false otherwise.setEnableDrillDownpublic boolean isRenderAsHTML32()
Returns whether the report is rendered as HTML 3.2.
false otherwise.setRenderAsHTML32public boolean isSeparatePages()
Returns whether each report page is displayed as
a separate HTML page. It is not recommended
that you set setSeperatePages to false when displaying
longer reports as the report will not display until the
report has been fully loaded. When setSeperatePages is set to
false searchText
will not be available.
true if the report is displayed as separate
pages and false otherwise.setSeparatePagespublic boolean isShowAllPageIds()
Returns whether PageIds are added to the HTML content.
If page IDs are added to the HTML additional content, they will be added
to the beginning of the HTML div tags to identify the individual
report elements.
true if the additional PageIds
are added to the HTML content and false otherwise.setShowAllPageIdspublic void removeDrillDownSubreportEventListener()
Removes a DrillDownSubreportEventListener.
addDrillDownSubreportEventListenerpublic void removeNavigateEventListener()
Removes a NavigateEventListener.
addNavigateEventListenerpublic void removeToolbarCommandEventListener()
Removes a ToolbarCommandEventListener.
addToolbarCommandEventListener
public void searchText(java.lang.String strTextToSearch,
int searchDirection)
Highlights the first occurrence of the specified text in the report and scrolls to it.
Note: The text search begins on the following page.
To search the first page of a report or to search a report that
is displayed continuously (that is, where
setSeparatePages
is set to False), you must use the browser's search function.
strTextToSearch - A String that specifies the
text string to search for in the report.searchDirection - An int that specifies the search
direction. Currently, the only available value is 0 for forward.public void setBestFitPage(boolean bestFitPage)
Specifies whether the viewer should determine the size of the viewer based on the size of the report content to display.
bestFitPage - true to find the best fit for the
report, otherwise false to use the height and width
values it is given.isBestFitPagepublic void setDisplayGroupTree(boolean newM_bDisplayGroupTree)
Sets whether to display the group tree.
newM_bDisplayGroupTree - true to display
the group tree.isDisplayGroupTreepublic void setDisplayPage(boolean newM_bDisplayPage)
Sets whether to display the report page.
newM_bDisplayPage - true to display
the report page.isDisplayPagepublic void setDisplayToolbar(boolean display)
Sets whether to display the Toolbar.
display - true to display
the Toolbar.isDisplayToolbarpublic void setHasPageBottomToolbar(boolean newHasPageBottomToolbar)
Specifies whether the viewer displays a bottom toolbar.
newHasPageBottomToolbar - set to true to display a bottom toolbar, false otherwisepublic void setEnableDrillDown(boolean enableDrillDown)
Sets whether to enable drill down.
enableDrillDown - true to enable drill down.isEnableDrillDownpublic void setGroupTreeWidth(int newGroupTreeWidth)
Sets the width of the group tree. This value can be either be specified in pixels
or as a percentage, by passing the appropriate CrHtmlUnitEnum object to
setGroupTreeWidthUnit(com.crystaldecisions.report.web.viewer.CrHtmlUnitEnum).
The units for the setGroupTreeWidth method are determined by the setGroupTreeWidthUnit method.
newGroupTreeWidth - An int specifying the new width of the group tree.public void setGroupTreeWidthUnit(CrHtmlUnitEnum newGroupTreeWidthUnit)
Sets whether to use pixels or percentage to determine the group tree width.
newGroupTreeWidthUnit - A CrHtmlUnitEnum object specifying the unit to use
to determine group tree width.CrHtmlUnitEnumpublic void setPrintMode(CrPrintMode printMode)
Sets whether to print using PDF or ActiveX print mode when the user clicks the print button. In PDF print mode, a PDF will be displayed, allowing the user to then print it. In ActiveX print mode, a small ActiveX control is downloaded to the client machine to execute the print job. If ActiveX print mode is selected on a system that does not support ActiveX controls, the print mode will default to PDF printing.
printMode - A CrPrintMode object specifying the print mode to be used.getPrintMode()public CrPrintMode getPrintMode()
Returns the current print mode that will be used when the user clicks the print button.
CrPrintMode object specifying the print mode currently being used.setPrintMode(com.crystaldecisions.report.web.viewer.CrPrintMode)public void setHasExportButton(boolean newM_bHasExportButton)
Sets whether to display the export button.
Note: setOwnPage
must be set to true or the button is not rendered,
regardless of the value set in the setHasExportButton
method.
newM_bHasExportButton - true
to display the export button.hasExportButtonpublic void setHasGotoPageButton(boolean newM_bHasGotoPageButton)
Sets whether to display the GotoPageButton.
Note: If true, the HTML returned includes a
text box, into which the user can type a page number to navigate
to a specific page in the report. If False, the HTML returned
displays the current page, but does not allow the user to navigate
by page number. The default value is true.
newM_bHasGotoPageButton - true
to display the GotoPageButton button.hasGotoPageButtonpublic void setHasLogo(boolean newM_bHasLogo)
Sets whether to display the company logo.
newM_bHasLogo - true
to display the company logo.hasLogopublic void setHasPageNavigationButtons(boolean newM_bHasPageNavigationButtons)
Sets whether to display the page navigation buttons.
The page navigation buttons include the first, last, previous, and next page buttons, the go to page text box and the page number label. This property applies to both the top and bottom toolbars.
newM_bHasPageNavigationButtons - true
to display page navigation buttons.hasPageNavigationButtonspublic void setHasPrintButton(boolean newM_bHasPrintButton)
Sets whether to display the print button.
Note: If the PrintMode property is set to 0 (PDF), printing is accomplished by automatically exporting the report to PDF; the user can then print the PDF. If the PrintMode property is set to 1 (ActiveX), a small ActiveX control is downloaded to the client machine to execute the print job.
newM_bHasPrintButton - true
to display the print button.hasPrintButtonpublic void setHasRefreshButton(boolean newM_bHasRefreshButton)
Sets whether to display the refresh button.
Note: To avoid inconsistencies in the report data, it is recommended that you cache the report source when refreshing the report.
newM_bHasRefreshButton - true
to display the refresh button.hasRefreshButtonpublic void setHasSearchButton(boolean newM_bHasSearchButton)
Sets whether to include or exclude the search button and associated text box when rendering the report.
newM_bHasSearchButton - true
to display the search button.hasSearchButtonpublic void setHasToggleGroupTreeButton(boolean newM_bHasToggleButton)
Sets whether to display the toggle group tree button.
newM_bHasToggleButton - true
to display the toggle button.hasToggleGroupTreeButtonpublic void setHasViewList(boolean newM_bHasViewList)
Sets whether to display the view list.
Note: The view list will include the Main Report and any views you have drilled-down into. This can include groups, charts and subreports.
newM_bHasViewList - true
to display the view list button.hasViewListpublic void setHasZoomFactorList(boolean newM_bHasZoomButton)
Sets whether to display a zoom factor list.
newM_bHasZoomButton - true
to display a zoom factor list.getZoomFactor,
hasZoomFactorList,
setZoomFactorpublic void setPageToTreeRatio(double newM_nPageToTreeRatio)
setGroupTreeWidth
and setGroupTreeWidthUnit
public void setRenderAsHTML32(boolean newM_bRenderAsHTML32)
Sets whether to render the content as HTML 3.2.
Note: If true, then the report page viewer is rendered with only a
limited toolbar. Additionally, setting this method to true disables the advanced
features of the DHTML interactive viewer.
newM_bRenderAsHTML32 - true to display the content
as HTML 3.2.isRenderAsHTML32public void setSeparatePages(boolean separate)
Sets whether the report is displayed as
separate pages or one long page. It is not recommended
that you set to this false when displaying
longer reports as the report will not display until the
report has been fully loaded. When set to
false searchText
will not be available.
Note: It can take a considerable length of time for long reports to load continuously. Additionally, some browsers have memory limits that will cause long HTML pages to display incorrectly. Setting the setSeparatePages method to False is only recommended for reports that have a few pages.
separate - true if the report is displayed as separate
pages.isSeparatePagespublic void setShowAllPageIds(boolean showAllPageIds)
Sets whether PageIds are added to the HTML content.
If page IDs are added to the HTML additional content, they will be added
to the beginning of the HTML div tags to identify
the page.
showAllPageIds - true if the additional PageIds
are added to the HTML content.isShowAllPageIdspublic void setZoomFactor(int zoomFactor)
Sets a new zoom factor for displaying the report. Acceptable values for the zoom factor range from 10 to 400 percent.
zoomFactor - An int that specifies the value for the
zoom factor.getZoomFactor,
hasZoomFactorList,
setHasZoomFactorListpublic void showFirstPage()
Displays the first page of the report.
showLastPage,
showNextPage,
showNthPage,
showPreviousPagepublic void showLastPage()
Displays the last page of the report.
showFirstPage,
showNextPage,
showNthPage,
showPreviousPagepublic void showNextPage()
Displays the next page of the report.
Note: If the last page of the report is currently displayed, the viewer remains on this page.
showFirstPage,
showLastPage,
showNthPage,
showPreviousPagepublic void showNthPage(int pageNumber)
Displays the specified page of the report.
Note: If the report has no Nth page, the last page of the report is displayed.
pageNumber - An int that specifies the page of the report
to be displayed.showFirstPage,
showLastPage,
showNextPage,
showPreviousPagepublic void showPreviousPage()
Displays the previous page of the report.
Note: If the first page of the report is currently displayed, the viewer remains on this page.
showFirstPage,
showLastPage,
showNextPage,
showNthPage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||