Style Intelligence v12.0

inetsoft.sree
Class TemplateReplet

java.lang.Object
  extended by inetsoft.sree.BasicReplet
      extended by inetsoft.sree.TemplateReplet
All Implemented Interfaces:
Replet

public class TemplateReplet
extends BasicReplet

The TemplateReplet handles all replets that uses report templates for creating a report. No additional programming is required to use this class. To create a replet from a template, register a replet with the 'Template' option selected and specify the template file resource name. The TemplateReplet automatically loads in the template and processes any data binding defined in the template.

If a replet uses a template to load in a report but needs to add additional logic for handling a report request, it can use TemplateReplet as the base class. The derived class must call setTemplate() in its init() method and pass in the template file resource path. In the subclass' createReport() method, it should call super.createReport() to get a ReportSheet.


Nested Class Summary
static class TemplateReplet.ReportInfo
           
 
Field Summary
protected  boolean cache
           
protected  ReportSheet initReport
           
protected  String template
           
 
Fields inherited from class inetsoft.sree.BasicReplet
catalog, destroyed, fieldelems, lastreq, principal
 
Fields inherited from interface inetsoft.sree.Replet
DESIGN_MODE, RUN_MODE
 
Constructor Summary
TemplateReplet()
           
 
Method Summary
 ReportSheet createReport(RepletRequest req)
          Generate a report.
 void destroy()
          Remove the cached template file.
 ReportSheet fetchTemplate()
          Obtain a template from cache or file.
 ReportSheet getReport()
          Get the report object.
 long getReportLastModified()
          Get the report last modified time.
 String getTemplate()
          Get the template resource name or URL.
 void init(RepletRequest req)
          Initialize the replet.
 void setReport(ReportSheet report)
          Set the report in this replet.
 void setTemplate(String template)
          Set the template file resource name or URL.
 void waitForLoaded()
          Wait until report is loaded.
 
Methods inherited from class inetsoft.sree.BasicReplet
addFormLink, addLink, addLink, addLink, addLink, addLinkURL, addMenuAction, addMenuAction, addPopupMenu, addPopupMenu, addRepletMenuListener, addRepletParameters, addRepletSelectionListener, addRequest, addRequestListener, addStatus, applyCalcTableSortOnHeader, containsVariable, createRepletScriptable, execute, execute, finalize, fireRepletMenuEvent, fireRequestEvent, fireSelectionEvent, generate, getCacheTime, getCatalog, getContextName, getCreateDate, getEventHandler, getEventMask, getID, getLastAccessDate, getName, getOrientation, getPageSize, getPrincipal, getPrintReport, getRegisteredSelections, getRepletParameters, getRepletRequest, getReportMode, getSaveParameters, getScheduleActionListener, getVariableTable, handleEvent, handleRequestEvent, initReport, initScript, isSortOnHeader, processParameters, processReport, reexecute, refreshVariableTable, refreshVariableTable, regenerate, removeAdhocVariables, removeAllEventHandlers, removeRepletMenuListener, removeRepletParameters, removeRepletSelectionListener, removeRequestListener, setAdhocVariables, setCacheTime, setChanged, setCreateDate, setID, setLastAccessDate, setName, setOrientation, setPageSize, setPrincipal, setRepletRequest, setReportMode, setSaveParameters, setScheduleActionListener, setSortOnHeader
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

template

protected String template

cache

protected boolean cache

initReport

protected ReportSheet initReport
Constructor Detail

TemplateReplet

public TemplateReplet()
Method Detail

getReport

public ReportSheet getReport()
Get the report object. This may be null if generate() has not been called.

Specified by:
getReport in interface Replet
Overrides:
getReport in class BasicReplet

setReport

public void setReport(ReportSheet report)
Set the report in this replet. This is called by the server to modify the report in adhoc query.

Overrides:
setReport in class BasicReplet

createReport

public ReportSheet createReport(RepletRequest req)
                         throws RepletException
Generate a report. This method is called at every request (including the initial request). Subclasses should call super.createReport() to get a ReportSheet before performing additional processing.

Specified by:
createReport in class BasicReplet
Parameters:
req - replet request, including replet parameter values.
Returns:
generated report.
Throws:
RepletException

waitForLoaded

public void waitForLoaded()
                   throws RepletException
Wait until report is loaded.

Specified by:
waitForLoaded in interface Replet
Overrides:
waitForLoaded in class BasicReplet
Throws:
RepletException

init

public void init(RepletRequest req)
          throws RepletException
Initialize the replet. The initialization parameter is what's specified during replet registration. It is called once after a replet is loaded.

Specified by:
init in interface Replet
Overrides:
init in class BasicReplet
Parameters:
req - initialization request.
Throws:
RepletException

setTemplate

public void setTemplate(String template)
Set the template file resource name or URL. The template is loaded as a resource stream or URL at runtime. The template must be specified before the init() method is called.


getTemplate

public String getTemplate()
Get the template resource name or URL.


fetchTemplate

public ReportSheet fetchTemplate()
                          throws Exception
Obtain a template from cache or file. This template may be different from the report returned from getReport(). The template returned from getReport() is used to execute and generate the actual viewing report, and the template returned here is the original template.

Throws:
Exception

getReportLastModified

public long getReportLastModified()
Get the report last modified time.

Specified by:
getReportLastModified in interface Replet
Overrides:
getReportLastModified in class BasicReplet

destroy

public void destroy()
Remove the cached template file.

Specified by:
destroy in interface Replet
Overrides:
destroy in class BasicReplet

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.