InetSoft Technology: Example of a Report Event Handler

To illustrate the use of the event handler, we add two embedded request links. When a link is clicked on, it sends a CUSTOMIZE request to the replet, which sets the visibility of the report title.
#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

public void init(RepletRequest req) throws
RepletException {
try {
// load the report template
InputStream input = getClass().
getResourceAsStream("/" + req.getParameter("templateName") + ".srt");
Builder builder = Builder.getBuilder(Builder.TEMPLATE, input);
report = (ReportSheet)".");
// load data from data file
InputStream input2 =
ttl = new TextTableLens(input2,",");
RepletParameters def =
new RepletParameters(RepletRequest.CUSTOMIZE);

def.addBoolean("Show Title", true);
def.addParameter("Title", "", null);
def.setVisible("Title", false);
RepletParameters def1 = new
def1.addParameter("Title", "", null);
def1.addBoolean("Show Title", true);
def1.setVisible("Show Title", false);
EventHandler eh = getEventHandler();
RepletRequest q1 =
new RepletRequest(RepletRequest.CUSTOMIZE);
q1.setParameter("Show Title", new Boolean(true));
// the following call is equivalent to addRequest()
// except addRequest() also inserts commands to change
// the cursor to HAND when the mouse moves on the link
eh.addMouseClickCommand("ShowTitleLink", null,
RepletRequest q2 =
new RepletRequest(RepletRequest.CUSTOMIZE);
q2.setParameter("Show Title", new Boolean(false));
eh.addMouseClickCommand("HideTitleLink", null,
} catch(Exception e) {
throw new RepletException(e.getMessage());

We can then run the replet and click on the two links ('Show Title' and 'Hide Title') to make the report title visible/invisible.