Revision 47256

View differences:

tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.buildtools/src/main/resources/header.txt
1
gvSIG. Desktop Geographic Information System.
2

  
3
Copyright (C) 2007-2013 gvSIG Association.
4
  
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 3
8
of the License, or (at your option) any later version.
9
  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14
 
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
MA  02110-1301, USA.
19

  
20
For any additional information, do not hesitate to contact us 
21
at info AT gvsig.com, or visit our website www.gvsig.com.
0 22

  
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.buildtools/src/main/resources/gvsig/checkstyle.xml
1
<?xml version="1.0"?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 3
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<!DOCTYPE module PUBLIC
28
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
29
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
30

  
31
<!--
32

  
33
  Checkstyle configuration that checks the sun coding conventions from:
34

  
35
    - the Java Language Specification at
36
      http://java.sun.com/docs/books/jls/second_edition/html/index.html
37

  
38
    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
39

  
40
    - the Javadoc guidelines at
41
      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
42

  
43
    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
44

  
45
    - some best practices
46

  
47
  Checkstyle is very configurable. Be sure to read the documentation at
48
  http://checkstyle.sf.net (or in your downloaded distribution).
49

  
50
  Most Checks are configurable, be sure to consult the documentation.
51

  
52
  To completely disable a check, just comment it out or delete it from the file.
53

  
54
  Finally, it is worth reading the documentation.
55

  
56
-->
57

  
58
<module name="Checker">
59
    <!--
60
        If you set the basedir property below, then all reported file
61
        names will be relative to the specified directory. See
62
        http://checkstyle.sourceforge.net/5.x/config.html#Checker
63

  
64
        <property name="basedir" value="${basedir}"/>
65
    -->
66
    <!-- gvSIG: All project files have the ISO-8859-1 charset -->
67
	<property name="charset" value="ISO-8859-1" />
68

  
69
    <!-- Checks that a package-info.java file exists for each package.     -->
70
    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
71
	<module name="JavadocPackage">
72
		<property name="allowLegacy" value="true" />
73
	</module>
74

  
75
    <!-- Checks whether files end with a new line.                        -->
76
    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
77
    <module name="NewlineAtEndOfFile"/>
78

  
79
    <!-- Checks that property files contain the same keys.         -->
80
    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
81
    <module name="Translation"/>
82
    
83
    <!-- Checks for Size Violations.                    -->
84
    <!-- See http://checkstyle.sf.net/config_sizes.html -->
85
    <module name="FileLength"/>
86
    
87
    <!-- Checks for whitespace                               -->
88
    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
89
    <module name="FileTabCharacter"/>
90

  
91

  
92
    <module name="TreeWalker">
93

  
94
	    <!-- Miscellaneous other checks.                   -->
95
	    <!-- See http://checkstyle.sf.net/config_misc.html -->
96
	    <!-- gvSIG: apply only to java files -->
97
	    <module name="RegexpSinglelineJava">
98
	       <property name="format" value="\s+$"/>
99
	       <property name="minimum" value="0"/>
100
	       <property name="maximum" value="0"/>
101
	       <property name="message" value="Line has trailing spaces."/>
102
	       <property name="ignoreComments" value="true"/>
103
	    </module>
104
	    
105
        <!-- Checks for Javadoc comments.                     -->
106
        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
107
		<!--
108
			gvSIG rule 3: All protected or public classes must have a Javadoc comments,
109
			except getters and setters
110
		-->
111
		<module name="JavadocMethod">
112
			<property name="scope" value="protected" />
113
			<property name="allowMissingPropertyJavadoc" value="true" />
114
		</module>
115
		<!--
116
			gvSIG rule 9: All classes must have a Javadoc comment
117
			with the "@author tag" and the "@version $Id$" tag included 
118
		-->
119
		<module name="JavadocType">
120
			<property name="scope" value="private" />
121
			<property name="authorFormat" value="\S" />
122
			<property name="versionFormat" value="\$Id.*\$"/>
123
		</module>
124
        <module name="JavadocVariable">
125
			<property name="scope" value="protected" />
126
		</module>
127
		<!-- gvSIG rule 3: Check correctly formatted Javadoc -->
128
		<module name="JavadocStyle">
129
			<property name="scope" value="protected" />
130
		</module>
131

  
132

  
133
        <!-- Checks for Naming Conventions.                  -->
134
        <!-- See http://checkstyle.sf.net/config_naming.html -->
135
        <module name="ConstantName"/>
136
        <module name="LocalFinalVariableName"/>
137
        <module name="LocalVariableName"/>
138
        <module name="MemberName"/>
139
        <module name="MethodName"/>
140
		<!-- gvSIG rule 15: All packages must begin with org.gvsig.  -->
141
		<module name="PackageName">
142
			<property name="format" value="^org\.gvsig(\.[a-z][a-z0-9]*)+$" />
143
		</module>
144
		<!-- gvSIG advised rule 1: Abstract class names must begin with Abstract. -->
145
		<!-- module name="AbstractClassName" /-->
146
        <module name="ParameterName"/>
147
        <module name="StaticVariableName"/>
148
        <module name="TypeName"/>
149

  
150
        <!-- Checks for imports                              -->
151
        <!-- See http://checkstyle.sf.net/config_import.html -->
152
        <module name="AvoidStarImport"/>
153
        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
154
        <module name="RedundantImport"/>
155
        <module name="UnusedImports"/>
156

  
157

  
158
        <!-- Checks for Size Violations.                    -->
159
        <!-- See http://checkstyle.sf.net/config_sizes.html -->
160
        <module name="LineLength"/>
161
        <module name="MethodLength"/>
162
        <module name="ParameterNumber"/>
163

  
164

  
165
        <!-- Checks for whitespace                               -->
166
        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
167
        <module name="EmptyForIteratorPad"/>
168
        <module name="GenericWhitespace"/>
169
        <module name="MethodParamPad"/>
170
        <module name="NoWhitespaceAfter"/>
171
        <module name="NoWhitespaceBefore"/>
172
        <module name="OperatorWrap"/>
173
        <module name="ParenPad"/>
174
        <module name="TypecastParenPad"/>
175
        <module name="WhitespaceAfter"/>
176
        <module name="WhitespaceAround"/>
177

  
178

  
179
        <!-- Modifier Checks                                    -->
180
        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
181
        <module name="ModifierOrder"/>
182
        <module name="RedundantModifier"/>
183

  
184

  
185
        <!-- Checks for blocks. You know, those {}'s         -->
186
        <!-- See http://checkstyle.sf.net/config_blocks.html -->
187
        <module name="AvoidNestedBlocks"/>
188
        <module name="EmptyBlock"/>
189
        <module name="LeftCurly"/>
190
        <module name="NeedBraces"/>
191
        <module name="RightCurly"/>
192

  
193

  
194
        <!-- Checks for common coding problems               -->
195
        <!-- See http://checkstyle.sf.net/config_coding.html -->
196
        <module name="AvoidInlineConditionals"/>
197
        <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
198
        <module name="EmptyStatement"/>
199
        <module name="EqualsHashCode"/>
200
        <module name="HiddenField"/>
201
        <module name="IllegalInstantiation"/>
202
        <module name="InnerAssignment"/>
203
        <module name="MagicNumber"/>
204
        <module name="MissingSwitchDefault"/>
205
        <module name="RedundantThrows"/>
206
        <module name="SimplifyBooleanExpression"/>
207
        <module name="SimplifyBooleanReturn"/>
208

  
209
		<!-- gvSIG: Check for some common programming errors -->
210
		<module name="CovariantEquals" />
211
		<module name="StringLiteralEquality" />
212

  
213
        <!-- Checks for class design                         -->
214
        <!-- See http://checkstyle.sf.net/config_design.html -->
215
        <module name="DesignForExtension"/>
216
        <module name="FinalClass"/>
217
        <module name="HideUtilityClassConstructor"/>
218
        <module name="InterfaceIsType"/>
219
        <module name="VisibilityModifier"/>
220

  
221

  
222
        <!-- Miscellaneous other checks.                   -->
223
        <!-- See http://checkstyle.sf.net/config_misc.html -->
224
        <module name="ArrayTypeStyle"/>
225
        <!-- gvSIG: removed -->
226
        <!-- module name="FinalParameters"/-->
227
        <module name="TodoComment"/>
228
        <module name="UpperEll"/>
229
				
230
	    <!-- gvSIG rule 2: Sun style with 4 spaces -->
231
	    <module name="Indentation">
232
	    	<property name="basicOffset" value="4"/>
233
		    <property name="caseIndent" value="0"/>
234
		</module>
235
        
236
        <!-- gvSIG rule 10: Do not use System.out/err to log -->
237
		<module name="Regexp">
238
		    <!-- . matches any character, so we need to escape it and use \. 
239
		    to match dots.-->
240
		    <property name="format" value="System\.[out|err]\.println"/>
241
		    <property name="illegalPattern" value="true"/>
242
		</module>
243
		
244
		<!-- gvSIG rule 11: Try to avoid catching Throwable or 
245
		Exception and catch specific exceptions instead. -->
246
		<module name="IllegalCatch"/>
247
		
248
		<!-- gvSIG rule 13: Use interfaces in the declaration of 
249
		methods and variables.
250
        By default only avoids usage of Classes:
251
			"java.util.GregorianCalendar, java.util.Hashtable, 
252
		  	java.util.HashSet, java.util.HashMap, java.util.ArrayList, 
253
		  	java.util.LinkedList, java.util.LinkedHashMap, 
254
		  	java.util.LinkedHashSet, java.util.TreeSet, 
255
		  	java.util.TreeMap, java.util.Vector" -->
256
		<module name="IllegalType">
257
		    <property name="ignoredMethodNames" value="getInstance"/>
258
		</module>
259
		
260
    </module>
261

  
262
	<!--  gvSIG rule 1: check for the gvSIG header -->
263
    <!-- Uneeded, use the maven-license-plugin instead
264
	<module name="RegexpHeader"> -->
265
		<!-- The follow property value demonstrates the ability     -->
266
		<!-- to have access to ANT properties. In this case it uses -->
267
		<!-- the ${basedir} property to allow Checkstyle to be run  -->
268
		<!-- from any directory within a project. See property      -->
269
		<!-- expansion,                                             -->
270
		<!-- http://checkstyle.sf.net/config.html#properties        -->
271
    <!--
272
		<property name="headerFile" value="${checkstyle.header.file}" />
273
	</module>
274
    -->
275

  
276
</module>
0 277

  
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.buildtools/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<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">
3
  <modelVersion>4.0.0</modelVersion>
4
  <groupId>org.gvsig</groupId>
5
  <artifactId>org.gvsig.desktop.buildtools</artifactId>
6
  <version>1.0.0</version>
7
  <packaging>jar</packaging>
8
  <name>${project.artifactId}</name>
9
  <description>Resources used for build gvsig desktop</description>
10

  
11

  
12
<!-- No puede ser hijo de org.gvsig.desktop para evitar referencas circulares -->
13
<!--
14
  <parent>
15
    <groupId>org.gvsig</groupId>
16
    <artifactId>org.gvsig.desktop</artifactId>
17
    <version>2.0.327-SNAPSHOT</version>
18
   </parent>  
19
-->
20

  
21

  
22
    <licenses>
23
        <license>
24
            <name>GPLv3</name>
25
            <url>http://www.gnu.org/licenses/gpl.html</url>
26
            <distribution>repo</distribution>
27
            <comments>
28
			"GPL" stands for "General Public License". The most widespread such
29
			license is the GNU General Public License, or GNU GPL for short.
30
			This can be further shortened to "GPL", when it is understood that
31
			the GNU GPL is the one intended.
32
	      	</comments>
33
        </license>
34
    </licenses>
35

  
36
    <organization>
37
        <name>gvSIG Association</name>
38
        <url>http://www.gvsig.com/</url>
39
    </organization>
40

  
41
    <scm>
42
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/trunk</connection>
43
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/trunk</developerConnection>
44
        <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/trunk</url>
45
    </scm>
46
    
47
    <repositories>
48
      <repository>
49
        <id>gvsig-public-http-repository</id>
50
        <name>gvSIG maven public HTTP repository</name>
51
        <url>http://devel.gvsig.org/m2repo/j2se</url>
52
        <releases>
53
          <enabled>true</enabled>
54
          <updatePolicy>daily</updatePolicy>
55
          <checksumPolicy>warn</checksumPolicy>
56
        </releases>
57
        <snapshots>
58
          <enabled>true</enabled>
59
          <updatePolicy>daily</updatePolicy>
60
          <checksumPolicy>warn</checksumPolicy>
61
        </snapshots>
62
      </repository>
63
    </repositories>
64

  
65
    <distributionManagement>
66
      <site>
67
        <id>gvsig-repository</id>
68
        <url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url>
69
      </site>
70
      <repository>
71
          <id>gvsig-repository</id>
72
          <name>gvSIG maven repository</name>
73
          <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
74
          <uniqueVersion>false</uniqueVersion>
75
      </repository>
76
      <snapshotRepository>
77
          <id>gvsig-repository</id>
78
          <name>gvSIG maven repository</name>
79
          <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
80
          <uniqueVersion>false</uniqueVersion>
81
      </snapshotRepository>
82
    </distributionManagement>
83
    
84
    <issueManagement>
85
      <system>redmine</system>
86
      <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop</url>
87
    </issueManagement>
88

  
89
    <mailingLists>
90
      <mailingList>
91
        <name>User List</name>
92
        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</subscribe>
93
        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</unsubscribe>
94
        <post>gvsig_usuarios@listserv.gva.es</post>
95
        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
96
        <otherArchives>
97
          <otherArchive>http://www.mail-archive.com/gvsig_usuarios@runas.cap.gva.es</otherArchive>
98
          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
99
        </otherArchives>
100
      </mailingList>
101
      <mailingList>
102
        <name>Developer List</name>
103
        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</subscribe>
104
        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</unsubscribe>
105
        <post>gvsig_desarrolladores@listserv.gva.es</post>
106
        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
107
        <otherArchives>
108
          <otherArchive>http://www.mail-archive.com/gvsig_desarrolladores@runas.cap.gva.es</otherArchive>
109
          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
110
        </otherArchives>
111
      </mailingList>
112
      <mailingList>
113
        <name>International List</name>
114
        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</subscribe>
115
        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</unsubscribe>
116
        <post>gvsig_internacional@listserv.gva.es</post>
117
        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
118
        <otherArchives>
119
          <otherArchive>http://www.mail-archive.com/gvsig_internacional@runas.cap.gva.es</otherArchive>
120
          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
121
        </otherArchives>
122
      </mailingList>
123
    </mailingLists>
124
    
125
    <build>
126
        <extensions>
127
            <extension>
128
                <groupId>org.apache.maven.wagon</groupId>
129
                <artifactId>wagon-webdav-jackrabbit</artifactId>
130
                <version>1.0-beta-7</version>
131
            </extension>
132
        </extensions>
133
    </build>
134

  
135
</project>
0 136

  
tags/org.gvsig.desktop-2.0.416/license.txt
1
gvSIG. Desktop Geographic Information System.
2

  
3
Copyright (C) 2007-2020 gvSIG Association.
4

  
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 3
8
of the License, or (at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

  
15
 You should have received a copy of the GNU General Public License 
16
along with this program. If not, see <https://www.gnu.org/licenses/>. 
17

  
18
For any additional information, do not hesitate to contact us
19
at info AT gvsig.com, or visit our website www.gvsig.com.
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.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.raster.legend</artifactId>
6
        <version>2.0.416</version>
7
      </parent>
8
    <artifactId>org.gvsig.raster.legend.swing</artifactId>
9
    <packaging>pom</packaging>
10
    <modules>
11
        <module> org.gvsig.raster.legend.swing.api </module>
12
        <module> org.gvsig.raster.legend.swing.impl </module>
13
    </modules>
14
</project>
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.raster.swing.legend.RasterSwingLegendLibrary
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/RasterSwingLegendLocator.java
1
package org.gvsig.raster.swing.legend;
2
/* gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2017 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 2
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

  
25

  
26
import org.gvsig.tools.locator.BaseLocator;
27

  
28
/**
29
 * This locator is the entry point for the raster buffer swing library,
30
 *
31
 * @author gvSIG team
32
 * @version $Id$
33
 */
34
public class RasterSwingLegendLocator extends BaseLocator {
35

  
36
    /**
37
     * Chart swing manager name.
38
     */
39
    public static final String SWING_MANAGER_NAME =
40
        "Raster.swing.legend.manager";
41

  
42
    /**
43
     * Chart swing manager description.
44
     */
45
    public static final String SWING_MANAGER_DESCRIPTION =
46
        "UIManager of Raster legend library";
47

  
48
    private static final String LOCATOR_NAME = "Raster.swing.legend.locator";
49

  
50
    /**
51
     * Unique instance.
52
     */
53
    private static final RasterSwingLegendLocator INSTANCE =
54
        new RasterSwingLegendLocator();
55

  
56
    /**
57
     * Return the singleton instance.
58
     *
59
     * @return the singleton instance
60
     */
61
    public static RasterSwingLegendLocator getInstance() {
62
        return INSTANCE;
63
    }
64

  
65
    /**
66
     * Return the Locator's name
67
     *
68
     * @return a String with the Locator's name
69
     */
70
    public final String getLocatorName() {
71
        return LOCATOR_NAME;
72
    }
73

  
74
    /**
75
     * Registers the Class implementing the PersistenceManager interface.
76
     *
77
     * @param clazz
78
     *            implementing the PersistenceManager interface
79
     */
80
    public static void registerSwingManager(
81
        Class<? extends RasterSwingLegendManager> clazz) {
82
        getInstance().register(SWING_MANAGER_NAME, SWING_MANAGER_DESCRIPTION,
83
            clazz);
84
    }
85

  
86
    /**
87
     * Gets the instance of the {@link ScriptingUIManager} registered.
88
     *
89
     * @return {@link ScriptingUIManager}
90
     */
91
    public static RasterSwingLegendManager getSwingManager() {
92
        return (RasterSwingLegendManager) getInstance()
93
            .get(SWING_MANAGER_NAME);
94
    }
95

  
96
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/RasterSwingLegendLibrary.java
1
package org.gvsig.raster.swing.legend;
2

  
3
import org.gvsig.tools.library.AbstractLibrary;
4
/* gvSIG. Desktop Geographic Information System.
5
 *
6
 * Copyright ? 2007-2017 gvSIG Association
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
 * MA  02110-1301, USA.
22
 *
23
 * For any additional information, do not hesitate to contact us
24
 * at info AT gvsig.com, or visit our website www.gvsig.com.
25
 */
26
import org.gvsig.tools.library.LibraryException;
27
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
28

  
29

  
30

  
31

  
32
/**
33
 * @author fdiaz
34
 *
35
 */
36
public class RasterSwingLegendLibrary extends AbstractLibrary{
37

  
38
    @Override
39
    public void doRegistration() {
40
        registerAsAPI(RasterSwingLegendLibrary.class);
41
//        this.require(RasterLibrary.class);
42
//        this.require(BufferLibrary.class);
43
    }
44

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

  
49
    @Override
50
    protected void doPostInitialize() throws LibraryException {
51
        // Validate there is any implementation registered.
52
        RasterSwingLegendManager manager =
53
            RasterSwingLegendLocator.getSwingManager();
54
        if (manager == null) {
55
            throw new ReferenceNotRegisteredException(
56
                RasterSwingLegendLocator.SWING_MANAGER_NAME,
57
                RasterSwingLegendLocator.getInstance());
58
        }
59
    }
60

  
61

  
62
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/RasterSwingLegendManager.java
1
package org.gvsig.raster.swing.legend;
2
/* gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2017 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 2
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

  
25

  
26
import org.gvsig.raster.swing.legend.colortable.create.CreateColorTablePanel;
27
import org.gvsig.raster.swing.legend.colortable.editor.ColorTableEditorPanel;
28
import org.gvsig.raster.swing.legend.colortable.selector.ColorTableSelectorPanel;
29
import org.gvsig.tools.service.Manager;
30

  
31

  
32
/**
33
 *
34
 * @see RasterSwingLegendManager
35
 * @author gvSIG team
36
 * @version $Id$
37
 */
38
public interface RasterSwingLegendManager extends Manager{
39

  
40
    /**
41
     * @return
42
     */
43
    ColorTableSelectorPanel createColorTableSelectorPanel();
44

  
45
    /**
46
     * @return
47
     */
48
    ColorTableEditorPanel createColorTableEditorPanel();
49

  
50
    /**
51
     * @return
52
     */
53
    CreateColorTablePanel createCreateColorTablePanel();
54

  
55

  
56
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/colortable/selector/ColorTablesTableModel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.swing.legend.colortable.selector;
24

  
25
import java.io.File;
26
import java.util.List;
27

  
28
import javax.swing.table.TableModel;
29

  
30
import org.apache.commons.lang3.tuple.Pair;
31

  
32
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
33

  
34

  
35
/**
36
 * @author fdiaz
37
 *
38
 */
39
public interface ColorTablesTableModel extends TableModel {
40

  
41
    /**
42
     * @param colorTable
43
     */
44
    public void addColorTable(Pair<File,ColorTable> colorTable);
45

  
46
    /**
47
     * @param index
48
     */
49
    public void removeColorTable(int index);
50

  
51
    /**
52
     * @param index
53
     * @return
54
     */
55
    public Pair<File, ColorTable> getColorTable(int index);
56

  
57
    /**
58
     * @param selectedRow
59
     * @param colorTableEdited
60
     */
61
    public void setColorTable(int index, ColorTable colorTableEdited);
62

  
63
    List<Pair<File, ColorTable>> getColorTables();
64

  
65
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/colortable/selector/ColorTableSelectorPanel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.swing.legend.colortable.selector;
24

  
25
import java.awt.event.ActionListener;
26
import java.io.File;
27
import java.util.List;
28

  
29
import javax.swing.event.ListSelectionListener;
30

  
31
import org.apache.commons.lang3.tuple.Pair;
32

  
33
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
34
import org.gvsig.tools.swing.api.Component;
35

  
36

  
37
/**
38
 * @author fdiaz
39
 *
40
 */
41
public interface ColorTableSelectorPanel extends Component {
42

  
43
    /**
44
     * @author fdiaz
45
     *
46
     */
47
    public enum Modification {
48
        NONE,
49
        ADDED,
50
        MODIFIED,
51
        REMOVED
52
    }
53

  
54
    /**
55
     * @return
56
     */
57
    public ColorTable getSelected();
58

  
59
    /**
60
     * Selects the ColorTable at position i
61
     *
62
     * @param i
63
     */
64
    public void select(int i);
65

  
66
    /**
67
     * @param colorTables
68
     */
69
    public void set(List<Pair<File,ColorTable>> colorTables);
70

  
71
    public List<Pair<File,ColorTable>> getModifiedColorTables();
72

  
73
    public List<Pair<File,ColorTable>> getRemovedColorTables();
74

  
75
    public List<ColorTable> getAddedColorTables();
76

  
77
    public void setEditable(boolean editable);
78

  
79
    /**
80
     * @param listener
81
     */
82
    public void addListSelectionListener(ListSelectionListener listener);
83

  
84
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/colortable/create/CreateColorTablePanel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.swing.legend.colortable.create;
24

  
25
import java.awt.Color;
26

  
27
import org.gvsig.raster.lib.legend.api.colortable.MakeColorTable;
28
import org.gvsig.tools.swing.api.Component;
29

  
30

  
31
/**
32
 * @author fdiaz
33
 *
34
 */
35
public interface CreateColorTablePanel extends Component {
36

  
37
    /**
38
     * @param colorTable
39
     */
40
    public void fetch(MakeColorTable makeColorTable);
41

  
42
    /**
43
     * @param name
44
     */
45
    public void setName(String name);
46

  
47
    /**
48
     * @param minimum
49
     */
50
    public void setMinimum(double minimum);
51

  
52
    /**
53
     * @param maximum
54
     */
55
    public void setMaximum(double maximum);
56

  
57
    /**
58
     * @param mode
59
     */
60
    public void setMode(int mode);
61

  
62
    /**
63
     * @param intervals
64
     */
65
    public void setIntervals(int intervals);
66

  
67
    /**
68
     * @param intervalSize
69
     */
70
    public void setIntervalSize(double intervalSize);
71

  
72
    /**
73
     * @param fromColor
74
     */
75
    public void setFromColor(Color fromColor);
76

  
77
    /**
78
     * @param toColor
79
     */
80
    public void setToColor(Color toColor);
81

  
82

  
83

  
84
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/colortable/editor/ColorTableClassesTableModel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.swing.legend.colortable.editor;
24

  
25
import javax.swing.table.TableModel;
26

  
27
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
28
import org.gvsig.raster.lib.legend.api.colortable.colortableclass.ColorTableClass;
29

  
30

  
31
/**
32
 * @author fdiaz
33
 *
34
 */
35
public interface ColorTableClassesTableModel extends TableModel {
36

  
37
    /**
38
     * @param colorTable
39
     */
40
    public void addColorTableClass(ColorTableClass colorTableClass);
41

  
42
    /**
43
     * @param index
44
     */
45
    public void removeColorTableClass(int index);
46

  
47
    /**
48
     * @param index
49
     * @return
50
     */
51
    public ColorTableClass getColorTableClass(int index);
52

  
53
    /**
54
     *
55
     */
56
    public void removeAllColorTableClasses();
57

  
58
    public void setColorTable(ColorTable colorTable);
59

  
60
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.api/src/main/java/org/gvsig/raster/swing/legend/colortable/editor/ColorTableEditorPanel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.swing.legend.colortable.editor;
24

  
25
import java.awt.event.ItemListener;
26

  
27
import javax.swing.event.ChangeListener;
28
import javax.swing.event.TableModelListener;
29

  
30
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
31
import org.gvsig.raster.lib.legend.api.colortable.colortableclass.ColorTableClass;
32
import org.gvsig.tools.swing.api.Component;
33

  
34

  
35
/**
36
 * @author fdiaz
37
 *
38
 */
39
public interface ColorTableEditorPanel extends Component {
40

  
41
    /**
42
     * @param colorTable
43
     */
44
    public void set(ColorTable colorTable);
45

  
46
    public ColorTableClass getSelected();
47

  
48
    public ColorTable getColorTable();
49

  
50
    public boolean isModified();
51

  
52
    void addTableModelListener(TableModelListener listener);
53

  
54
    void removeTableModelListener(TableModelListener listener);
55

  
56
    void addChkInterpolatedItemListener(ItemListener listener);
57

  
58

  
59
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.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.raster.legend.swing</artifactId>
6
        <version>2.0.416</version>
7
      </parent>
8
    <artifactId>org.gvsig.raster.legend.swing.api</artifactId>
9
    <name>${project.artifactId}</name>
10
    <dependencies>
11
        <dependency>
12
            <groupId>org.gvsig</groupId>
13
            <artifactId>org.gvsig.tools.swing.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.mapcontext.api</artifactId>
24
            <scope>compile</scope>
25
        </dependency>
26
    </dependencies>
27
</project>
0 28

  
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.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.raster.legend.swing</artifactId>
6
        <version>2.0.416</version>
7
      </parent>
8
    <artifactId>org.gvsig.raster.legend.swing.impl</artifactId>
9
    <name>${project.artifactId}</name>
10
    <dependencies>
11
        <dependency>
12
            <groupId>org.gvsig</groupId>
13
            <artifactId>org.gvsig.raster.legend.swing.api</artifactId>
14
        </dependency>
15
        <dependency>
16
            <groupId>com.jgoodies</groupId>
17
            <artifactId>jgoodies-forms</artifactId>
18
        </dependency>
19
        <dependency>
20
            <groupId>com.jeta</groupId>
21
            <artifactId>formsrt</artifactId>
22
            <scope>compile</scope>
23
        </dependency>
24

  
25
        <dependency>
26
            <groupId>org.gvsig</groupId>
27
            <artifactId>org.gvsig.tools.lib</artifactId>
28
        </dependency>
29
    </dependencies>
30
</project>
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.raster.swing.legend.impl.DefaultRasterSwingLegendLibrary
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.impl/src/main/java/org/gvsig/raster/swing/legend/impl/colortable/selector/ColorTableSelectorPanelView.java
1
package org.gvsig.raster.swing.legend.impl.colortable.selector;
2

  
3
import com.jeta.open.i18n.I18NUtils;
4
import com.jgoodies.forms.layout.CellConstraints;
5
import com.jgoodies.forms.layout.FormLayout;
6
import java.awt.BorderLayout;
7
import java.awt.ComponentOrientation;
8
import java.awt.Container;
9
import java.awt.Dimension;
10
import javax.swing.Box;
11
import javax.swing.ImageIcon;
12
import javax.swing.JButton;
13
import javax.swing.JFrame;
14
import javax.swing.JPanel;
15
import javax.swing.JScrollPane;
16
import javax.swing.JTable;
17

  
18

  
19
public class ColorTableSelectorPanelView extends JPanel
20
{
21
   JTable tblColorTables = new JTable();
22
   JButton btnImport = new JButton();
23
   JButton btnNew = new JButton();
24
   JButton btnExport = new JButton();
25
   JButton btnRemove = new JButton();
26
   JButton btnEdit = new JButton();
27

  
28
   /**
29
    * Default constructor
30
    */
31
   public ColorTableSelectorPanelView()
32
   {
33
      initializePanel();
34
   }
35

  
36
   /**
37
    * Adds fill components to empty cells in the first row and first column of the grid.
38
    * This ensures that the grid spacing will be the same as shown in the designer.
39
    * @param cols an array of column indices in the first row where fill components should be added.
40
    * @param rows an array of row indices in the first column where fill components should be added.
41
    */
42
   void addFillComponents( Container panel, int[] cols, int[] rows )
43
   {
44
      Dimension filler = new Dimension(10,10);
45

  
46
      boolean filled_cell_11 = false;
47
      CellConstraints cc = new CellConstraints();
48
      if ( cols.length > 0 && rows.length > 0 )
49
      {
50
         if ( cols[0] == 1 && rows[0] == 1 )
51
         {
52
            /** add a rigid area  */
53
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
54
            filled_cell_11 = true;
55
         }
56
      }
57

  
58
      for( int index = 0; index < cols.length; index++ )
59
      {
60
         if ( cols[index] == 1 && filled_cell_11 )
61
         {
62
            continue;
63
         }
64
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
65
      }
66

  
67
      for( int index = 0; index < rows.length; index++ )
68
      {
69
         if ( rows[index] == 1 && filled_cell_11 )
70
         {
71
            continue;
72
         }
73
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
74
      }
75

  
76
   }
77

  
78
   /**
79
    * Helper method to load an image file from the CLASSPATH
80
    * @param imageName the package and name of the file to load relative to the CLASSPATH
81
    * @return an ImageIcon instance with the specified image file
82
    * @throws IllegalArgumentException if the image resource cannot be loaded.
83
    */
84
   public ImageIcon loadImage( String imageName )
85
   {
86
      try
87
      {
88
         ClassLoader classloader = getClass().getClassLoader();
89
         java.net.URL url = classloader.getResource( imageName );
90
         if ( url != null )
91
         {
92
            ImageIcon icon = new ImageIcon( url );
93
            return icon;
94
         }
95
      }
96
      catch( Exception e )
97
      {
98
         e.printStackTrace();
99
      }
100
      throw new IllegalArgumentException( "Unable to load image: " + imageName );
101
   }
102

  
103
   /**
104
    * Method for recalculating the component orientation for 
105
    * right-to-left Locales.
106
    * @param orientation the component orientation to be applied
107
    */
108
   public void applyComponentOrientation( ComponentOrientation orientation )
109
   {
110
      // Not yet implemented...
111
      // I18NUtils.applyComponentOrientation(this, orientation);
112
      super.applyComponentOrientation(orientation);
113
   }
114

  
115
   public JPanel createPanel()
116
   {
117
      JPanel jpanel1 = new JPanel();
118
      FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
119
      CellConstraints cc = new CellConstraints();
120
      jpanel1.setLayout(formlayout1);
121

  
122
      tblColorTables.setName("tblColorTables");
123
      JScrollPane jscrollpane1 = new JScrollPane();
124
      jscrollpane1.setViewportView(tblColorTables);
125
      jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
126
      jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
127
      jpanel1.add(jscrollpane1,new CellConstraints(2,2,10,1,CellConstraints.FILL,CellConstraints.FILL));
128

  
129
      btnImport.setActionCommand("JButton");
130
      btnImport.setName("btnImport");
131
      btnImport.setToolTipText("_import");
132
      jpanel1.add(btnImport,cc.xy(9,4));
133

  
134
      btnNew.setActionCommand("JButton");
135
      btnNew.setName("btnNew");
136
      btnNew.setToolTipText("_new_color_table");
137
      jpanel1.add(btnNew,cc.xy(3,4));
138

  
139
      btnExport.setActionCommand("JButton");
140
      btnExport.setName("btnExport");
141
      btnExport.setToolTipText("_export");
142
      jpanel1.add(btnExport,cc.xy(11,4));
143

  
144
      btnRemove.setActionCommand("JButton");
145
      btnRemove.setName("btnRemove");
146
      btnRemove.setToolTipText("_remove");
147
      jpanel1.add(btnRemove,cc.xy(7,4));
148

  
149
      btnEdit.setName("btnEdit");
150
      btnEdit.setToolTipText("_edit");
151
      jpanel1.add(btnEdit,cc.xy(5,4));
152

  
153
      addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12 },new int[]{ 1,2,3,4,5 });
154
      return jpanel1;
155
   }
156

  
157
   /**
158
    * Initializer
159
    */
160
   protected void initializePanel()
161
   {
162
      setLayout(new BorderLayout());
163
      add(createPanel(), BorderLayout.CENTER);
164
   }
165

  
166

  
167
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.impl/src/main/java/org/gvsig/raster/swing/legend/impl/colortable/selector/PreviewerColorTableCellRenderer.java
1
package org.gvsig.raster.swing.legend.impl.colortable.selector;
2

  
3
import java.awt.Color;
4
import java.awt.Component;
5
import java.awt.Graphics2D;
6
import java.awt.Rectangle;
7
import java.awt.image.BufferedImage;
8

  
9
import javax.swing.ImageIcon;
10
import javax.swing.JComponent;
11
import javax.swing.JLabel;
12
import javax.swing.JPanel;
13
import javax.swing.JTable;
14
import javax.swing.table.TableCellRenderer;
15

  
16
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
17

  
18

  
19
/**
20
 * @author fdiaz
21
 *
22
 */
23
public class PreviewerColorTableCellRenderer extends JLabel implements TableCellRenderer {
24

  
25
    /**
26
     *
27
     */
28
    private static final long serialVersionUID = 9027225839371919399L;
29
    private ColorTable colorTable;
30

  
31
    @Override
32
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
33
        int row, int column) {
34
        if (value instanceof ColorTable) {
35
            this.colorTable = (ColorTable)value;
36
            Rectangle cellRect = table.getCellRect(row, column, false);
37
            BufferedImage image = new BufferedImage((int)cellRect.getWidth(), (int)cellRect.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
38
            this.paintImage(image, isSelected);
39
            ImageIcon icon = new ImageIcon(image, this.colorTable.getName());
40
            this.setIcon(icon);
41
        }
42
        return this;
43
    }
44

  
45
    private void paintImage(BufferedImage image, boolean isSelected) {
46
        Graphics2D g = (Graphics2D)image.getGraphics();
47

  
48
        Rectangle area = new Rectangle(image.getWidth(), image.getHeight());
49

  
50
        int x1 = area.x;
51
        int x2 = area.x + area.width - 1;
52

  
53
        Color bgColor = new Color(224, 224, 224);
54
        for (int i = 0; (i * 4) <= area.width; i++) {
55
            for (int j = 0; (j * 4) <= area.height; j++) {
56
                if ((i + j) % 2 == 0)
57
                    g.setColor(Color.white);
58
                else
59
                    g.setColor(bgColor);
60
                g.fillRect(area.x + 1 + i * 4, area.y + 1 + j * 4, 4, 4);
61
            }
62
        }
63

  
64
        if (colorTable.getClasses().size() >= 1) {
65
            double min = colorTable.getClasses().get(0).getValue();
66
            double max = colorTable.getClasses().get(colorTable.getClasses().size() - 1).getValue();
67
            for (int i = area.x; i < (area.x + area.width); i++) {
68
                double pos = min + (((max - min) * (i - area.x)) / (area.width - 2));
69

  
70
                byte[] col3 = colorTable.getRGBA(pos);
71
                g.setColor(new Color(col3[0] & 0xff, col3[1] & 0xff, col3[2] & 0xff, col3[3] & 0xff));
72
                g.drawLine(i, area.y, i, area.y + area.height);
73
            }
74
        } else {
75
            g.setColor(new Color(224, 224, 224));
76
            g.fillRect(x1, area.y, x2 - x1, area.height); // - 1);
77
        }
78
        if (isSelected) { //?????
79
            g.setColor(Color.black);
80
        } else {
81
            g.setColor(new Color(96, 96, 96));
82
        }
83
        g.drawRect(x1, area.y, x2 - x1, area.height - 1);
84
    }
85

  
86
}
tags/org.gvsig.desktop-2.0.416/org.gvsig.desktop.library/org.gvsig.raster.legend/org.gvsig.raster.legend.swing/org.gvsig.raster.legend.swing.impl/src/main/java/org/gvsig/raster/swing/legend/impl/colortable/selector/DefaultColorTablesTableModel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff