Package com.inet.viewer
Interface ReportViewer
- All Superinterfaces:
ViewerComponent
- All Known Implementing Classes:
SwingReportViewer
This is the top level viewer instance of the i-net Clear Reports report viewer, and allows
creation, retrieval, and removal of one or more ReportViews.
To create a ReportView, a RenderData object is necessary, in order for the ReportView to be
able to fetch its report data.
This class also holds the tool bar which can be used to fire actions, add or remove buttons.
- Since:
- 7.0
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddNewReportView
(RenderData data) Creates a new ReportView object, using the RenderData parameter as its source of report data.addNewReportView
(RenderData data, boolean isClosable) Creates a new ReportView object, using the RenderData parameter as its source of report data.void
addReportView
(ReportView view) Adds a given ReportView to the ReportViewer - this ReportView need not be initialized at this point in time.
Note that as long as the viewer exists, this report view will be held in memory, unless it is removed viacloseReportView(int)
orcloseAllReportViews()
.void
addReportView
(ReportView view, boolean isClosable) Adds a given ReportView to the ReportViewer - this ReportView need not be initialized at this point in time.
Note that as long as the viewer exists, this report view will be held in memory, unless it is removed viacloseReportView(int)
orcloseAllReportViews()
.void
Adds anReportViewChangeListener
to the ReportView.void
Adds aPropertyChangeListener
to the listener list.void
This method permanently closes and removes all ReportViews currently in the ReportViewer.void
closeReportView
(int index) Permanently closes and removes the ReportView at the given index, 0-based.void
closeReportView
(ReportView view) Permanently closes and disposes the ReportView given as the parameter and removes it from the ReportViewer.Returns the currently visible or selected ReportView object.Returns theProgressPool
of the viewer.getReportView
(int i) Returns the report view at the given index.int
Returns the number of ReportViews registered and added to this viewer.Returns the current ToolBar - this tool bar belongs to the currently visible or selected ReportView object.Returns the current ViewerContext for this viewer, which is used for reacting to and handling events occurring in the viewer.boolean
Returns whether the global "hasGroupTree" setting is on or off (by default it is on).boolean
Returns whether the global setting of "hasStatusBar" is on or off (by default it is on).void
Removes anReportViewChangeListener
from the ReportView.void
Removes aPropertyChangeListener
from the list of listeners.void
Sets which ReportView is currently selected and to be affected by any toolbar actions, etc.void
setCustomPromptEditor
(String promptName, int valueType, CustomPromptEditor editor) Registers the givenCustomPromptEditor
for prompts with the given name and value type, case-insensitive.void
setHasGroupTree
(boolean hasGroupTree) Sets all report views to whether or not they are to show a group tree.void
setHasStatusBar
(boolean hasStatusBar) Sets for all report views whether or not they are to show a status bar.void
setViewerContext
(ViewerContext context) Sets the ViewerContext for this viewer, used for reacting to and handling events which occur in the viewer.Methods inherited from interface com.inet.viewer.ViewerComponent
getComponent
-
Field Details
-
PROP_STATUS_MESSAGE
Property for use by thePropertyChangeListener
, standing for a change in the status bar message- Since:
- 7.0
- See Also:
-
UIPROP_SCROLLPANE_BACKGROUND
UI property key for setting the background color in the scroll pane area of the Viewer where no page can be seen. If no property is set,Color.LIGHT_GRAY
is taken by default.- See Also:
-
-
Method Details
-
getCurrentReportView
ReportView getCurrentReportView()Returns the currently visible or selected ReportView object. Note that this will return null if no ReportView is currently visible or selected.- Returns:
- Currently active ReportView, or null if none is currently active
- Since:
- 7.0
-
getReportViewCount
int getReportViewCount()Returns the number of ReportViews registered and added to this viewer. The return value -1 is the maximum allowed index forgetReportView(int)
.- Returns:
- The number of ReportViews held by the ReportViewer
- Since:
- 7.0
-
getReportView
Returns the report view at the given index. Note this report view need not be the current report view or even visible. The maximum allowed index isgetReportViewCount()-1
, the minimum allowed is 0.- Parameters:
i
- Index of report view to fetch.- Returns:
- ReportView at the index given
- Throws:
IndexOutOfBoundsException
- If index is smaller than 0 or is greater than or equal to getReportViewCount().- Since:
- 7.0
-
setCurrentReportView
Sets which ReportView is currently selected and to be affected by any toolbar actions, etc. Any time the toolbar or group view needs to fire an action, it asks the viewer for the current report view viagetCurrentReportView()
. This method makes sure that the correct report view is set as "current".
Note that this method also notifies eachReportViewChangeListener
of a change in the currently selected report view.
Note also that "null" is allowed here which causes no view at all to be viewed as the currently selected report view.- Parameters:
view
- ReportView to give focus to and to set as "current" report view.- Since:
- 7.0
- See Also:
-
getToolBar
ToolBar getToolBar()Returns the current ToolBar - this tool bar belongs to the currently visible or selected ReportView object. This object is responsible for various user actions for navigating through the report, printing, etc.- Returns:
- ToolBar of current ReportView
- Since:
- 7.0
-
addReportView
Adds a given ReportView to the ReportViewer - this ReportView need not be initialized at this point in time.
Note that as long as the viewer exists, this report view will be held in memory, unless it is removed viacloseReportView(int)
orcloseAllReportViews()
.- Parameters:
view
- ReportView to addisClosable
- Whether the report view is to have a close button- Since:
- 7.4
- See Also:
-
addNewReportView
Creates a new ReportView object, using the RenderData parameter as its source of report data. Also adds this newly created ReportView to the ReportViewer, therefore this view should not simply be added somewhere else without first removing it from the viewer. Note that as long as the viewer exists, this report view will be held in memory, unless it is removed viacloseReportView(int)
orcloseAllReportViews()
.
If a report with precisely the same properties has already been added, this will not create an identical second view, rather it will give focus to the view already opened. If you want to add two identical reports to the same viewer, simply add an identifying property to the report views, such as a time stamp.- Parameters:
data
- RenderData object specifying the source of report dataisClosable
- Whether the report view is to have a close button- Returns:
- Newly created ReportView - this ReportView has now been added to a ReportViewer and should not simply be added somewhere else without first removing it from the viewer.
- Since:
- 7.4
- See Also:
-
addReportView
Adds a given ReportView to the ReportViewer - this ReportView need not be initialized at this point in time.
Note that as long as the viewer exists, this report view will be held in memory, unless it is removed viacloseReportView(int)
orcloseAllReportViews()
. In this case, it can not be added back to the viewer via this method. Instead it must be recreated with theRenderData
.
Note also that the report view will not have a close button if it is the first report view added to the viewer, otherwise it will. If you'd like to customize this behavior, use the methodaddReportView(ReportView, boolean)
instead, where you can manually set whether or not the view is to have a close button.- Parameters:
view
- ReportView to add- Throws:
IllegalStateException
- if this view has previously been removed viacloseReportView(ReportView)
orcloseReportView(int)
orcloseAllReportViews()
.- Since:
- 7.0
- See Also:
-
addNewReportView
Creates a new ReportView object, using the RenderData parameter as its source of report data. Also adds this newly created ReportView to the ReportViewer.
Note that as long as the viewer exists, this report view will be held in memory, unless it is removed viacloseReportView(int)
orcloseAllReportViews()
. In this case, it can not be added back to the Viewer via this method. Instead it must be recreated with the RenderData.
Note also that the report view will not have a close button if it is the first report view added to the viewer, otherwise it will. If you'd like to customize this behavior, use the methodaddNewReportView(RenderData, boolean)
instead, where you can manually set whether or not the view is to have a close button.
If a report with precisely the same properties has already been added, this will not create an identical second view, rather it will give focus to the view already opened. If you want to add two identical reports to the same viewer, simply add an identifying property to the report views, such as a time stamp.- Parameters:
data
- RenderData object specifying the source of report data- Returns:
- Newly created ReportView - this ReportView has now been added to a ReportViewer and should not simply be added somewhere else without first removing it from the viewer.
- Throws:
IllegalStateException
- if this view has previously been removed viacloseReportView(ReportView)
orcloseReportView(int)
orcloseAllReportViews()
.- Since:
- 7.0
- See Also:
-
closeReportView
void closeReportView(int index) Permanently closes and removes the ReportView at the given index, 0-based. That is,closeReportView(0)
will close and remove the first ReportView added to the Viewer,closeReportView(1)
the second, etc. This will also close any currently open connections to the ReportView's RenderData object. Note that this causes the report view to be disposed of - trying to add it back to the viewer viaaddReportView(ReportView, boolean)
will result in an IllegalStateException. Instead simply create a new report view with the same RenderData. If there is no ReportView at this index, this method will throw a ViewerException.- Parameters:
index
- Index of ReportView to close and remove.- Since:
- 7.0
-
closeReportView
Permanently closes and disposes the ReportView given as the parameter and removes it from the ReportViewer. This will also close any currently open connections to the ReportView's RenderData object. Note that this causes the report view to be disposed of - trying to add it back to the viewer viaaddReportView(ReportView, boolean)
will result in an IllegalStateException. Instead simply create a new report view with the same RenderData.- Parameters:
view
- ReportView to close and remove from the ReportViewer- Since:
- 7.0
-
closeAllReportViews
void closeAllReportViews()This method permanently closes and removes all ReportViews currently in the ReportViewer. This will also close any currently open connections to the various RenderData objects to which the ReportViews are connected. Note that this causes the report views to be disposed of - trying to add one of them back to the viewer viaaddReportView(ReportView, boolean)
will result in an IllegalStateException. Instead simply create a new report view with the same RenderData.- Since:
- 7.0
-
addReportViewChangeListener
Adds anReportViewChangeListener
to the ReportView.- Parameters:
rvcl
- theReportViewChangeListener
to be added- Since:
- 7.0
-
removeReportViewChangeListener
Removes anReportViewChangeListener
from the ReportView.- Parameters:
rvcl
- the listener to be removed- Since:
- 7.0
-
setHasGroupTree
void setHasGroupTree(boolean hasGroupTree) Sets all report views to whether or not they are to show a group tree. If this is false, the report views are not to show any group tree, regardless of whether or not their reports have groups.- Parameters:
hasGroupTree
- Are all report views to show a group tree?- Since:
- 7.0
-
hasGroupTree
boolean hasGroupTree()Returns whether the global "hasGroupTree" setting is on or off (by default it is on). Note that there can always be local exceptions to this rule.- Returns:
- Global "hasGroupTree" setting
- Since:
- 7.0
-
setHasStatusBar
void setHasStatusBar(boolean hasStatusBar) Sets for all report views whether or not they are to show a status bar. If this is false, the report views are not to show a status bar.- Parameters:
hasStatusBar
- Are all report views to show a status bar?- Since:
- 7.0
-
hasStatusBar
boolean hasStatusBar()Returns whether the global setting of "hasStatusBar" is on or off (by default it is on).- Returns:
- Global "hasStatusBar" setting
- Since:
- 7.0
-
getProgressPool
ProgressPool getProgressPool()Returns theProgressPool
of the viewer. The ProgressPool handles all progresses of the viewer. You can add listeners to the ProgressPool to watch status changes of the progresses.- Returns:
- Returns the ProgressPool of the viewer.
- Since:
- 7.0
-
addStateChangeListener
Adds aPropertyChangeListener
to the listener list. The listener will be informed about status changes of all progresses and messages changes in the StatusBar.- Parameters:
l
- PropertyChangeListener to add to the list of listeners- Since:
- 7.0
-
removeStateChangeListener
Removes aPropertyChangeListener
from the list of listeners.- Parameters:
l
- PropertyChangeListener to remove from the list of listeners.- Since:
- 7.0
-
setViewerContext
Sets the ViewerContext for this viewer, used for reacting to and handling events which occur in the viewer.- Parameters:
context
- ViewerContext to use for this viewer. Can not be null.- Throws:
IllegalArgumentException
- If context is null.- Since:
- 7.0
- See Also:
-
getViewerContext
ViewerContext getViewerContext()Returns the current ViewerContext for this viewer, which is used for reacting to and handling events occurring in the viewer. By default, this will return an instance ofSwingViewerContext
.- Returns:
- ViewerContext used by this viewer
- Since:
- 7.0
- See Also:
-
setCustomPromptEditor
Registers the givenCustomPromptEditor
for prompts with the given name and value type, case-insensitive. Setting null as the editor unregisters any CustomPromptEditor for the given name and value type. An existingCustomPromptEditor
for the given name and value type will be replaced with the one set with this method. Depending on the value type of the prompt, your custom prompt editor should return one of the following types:- If a multiple prompt, a vector containing one or more single values.
- If one of the values is a range, it should be a RangePromptValue.
For single value prompts:
-
- String for value type PromptData#STRING
- Double for value type PromptData#NUMBER and PromptData#CURRENCY
- Boolean for value type PromptData#BOOLEAN
- Date for value type PromptData#DATE and PromptData#DATETIME
- Time for value type PromptData#TIME
- byte[] for value type PromptData#BINARY
- Parameters:
promptName
- name of prompt to register custom prompt editor for, may not be nullvalueType
- value type of the promptName. Use the constants form the class PromptData for the types.editor
- custom prompt editor for prompting certain prompts with your own components.- Throws:
NullPointerException
- if promptName is null- Since:
- 9.0
-