|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openxava.actions.BaseAction
org.openxava.actions.ViewBaseAction
org.openxava.actions.JasperMultipleReportBaseAction
public abstract class JasperMultipleReportBaseAction
To generate several custom Jasper Reports with the same action.
You only need to overwrite the abstract methods.
To send parameters to the reports you have 3 options.
public Map getParameters() throws Exception {
Map parameters = new HashMap();
parameters.put("param1", value1);
parameters.put("param2", value2);
return parameters;
}
protected Map getParameters(int index) throws Exception {
Map parameters = new HashMap();
switch (index) {
case 0:
parameters.put("param1", value1);
parameters.put("param2", value2);
return parameters;
case 1:
parameters.put("param3", value3);
parameters.put("param4", value4);
return parameters;
}
return null;
}
public void execute() throws Exception {
Map parameters1 = new HashMap();
parameters1.put("param1", value1);
parameters1.put("param2", value2);
addParameters(parameters1);
Map parameters2 = new HashMap();
parameters1.put("param3", value3);
parameters1.put("param4", value4);
addParameters(parameters2);
super.execute();
}
| Field Summary | |
|---|---|
static java.lang.String |
EXCEL
|
static java.lang.String |
ODT
|
static java.lang.String |
PDF
|
static java.lang.String |
RTF
|
| Fields inherited from interface org.openxava.actions.IChangeModeAction |
|---|
DETAIL, LIST, PREVIOUS_MODE, SPLIT |
| Constructor Summary | |
|---|---|
JasperMultipleReportBaseAction()
|
|
| Method Summary | |
|---|---|
void |
addParameters(int index,
java.util.Map parameters)
Add a parameter set at a specified index. |
void |
addParameters(java.util.Map parameters)
Add a parameter set to the current list. |
void |
execute()
|
protected abstract net.sf.jasperreports.engine.JRDataSource[] |
getDataSources()
Data to print. |
java.lang.String |
getFormat()
Output report format, it can be 'pdf' or 'excel'. |
java.lang.String[] |
getForwardURIs()
The URIs to go. |
protected abstract java.lang.String[] |
getJRXMLs()
The name of the XML with the JasperReports design. |
protected java.util.Map |
getParameters()
Parameters to send to report. |
protected java.util.Map |
getParameters(int i)
Retrieve parameters for the specified report index. |
java.util.List<java.util.Map> |
getParametersList()
Retrieve the current parameter list. |
boolean |
inNewWindow()
|
void |
setFormat(java.lang.String format)
Output report format, it can be 'pdf', 'excel' or 'rtf'. |
void |
setModel(java.lang.String modelName)
|
void |
setParametersList(java.util.List<java.util.Map> parametersList)
Set parameter list. |
| Methods inherited from class org.openxava.actions.ViewBaseAction |
|---|
closeDialog, getModelName, getPreviousView, getPreviousViews, getView, resetDescriptionsCache, returnToPreviousView, setControllers, setPreviousViews, setView, showDialog, showDialog, showNewView, showView |
| Methods inherited from class org.openxava.actions.BaseAction |
|---|
addActions, addError, addErrors, addInfo, addMessage, addMessages, addWarning, clearActions, executeAfter, executeBefore, getContext, getEnvironment, getErrors, getLocale, getManager, getMessages, getNextMode, getRequest, removeActions, returnToPreviousControllers, setContext, setDefaultControllers, setEnvironment, setErrors, setMessages, setNextMode, setRequest |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.openxava.actions.IAction |
|---|
getErrors, getMessages, setEnvironment, setErrors, setMessages |
| Methods inherited from interface org.openxava.actions.IAction |
|---|
getErrors, getMessages, setEnvironment, setErrors, setMessages |
| Field Detail |
|---|
public static java.lang.String PDF
public static java.lang.String EXCEL
public static java.lang.String RTF
public static java.lang.String ODT
| Constructor Detail |
|---|
public JasperMultipleReportBaseAction()
| Method Detail |
|---|
protected abstract net.sf.jasperreports.engine.JRDataSource[] getDataSources()
throws java.lang.Exception
If return null then a JDBC connection is sent to JasperReport, this is for the case of a SQL inside JasperReport design.
java.lang.Exception
protected abstract java.lang.String[] getJRXMLs()
throws java.lang.Exception
If it is a relative path (as reports/myreport.jrxml has to
be in classpath. If it is a absolute path (as
/home/java/reports/myreport.xml or
C:\\JAVA\\REPORTS\MYREPORT.JRXML then it look at the file
system.
java.lang.Exception
protected java.util.Map getParameters()
throws java.lang.Exception
java.lang.Exception
protected java.util.Map getParameters(int i)
throws java.lang.Exception
Maintains backward compatibility by calling getParameters() if parameters list is empty or not enough parameter sets defined.
java.lang.Exception
public java.lang.String getFormat()
throws java.lang.Exception
java.lang.Exception
public void setFormat(java.lang.String format)
throws java.lang.Exception
java.lang.Exception
public void execute()
throws java.lang.Exception
execute in interface IActionjava.lang.Exceptionpublic java.lang.String[] getForwardURIs()
IMultipleForwardActionIf it starts with "http://" or "http://" the action will forward to the absolute URL in internet, if it starts with "javascript:" the corresponding code will executed by the browser, otherwise it will forward to a resource inside this application.
getForwardURIs in interface IMultipleForwardActionpublic boolean inNewWindow()
public void setModel(java.lang.String modelName)
setModel in interface IModelActionpublic void setParametersList(java.util.List<java.util.Map> parametersList)
Allows setting the parameter list outside this code.
public java.util.List<java.util.Map> getParametersList()
public void addParameters(java.util.Map parameters)
Appends the parameter set to the parameter list.
public void addParameters(int index,
java.util.Map parameters)
Inserts the parameter set into the parameter list at the specified index.
index - - The index to insert into.parameter - - The parameter set to insert.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||