Revision 3618

View differences:

org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/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

  
3
    <modelVersion>4.0.0</modelVersion>
4
    <parent>
5
        <groupId>org.gvsig</groupId>
6
        <artifactId>org.gvsig.desktop</artifactId>
7
        <version>2.0.321</version>
8
    </parent>
9
    <artifactId>org.gvsig.pdf</artifactId>
10
    <version>1.0.39</version>
11
    <packaging>pom</packaging>
12
    <name>${project.artifactId}</name>
13

  
14
    <url>https://devel.gvsig.org/svn/gvsig-projects-pool/${project.artifactId}/trunk/${project.artifactId}</url>
15
  
16
    <distributionManagement>
17
        <site>
18
            <id>gvsig-repository</id>
19
            <url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url>
20
        </site>
21
    </distributionManagement>
22
  
23
    <scm>
24
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39</connection>
25
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39</developerConnection>
26
        <url>https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39</url>
27
    </scm>
28

  
29
    <developers>
30
        <developer>
31
            <id>jjdelcerro</id>
32
            <name>Joaquin Jose del Cerro</name>
33
            <email>jjdelcerro@gvsig.com</email>
34
            <roles>
35
                <role>Architect</role>
36
                <role>Developer</role>
37
            </roles>
38
        </developer>
39
    </developers>
40

  
41
    <repositories>
42
        <repository>
43
            <id>gvsig-public-http-repository</id>
44
            <name>gvSIG maven public HTTP repository</name>
45
            <url>http://devel.gvsig.org/m2repo/j2se</url>
46
            <releases>
47
                <enabled>true</enabled>
48
                <updatePolicy>daily</updatePolicy>
49
                <checksumPolicy>warn</checksumPolicy>
50
            </releases>
51
            <snapshots>
52
                <enabled>true</enabled>
53
                <updatePolicy>daily</updatePolicy>
54
                <checksumPolicy>warn</checksumPolicy>
55
            </snapshots>
56
        </repository>
57
<!--        <repository>
58
            
59
            https://stackoverflow.com/questions/26993105/i-get-an-error-downloading-javax-media-jai-core1-1-3-from-maven-central
60
            
61
            <id>geotoolkit-org</id>
62
            <name>geotoolkit.org repository</name>
63
            <url>http://maven.geotoolkit.org/</url>
64
        </repository>-->
65
    </repositories>
66

  
67
    <build>
68
        <plugins>
69
            <plugin>
70
                <groupId>org.apache.maven.plugins</groupId>
71
                <artifactId>maven-release-plugin</artifactId>
72
                <configuration>
73
                    <tagBase>https://devel.gvsig.org/svn/gvsig-projects-pool/${project.artifactId}/tags</tagBase>
74
                    <goal>deploy</goal>
75
                </configuration>
76
            </plugin>
77
        </plugins>
78
    </build>
79

  
80

  
81
    <dependencyManagement>
82
        <dependencies>
83
            <dependency>
84
                <groupId>org.gvsig</groupId>
85
                <artifactId>org.gvsig.pdf.app.mainplugin</artifactId>
86
                <version>1.0.39</version>
87
            </dependency>
88
            <dependency>
89
                <groupId>org.gvsig</groupId>
90
                <artifactId>org.gvsig.pdf.lib.api</artifactId>
91
                <version>1.0.39</version>
92
            </dependency>
93
            <dependency>
94
                <groupId>org.gvsig</groupId>
95
                <artifactId>org.gvsig.pdf.lib.impl</artifactId>
96
                <version>1.0.39</version>
97
            </dependency>
98
            <dependency>
99
                <groupId>org.gvsig</groupId>
100
                <artifactId>org.gvsig.pdf.swing.api</artifactId>
101
                <version>1.0.39</version>
102
            </dependency>
103
            <dependency>
104
                <groupId>org.gvsig</groupId>
105
                <artifactId>org.gvsig.pdf.swing.impl</artifactId>
106
                <version>1.0.39</version>
107
            </dependency>
108
            <dependency>
109
                <groupId>org.icepdf.os</groupId>
110
                <artifactId>icepdf-core</artifactId>
111
                <version>6.2.2</version>
112
                <exclusions>
113
                    <exclusion>
114
                        <groupId>batik</groupId>
115
                        <artifactId>batik-awt-util</artifactId>
116
                    </exclusion>        
117
                    <exclusion>
118
                        <groupId>batik</groupId>
119
                        <artifactId>batik-dom</artifactId>
120
                    </exclusion>        
121
                    <exclusion>
122
                        <groupId>batik</groupId>
123
                        <artifactId>batik-svg-dom</artifactId>
124
                    </exclusion>        
125
                    <exclusion>
126
                        <groupId>batik</groupId>
127
                        <artifactId>batik-svggen</artifactId>
128
                    </exclusion>        
129
                    <exclusion>
130
                        <groupId>batik</groupId>
131
                        <artifactId>batik-util</artifactId>
132
                    </exclusion>        
133
                    <exclusion>
134
                        <groupId>batik</groupId>
135
                        <artifactId>batik-xml</artifactId>
136
                    </exclusion>        
137
                    <!--
138
                    <exclusion>
139
                        <groupId>javax.media</groupId>
140
                        <artifactId>jai_core</artifactId>
141
                    </exclusion>        
142
                    -->
143
                </exclusions>
144
            </dependency>
145
	    <dependency>
146
                <groupId>org.icepdf.os</groupId>
147
                <artifactId>icepdf-viewer</artifactId>
148
                <version>6.2.2</version>
149
                <exclusions>
150
                    <exclusion>
151
                        <groupId>batik</groupId>
152
                        <artifactId>batik-awt-util</artifactId>
153
                    </exclusion>        
154
                    <exclusion>
155
                        <groupId>batik</groupId>
156
                        <artifactId>batik-dom</artifactId>
157
                    </exclusion>        
158
                    <exclusion>
159
                        <groupId>batik</groupId>
160
                        <artifactId>batik-svg-dom</artifactId>
161
                    </exclusion>        
162
                    <exclusion>
163
                        <groupId>batik</groupId>
164
                        <artifactId>batik-svggen</artifactId>
165
                    </exclusion>        
166
                    <exclusion>
167
                        <groupId>batik</groupId>
168
                        <artifactId>batik-util</artifactId>
169
                    </exclusion>        
170
                    <exclusion>
171
                        <groupId>batik</groupId>
172
                        <artifactId>batik-xml</artifactId>
173
                    </exclusion>  
174
                    <!--      
175
                    <exclusion>
176
                        <groupId>javax.media</groupId>
177
                        <artifactId>jai_core</artifactId>
178
                    </exclusion>        
179
                    -->
180
                </exclusions>
181
            </dependency>
182
            <!--
183
            <dependency>
184
              <groupId>com.cosium.jai-imageio</groupId>
185
              <artifactId>jai-imageio-core</artifactId>
186
              <version>1.3.0.1</version>
187
            </dependency>
188
            -->
189
            <dependency>
190
              <groupId>org.bouncycastle</groupId>
191
              <artifactId>bcpkix-jdk15on</artifactId>
192
              <version>1.54</version>
193
            </dependency>
194
            <dependency>
195
              <groupId>org.bouncycastle</groupId>
196
              <artifactId>bcprov-jdk15on</artifactId>
197
              <version>1.54</version>
198
            </dependency>
199
            <dependency>
200
              <groupId>org.bouncycastle</groupId>
201
              <artifactId>bcprov-ext-jdk15on</artifactId>
202
              <version>1.54</version>
203
            </dependency>
204
            <dependency>
205
                <groupId>com.itextpdf</groupId>
206
                <artifactId>itextpdf</artifactId>
207
                <version>5.5.8</version>
208
            </dependency>
209
        </dependencies>
210
    </dependencyManagement>
211

  
212
    <modules>
213
        <module>org.gvsig.pdf.lib</module>
214
        <module>org.gvsig.pdf.swing</module>
215
        <module>org.gvsig.pdf.app</module>
216
    </modules>
217

  
218
</project>
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/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.pdf.app</artifactId>
6
        <version>1.0.39</version>
7
    </parent>
8
    <artifactId>org.gvsig.pdf.app.mainplugin</artifactId>
9
    <name>${project.artifactId}</name>
10
    <dependencies>
11
        <dependency>
12
            <groupId>org.gvsig</groupId>
13
            <artifactId>org.gvsig.app.mainplugin</artifactId>
14
            <scope>compile</scope>
15
        </dependency>
16
        <dependency>
17
            <groupId>org.gvsig</groupId>
18
            <artifactId>org.gvsig.pdf.lib.api</artifactId>
19
            <scope>compile</scope>
20
        </dependency>
21
        <dependency>
22
            <groupId>org.gvsig</groupId>
23
            <artifactId>org.gvsig.pdf.lib.impl</artifactId>
24
            <scope>runtime</scope>
25
        </dependency>
26
        <dependency>
27
            <groupId>org.gvsig</groupId>
28
            <artifactId>org.gvsig.pdf.swing.api</artifactId>
29
            <scope>compile</scope>
30
        </dependency>
31
        <dependency>
32
            <groupId>org.gvsig</groupId>
33
            <artifactId>org.gvsig.pdf.swing.impl</artifactId>
34
            <scope>runtime</scope>
35
        </dependency>
36
        <dependency>
37
            <groupId>org.icepdf.os</groupId>
38
            <artifactId>icepdf-core</artifactId>
39
            <scope>runtime</scope>
40
        </dependency>
41
        <dependency>
42
            <groupId>org.icepdf.os</groupId>
43
            <artifactId>icepdf-viewer</artifactId>
44
            <scope>runtime</scope>
45
        </dependency>
46
        <dependency>
47
            <groupId>javax.media</groupId>
48
            <artifactId>jai_core</artifactId>
49
            <scope>runtime</scope>
50
        </dependency>
51
        
52
        <dependency>
53
            <groupId>org.bouncycastle</groupId>
54
            <artifactId>bcpkix-jdk15on</artifactId>
55
            <scope>runtime</scope>
56
        </dependency>
57
        <dependency>
58
            <groupId>org.bouncycastle</groupId>
59
            <artifactId>bcprov-jdk15on</artifactId>
60
            <scope>runtime</scope>
61
        </dependency>
62
        <dependency>
63
            <groupId>org.bouncycastle</groupId>
64
            <artifactId>bcprov-ext-jdk15on</artifactId>
65
            <scope>runtime</scope>
66
        </dependency>
67
    </dependencies>
68

  
69
    <properties>
70
        <gvsig.package.info.state>testing</gvsig.package.info.state>
71
        <gvsig.package.info.official>true</gvsig.package.info.official>
72
        <gvsig.package.info.dependencies>required: org.gvsig.app -ge 2.2.0</gvsig.package.info.dependencies>
73
        <gvsig.package.info.categories />
74
        <gvsig.package.info.name>PDF framework</gvsig.package.info.name>
75
        <gvsig.package.info.description>PDF framework and basic rules</gvsig.package.info.description>
76
        <gvsig.package.info.owner>gvSIG Association</gvsig.package.info.owner>
77
        <gvsig.package.info.javaVM>j1_8</gvsig.package.info.javaVM>
78
        <gvsig.package.info.sourcesURL>${project.scm.url}</gvsig.package.info.sourcesURL>
79
        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-pdf/pool</gvsig.package.info.poolURL>
80
    </properties>
81

  
82
</project>
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/buildNumber.properties
1
#Mon Mar 29 19:10:12 CEST 2021
2
buildNumber=40
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
#Translations for language [es]
2
#Thu Nov 20 10:10:09 CET 2014
3
_Open=Abrir
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
#Translations for language [en]
2
#Thu Nov 20 10:10:15 CET 2014
3
_Open=Open
4

  
5

  
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2014 gvSIG
3
  Association. This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by the Free Software
5
  Foundation; either version 3 of the License, or (at your option) any later version.
6
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
  PURPOSE. See the GNU General Public License for more details. You should have received
9
  a copy of the GNU General Public License along with this program; if not, write to
10
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
11
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
12
  or visit our website www.gvsig.com. -->
13
<plugin-config>
14
  <depends plugin-name="org.gvsig.app.mainplugin" />
15
  <resourceBundle name="text" />
16
  <libraries library-dir="lib" />
17
  <extensions>
18

  
19

  
20
    <extension class-name="org.gvsig.pdf.app.mainplugin.PDFExtension"
21
      description="" active="true" priority="1">
22
    </extension>
23

  
24

  
25
  </extensions>
26
</plugin-config>
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.app/org.gvsig.pdf.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.pdf.lib.api</include>
58
                <include>org.gvsig:org.gvsig.pdf.lib.impl</include>
59
                <include>org.gvsig:org.gvsig.pdf.swing.api</include>
60
                <include>org.gvsig:org.gvsig.pdf.swing.impl</include>
61
                <include>org.icepdf.os:icepdf-viewer</include>
62
                <include>org.icepdf.os:icepdf-core</include>
63

  
64
                <include>javax.media:jai_core</include>
65
                <include>org.bouncycastle:bcpkix-jdk15on</include>
66
                <!--
67
                Estos dos jars ya se los esta llevando andami
68
                <include>org.bouncycastle:bcprov-jdk15on</include>
69
                <include>org.bouncycastle:bcprov-ext-jdk15on</include>
70
                -->
71
            </includes>
72
        </dependencySet>
73
    </dependencySets>
74

  
75
</assembly>
76

  
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/java/org/gvsig/pdf/app/mainplugin/PDFExtension.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.pdf.app.mainplugin;
25

  
26
import org.gvsig.andami.plugins.Extension;
27

  
28
/**
29
 *
30
 * @author jjdelcerro
31
 */
32
public class PDFExtension extends Extension {
33

  
34
    @Override
35
    public void initialize() {
36

  
37
    }
38

  
39
    @Override
40
    public void postInitialize() {
41

  
42
    }
43

  
44
    @Override
45
    public void execute(String action) {
46

  
47
    }
48

  
49
    @Override
50
    public boolean isEnabled() {
51

  
52
        return true;
53
    }
54

  
55
    @Override
56
    public boolean isVisible() {
57
        return true;
58
    }
59

  
60
}
0 61

  
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.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.pdf</artifactId>
6
    <version>1.0.39</version>
7
  </parent>
8
  <artifactId>org.gvsig.pdf.app</artifactId>
9
  <packaging>pom</packaging>
10
  <name>${project.artifactId}</name>
11
  <modules>
12
  	<module>org.gvsig.pdf.app.mainplugin</module>
13
  </modules>
14
</project>
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.api/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.pdf.lib</artifactId>
6
    <version>1.0.39</version>
7
  </parent>
8
  <artifactId>org.gvsig.pdf.lib.api</artifactId>
9
  <name>${project.artifactId}</name>
10
  <dependencies>
11
    <dependency>
12
      <groupId>org.gvsig</groupId>
13
      <artifactId>org.gvsig.tools.lib</artifactId>
14
      <scope>compile</scope>
15
    </dependency>
16
    <dependency>
17
      <groupId>org.gvsig</groupId>
18
      <artifactId>org.gvsig.fmap.dal.api</artifactId>
19
      <scope>compile</scope>
20
    </dependency>
21
  </dependencies>
22

  
23
</project>
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.api/src/main/java/org/gvsig/pdf/lib/api/PDFWriter.java
1
package org.gvsig.pdf.lib.api;
2

  
3
import java.awt.Graphics2D;
4

  
5
/**
6
 *
7
 * @author osc
8
 */
9
public interface PDFWriter {
10

  
11
    public static final int PAGE_LETTER = 1;
12
    public static final int PAGE_LEGAL = 2;
13
    public static final int PAGE_A4 = 4;
14
    public static final int PAGE_A5 = 5;
15

  
16
    public void open(int pageSize);
17

  
18
    public void close();
19

  
20
    public float getWidth();
21

  
22
    public float getHeight();
23

  
24
    public Graphics2D getGraphics2D();
25
    
26
    public byte[] toByteArray();
27
    
28
    public PDFDocument toDocument();
29
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.api/src/main/java/org/gvsig/pdf/lib/api/PDFDocument.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.pdf.lib.api;
7

  
8
import java.io.IOException;
9
import java.io.InputStream;
10

  
11
/**
12
 *
13
 * @author osc
14
 */
15
public interface PDFDocument {
16
    public InputStream getInputStream() throws IOException ;
17
    
18
    public void setSource(Object source);
19

  
20
    public byte[] toByteArray();
21
    
22
    public String toHexString();
23
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.api/src/main/java/org/gvsig/pdf/lib/api/PDFLocator.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.pdf.lib.api;
25

  
26
import org.gvsig.tools.locator.AbstractLocator;
27
import org.gvsig.tools.locator.Locator;
28
import org.gvsig.tools.locator.LocatorException;
29

  
30
@SuppressWarnings("rawtypes")
31
public class PDFLocator extends AbstractLocator {
32

  
33
	private static final String LOCATOR_NAME = "PDFLocator";
34
	
35
	public static final String PDF_MANAGER_NAME =
36
			"PDFManager";
37

  
38
	private static final String PDF_MANAGER_DESCRIPTION =
39
			"PDF Manager of gvSIG";
40
	
41
	private static final PDFLocator instance = new PDFLocator();
42

  
43
	private PDFLocator() {
44

  
45
	}
46

  
47
	/**
48
	 * Return the singleton instance.
49
	 * 
50
	 * @return the singleton instance
51
	 */
52
	public static PDFLocator getInstance() {
53
		return instance;
54
	}
55

  
56
        @Override
57
	public String getLocatorName() {
58
		return LOCATOR_NAME;
59
	}
60

  
61
	/**
62
	 * Return a reference to PDFManager.
63
	 * 
64
	 * @return a reference to PDFManager
65
	 * @throws LocatorException
66
	 *             if there is no access to the class or the class cannot be
67
	 *             instantiated
68
	 * @see Locator#get(String)
69
	 */
70
	public static PDFManager getPDFManager()
71
			throws LocatorException {
72
		return (PDFManager) getInstance().get(PDF_MANAGER_NAME);
73
	}
74

  
75
	/**
76
	 * Registers the Class implementing the PDFManager interface.
77
	 * 
78
	 * @param clazz
79
	 *            implementing the PDFManager interface
80
	 */
81
//	public static void registerPDFManager(Class clazz) {
82
//		getInstance().register(PDF_MANAGER_NAME,
83
//				PDF_MANAGER_DESCRIPTION, clazz);
84
//	}
85

  
86
	public static void registerDefaultPDFManager(Class clazz) {
87
		getInstance().registerDefault(PDF_MANAGER_NAME,
88
				PDF_MANAGER_DESCRIPTION, clazz);
89
	}
90

  
91

  
92
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.api/src/main/java/org/gvsig/pdf/lib/api/PDFLibrary.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.pdf.lib.api;
25

  
26
import org.gvsig.fmap.dal.DALLibrary;
27
import org.gvsig.tools.ToolsLibrary;
28
import org.gvsig.tools.library.AbstractLibrary;
29
import org.gvsig.tools.library.LibraryException;
30

  
31
/**
32
 *
33
 * @author jjdelcerro
34
 */
35
public class PDFLibrary extends AbstractLibrary {
36

  
37
    @Override
38
    public void doRegistration() {
39
        super.doRegistration();
40
        registerAsAPI(PDFLibrary.class);
41
        this.require(ToolsLibrary.class);
42
        this.require(DALLibrary.class);
43
    }
44

  
45
    @Override
46
    protected void doInitialize() throws LibraryException {
47
    }
48

  
49
    @Override
50
    protected void doPostInitialize() throws LibraryException {
51
    }
52

  
53
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.api/src/main/java/org/gvsig/pdf/lib/api/PDFManager.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.pdf.lib.api;
25

  
26
import java.io.File;
27

  
28
/**
29
 *
30
 * @author jjdelcerro
31
 */
32
public interface PDFManager {
33
    
34
    public PDFDocument createPDFDocument(byte[] document);
35
    public PDFDocument createPDFDocument(String document);
36
    public PDFDocument createPDFDocument(File document);
37
    public PDFDocument createPDFDocument(); 
38
    public PDFWriter createPDFWriter();
39
    
40
    
41
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.pdf.lib.api.PDFLibrary
0 2

  
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/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.pdf</artifactId>
6
    <version>1.0.39</version>
7
  </parent>
8
  <artifactId>org.gvsig.pdf.lib</artifactId>
9
  <packaging>pom</packaging>
10
  <name>${project.artifactId}</name>
11
  <modules>
12
  	<module>org.gvsig.pdf.lib.api</module>
13
  	<module>org.gvsig.pdf.lib.impl</module>
14
  </modules>
15
</project>
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.pdf.lib.impl.PDFImplLibrary
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/java/org/gvsig/pdf/lib/impl/PDFImplLibrary.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.pdf.lib.impl;
25

  
26
import org.gvsig.fmap.dal.DALLocator;
27
import org.gvsig.fmap.dal.DataManager;
28
import org.gvsig.pdf.lib.api.PDFLibrary;
29
import org.gvsig.pdf.lib.api.PDFLocator;
30
import org.gvsig.tools.ToolsLibrary;
31
import org.gvsig.tools.library.AbstractLibrary;
32
import org.gvsig.tools.library.LibraryException;
33

  
34
public class PDFImplLibrary extends AbstractLibrary {
35

  
36
    @Override
37
    public void doRegistration() {
38
        super.doRegistration();
39
        registerAsImplementationOf(PDFLibrary.class);
40
        this.require(ToolsLibrary.class);
41
//        this.require(DALLibrary.class);
42
//        this.require(GeometryLibrary.class);
43
    }
44

  
45
    @Override
46
    protected void doInitialize() throws LibraryException {
47
        PDFLocator.registerDefaultPDFManager(DefaultPDFManager.class);
48
    }
49

  
50
    @Override
51
    protected void doPostInitialize() throws LibraryException {
52
        DataManager dataManager = DALLocator.getDataManager();
53
        dataManager.registerDataProfile(new PDFProfile());
54
    }
55

  
56
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/java/org/gvsig/pdf/lib/impl/DefaultPDFManager.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.pdf.lib.impl;
25

  
26
import java.io.File;
27
import org.gvsig.pdf.lib.api.PDFDocument;
28
import org.gvsig.pdf.lib.api.PDFManager;
29
import org.gvsig.pdf.lib.api.PDFWriter;
30

  
31
public class DefaultPDFManager implements PDFManager {
32

  
33
    @Override
34
    public PDFDocument createPDFDocument(byte[] document) {
35
        DefaultPDFDocument doc = new DefaultPDFDocument();
36
        doc.setSource(document);
37
        return doc;
38
    }
39

  
40
    @Override
41
    public PDFDocument createPDFDocument(String document) {
42
        DefaultPDFDocument doc = new DefaultPDFDocument();
43
        doc.setSource(document);
44
        return doc;
45
    }
46

  
47
    @Override
48
    public PDFDocument createPDFDocument(File document) {
49
        DefaultPDFDocument doc = new DefaultPDFDocument();
50
        doc.setSource(document);
51
        return doc;
52
    }
53
   
54
    @Override
55
    public PDFDocument createPDFDocument() {
56
        DefaultPDFDocument doc = new DefaultPDFDocument();
57
        return doc;
58
    }
59

  
60
    @Override
61
    public PDFWriter createPDFWriter() {
62
        return new DefaultPDFWriter();
63
    }
64
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/java/org/gvsig/pdf/lib/impl/PDFProfile.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.pdf.lib.impl;
7

  
8
import java.io.File;
9
import org.gvsig.fmap.dal.feature.AbstractDataProfile;
10
import org.gvsig.pdf.lib.api.PDFDocument;
11
import org.gvsig.pdf.lib.api.PDFLocator;
12
import org.gvsig.pdf.lib.api.PDFManager;
13
import org.gvsig.tools.dataTypes.CoercionException;
14
import org.gvsig.tools.dataTypes.DataType;
15
import org.gvsig.tools.dataTypes.DataTypes;
16
import org.gvsig.tools.dynobject.Tags;
17

  
18
public class PDFProfile extends AbstractDataProfile {
19

  
20
    public PDFProfile() {
21
        super("PDF", File.class);
22
    }
23

  
24
    @Override
25
    public Object createData(Object pdf, Tags tags) {
26
        PDFManager manager = PDFLocator.getPDFManager();
27
        PDFDocument pdfdoc = manager.createPDFDocument();
28
        pdfdoc.setSource(pdf);
29
        return pdfdoc;
30
    }
31

  
32
    @Override
33
    public Object coerce(DataType dataType, Object data, Tags tags) throws CoercionException {
34
        PDFDocument document;
35
        try {
36
            switch (dataType.getType()) {
37
                case DataTypes.BYTEARRAY:
38
                    document = PDFLocator.getPDFManager().createPDFDocument();
39
                    document.setSource(data);
40
                    return document.toByteArray();
41
                case DataTypes.FILE:
42
                    if (data instanceof File) {
43
                        return data;
44
                    }
45
                case DataTypes.STRING:
46
                    document = PDFLocator.getPDFManager().createPDFDocument();
47
                    document.setSource(data);
48
                    return document.toHexString();
49
                default:
50
                    break;
51
            }
52
        } catch (Exception ex) {
53
            throw new CoercionException("Can't convert pdf to " + dataType.getName(), ex);
54
        }
55
        throw new CoercionException("Can't convert pdf to " + dataType.getName());
56
    }
57

  
58
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/java/org/gvsig/pdf/lib/impl/DefaultPDFWriter.java
1
package org.gvsig.pdf.lib.impl;
2

  
3
import com.lowagie.text.Document;
4
import com.lowagie.text.PageSize;
5
import com.lowagie.text.Rectangle;
6
import com.lowagie.text.pdf.PdfContentByte;
7
import com.lowagie.text.pdf.PdfDocument;
8
import com.lowagie.text.pdf.PdfTemplate;
9
import com.lowagie.text.pdf.PdfWriter;
10
import java.awt.Graphics2D;
11
import org.apache.commons.io.IOUtils;
12
import org.apache.commons.io.output.ByteArrayOutputStream;
13
import org.gvsig.pdf.lib.api.PDFDocument;
14
import org.gvsig.pdf.lib.api.PDFWriter;
15

  
16
/**
17
 *
18
 * @author osc
19
 */
20
public class DefaultPDFWriter implements PDFWriter {
21

  
22
    private Rectangle pageSize;
23
    private Document document;
24
    private ByteArrayOutputStream output;
25
    private PdfTemplate template;
26
    private PdfContentByte contents;
27
    private Graphics2D graphics;
28

  
29
    @Override
30
    public void open(int pageSize) {
31
        this.output = null;
32
        switch (pageSize) {
33
            case PDFWriter.PAGE_A4:
34
                this.pageSize = PageSize.A4;
35
                break;
36
            case PDFWriter.PAGE_A5:
37
                this.pageSize = PageSize.A5;
38
                break;
39
            case PDFWriter.PAGE_LEGAL:
40
                this.pageSize = PageSize.LEGAL;
41
                break;
42
            case PDFWriter.PAGE_LETTER:
43
                this.pageSize = PageSize.LETTER;
44
                break;
45
            default:
46
                throw new IllegalArgumentException("Invalid value of page format");
47
        }
48
    }
49

  
50
    @Override
51
    public void close() {
52
        try {
53
            // Add in the middle of the page
54
            float offsetX = (pageSize.getWidth() - template.getWidth()) / 2;
55
            float offsetY = (pageSize.getHeight() - template.getHeight()) / 2;
56
            contents.addTemplate(template, offsetX, offsetY);
57

  
58
            document.close();
59
        } catch(Exception ex) {
60
            // Do nothing
61
        }
62
        template = null;
63
        contents = null;
64
        if( graphics!=null ) {
65
            try {
66
                graphics.dispose();
67
            } catch(Exception ex) {
68
                // Do nothing
69
            }
70
            graphics = null;
71
        }
72
        if( document!= null ) {
73
            try {
74
                document.close();
75
            } catch(Exception ex) {
76
                // Do nothing
77
            }
78
            document = null;
79
        }
80
        IOUtils.closeQuietly(output);
81
        pageSize = null;
82
    }
83

  
84
    @Override
85
    public Graphics2D getGraphics2D() {
86
        try {
87
            if (graphics != null) {
88
                return graphics;
89
            }
90
            document = new Document(this.pageSize);
91

  
92
            PdfDocument pdf = new PdfDocument();
93

  
94
            document.addDocListener(pdf);
95
            this.output = new ByteArrayOutputStream();
96
            PdfWriter writer = PdfWriter.getInstance(pdf, output);
97
            pdf.addWriter(writer);
98

  
99
            document.open();
100

  
101
            // Create a template and a Graphics2D object
102
            Rectangle docPageSize = document.getPageSize();
103
            int w = (int) (docPageSize.getWidth() * 0.9);
104
            int h = (int) (docPageSize.getHeight() * 0.95);
105
            contents = writer.getDirectContent();
106
            template = contents.createTemplate(w, h);
107

  
108
            graphics = template.createPrinterGraphics(w, h, null);
109
            // If you want to prevent copy/paste, you can use
110
            // g2 = tp.createGraphicsShapes(w, h, true, 0.9f);
111

  
112
            return graphics;
113
        } catch (Exception ex) {
114
            this.close();
115
            throw new RuntimeException("Can't create graphics.",ex);
116
        }
117
    }
118

  
119
    @Override
120
    public float getWidth() {
121
        if( graphics==null ) {
122
            this.getGraphics2D();
123
        }
124
        return template.getWidth();
125
    }
126

  
127
    @Override
128
    public float getHeight() {
129
        if( graphics==null ) {
130
            this.getGraphics2D();
131
        }
132
        return template.getHeight();
133
    }
134

  
135
    @Override
136
    public byte[] toByteArray() {
137
        return this.output.toByteArray();
138
    }
139

  
140
    @Override
141
    public PDFDocument toDocument() {
142
        PDFDocument theDocument = new DefaultPDFDocument();
143
        theDocument.setSource(this.toByteArray());
144
        return theDocument;
145
    }
146

  
147
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/java/org/gvsig/pdf/lib/impl/DefaultPDFDocument.java
1
package org.gvsig.pdf.lib.impl;
2

  
3
import java.io.ByteArrayInputStream;
4
import java.io.File;
5
import java.io.FileInputStream;
6
import java.io.FileNotFoundException;
7
import java.io.IOException;
8
import java.io.InputStream;
9
import java.net.URL;
10
import org.gvsig.pdf.lib.api.PDFDocument;
11
import org.slf4j.LoggerFactory;
12
import org.apache.commons.codec.binary.Hex;
13
import org.apache.commons.codec.DecoderException;
14
import org.apache.commons.codec.binary.Base64;
15

  
16
/**
17
 *
18
 * @author osc
19
 */
20
public class DefaultPDFDocument implements PDFDocument {
21

  
22
    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(DefaultPDFDocument.class);
23
    private Object source;
24

  
25
    public DefaultPDFDocument() {
26

  
27
    }
28

  
29
    @Override
30
    public void setSource(Object source) {
31
        this.source = source;
32
    }
33

  
34
    @Override
35
    public InputStream getInputStream() throws IOException {
36
        InputStream is = null;
37
        if (source == null) {
38
            return null;
39
        } else if (source instanceof File) {
40
            File fileSource = (File) source;
41
            try {
42
                is = new FileInputStream(fileSource);
43
            } catch (IOException ex) {
44
                LOGGER.warn("Not been able to convert file to input stream", ex);
45
                throw new IOException(ex);
46
            }
47
        } else if (source instanceof URL) {
48
            URL urlSource = (URL) source;
49
            try {
50
                is = urlSource.openStream();
51
            } catch (IOException ex) {
52
                LOGGER.warn("Not been able to open URL stream", ex);
53
                throw new IOException(ex);
54
            }
55
        } else if (source instanceof String) {
56
            String strSource = (String) source;
57
            File f = new File(strSource);
58
            if (f.exists()) {
59
                try {
60
                    is = new FileInputStream(f);
61
                } catch (FileNotFoundException ex) {
62
                    LOGGER.warn("Not been able to load existing file", ex);
63
                    throw new IOException(ex);
64
                }
65
            } else {
66
                try {
67
                    URL url = new URL(strSource);
68
                    is = url.openStream();
69
                    is.available(); // Force exception if is null
70
                } catch (Exception ex) {
71
                    try {
72
                        byte[] data = Hex.decodeHex(strSource.toCharArray());
73
                        is = new ByteArrayInputStream(data);
74
                    } catch (DecoderException ex2) {
75
                        try {
76
                            byte[] data = Base64.decodeBase64(strSource);
77
                            is = new ByteArrayInputStream(data);
78
                        } catch (Exception ex3) {
79
                            throw new IOException(ex3);
80
                        }
81
                    }
82
                }
83
            }
84
        } else if (source instanceof byte[]) {
85
            byte[] byteSource = (byte[]) source;
86
            is = new ByteArrayInputStream(byteSource);
87
        }
88

  
89
        return is;
90
    }
91

  
92
    @Override
93
    public byte[] toByteArray() {
94
        if (this.source != null) {
95
            try {
96
                InputStream is = this.getInputStream();
97
                byte[] bytes = new byte[is.available()];
98
                is.read(bytes);
99
                return bytes;
100
            } catch (IOException ex) {
101
                LOGGER.warn("Not been able to convert pdf to byte array", ex);
102
            }
103
        }
104
        return null;
105

  
106
    }
107

  
108
    private String bytearray_hex(byte[] data) {
109
        StringBuilder builder = new StringBuilder();
110
        for (byte abyte : data) {
111
            int v = abyte & 0xff;
112
            builder.append(String.format("%02x", v));
113
        }
114
        return builder.toString();
115
    }
116

  
117
    @Override
118
    public String toHexString() {
119
        byte[] data = this.toByteArray();
120
        return bytearray_hex(data);
121
    }
122
}
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/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.pdf.lib</artifactId>
6
        <version>1.0.39</version>
7
    </parent>
8
    <artifactId>org.gvsig.pdf.lib.impl</artifactId>
9
    <name>${project.artifactId}</name>
10
    <dependencies>
11
        <dependency>
12
            <groupId>org.gvsig</groupId>
13
            <artifactId>org.gvsig.pdf.lib.api</artifactId>
14
            <scope>compile</scope>
15
        </dependency>
16
        <dependency>
17
            <groupId>org.gvsig</groupId>
18
            <artifactId>org.gvsig.tools.lib</artifactId>
19
            <scope>compile</scope>
20
        </dependency>
21
        <dependency>
22
            <groupId>org.gvsig</groupId>
23
            <artifactId>org.gvsig.fmap.dal.api</artifactId>
24
            <scope>compile</scope>
25
        </dependency>
26
        <dependency>
27
            <groupId>org.gvsig</groupId>
28
            <artifactId>org.gvsig.fmap.dal.swing.api</artifactId>
29
            <scope>compile</scope>
30
        </dependency>
31
        <dependency>
32
            <groupId>commons-codec</groupId>
33
            <artifactId>commons-codec</artifactId>
34
            <scope>compile</scope>
35
        </dependency>
36
        <dependency>
37
            <groupId>com.lowagie</groupId>
38
            <artifactId>itext</artifactId>
39
            <scope>compile</scope>
40
        </dependency>
41
    </dependencies>
42
</project>
0 43

  
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.swing/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.pdf</artifactId>
6
    <version>1.0.39</version>
7
  </parent>
8
  <artifactId>org.gvsig.pdf.swing</artifactId>
9
  <packaging>pom</packaging>
10
  <name>${project.artifactId}</name>
11
  <modules>
12
  	<module>org.gvsig.pdf.swing.api</module>
13
  	<module>org.gvsig.pdf.swing.impl</module>
14
  </modules>
15
</project>
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.39/org.gvsig.pdf.swing/org.gvsig.pdf.swing.api/src/main/java/org/gvsig/pdf/swing/api/PDFSwingLocator.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.pdf.swing.api;
25

  
26
import org.gvsig.tools.locator.AbstractLocator;
27
import org.gvsig.tools.locator.Locator;
28
import org.gvsig.tools.locator.LocatorException;
29

  
30
@SuppressWarnings("rawtypes")
31
public class PDFSwingLocator extends AbstractLocator {
32

  
33
	private static final String LOCATOR_NAME = "PDFSwingLocator";
34
	
35
	public static final String PDF_SWING_MANAGER_NAME =
36
			"org.gvsig.pdf.swing.manager";
37

  
38
	private static final String PDF_SWING_MANAGER_DESCRIPTION =
39
			"PDF Swing Manager of gvSIG";
40
	
41
	private static final PDFSwingLocator instance = new PDFSwingLocator();
42

  
43
	private PDFSwingLocator() {
44

  
45
	}
46

  
47
	/**
48
	 * Return the singleton instance.
49
	 * 
50
	 * @return the singleton instance
51
	 */
52
	public static PDFSwingLocator getInstance() {
53
		return instance;
54
	}
55

  
56
        @Override
57
	public String getLocatorName() {
58
		return LOCATOR_NAME;
59
	}
60

  
61
	/**
62
	 * Return a reference to PDFManager.
63
	 * 
64
	 * @return a reference to PDFManager
65
	 * @throws LocatorException
66
	 *             if there is no access to the class or the class cannot be
67
	 *             instantiated
68
	 * @see Locator#get(String)
69
	 */
70
	public static PDFSwingManager getPDFSwingManager()
71
			throws LocatorException {
72
		return (PDFSwingManager) getInstance().get(PDF_SWING_MANAGER_NAME);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff