gvsig-projects-pool / org.gvsig.report / trunk / org.gvsig.report / org.gvsig.report.swing / org.gvsig.report.swing.impl / src / main / java / org / gvsig / report / swing / impl / actions / JasperReportActionFactory.java @ 8035
History | View | Annotate | Download (1.61 KB)
1 |
package org.gvsig.report.swing.impl.actions; |
---|---|
2 |
|
3 |
import javax.json.JsonObject; |
4 |
import org.apache.commons.lang3.StringUtils; |
5 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
6 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
7 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
8 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
9 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
10 |
import org.gvsig.fmap.dal.swing.report.AbstractReportActionFactory; |
11 |
import org.gvsig.fmap.dal.swing.report.ReportAction; |
12 |
import org.gvsig.fmap.dal.swing.report.ReportActionFactory; |
13 |
|
14 |
/**
|
15 |
*
|
16 |
* @author jjdelcerro
|
17 |
*/
|
18 |
public class JasperReportActionFactory extends AbstractReportActionFactory implements ReportActionFactory { |
19 |
|
20 |
public JasperReportActionFactory() {
|
21 |
super("jasper"); |
22 |
} |
23 |
|
24 |
@Override
|
25 |
public ReportAction createReportAction(FeatureStore store, FeatureQuery query, FeatureSelection selecteds, JsonObject json) {
|
26 |
String type = json.getString("type", "jasper"); |
27 |
if( !StringUtils.equalsIgnoreCase(type, "jasper") ) { |
28 |
return null; |
29 |
} |
30 |
ReportAction reportAction = new JasperReportAction(this, store, query, selecteds, json); |
31 |
return reportAction;
|
32 |
} |
33 |
|
34 |
public static void selfRegister() { |
35 |
DataSwingManager dalSwingManager = DALSwingLocator.getSwingManager(); |
36 |
dalSwingManager.registerReportAction(new JasperReportActionFactory());
|
37 |
} |
38 |
|
39 |
@Override
|
40 |
public boolean isApplicable(Object... args) { |
41 |
JsonObject json = (JsonObject) args[0];
|
42 |
String type = json.getString("type", "jasper").trim(); |
43 |
return StringUtils.equalsIgnoreCase(type, "jasper"); |
44 |
} |
45 |
|
46 |
} |