The Designer provides the embedded Script implementation of all the methods discussed in this section. It is better to use the Designer to specify links and interactions, only using the API described below if the desired feature cannot be implemented from the visual interface.
The BasicReplet API defines a number of methods for adding common user interactions to a replet. Each call to these methods causes some default event handlers to be registered in order to support that interaction.
They serve as convenience functions as well as high-level encapsulations of the functionality. For most replets, the high-level methods are enough to handle most user interaction needs and programmers do not need to work with the lower level event handling API.
#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index |
|
Read More |
addLink()
There are three varieties of this method for adding a link to another element or report:
1. addLink(String eid, String replet) Add a hyperlink from the specified element (element ID) to a replet. When the element is clicked, the target replet is opened in a new window.
2. addLink(String eid, EventPoint item, String replet, RepletRequest req)
Add a hyperlink from a data item in the specified element to a replet. The data item is identified by the element ID (String eid), and by the location of the item in an EventPoint object. The point can identify either a table cell or a chart data point. In the case of table cells, EventPoint.x is the column number and EventPoint.y is the row number. Row and column numbers can also be obtained by item.getrow() and item.getcolumn(). In the case of chart data points, EventPoint.x is the index in a dataset and EventPoint.y is the dataset index. If either of the item positions (x and y) is to be ignored, set the respective value to -1. For example, if the link should be active for the entire first column, use EventPoint(0, -1) as the item value.
3. addLink(String eid, EventPoint item, String toeid, int row) Add a hyperlink from an element or an element item to another element in the same report. If the link is on an element, the item should be a null value. An optional row number can be specified if the target element is a table.
addLinkURL(String eid, EventPoint item, String url, String target)
Add a hyperlink from an element or an element item to a URL. The URL is displayed in the named frame, or in the current browser window if the target is null.
addRequest(String eid, EventPoint item, RepletRequest req)
Add a request link to the element/item (item could be null). When the element/item is clicked, the request is sent to the replet as a RequestEvent.
addStatus(String eid, EventPoint item, String msg)
Associate a status message with an element or an element item (item could be null). The message will be displayed when the mouse moves into the specified element or item.
addPopupMenu()
There are two varieties of this method of adding a popup menu:
1. addPopupMenu(String[] items)
Add a page level popup menu. The popup menu is activated when a right mouse click occurs anywhere on the page.
2. addPopupMenu(String eid, EventPoint item, String[] items)
Add an element popup menu. The popup menu is activated when a right mouse click occurs in the specified element/item (item could be null).
addMenuAction()
There are two varieties of this method, corresponding to the two addPopupMenu() methods. RepletCommand is covered in detail later.
1. addMenuAction(String menuitem, RepletCommand action)
Specify the command to execute when a menu item is selected.
2. addMenuAction(String eid, EventPoint item, String menuitem, RepletCommand action)
Specify the command to execute when an element menu item is selected. addFormLink(String form, String replet) Forward a form request to another replet. Form handling is covered in detail later.
Note that addLink() and addLinkURL() are memory intensive functions. Hence, it is highly recommended that these functions not be used, and instead, hyperlinks are added through the Designer. Right click on the report element (Table, Section, Chart or Text) and select the 'Hyperlink' option. You can specify the hyperlink to be a web link or a report link.