Revision 674
org.gvsig.report/tags/org.gvsig.report-1.0.3/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.desktop</artifactId> |
|
6 |
<version>2.0.230</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.report</artifactId> |
|
9 |
<version>1.0.3</version> |
|
10 |
<packaging>pom</packaging> |
|
11 |
<name>${project.artifactId}</name> |
|
12 |
|
|
13 |
<url>https://redmine.gvsig.net/redmine/projects/gvsig-projects-pool</url> |
|
14 |
|
|
15 |
<repositories> |
|
16 |
<repository> |
|
17 |
<id>gvsig-public-http-repository</id> |
|
18 |
<name>gvSIG maven public HTTP repository</name> |
|
19 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
20 |
<releases> |
|
21 |
<enabled>true</enabled> |
|
22 |
<updatePolicy>daily</updatePolicy> |
|
23 |
<checksumPolicy>warn</checksumPolicy> |
|
24 |
</releases> |
|
25 |
<snapshots> |
|
26 |
<enabled>true</enabled> |
|
27 |
<updatePolicy>daily</updatePolicy> |
|
28 |
<checksumPolicy>warn</checksumPolicy> |
|
29 |
</snapshots> |
|
30 |
</repository> |
|
31 |
</repositories> |
|
32 |
<distributionManagement> |
|
33 |
<site> |
|
34 |
<id>gvsig-repository</id> |
|
35 |
<url>dav:https://devel.gvsig.org/download/projects/gvsig-report/pool/${project.artifactId}/${project.version}</url> |
|
36 |
</site> |
|
37 |
</distributionManagement> |
|
38 |
<scm> |
|
39 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.report/tags/org.gvsig.report-1.0.3</connection> |
|
40 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.report/tags/org.gvsig.report-1.0.3</developerConnection> |
|
41 |
<url>https://redmine.gvsig.net/redmine/projects/gvsig-projects-pool/repository/show/org.gvsig.report/tags/org.gvsig.report-1.0.3</url> |
|
42 |
</scm> |
|
43 |
|
|
44 |
<build> |
|
45 |
<plugins> |
|
46 |
<plugin> |
|
47 |
<groupId>org.apache.maven.plugins</groupId> |
|
48 |
<artifactId>maven-release-plugin</artifactId> |
|
49 |
<configuration> |
|
50 |
<tagBase>https://devel.gvsig.org/svn/gvsig-projects-pool/${project.artifactId}/tags</tagBase> |
|
51 |
<goal>deploy</goal> |
|
52 |
</configuration> |
|
53 |
</plugin> |
|
54 |
</plugins> |
|
55 |
</build> |
|
56 |
|
|
57 |
|
|
58 |
<dependencyManagement> |
|
59 |
<dependencies> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.report.app.mainplugin</artifactId> |
|
63 |
<version>1.0.3</version> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.report.lib.api</artifactId> |
|
68 |
<version>1.0.3</version> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.report.lib.impl</artifactId> |
|
73 |
<version>1.0.3</version> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.report.swing.api</artifactId> |
|
78 |
<version>1.0.3</version> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.report.swing.impl</artifactId> |
|
83 |
<version>1.0.3</version> |
|
84 |
</dependency> |
|
85 |
|
|
86 |
<dependency> |
|
87 |
<groupId>org.apache.httpcomponents</groupId> |
|
88 |
<artifactId>httpcore-nio</artifactId> |
|
89 |
<version>4.4.4</version> |
|
90 |
</dependency> |
|
91 |
<dependency> |
|
92 |
<groupId>org.apache.httpcomponents</groupId> |
|
93 |
<artifactId>httpcore</artifactId> |
|
94 |
<version>4.4.4</version> |
|
95 |
</dependency> |
|
96 |
|
|
97 |
|
|
98 |
<dependency> |
|
99 |
<groupId>net.sf.jasperreports</groupId> |
|
100 |
<artifactId>jasperreports</artifactId> |
|
101 |
<version>6.6.0</version> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>commons-beanutils</groupId> |
|
105 |
<artifactId>commons-beanutils</artifactId> |
|
106 |
<version>1.6</version> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>commons-digester</groupId> |
|
110 |
<artifactId>commons-digester</artifactId> |
|
111 |
<version>2.1</version> |
|
112 |
</dependency> |
|
113 |
<dependency> |
|
114 |
<groupId>commons-logging</groupId> |
|
115 |
<artifactId>commons-logging</artifactId> |
|
116 |
<version>1.1.1</version> |
|
117 |
</dependency> |
|
118 |
<dependency> |
|
119 |
<groupId>com.lowagie</groupId> |
|
120 |
<artifactId>itext</artifactId> |
|
121 |
<version>2.1.7</version> |
|
122 |
</dependency> |
|
123 |
<dependency> |
|
124 |
<groupId>bouncycastle</groupId> |
|
125 |
<artifactId>bcmail-jdk14</artifactId> |
|
126 |
<version>138</version> |
|
127 |
</dependency> |
|
128 |
<dependency> |
|
129 |
<groupId>bouncycastle</groupId> |
|
130 |
<artifactId>bcprov-jdk14</artifactId> |
|
131 |
<version>138</version> |
|
132 |
</dependency> |
|
133 |
<dependency> |
|
134 |
<groupId>org.bouncycastle</groupId> |
|
135 |
<artifactId>bctsp-jdk14</artifactId> |
|
136 |
<version>1.38</version> |
|
137 |
</dependency> |
|
138 |
<dependency> |
|
139 |
<groupId>org.bouncycastle</groupId> |
|
140 |
<artifactId>bcprov-jdk14</artifactId> |
|
141 |
<version>1.38</version> |
|
142 |
</dependency> |
|
143 |
<dependency> |
|
144 |
<groupId>org.bouncycastle</groupId> |
|
145 |
<artifactId>bcmail-jdk14</artifactId> |
|
146 |
<version>1.38</version> |
|
147 |
</dependency> |
|
148 |
<dependency> |
|
149 |
<groupId>org.jfree</groupId> |
|
150 |
<artifactId>jcommon</artifactId> |
|
151 |
<version>1.0.23</version> |
|
152 |
</dependency> |
|
153 |
<dependency> |
|
154 |
<groupId>org.jfree</groupId> |
|
155 |
<artifactId>jfreechart</artifactId> |
|
156 |
<version>1.0.14</version> |
|
157 |
</dependency> |
|
158 |
<dependency> |
|
159 |
<groupId>org.eclipse.jdt.core.compiler</groupId> |
|
160 |
<artifactId>ecj</artifactId> |
|
161 |
<version>4.4.2</version> |
|
162 |
</dependency> |
|
163 |
<dependency> |
|
164 |
<groupId>org.codehaus.castor</groupId> |
|
165 |
<artifactId>castor-xml</artifactId> |
|
166 |
<version>1.3.3</version> |
|
167 |
</dependency> |
|
168 |
<dependency> |
|
169 |
<groupId>org.codehaus.castor</groupId> |
|
170 |
<artifactId>castor-core</artifactId> |
|
171 |
<version>1.3.3</version> |
|
172 |
</dependency> |
|
173 |
<dependency> |
|
174 |
<groupId>commons-lang</groupId> |
|
175 |
<artifactId>commons-lang</artifactId> |
|
176 |
<version>2.6</version> |
|
177 |
</dependency> |
|
178 |
<dependency> |
|
179 |
<groupId>javax.inject</groupId> |
|
180 |
<artifactId>javax.inject</artifactId> |
|
181 |
<version>1</version> |
|
182 |
</dependency> |
|
183 |
<dependency> |
|
184 |
<groupId>stax</groupId> |
|
185 |
<artifactId>stax</artifactId> |
|
186 |
<version>1.2.0</version> |
|
187 |
</dependency> |
|
188 |
<dependency> |
|
189 |
<groupId>stax</groupId> |
|
190 |
<artifactId>stax-api</artifactId> |
|
191 |
<version>1.0.1</version> |
|
192 |
</dependency> |
|
193 |
<dependency> |
|
194 |
<groupId>javax.xml.stream</groupId> |
|
195 |
<artifactId>stax-api</artifactId> |
|
196 |
<version>1.0-2</version> |
|
197 |
</dependency> |
|
198 |
<dependency> |
|
199 |
<groupId>com.fasterxml.jackson.core</groupId> |
|
200 |
<artifactId>jackson-core</artifactId> |
|
201 |
<version>2.9.5</version> |
|
202 |
</dependency> |
|
203 |
<dependency> |
|
204 |
<groupId>com.fasterxml.jackson.core</groupId> |
|
205 |
<artifactId>jackson-databind</artifactId> |
|
206 |
<version>2.9.5</version> |
|
207 |
</dependency> |
|
208 |
<dependency> |
|
209 |
<groupId>com.fasterxml.jackson.core</groupId> |
|
210 |
<artifactId>jackson-annotations</artifactId> |
|
211 |
<version>2.9.5</version> |
|
212 |
</dependency> |
|
213 |
<dependency> |
|
214 |
<groupId>com.ibm.icu</groupId> |
|
215 |
<artifactId>icu4j</artifactId> |
|
216 |
<version>57.1</version> |
|
217 |
</dependency> |
|
218 |
|
|
219 |
|
|
220 |
</dependencies> |
|
221 |
</dependencyManagement> |
|
222 |
|
|
223 |
<modules> |
|
224 |
<module>${project.artifactId}.lib</module> |
|
225 |
<module>${project.artifactId}.swing</module> |
|
226 |
<module>${project.artifactId}.app</module> |
|
227 |
</modules> |
|
228 |
|
|
229 |
</project> |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.report</artifactId> |
|
6 |
<version>1.0.3</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.report.app</artifactId> |
|
9 |
<packaging>pom</packaging> |
|
10 |
<name>${project.artifactId}</name> |
|
11 |
<modules> |
|
12 |
<module>${project.artifactId}.mainplugin</module> |
|
13 |
</modules> |
|
14 |
</project> |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<assembly> |
|
27 |
<id>gvsig-plugin-package</id> |
|
28 |
<formats> |
|
29 |
<format>zip</format> |
|
30 |
</formats> |
|
31 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
32 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
33 |
<files> |
|
34 |
<file> |
|
35 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
36 |
<outputDirectory>lib</outputDirectory> |
|
37 |
</file> |
|
38 |
<file> |
|
39 |
<source>target/package.info</source> |
|
40 |
</file> |
|
41 |
</files> |
|
42 |
|
|
43 |
<fileSets> |
|
44 |
<fileSet> |
|
45 |
<directory>src/main/resources-plugin</directory> |
|
46 |
<outputDirectory>.</outputDirectory> |
|
47 |
</fileSet> |
|
48 |
</fileSets> |
|
49 |
|
|
50 |
|
|
51 |
<dependencySets> |
|
52 |
<dependencySet> |
|
53 |
<useProjectArtifact>false</useProjectArtifact> |
|
54 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
55 |
<outputDirectory>lib</outputDirectory> |
|
56 |
<includes> |
|
57 |
<include>org.gvsig:org.gvsig.report.lib.api</include> |
|
58 |
<include>org.gvsig:org.gvsig.report.lib.impl</include> |
|
59 |
<include>org.gvsig:org.gvsig.report.swing.api</include> |
|
60 |
<include>org.gvsig:org.gvsig.report.swing.impl</include> |
|
61 |
|
|
62 |
<include>org.apache.httpcomponents:httpcore-nio</include> |
|
63 |
<include>org.apache.httpcomponents:httpcore</include> |
|
64 |
|
|
65 |
<include>net.sf.jasperreports:jasperreports</include> |
|
66 |
<include>commons-beanutils:commons-beanutils</include> |
|
67 |
<include>commons-digester:commons-digester</include> |
|
68 |
<include>commons-logging:commons-logging</include> |
|
69 |
<include>com.lowagie:itext</include> |
|
70 |
<!-- |
|
71 |
<include>bouncycastle:bcmail-jdk14</include> |
|
72 |
<include>bouncycastle:bcprov-jdk14</include> |
|
73 |
<include>org.bouncycastle:bctsp-jdk14</include> |
|
74 |
<include>org.bouncycastle:bcprov-jdk14</include> |
|
75 |
<include>org.bouncycastle:bcmail-jdk14</include> |
|
76 |
--> |
|
77 |
<include>org.jfree:jcommon</include> |
|
78 |
<include>org.jfree:jfreechart</include> |
|
79 |
<include>org.eclipse.jdt.core.compiler:ecj</include> |
|
80 |
<include>org.codehaus.castor:castor-xml</include> |
|
81 |
<include>org.codehaus.castor:castor-core</include> |
|
82 |
<include>commons-lang:commons-lang</include> |
|
83 |
<include>javax.inject:javax.inject</include> |
|
84 |
<include>stax:stax</include> |
|
85 |
<!-- |
|
86 |
<include>stax:stax-api</include> |
|
87 |
--> |
|
88 |
<include>javax.xml.stream:stax-api</include> |
|
89 |
<include>com.fasterxml.jackson.core:jackson-core</include> |
|
90 |
<include>com.fasterxml.jackson.core:jackson-databind</include> |
|
91 |
<include>com.fasterxml.jackson.core:jackson-annotations</include> |
|
92 |
<include>com.ibm.icu:icu4j</include> |
|
93 |
|
|
94 |
</includes> |
|
95 |
</dependencySet> |
|
96 |
</dependencySets> |
|
97 |
|
|
98 |
</assembly> |
|
99 |
|
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/ReportExtension.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.report.app.mainplugin; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.List; |
|
28 |
import org.apache.commons.lang3.StringUtils; |
|
29 |
import org.gvsig.andami.IconThemeHelper; |
|
30 |
import org.gvsig.andami.plugins.Extension; |
|
31 |
import org.gvsig.app.ApplicationLocator; |
|
32 |
import org.gvsig.app.ApplicationManager; |
|
33 |
import org.gvsig.app.project.ProjectManager; |
|
34 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
35 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
36 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
37 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
38 |
import org.gvsig.propertypage.PropertiesPageManager; |
|
39 |
import org.gvsig.report.app.mainplugin.document.gui.projectpanel.ProjectReportPanelPageFactory; |
|
40 |
import org.gvsig.report.lib.api.ReportDataSets; |
|
41 |
import org.gvsig.report.lib.api.ReportServerConfig; |
|
42 |
import org.gvsig.report.swing.api.ReportSwingLocator; |
|
43 |
import org.gvsig.report.swing.api.ReportSwingManager; |
|
44 |
import org.gvsig.tools.ToolsLocator; |
|
45 |
import org.gvsig.tools.exception.BaseException; |
|
46 |
import org.gvsig.tools.i18n.I18nManager; |
|
47 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
48 |
import org.gvsig.tools.visitor.Visitor; |
|
49 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
50 |
|
|
51 |
/** |
|
52 |
* |
|
53 |
* @author jjdelcerro |
|
54 |
*/ |
|
55 |
public class ReportExtension extends Extension { |
|
56 |
|
|
57 |
private ReportState reportState; |
|
58 |
|
|
59 |
@Override |
|
60 |
public void initialize() { |
|
61 |
IconThemeHelper.registerIcon("report", "report-publish-layer", this); |
|
62 |
this.reportState = ReportState.get(); |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public void postInitialize() { |
|
67 |
new org.gvsig.report.app.mainplugin.document.ReportManager().selfRegister(); |
|
68 |
|
|
69 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
70 |
ProjectManager projectManager = application.getProjectManager(); |
|
71 |
ViewManager viewManager = (ViewManager) projectManager.getDocumentManager(ViewManager.TYPENAME); |
|
72 |
viewManager.addTOCContextAction("report-publish-layer"); |
|
73 |
|
|
74 |
PropertiesPageManager propertiesManager = ToolsUtilLocator.getPropertiesPageManager(); |
|
75 |
propertiesManager.registerFactory(new ProjectReportPanelPageFactory()); |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public void execute(String action) { |
|
80 |
final I18nManager i18n = ToolsLocator.getI18nManager(); |
|
81 |
final ApplicationManager application = ApplicationLocator.getManager(); |
|
82 |
final ReportSwingManager reportSwingManager = ReportSwingLocator.getReportSwingManager(); |
|
83 |
|
|
84 |
if (StringUtils.equalsIgnoreCase(action, "report-publish-layer")) { |
|
85 |
ViewDocument view = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
86 |
if (view == null) { |
|
87 |
return; |
|
88 |
} |
|
89 |
final List<FLyrVect> layers = new ArrayList<>(); |
|
90 |
try { |
|
91 |
view.getMapContext().getLayers().accept(new Visitor() { |
|
92 |
@Override |
|
93 |
public void visit(Object o) throws VisitCanceledException, BaseException { |
|
94 |
FLayer layer = (FLayer) o; |
|
95 |
if (layer instanceof FLyrVect && layer.isActive()) { |
|
96 |
layers.add((FLyrVect) layer); |
|
97 |
} |
|
98 |
} |
|
99 |
}); |
|
100 |
} catch (Exception ex) { |
|
101 |
logger.warn("Can't publish layers.", ex); |
|
102 |
} |
|
103 |
if (!layers.isEmpty()) { |
|
104 |
ReportServerConfig config = this.reportState.getConfig(); |
|
105 |
ReportDataSets datasets = config.getDatasets(); |
|
106 |
for (FLyrVect layer : layers) { |
|
107 |
if (datasets.contains(layer.getFeatureStore())) { |
|
108 |
//continue; |
|
109 |
} |
|
110 |
datasets.add( |
|
111 |
layer.getName(), |
|
112 |
layer.getFeatureStore() |
|
113 |
); |
|
114 |
} |
|
115 |
} |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public boolean isEnabled() { |
|
121 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
122 |
ViewDocument view = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
123 |
if (view == null) { |
|
124 |
return false; |
|
125 |
} |
|
126 |
return view.getMapContext().hasActiveVectorLayers(); |
|
127 |
} |
|
128 |
|
|
129 |
@Override |
|
130 |
public boolean isVisible() { |
|
131 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
132 |
ViewDocument view = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME); |
|
133 |
return view != null; |
|
134 |
} |
|
135 |
|
|
136 |
} |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/ReportState.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.report.app.mainplugin; |
|
3 |
|
|
4 |
import java.beans.PropertyChangeEvent; |
|
5 |
import java.beans.PropertyChangeListener; |
|
6 |
import java.io.File; |
|
7 |
import java.util.EventListener; |
|
8 |
import javax.swing.SwingUtilities; |
|
9 |
import org.apache.commons.collections.buffer.CircularFifoBuffer; |
|
10 |
import org.apache.commons.lang3.tuple.ImmutablePair; |
|
11 |
import org.gvsig.app.ApplicationLocator; |
|
12 |
import org.gvsig.app.ApplicationManager; |
|
13 |
import org.gvsig.app.project.Project; |
|
14 |
import org.gvsig.app.project.ProjectManager; |
|
15 |
import org.gvsig.app.project.ProjectNotification; |
|
16 |
import org.gvsig.report.lib.api.ReportLocator; |
|
17 |
import org.gvsig.report.lib.api.ReportManager; |
|
18 |
import org.gvsig.report.lib.api.ReportServer; |
|
19 |
import org.gvsig.report.lib.api.ReportServerConfig; |
|
20 |
import org.gvsig.report.swing.api.JReportServer; |
|
21 |
import org.gvsig.report.swing.api.ReportSwingLocator; |
|
22 |
import org.gvsig.report.swing.api.ReportSwingManager; |
|
23 |
import org.gvsig.tools.observer.Observable; |
|
24 |
import org.gvsig.tools.observer.Observer; |
|
25 |
import org.gvsig.tools.util.BaseListenerSupport; |
|
26 |
|
|
27 |
/** |
|
28 |
* |
|
29 |
* @author jjdelcerro |
|
30 |
*/ |
|
31 |
public class ReportState { |
|
32 |
|
|
33 |
private static final String REPORTS_CONFIG = "reports.config"; |
|
34 |
|
|
35 |
private static ReportState reportState = null; |
|
36 |
|
|
37 |
public static ReportState get() { |
|
38 |
if( reportState == null ) { |
|
39 |
reportState = new ReportState(); |
|
40 |
} |
|
41 |
return reportState; |
|
42 |
} |
|
43 |
|
|
44 |
private ReportServer server = null; |
|
45 |
private JReportServer serverPanel = null; |
|
46 |
private CircularFifoBuffer serverlog = null; |
|
47 |
private ReportServer.LoggerListener logListener = null; |
|
48 |
private AppReportServices services = null; |
|
49 |
|
|
50 |
private ReportState() { |
|
51 |
this.initServer(null, null); |
|
52 |
ProjectManager projectManager = ProjectManager.getInstance(); |
|
53 |
projectManager.addProjectListener(new BaseListenerSupport.NotificationListener() { |
|
54 |
@Override |
|
55 |
public void notify(EventListener event) { |
|
56 |
if( event instanceof ProjectManager.NewProjectEvent ) { |
|
57 |
initServer(null, null); |
|
58 |
onNewProject(((ProjectManager.NewProjectEvent)event).getProject()); |
|
59 |
|
|
60 |
} |
|
61 |
} |
|
62 |
}); |
|
63 |
Project project = projectManager.getCurrentProject(); |
|
64 |
if( project!=null ) { |
|
65 |
project.setProperty(this, this); |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
69 |
private void onNewProject(Project project) { |
|
70 |
project.addObserver(new Observer() { |
|
71 |
@Override |
|
72 |
public void update(Observable observable, Object param) { |
|
73 |
if( param instanceof ProjectNotification) { |
|
74 |
ProjectNotification notification = (ProjectNotification) param; |
|
75 |
switch( notification.getNotificationType()) { |
|
76 |
case ProjectNotification.BEFORE_SAVE_TO_STREAM: |
|
77 |
putServerConfigInProject( |
|
78 |
notification.getProject(), |
|
79 |
notification.getFile()); |
|
80 |
break; |
|
81 |
case ProjectNotification.AFTER_LOAD_FROM_STREAM: |
|
82 |
fetchServerConfigFromProject( |
|
83 |
notification.getProject(), |
|
84 |
notification.getFile()); |
|
85 |
break; |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
} |
|
90 |
} ); |
|
91 |
} |
|
92 |
|
|
93 |
public ReportServer getServer() { |
|
94 |
return this.server; |
|
95 |
} |
|
96 |
|
|
97 |
public ReportServerConfig getConfig() { |
|
98 |
return this.server.getConfig(); |
|
99 |
} |
|
100 |
|
|
101 |
private void initServer(String configJSON, File rootFolder) { |
|
102 |
ReportManager manager = ReportLocator.getReportManager(); |
|
103 |
if( this.server != null ) { |
|
104 |
if( this.server.isStarted() ) { |
|
105 |
this.server.stop(); |
|
106 |
} |
|
107 |
this.server = null; |
|
108 |
} |
|
109 |
this.logListener = new ReportServer.LoggerListener() { |
|
110 |
@Override |
|
111 |
public void log(int level, String message) { |
|
112 |
serverlog.add( new ImmutablePair<>(level, message)); |
|
113 |
} |
|
114 |
}; |
|
115 |
|
|
116 |
this.serverlog = new CircularFifoBuffer(200); |
|
117 |
this.services = new AppReportServices(); |
|
118 |
this.services.setRootFolder(rootFolder); |
|
119 |
ReportServerConfig config = manager.createServerConfig(this.services, configJSON); |
|
120 |
this.server = manager.createServer(config); |
|
121 |
this.server.addLogListener(logListener); |
|
122 |
if( this.serverPanel!=null ) { |
|
123 |
this.serverPanel.setServer(this.server); |
|
124 |
} |
|
125 |
config.addPropertyChangeListener(new PropertyChangeListener() { |
|
126 |
@Override |
|
127 |
public void propertyChange(PropertyChangeEvent evt) { |
|
128 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
129 |
Project project = application.getCurrentProject(); |
|
130 |
putServerConfigInProject(project, null); |
|
131 |
} |
|
132 |
}); |
|
133 |
if( this.getConfig().getAutostart() ) { |
|
134 |
if( !this.server.isStarted() ) { |
|
135 |
this.server.start(); |
|
136 |
} |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
private void putServerConfigInProject(Project project, File rootFolder) { |
|
141 |
if( this.services!=null ) { |
|
142 |
this.services.setRootFolder(rootFolder); |
|
143 |
} |
|
144 |
if( this.server!=null && this.server.getConfig().getAutostart() ) { |
|
145 |
project.setProperty(REPORTS_CONFIG, server.getConfig().toJSON()); |
|
146 |
} else { |
|
147 |
project.setProperty(REPORTS_CONFIG, null); |
|
148 |
} |
|
149 |
} |
|
150 |
|
|
151 |
private void fetchServerConfigFromProject(Project project, File rootFolder) { |
|
152 |
String configJSON = (String) project.getProperty(REPORTS_CONFIG); |
|
153 |
initServer(configJSON, rootFolder); |
|
154 |
} |
|
155 |
|
|
156 |
public JReportServer getServerPanel() { |
|
157 |
if( this.serverPanel==null ) { |
|
158 |
ReportSwingManager swingManager = ReportSwingLocator.getReportSwingManager(); |
|
159 |
this.serverPanel = swingManager.createJReportServer(this.server); |
|
160 |
SwingUtilities.invokeLater(new Runnable() { |
|
161 |
@Override |
|
162 |
public void run() { |
|
163 |
for (Object entry : serverlog) { |
|
164 |
ImmutablePair<Integer,String> logEntry = (ImmutablePair) entry; |
|
165 |
serverPanel.log(logEntry.getLeft(), logEntry.getRight()); |
|
166 |
} |
|
167 |
} |
|
168 |
}); |
|
169 |
|
|
170 |
// this.serverPanel.asJComponent().addComponentListener(new ComponentAdapter() { |
|
171 |
// @Override |
|
172 |
// public void componentHidden(ComponentEvent e) { |
|
173 |
// serverPanel = null; |
|
174 |
// } |
|
175 |
// |
|
176 |
// }); |
|
177 |
} |
|
178 |
return this.serverPanel; |
|
179 |
} |
|
180 |
|
|
181 |
|
|
182 |
} |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/document/ReportManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.report.app.mainplugin.document; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.Iterator; |
|
28 |
import java.util.List; |
|
29 |
import org.gvsig.report.app.mainplugin.document.gui.properties.ReportPropertiesPanel; |
|
30 |
import javax.swing.ImageIcon; |
|
31 |
|
|
32 |
import org.gvsig.andami.IconThemeHelper; |
|
33 |
import org.gvsig.andami.PluginServices; |
|
34 |
import org.gvsig.andami.PluginsLocator; |
|
35 |
import org.gvsig.andami.PluginsManager; |
|
36 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
37 |
import org.gvsig.app.project.ProjectManager; |
|
38 |
import org.gvsig.app.project.documents.AbstractDocument; |
|
39 |
import org.gvsig.app.project.documents.AbstractDocumentManager; |
|
40 |
import org.gvsig.app.project.documents.Document; |
|
41 |
import org.gvsig.app.project.documents.actions.CopyDocumentAction; |
|
42 |
import org.gvsig.app.project.documents.actions.CutDocumentAction; |
|
43 |
import org.gvsig.app.project.documents.actions.PasteDocumentAction; |
|
44 |
import org.gvsig.app.project.documents.gui.IDocumentWindow; |
|
45 |
import org.gvsig.app.project.documents.gui.WindowLayout; |
|
46 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
47 |
import org.gvsig.propertypage.PropertiesPageManager; |
|
48 |
import org.gvsig.report.app.mainplugin.ReportExtension; |
|
49 |
import org.gvsig.report.app.mainplugin.ReportState; |
|
50 |
import org.gvsig.report.app.mainplugin.document.gui.ReportDocumentPanel; |
|
51 |
import org.gvsig.report.app.mainplugin.document.gui.CreateReportPanel; |
|
52 |
import org.gvsig.report.app.mainplugin.document.gui.properties.GeneralDocumentPropertiesPageFactory; |
|
53 |
import org.gvsig.report.app.mainplugin.document.gui.properties.LocationReportPropertiesPageFactory; |
|
54 |
import org.gvsig.report.lib.api.Report; |
|
55 |
import org.gvsig.report.lib.api.ReportLocator; |
|
56 |
import org.gvsig.report.lib.api.ReportServer; |
|
57 |
import org.gvsig.report.swing.api.ReportSwingLocator; |
|
58 |
import org.gvsig.report.swing.api.ReportSwingManager; |
|
59 |
import org.gvsig.tools.ToolsLocator; |
|
60 |
import org.gvsig.tools.dynobject.DynStruct; |
|
61 |
import org.gvsig.tools.i18n.I18nManager; |
|
62 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
63 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
64 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
65 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
66 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
67 |
import org.slf4j.Logger; |
|
68 |
import org.slf4j.LoggerFactory; |
|
69 |
|
|
70 |
public class ReportManager extends AbstractDocumentManager { |
|
71 |
|
|
72 |
private static final Logger logger = LoggerFactory.getLogger(ReportManager.class); |
|
73 |
|
|
74 |
private static final String PERSISTENCE_REPORT_DOCUMENT_DEFINITION_NAME |
|
75 |
= "DefaultReportDocument"; |
|
76 |
public static String TYPENAME = "project.document.report"; |
|
77 |
private DynStruct persistenceDefinition; |
|
78 |
|
|
79 |
public ReportManager() { |
|
80 |
// Do nothing |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
public int getPriority() { |
|
85 |
return 0; |
|
86 |
} |
|
87 |
|
|
88 |
@Override |
|
89 |
public ImageIcon getIcon() { |
|
90 |
return PluginServices.getIconTheme().get("document-report-icon"); |
|
91 |
} |
|
92 |
|
|
93 |
@Override |
|
94 |
public ImageIcon getIconSelected() { |
|
95 |
return PluginServices.getIconTheme().get("document-report-icon-sel"); |
|
96 |
} |
|
97 |
|
|
98 |
@Override |
|
99 |
public String getTitle() { |
|
100 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
101 |
return i18n.getTranslation("_Report"); |
|
102 |
} |
|
103 |
|
|
104 |
@Override |
|
105 |
public String getTypeName() { |
|
106 |
return TYPENAME; |
|
107 |
} |
|
108 |
|
|
109 |
@Override |
|
110 |
public Class getMainWindowClass() { |
|
111 |
return ReportDocumentPanel.class; |
|
112 |
} |
|
113 |
|
|
114 |
|
|
115 |
private ReportServer getServer() { |
|
116 |
return ReportState.get().getServer(); |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public AbstractDocument createDocument() { |
|
121 |
org.gvsig.report.lib.api.ReportManager reportManager = ReportLocator.getReportManager(); |
|
122 |
Report report = reportManager.createReport(this.getServer(), null, null); |
|
123 |
AbstractDocument doc = new ReportDocumentImpl(this, report); |
|
124 |
|
|
125 |
if (this.notifyObservers(NOTIFY_AFTER_CREATEDOCUMENT, doc).isCanceled()) { |
|
126 |
return null; |
|
127 |
} |
|
128 |
return doc; |
|
129 |
|
|
130 |
} |
|
131 |
|
|
132 |
@Override |
|
133 |
public Iterator<ReportDocument> createDocumentsByUser() { |
|
134 |
final I18nManager i18n = ToolsLocator.getI18nManager(); |
|
135 |
final WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
136 |
final ReportSwingManager reportSwingManager = ReportSwingLocator.getReportSwingManager(); |
|
137 |
|
|
138 |
final CreateReportPanel panel = new CreateReportPanel(this.getServer()); |
|
139 |
final Dialog dialog = winManager.createDialog( |
|
140 |
panel.asJComponent(), |
|
141 |
i18n.getTranslation("_Create_report_document"), |
|
142 |
null, |
|
143 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
144 |
); |
|
145 |
dialog.show(WindowManager.MODE.DIALOG); |
|
146 |
if (dialog.getAction() != WindowManager_v2.BUTTON_OK) { |
|
147 |
return null; |
|
148 |
} |
|
149 |
Report report = panel.getReport(); |
|
150 |
ReportDocument doc = new ReportDocumentImpl(this, report); |
|
151 |
|
|
152 |
List<ReportDocument> r = new ArrayList<>(); |
|
153 |
r.add(doc); |
|
154 |
|
|
155 |
return r.iterator(); |
|
156 |
} |
|
157 |
|
|
158 |
@Override |
|
159 |
public IWindow getMainWindow(Document doc, WindowLayout layout) { |
|
160 |
IDocumentWindow win = (IDocumentWindow) super.getMainWindow(doc, layout); |
|
161 |
if (win == null) { |
|
162 |
win = this.createDocumentWindow(doc); |
|
163 |
if (layout != null && win != null) { |
|
164 |
win.setWindowLayout(layout); |
|
165 |
} |
|
166 |
if (this.notifyObservers(NOTIFY_AFTER_CREATEMAINWINDOW, win).isCanceled()) { |
|
167 |
return null; |
|
168 |
} |
|
169 |
} |
|
170 |
if (this.notifyObservers(NOTIFY_AFTER_GETMAINWINDOW, win).isCanceled()) { |
|
171 |
return null; |
|
172 |
} |
|
173 |
((AbstractDocument) doc).raiseEventCreateWindow(win); |
|
174 |
return win; |
|
175 |
} |
|
176 |
|
|
177 |
@Override |
|
178 |
public IWindow getPropertiesWindow(Document doc) { |
|
179 |
IWindow win = super.getPropertiesWindow(doc); |
|
180 |
if (win == null) { |
|
181 |
win = new ReportPropertiesPanel((ReportDocument) doc); |
|
182 |
if (this.notifyObservers(NOTIFY_AFTER_CREATEPROPERTIESWINDOW, win).isCanceled()) { |
|
183 |
return null; |
|
184 |
} |
|
185 |
} |
|
186 |
if (this.notifyObservers(NOTIFY_AFTER_GETPROPERTIESWINDOW, win).isCanceled()) { |
|
187 |
return null; |
|
188 |
} |
|
189 |
return win; |
|
190 |
} |
|
191 |
|
|
192 |
public void selfRegister() { |
|
193 |
if (this.persistenceDefinition != null) { |
|
194 |
return; |
|
195 |
} |
|
196 |
ProjectManager projectManager = ProjectManager.getInstance(); |
|
197 |
|
|
198 |
PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager(); |
|
199 |
this.persistenceDefinition = persistenceManager.addDefinition( |
|
200 |
ReportDocument.class, |
|
201 |
PERSISTENCE_REPORT_DOCUMENT_DEFINITION_NAME, |
|
202 |
"Default report document persistence definition", |
|
203 |
null, |
|
204 |
null |
|
205 |
); |
|
206 |
this.persistenceDefinition.extend(persistenceManager.getDefinition(AbstractDocument.PERSISTENCE_DEFINITION_NAME)); |
|
207 |
|
|
208 |
this.persistenceDefinition.addDynFieldString("report_datasetName").setMandatory(true); |
|
209 |
this.persistenceDefinition.addDynFieldFile("report_file").setMandatory(true); |
|
210 |
|
|
211 |
persistenceManager.registerFactory(this); |
|
212 |
|
|
213 |
IconThemeHelper.registerIcon("document", "document-report-icon", ReportManager.class); |
|
214 |
IconThemeHelper.registerIcon("document", "document-report-icon-sel", ReportManager.class); |
|
215 |
|
|
216 |
projectManager.registerDocumentFactory(this); |
|
217 |
projectManager.registerDocumentAction(TYPENAME, new CopyDocumentAction()); |
|
218 |
projectManager.registerDocumentAction(TYPENAME, new CutDocumentAction()); |
|
219 |
projectManager.registerDocumentAction(TYPENAME, new PasteDocumentAction()); |
|
220 |
|
|
221 |
PropertiesPageManager propertiesPageManager = MapControlLocator.getPropertiesPageManager(); |
|
222 |
propertiesPageManager.registerFactory(new GeneralDocumentPropertiesPageFactory( |
|
223 |
ReportDocument.REPORT_PROPERTIES_PAGE_GROUP, |
|
224 |
"General" |
|
225 |
) |
|
226 |
); |
|
227 |
|
|
228 |
propertiesPageManager.registerFactory(new LocationReportPropertiesPageFactory()); |
|
229 |
} |
|
230 |
|
|
231 |
@SuppressWarnings("rawtypes") |
|
232 |
@Override |
|
233 |
public DynStruct getDefinition(String className) { |
|
234 |
|
|
235 |
if (this.persistenceDefinition.getName().equalsIgnoreCase(className)) { |
|
236 |
return this.persistenceDefinition; |
|
237 |
} |
|
238 |
if (this.persistenceDefinition.getFullName().equalsIgnoreCase(className)) { |
|
239 |
return this.persistenceDefinition; |
|
240 |
} |
|
241 |
if (this.getDocumentClass().getName().equals(className)) { |
|
242 |
return this.persistenceDefinition; |
|
243 |
} |
|
244 |
|
|
245 |
return null; |
|
246 |
} |
|
247 |
|
|
248 |
@SuppressWarnings("rawtypes") |
|
249 |
@Override |
|
250 |
protected Class getDocumentClass() { |
|
251 |
return ReportDocumentImpl.class; |
|
252 |
} |
|
253 |
|
|
254 |
@Override |
|
255 |
public boolean manages(Object object) { |
|
256 |
return object instanceof ReportDocument; |
|
257 |
} |
|
258 |
} |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/document/ReportDocument.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.report.app.mainplugin.document; |
|
25 |
|
|
26 |
import java.beans.PropertyChangeListener; |
|
27 |
|
|
28 |
import org.gvsig.app.project.Project; |
|
29 |
import org.gvsig.app.project.documents.Document; |
|
30 |
import org.gvsig.report.lib.api.Report; |
|
31 |
import org.gvsig.tools.util.PropertiesSupport; |
|
32 |
|
|
33 |
|
|
34 |
public interface ReportDocument extends Document, PropertiesSupport { |
|
35 |
|
|
36 |
public static final String REPORT_PROPERTIES_PAGE_GROUP = "ReportDocument"; |
|
37 |
|
|
38 |
public Report getReport(); |
|
39 |
|
|
40 |
@Override |
|
41 |
public String getName(); |
|
42 |
|
|
43 |
@Override |
|
44 |
public Project getProject(); |
|
45 |
|
|
46 |
@Override |
|
47 |
public void addPropertyChangeListener(PropertyChangeListener listener); |
|
48 |
|
|
49 |
} |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/document/ReportDocumentImpl.java | ||
---|---|---|
1 |
package org.gvsig.report.app.mainplugin.document; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.Map; |
|
5 |
import org.gvsig.app.project.documents.AbstractDocument; |
|
6 |
import org.gvsig.report.lib.api.Report; |
|
7 |
import org.gvsig.report.lib.api.ReportLocator; |
|
8 |
import org.gvsig.report.lib.api.ReportServer; |
|
9 |
import org.gvsig.tools.persistence.PersistentState; |
|
10 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
11 |
import org.gvsig.tools.util.PropertiesSupport; |
|
12 |
import org.gvsig.tools.util.PropertiesSupportHelper; |
|
13 |
|
|
14 |
/** |
|
15 |
* |
|
16 |
* @author jjdelcerro |
|
17 |
*/ |
|
18 |
public class ReportDocumentImpl |
|
19 |
extends AbstractDocument |
|
20 |
implements ReportDocument { |
|
21 |
|
|
22 |
private PropertiesSupport propertiesSupport; |
|
23 |
private Report report; |
|
24 |
|
|
25 |
public ReportDocumentImpl() { |
|
26 |
this(null); |
|
27 |
} |
|
28 |
|
|
29 |
public ReportDocumentImpl(ReportManager reportManager) { |
|
30 |
super(reportManager); |
|
31 |
this.propertiesSupport = new PropertiesSupportHelper(); |
|
32 |
this.setOwner(System.getProperty("user.name")); |
|
33 |
} |
|
34 |
|
|
35 |
public ReportDocumentImpl(ReportManager reportManager, Report report) { |
|
36 |
this(reportManager); |
|
37 |
this.report = report; |
|
38 |
this.setName(report.getName()); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public Report getReport() { |
|
43 |
return this.report; |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public Object getProperty(String string) { |
|
48 |
return this.propertiesSupport.getProperty(string); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public void setProperty(String string, Object o) { |
|
53 |
this.propertiesSupport.setProperty(string, o); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public Map<String, Object> getProperties() { |
|
58 |
return this.propertiesSupport.getProperties(); |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
63 |
state.set("report_file", this.report.getFile()); |
|
64 |
state.set("report_datasetName", this.report.getDataSet().getName()); |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public void loadFromState(PersistentState state) throws PersistenceException { |
|
69 |
|
|
70 |
File reportFile = state.getFile("report_file"); |
|
71 |
String datasetName = state.getString("report_datasetName"); |
|
72 |
org.gvsig.report.lib.api.ReportManager manager = ReportLocator.getReportManager(); |
|
73 |
this.report = manager.createReport(reportFile, datasetName); |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
} |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/document/gui/projectpanel/ProjectReportPanelPage.java | ||
---|---|---|
1 |
package org.gvsig.report.app.mainplugin.document.gui.projectpanel; |
|
2 |
|
|
3 |
import javax.swing.JComponent; |
|
4 |
import org.gvsig.app.project.Project; |
|
5 |
import org.gvsig.app.project.documents.gui.projectpanel.ProjectPanelPage; |
|
6 |
import org.gvsig.report.app.mainplugin.ReportState; |
|
7 |
import org.gvsig.report.swing.api.JReportServer; |
|
8 |
import org.gvsig.tools.ToolsLocator; |
|
9 |
import org.gvsig.tools.i18n.I18nManager; |
|
10 |
import org.slf4j.Logger; |
|
11 |
import org.slf4j.LoggerFactory; |
|
12 |
|
|
13 |
public class ProjectReportPanelPage |
|
14 |
implements ProjectPanelPage { |
|
15 |
|
|
16 |
private final Logger LOG = LoggerFactory.getLogger(ProjectReportPanelPage.class); |
|
17 |
|
|
18 |
private Project project; |
|
19 |
private JReportServer serverPanel = null; |
|
20 |
|
|
21 |
public ProjectReportPanelPage() { |
|
22 |
this.project = null; |
|
23 |
this.initComponents(); |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public void setData(Object data) { |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
public String getTitle() { |
|
33 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
34 |
return i18n.getTranslation("_Reports"); |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public int getPriority() { |
|
39 |
return 500; |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public boolean whenAccept() { |
|
44 |
return true; |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public boolean whenApply() { |
|
49 |
return true; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public boolean whenCancel() { |
|
54 |
return true; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public JComponent asJComponent() { |
|
59 |
if( this.serverPanel == null ) { |
|
60 |
this.serverPanel = ReportState.get().getServerPanel(); |
|
61 |
} |
|
62 |
return this.serverPanel.asJComponent(); |
|
63 |
} |
|
64 |
|
|
65 |
private void initComponents() { |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public void setProject(Project project) { |
|
71 |
} |
|
72 |
|
|
73 |
} |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/document/gui/projectpanel/ProjectReportPanelPageFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.report.app.mainplugin.document.gui.projectpanel; |
|
3 |
|
|
4 |
import org.gvsig.app.project.Project; |
|
5 |
import org.gvsig.propertypage.PropertiesPage; |
|
6 |
import org.gvsig.propertypage.PropertiesPageFactory; |
|
7 |
|
|
8 |
public class ProjectReportPanelPageFactory implements PropertiesPageFactory { |
|
9 |
|
|
10 |
@Override |
|
11 |
public String getGroupID() { |
|
12 |
return Project.PROJECT_PANEL_PAGE_GROUP; |
|
13 |
} |
|
14 |
|
|
15 |
@Override |
|
16 |
public String getName() { |
|
17 |
return "Report"; |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
public boolean isVisible(Object obj) { |
|
22 |
// Always if enabled this page |
|
23 |
return true; |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public PropertiesPage create(Object container, Object data) { |
|
28 |
return new ProjectReportPanelPage(); |
|
29 |
} |
|
30 |
|
|
31 |
} |
org.gvsig.report/tags/org.gvsig.report-1.0.3/org.gvsig.report.app/org.gvsig.report.app.mainplugin/src/main/java/org/gvsig/report/app/mainplugin/document/gui/CreateReportPanelView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">U1d5b55e5W1651053ccc1WN8000</at> |
|
28 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at> |
|
29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE</at> |
|
30 |
<at name="components"> |
|
31 |
<object classname="java.util.LinkedList"> |
|
32 |
<item > |
|
33 |
<at name="value"> |
|
34 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
35 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
36 |
<at name="cellconstraints"> |
|
37 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
38 |
<at name="column">2</at> |
|
39 |
<at name="row">2</at> |
|
40 |
<at name="colspan">1</at> |
|
41 |
<at name="rowspan">1</at> |
|
42 |
<at name="halign">default</at> |
|
43 |
<at name="valign">default</at> |
|
44 |
<at name="insets" object="insets">0,0,0,0</at> |
|
45 |
</object> |
|
46 |
</at> |
|
47 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
48 |
</super> |
|
49 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
50 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
51 |
<at name="beanproperties"> |
|
52 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
53 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
54 |
<at name="properties"> |
|
55 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
56 |
<at name="border"> |
|
57 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
58 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
59 |
<at name="name">border</at> |
|
60 |
</super> |
|
61 |
<at name="borders"> |
|
62 |
<object classname="java.util.LinkedList"> |
|
63 |
<item > |
|
64 |
<at name="value"> |
|
65 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
66 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
67 |
<at name="name">border</at> |
|
68 |
</super> |
|
69 |
</object> |
|
70 |
</at> |
|
71 |
</item> |
|
72 |
</object> |
|
73 |
</at> |
|
74 |
</object> |
|
75 |
</at> |
|
76 |
<at name="name">lblReportFile</at> |
|
77 |
<at name="width">58</at> |
|
78 |
<at name="text">Report file</at> |
|
79 |
<at name="fill"> |
|
80 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
81 |
<at name="name">fill</at> |
|
82 |
</object> |
|
83 |
</at> |
|
84 |
<at name="height">14</at> |
|
85 |
</object> |
|
86 |
</at> |
|
87 |
</object> |
|
88 |
</at> |
|
89 |
</object> |
|
90 |
</at> |
|
91 |
</item> |
|
92 |
<item > |
|
93 |
<at name="value"> |
|
94 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
95 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
96 |
<at name="cellconstraints"> |
|
97 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
98 |
<at name="column">2</at> |
|
99 |
<at name="row">4</at> |
|
100 |
<at name="colspan">1</at> |
|
101 |
<at name="rowspan">1</at> |
|
102 |
<at name="halign">default</at> |
|
103 |
<at name="valign">default</at> |
|
104 |
<at name="insets" object="insets">0,0,0,0</at> |
|
105 |
</object> |
|
106 |
</at> |
|
107 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
108 |
</super> |
|
109 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
110 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
111 |
<at name="beanproperties"> |
|
112 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
113 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
114 |
<at name="properties"> |
|
115 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
116 |
<at name="border"> |
|
117 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
118 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
119 |
<at name="name">border</at> |
|
120 |
</super> |
|
121 |
<at name="borders"> |
|
122 |
<object classname="java.util.LinkedList"> |
|
123 |
<item > |
|
124 |
<at name="value"> |
|
125 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
126 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
127 |
<at name="name">border</at> |
|
128 |
</super> |
|
129 |
</object> |
|
130 |
</at> |
|
131 |
</item> |
|
132 |
</object> |
|
133 |
</at> |
|
134 |
</object> |
|
135 |
</at> |
|
136 |
<at name="name">lblDataSet</at> |
|
137 |
<at name="width">58</at> |
|
138 |
<at name="text">Data set</at> |
|
139 |
<at name="fill"> |
|
140 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
141 |
<at name="name">fill</at> |
|
142 |
</object> |
|
143 |
</at> |
|
144 |
<at name="height">14</at> |
|
145 |
</object> |
|
146 |
</at> |
|
147 |
</object> |
|
148 |
</at> |
|
149 |
</object> |
|
150 |
</at> |
|
151 |
</item> |
|
152 |
<item > |
|
153 |
<at name="value"> |
|
154 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
155 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
156 |
<at name="cellconstraints"> |
|
157 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
158 |
<at name="column">4</at> |
|
159 |
<at name="row">2</at> |
|
160 |
<at name="colspan">1</at> |
|
161 |
<at name="rowspan">1</at> |
|
162 |
<at name="halign">default</at> |
|
163 |
<at name="valign">default</at> |
|
164 |
<at name="insets" object="insets">0,0,0,0</at> |
|
165 |
</object> |
|
166 |
</at> |
|
167 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
168 |
</super> |
|
169 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
170 |
<at name="beanclass">javax.swing.JTextField</at> |
|
171 |
<at name="beanproperties"> |
|
172 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
173 |
<at name="classname">javax.swing.JTextField</at> |
|
174 |
<at name="properties"> |
|
175 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
176 |
<at name="border"> |
|
177 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
178 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
179 |
<at name="name">border</at> |
|
180 |
</super> |
|
181 |
<at name="borders"> |
|
182 |
<object classname="java.util.LinkedList"> |
|
183 |
<item > |
|
184 |
<at name="value"> |
|
185 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
186 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
187 |
<at name="name">border</at> |
|
188 |
</super> |
|
189 |
</object> |
|
190 |
</at> |
|
191 |
</item> |
|
192 |
</object> |
|
193 |
</at> |
|
194 |
</object> |
|
195 |
</at> |
|
196 |
<at name="name">txtReportFile</at> |
|
197 |
<at name="width">781</at> |
|
198 |
<at name="height">20</at> |
|
199 |
</object> |
|
200 |
</at> |
|
201 |
</object> |
|
202 |
</at> |
|
203 |
</object> |
|
204 |
</at> |
|
205 |
</item> |
|
206 |
<item > |
|
207 |
<at name="value"> |
|
208 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
209 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
210 |
<at name="cellconstraints"> |
|
211 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
212 |
<at name="column">6</at> |
|
213 |
<at name="row">2</at> |
|
214 |
<at name="colspan">1</at> |
|
215 |
<at name="rowspan">1</at> |
|
216 |
<at name="halign">default</at> |
|
217 |
<at name="valign">default</at> |
|
218 |
<at name="insets" object="insets">0,0,0,0</at> |
|
219 |
</object> |
|
220 |
</at> |
|
221 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
222 |
</super> |
|
223 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
224 |
<at name="beanclass">javax.swing.JButton</at> |
|
225 |
<at name="beanproperties"> |
|
226 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
227 |
<at name="classname">javax.swing.JButton</at> |
|
228 |
<at name="properties"> |
|
229 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
230 |
<at name="border"> |
|
231 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
232 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
233 |
<at name="name">border</at> |
|
234 |
</super> |
|
235 |
<at name="borders"> |
|
236 |
<object classname="java.util.LinkedList"> |
|
237 |
<item > |
|
238 |
<at name="value"> |
|
239 |
<object classname="com.jeta.forms.store.properties.EmptyBorderProperty"> |
|
240 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
241 |
<at name="name">border</at> |
|
242 |
<at name="title"></at> |
|
243 |
</super> |
|
244 |
<at name="top">2</at> |
|
245 |
<at name="left">2</at> |
|
246 |
<at name="bottom">2</at> |
|
247 |
<at name="right">2</at> |
|
248 |
</object> |
|
249 |
</at> |
|
250 |
</item> |
|
251 |
</object> |
|
252 |
</at> |
|
253 |
</object> |
|
254 |
</at> |
|
255 |
<at name="actionCommand">...</at> |
|
256 |
<at name="name">btnReportFile</at> |
|
257 |
<at name="width">16</at> |
|
258 |
<at name="text">...</at> |
|
259 |
<at name="height">18</at> |
|
260 |
</object> |
|
261 |
</at> |
|
262 |
</object> |
|
263 |
</at> |
|
264 |
</object> |
|
265 |
</at> |
|
266 |
</item> |
|
267 |
<item > |
|
268 |
<at name="value"> |
|
269 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
270 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
271 |
<at name="cellconstraints"> |
|
272 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
273 |
<at name="column">4</at> |
|
274 |
<at name="row">4</at> |
|
275 |
<at name="colspan">3</at> |
|
276 |
<at name="rowspan">1</at> |
|
277 |
<at name="halign">default</at> |
|
278 |
<at name="valign">default</at> |
|
279 |
<at name="insets" object="insets">0,0,0,0</at> |
|
280 |
</object> |
|
281 |
</at> |
|
282 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
283 |
</super> |
|
284 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
285 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
286 |
<at name="beanproperties"> |
|
287 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
288 |
<at name="classname">javax.swing.JComboBox</at> |
|
289 |
<at name="properties"> |
|
290 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
291 |
<at name="border"> |
|
292 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
293 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
294 |
<at name="name">border</at> |
|
295 |
</super> |
Also available in: Unified diff