|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.inet.viewer.SwingViewerContext
public class SwingViewerContext
The default implementation of ViewerContext for i-net Clear Reports Viewer. This takes all errors and displays them in a small error dialog, and shows a simple info dialog when one is requested.
Note that most often the source given for an error will be a SwingReportView, allowing you to make further adjustments to your settings for that view.
For example, if an UnknownHostException comes for a ReportView, you might want to make an adjustment to the ReportView's RenderData object, making it fall back onto a backup report server instead of the original one:
class MyErrorHandler extends SwingViewerContext {
public void showError( ViewerException e, Object source ) {
if (source instanceof ReportView && e.getCause() instanceof UnknownHostException) {
((ReportView)source).getReportData().setReportLocation( "http://www.backupserver.com:9000/?report=file:backupreport.rpt" );
((ReportView)source).reload();
}
}
It is also possible you would like to add specific logging to all errors shown:
class MyErrorHandler extends SwingViewerContext {
public void showError( ViewerException e, Object source ) {
// ...log the error here...
super.showError(e,source);
}
ReportViewer.setViewerContext(ViewerContext)| Constructor Summary | |
|---|---|
SwingViewerContext()
Deprecated. As of i-net Crystal-Clear 10.1, replaced by SwingViewerContext(SwingReportViewer) |
|
SwingViewerContext(SwingReportViewer viewer)
Creates a SwingViewerContext with a reference to a SwingReportViewer which is used for example when parent components are needed for dialogs, etc. |
|
| Method Summary | |
|---|---|
void |
export(ReportView view)
This method is called when the export action is to be performed. |
Progress |
export(java.awt.Component parent,
RenderData data,
java.beans.PropertyChangeListener changeListener)
Opens the export dialog with the given parent as its parent and exports using the provided RenderData object. |
Progress |
export(java.awt.Component parent,
RenderData data)
Opens the export dialog with the given parent as its parent and exports using the provided RenderData object. |
SwingReportViewer |
getViewer()
Returns the viewer to which this context belongs. |
void |
print(ReportView view)
This method is called when the print action is to be performed. |
void |
setViewer(SwingReportViewer viewer)
Sets the viewer to which this context belongs. |
void |
showError(java.lang.Throwable e,
java.lang.Object source)
This method will be called whenever an error occurs and thereby allows the implementor of this interface to handle the error as seen fit. |
void |
showInfo()
Shows the info screen of this viewer. |
boolean |
showPrompts(PromptData[] prompts,
RenderData data)
Handles a prompt request from the server. |
void |
showStatusMessage(ReportView view,
java.lang.String message,
boolean isError)
Handled when a status message is to be displayed. |
void |
showUrl(java.lang.String url,
java.util.Properties props)
Handles opening a URL, e.g. a click on a hyperlink. |
| Constructor Detail |
|---|
public SwingViewerContext()
SwingViewerContext(SwingReportViewer)
public SwingViewerContext(SwingReportViewer viewer)
viewer - SwingReportViewer to which this context belongs.| Method Detail |
|---|
public void showInfo()
showInfo in interface ViewerContext
public void showError(java.lang.Throwable e,
java.lang.Object source)
showError in interface ViewerContexte - The Throwable of the error that actually occurred.source - The source where the exception occurred, such as the SwingReportView or SwingPageView.public void export(ReportView view)
export in interface ViewerContextview - ReportView whose report is to be exported
public Progress export(java.awt.Component parent,
RenderData data,
java.beans.PropertyChangeListener changeListener)
parent - Parent to display the dialog indata - RenderData to use for retrieving the export datachangeListener - PropertyChangeListener that will be notified whenever a bean changes a "bound" property.
public Progress export(java.awt.Component parent,
RenderData data)
parent - Parent to display the dialog indata - RenderData to use for retrieving the export data
public void print(ReportView view)
print in interface ViewerContextview - ReportView whose report is to be printed.
public void showStatusMessage(ReportView view,
java.lang.String message,
boolean isError)
showStatusMessage in interface ViewerContextview - the ReportView which is to display the status message, must not be nullmessage - the message to be displayedisError - true if the message is an error message, false otherwise.
public void showUrl(java.lang.String url,
java.util.Properties props)
throws java.net.MalformedURLException
showUrl in interface ViewerContexturl - String of the hyperlink URL which is to be shown. The length need to be > 0.props - Extra optional Properties for the URL connection (can be null for no extra properties)
java.net.MalformedURLException - The supplied URL String is invalid.public void setViewer(SwingReportViewer viewer)
viewer - the viewer to which this context belongs, can be null if the context is not to be bound to a viewerpublic SwingReportViewer getViewer()
public boolean showPrompts(PromptData[] prompts,
RenderData data)
PromptData.setChosenValues(Object).
showPrompts in interface ViewerContextprompts - list of required promptsdata - RenderData of the report requiring prompts
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||