The client-side event handler can be accessed inside a BasicReplet and populated using the methods described on the previous "Client-side Report Event Handling" page.
public void init(RepletRequest req) { // add a popup menu to the page addPopupMenu(new String[] {"Select Columns", …}); … EventHandler eh = getEventHandler(); // prompt user to select columns for 'Select Columns' eh.addRepletMenuCommand("Select Columns", RepletCommand.promptParameters("columns")); … // declare the column selection parameters RepletParameters params = new RepletParameters("columns"); … addRepletParameters(params); }
public void init(RepletRequest req) { // add a popup menu to the page addPopupMenu(new String[] {"Refresh", …}); … EventHandler eh = getEventHandler(); // refresh the page when 'Refresh' menu is selected eh.addRepletMenuCommand("Refresh", RepletCommand.refresh()); … }
public void init(RepletRequest req) { RepletRequest custom = new RepletRequest(RepletRequest.CUSTOMIZE); custom.setParameter("Show Volumes", new Boolean(true)); EventHandler eh = getEventHandler(); // when mouse clicks on the text, send a customization // request to change the report. No customization dialog // will be shown eh.addMouseClickCommand("Text3", null, RepletCommand.sendRequest(custom)); …
Since the BasicReplet class already provides convenient methods for adding common interactions, it is normally not necessary to deal with event handling directly. For example, attaching a popup menu to an item can be done by calling addMousePopupTriggerCommand() with the Replet Command.showMenu() as the command. This can also be easily achieved by calling addPopupMenu() on the BasicReplet. Before starting any EventHandler coding, determine if there is a BasicReplet method that provides the function.
Copyright © 2024, InetSoft Technology Corp.