Custom Button Example
Note that the default toolbar already contains a 'Refresh' button.
This example explains how to create a custom refresh button. To create a button, first create a class that implements the ViewerAction interface to define the custom button. Create a graphic icon to represent the button on the viewer, and place the icon on the classpath so that it can be accessed as a resource.
public String getIconResource() {
return "/images/dbRefresh.gif";
}
This means the GIF file should be placed in a directory called images on the classpath, or in a JAR file.
Next, define the label for the button.
public String getLabel() {
return "Refresh DB";
}
Finally, define the actionPerformed() method, which accepts four parameters:
• replet ID
• replet repository instance
• replet object where the action is invoked
• repletRequest object
The method is free to perform any actions and can return a RepletCommand to direct the viewer to execute one or more viewer actions.
public RepletCommand actionPerformed(Object rid,
RepletRepository repo, Replet replet, RepletRequest req) {
// actions, such as refreshing the database data
return RepletCommand.refresh(); // refresh report
}
| << 3.9.1 Custom Buttons | © 1996-2013 InetSoft Technology Corporation (v11.5) | Configuring a Custom Button >> |