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) builder.read("."); // load data from data file InputStream input2 = getClass().getResourceAsStream("/data/education.csv"); ttl = new TextTableLens(input2,","); ttl.setHeaderRowCount(1); RepletParameters def = new RepletParameters(RepletRequest.CUSTOMIZE); def.addBoolean("Show Title", true); def.addParameter("Title", "", null); def.setVisible("Title", false); RepletParameters def1 = new RepletParameters(RepletRequest.CREATE); def1.addParameter("Title", "", null); def1.addBoolean("Show Title", true); def1.setVisible("Show Title", false); addRepletParameters(def); addRepletParameters(def1); 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, RepletCommand.sendRequest(q1)); RepletRequest q2 = new RepletRequest(RepletRequest.CUSTOMIZE); q2.setParameter("Show Title", new Boolean(false)); eh.addMouseClickCommand("HideTitleLink", null, RepletCommand.sendRequest(q2)); } catch(Exception e) { e.printStackTrace(); 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.
Copyright © 2023, InetSoft Technology Corp.