Revision 45597

View differences:

tags/org.gvsig.desktop-2.0.320/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.320/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.320/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.10-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.320/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.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.mapcontext.raster.swing.MapContextRasterSwingLibrary
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/previewer/OneLayerPreviewer.java
1
package org.gvsig.fmap.mapcontext.raster.swing.previewer;
2

  
3
import org.cresques.cts.IProjection;
4

  
5
import org.gvsig.fmap.mapcontext.layers.FLayer;
6
import org.gvsig.tools.dispose.Disposable;
7
import org.gvsig.tools.swing.api.Component;
8

  
9

  
10
/**
11
 * @author fdiaz
12
 *
13
 */
14
public interface OneLayerPreviewer extends Component, Disposable {
15

  
16
    /**
17
     * @param projection
18
     */
19
    public void setProjection(IProjection projection);
20

  
21
    /**
22
     * @param layer
23
     */
24
    public void setLayer(FLayer layer);
25

  
26
    /**
27
     * @return
28
     */
29
    public FLayer getLayer();
30

  
31
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/transparency/TransparencyPanel.java
1
package org.gvsig.fmap.mapcontext.raster.swing.transparency;
2

  
3
import java.awt.Color;
4

  
5
import org.gvsig.fmap.mapcontext.layers.FLayer;
6
import org.gvsig.tools.swing.api.Component;
7

  
8

  
9

  
10
/**
11
 * @author fdiaz
12
 *
13
 */
14
public interface TransparencyPanel extends Component {
15

  
16
    /**
17
     * Fetch the layer with the panel's values.
18
     *
19
     * @param layer
20
     * @return
21
     */
22
    public boolean fetch(FLayer layer);
23

  
24
    /**
25
     * Sets the layer
26
     *
27
     * @param layer
28
     */
29
    public void set(FLayer layer);
30

  
31
    /**
32
     * Sets the color.
33
     * @param color
34
     */
35
    public void setColor(Color color);
36

  
37
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/MapContextRasterSwingLocator.java
1
package org.gvsig.fmap.mapcontext.raster.swing;
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 MapContextRasterSwingLocator extends BaseLocator {
35

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

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

  
48
    private static final String LOCATOR_NAME = "Mapcontext.raster.swing.locator";
49

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

  
56
    /**
57
     * Return the singleton instance.
58
     *
59
     * @return the singleton instance
60
     */
61
    public static MapContextRasterSwingLocator 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 MapContextRasterSwingManager> 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 MapContextRasterSwingManager getSwingManager() {
92
        return (MapContextRasterSwingManager) getInstance()
93
            .get(SWING_MANAGER_NAME);
94
    }
95

  
96
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/MapContextRasterSwingLibrary.java
1
package org.gvsig.fmap.mapcontext.raster.swing;
2

  
3
/* gvSIG. Desktop Geographic Information System.
4
 *
5
 * Copyright ? 2007-2017 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 2
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
import org.gvsig.tools.library.AbstractLibrary;
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 MapContextRasterSwingLibrary extends AbstractLibrary{
37

  
38
    @Override
39
    public void doRegistration() {
40
        registerAsAPI(MapContextRasterSwingLibrary.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
        MapContextRasterSwingManager manager =
53
            MapContextRasterSwingLocator.getSwingManager();
54
        if (manager == null) {
55
            throw new ReferenceNotRegisteredException(
56
                MapContextRasterSwingLocator.SWING_MANAGER_NAME,
57
                MapContextRasterSwingLocator.getInstance());
58
        }
59
    }
60

  
61

  
62
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/export/ExportRasterPanel.java
1
package org.gvsig.fmap.mapcontext.raster.swing.export;
2

  
3
import java.nio.Buffer;
4

  
5
import org.gvsig.tools.swing.api.Component;
6

  
7

  
8
public interface ExportRasterPanel extends Component {
9

  
10
//    /**
11
//     * @param layer
12
//     */
13
//    public boolean fetch(FLayer layer);
14

  
15
    /**
16
     * @param buffer
17
     */
18
    public void set(Buffer buffer);
19

  
20
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/SelectableBandDescriptorsTableModel.java
1
package org.gvsig.fmap.mapcontext.raster.swing;
2

  
3
import org.gvsig.raster.swing.buffer.SelectableBandsTableModel;
4

  
5

  
6
/**
7
 * @author fdiaz
8
 *
9
 */
10
public interface SelectableBandDescriptorsTableModel extends SelectableBandsTableModel {
11

  
12
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/operations/OperationListPanel.java
1
package org.gvsig.fmap.mapcontext.raster.swing.operations;
2

  
3
import java.awt.event.ActionListener;
4

  
5
import javax.swing.event.ListSelectionListener;
6
import javax.swing.event.TableModelListener;
7

  
8
import org.gvsig.raster.lib.buffer.api.operations.OperationFactory;
9
import org.gvsig.raster.lib.buffer.api.operations.OperationList;
10
import org.gvsig.raster.lib.buffer.api.operations.OperationListEntry;
11
import org.gvsig.tools.swing.api.Component;
12

  
13
/**
14
 * @author fdiaz
15
 *
16
 */
17
public interface OperationListPanel extends Component {
18

  
19
    public static String ADD_ACTION_COMMAND = "add_operation_entry";
20
    public static String UPDATE_ACTION_COMMAND = "update_operation_entry";
21
    public static String UP_ACTION_COMMAND = "up_operation_entry";
22
    public static String DOWN_ACTION_COMMAND = "down_operation_entry";
23
    public static String REMOVE_ACTION_COMMAND = "remove_operation_entry";
24

  
25
    /**
26
     * @param operationList
27
     * @return
28
     */
29
    public boolean fetch(OperationList operationList);
30

  
31
    /**
32
     * @param operationList
33
     */
34
    public void set(OperationList operationList);
35

  
36
    /**
37
     * @param layer
38
     * @return
39
     */
40
    public OperationListEntry getSelected();
41

  
42
    /**
43
     * @param listener
44
     */
45
    public void addListSelectionListener(ListSelectionListener listener);
46

  
47
    /**
48
     * @param listener
49
     */
50
    public void addTableModelListener(TableModelListener listener);
51

  
52
    /**
53
     * @param enable
54
     */
55
    public void enableAdd(boolean enable);
56

  
57
    /**
58
     * @param enable
59
     */
60
    public void enableUpdate(boolean enable);
61

  
62
    /**
63
     * @param operationListEntry
64
     */
65
    public void add(OperationListEntry operationListEntry);
66

  
67
    /**
68
     * @param listener
69
     */
70
    void addActionListener(ActionListener listener);
71

  
72
    /**
73
    *
74
    */
75
    public void clearSelection();
76

  
77
    /**
78
     * @param row
79
     */
80
    public void select(int row);
81

  
82
    /**
83
     * @return
84
     */
85
    public int getSelectedRow();
86

  
87
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/operations/OperationSelectorPanel.java
1
package org.gvsig.fmap.mapcontext.raster.swing.operations;
2

  
3
import javax.swing.event.ListSelectionListener;
4

  
5
import org.gvsig.raster.lib.buffer.api.operations.OperationFactory;
6
import org.gvsig.tools.swing.api.Component;
7

  
8

  
9

  
10
/**
11
 * @author fdiaz
12
 *
13
 */
14
public interface OperationSelectorPanel extends Component {
15

  
16
    /**
17
     * @param layer
18
     * @return
19
     */
20
    public OperationFactory getSelected();
21

  
22
    /**
23
     * @param layer
24
     * @return
25
     */
26
    public void clearSelection();
27

  
28
    /**
29
     * @param listener
30
     */
31
    public void addListSelectionListener(ListSelectionListener listener);
32

  
33
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/MapContextRasterSwingManager.java
1
package org.gvsig.fmap.mapcontext.raster.swing;
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 java.util.List;
27

  
28
import org.gvsig.fmap.dal.raster.BandDescriptor;
29
import org.gvsig.fmap.mapcontext.raster.swing.bands.BandsPanel;
30
import org.gvsig.fmap.mapcontext.raster.swing.export.ExportRasterPanel;
31
import org.gvsig.fmap.mapcontext.raster.swing.operations.OperationListPanel;
32
import org.gvsig.fmap.mapcontext.raster.swing.operations.OperationSelectorPanel;
33
import org.gvsig.fmap.mapcontext.raster.swing.previewer.OneLayerPreviewer;
34
import org.gvsig.fmap.mapcontext.raster.swing.transparency.TransparencyPanel;
35
import org.gvsig.tools.service.Manager;
36

  
37

  
38
/**
39
 *
40
 * @see MapContextRasterSwingManager
41
 * @author gvSIG team
42
 * @version $Id$
43
 */
44
public interface MapContextRasterSwingManager extends Manager{
45

  
46
    /**
47
     * @return
48
     */
49
    public SelectableBandDescriptorsTableModel createSelectableBandDescriptorsTableModel(List<BandDescriptor> descriptors) ;
50

  
51
    /**
52
     * @return
53
     */
54
    public TransparencyPanel createTransparencyPanel();
55

  
56
    /**
57
     * @return
58
     */
59
    public BandsPanel createBandsPanel();
60

  
61

  
62
    /**
63
     * @return
64
     */
65
    public ExportRasterPanel createExportRaster();
66

  
67
    /**
68
     * @return
69
     */
70
    public OneLayerPreviewer createOneLayerPreviewer();
71

  
72
    /**
73
     * @return
74
     */
75
    public OperationListPanel createOperationListPanel();
76

  
77
    /**
78
     * @return
79
     */
80
    OperationSelectorPanel createOperationSelectorPanel();
81

  
82
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.api/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/bands/BandsPanel.java
1
package org.gvsig.fmap.mapcontext.raster.swing.bands;
2

  
3
import org.gvsig.tools.dispose.Disposable;
4
import org.gvsig.tools.swing.api.Component;
5
import org.gvsig.fmap.mapcontext.layers.FLayer;
6

  
7

  
8

  
9
/**
10
 * @author fdiaz
11
 *
12
 */
13
public interface BandsPanel extends Component, Disposable {
14

  
15
    /**
16
     * @param layer
17
     * @return
18
     */
19
    public boolean fetch(FLayer layer);
20

  
21
    /**
22
     * @param layer
23
     */
24
    public void set(FLayer layer);
25

  
26
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.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.fmap.mapcontext.swing</artifactId>
6
        <version>2.0.320</version>
7
      </parent>
8
    <artifactId>org.gvsig.fmap.mapcontext.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.raster.lib.buffer.api</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.mapcontext.api</artifactId>
29
            <scope>compile</scope>
30
        </dependency>
31
        <dependency>
32
            <groupId>org.gvsig</groupId>
33
            <artifactId>org.gvsig.raster.swing.buffer.api</artifactId>
34
            <scope>compile</scope>
35
        </dependency>
36
    </dependencies>
37
</project>
0 38

  
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.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.desktop.library</artifactId>
6
        <version>2.0.320</version>
7
      </parent>
8
    <groupId>org.gvsig</groupId>
9
    <artifactId>org.gvsig.fmap.mapcontext.swing</artifactId>
10
    <packaging>pom</packaging>
11
    <name>${project.artifactId}</name>
12
    <modules>
13
        <module>org.gvsig.fmap.mapcontext.swing.api</module>
14
        <module>org.gvsig.fmap.mapcontext.swing.impl</module>
15
    </modules>
16
</project>
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.mapcontext.raster.swing.impl.DefaultMapContextRasterSwingLibrary
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/impl/export/DefaultExportRasterPanel.java
1
package org.gvsig.fmap.mapcontext.raster.swing.impl.export;
2

  
3
import java.io.File;
4
import java.nio.Buffer;
5
import java.util.ArrayList;
6
import java.util.Iterator;
7
import java.util.List;
8

  
9
import javax.swing.JComponent;
10
import javax.swing.JFileChooser;
11

  
12
import org.slf4j.Logger;
13
import org.slf4j.LoggerFactory;
14

  
15
import org.gvsig.fmap.dal.DALLocator;
16
import org.gvsig.fmap.dal.DataManager;
17
import org.gvsig.fmap.dal.DataServerExplorer;
18
import org.gvsig.fmap.dal.raster.NewRasterStoreParameters;
19
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemFileFilter;
20
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
21
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
22
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
23
import org.gvsig.fmap.mapcontext.raster.swing.export.ExportRasterPanel;
24

  
25

  
26
/**
27
 * @author fdiaz
28
 *
29
 */
30
public class DefaultExportRasterPanel implements ExportRasterPanel {
31

  
32
    private static final Logger logger = LoggerFactory.getLogger(DefaultExportRasterPanel.class);
33

  
34
    JFileChooser jfc;
35
    Buffer buffer;
36

  
37
    @Override
38
    public JComponent asJComponent() {
39
        return jfc;
40
    }
41

  
42
    @Override
43
    public void set(Buffer buffer) {
44
        this.buffer = buffer;
45
        init();
46
    }
47

  
48
    private void init() {
49
        DataManager dm = DALLocator.getDataManager();
50
        FilesystemServerExplorerParameters param;
51
        FilesystemServerExplorer explorer = null;
52
        try {
53
            param =
54
                (FilesystemServerExplorerParameters) dm
55
                    .createServerExplorerParameters(FilesystemServerExplorer.NAME);
56
            // param.setInitialpath(lastPath);
57
            explorer = (FilesystemServerExplorer) dm.openServerExplorer(FilesystemServerExplorer.NAME, param);
58
        } catch (Exception e) {
59
            throw new RuntimeException(e);
60
        }
61

  
62
        final JFileChooser jfc = new JFileChooser("/home/paco/tmp");
63

  
64
        List dataStoreProviderNames = explorer.getDataStoreProviderNames();
65
        List<FilesystemServerExplorerProvider> creationProviders = new ArrayList<>();
66
        Iterator filters = explorer.getFilters(DataServerExplorer.MODE_RASTER);
67
        while (filters.hasNext()) {
68
            FilesystemServerExplorerProvider provider = (FilesystemServerExplorerProvider) filters.next();
69
            if (provider.canCreate()) {
70
                creationProviders.add(provider);
71
                jfc.addChoosableFileFilter(new MyFileFilter(provider));
72
            }
73
        }
74

  
75
//        jfc.addPropertyChangeListener(new PropertyChangeListener() {
76
//
77
//            @Override
78
//            public void propertyChange(PropertyChangeEvent evt) {
79
//                evt.getNewValue();
80
//
81
//                if (evt.getNewValue() instanceof MyFileFilter) {
82
//                    String dataStoreProviderName =
83
//                        ((MyFileFilter) evt.getNewValue()).getFileFilter().getDataStoreProviderName();
84
//                    NewRasterStoreParameters params = getParams(dataStoreProviderName);
85
//
86
//                    JComponent panelProperty = loadPanelProperties(params);
87
//                    if (panelProperty != null) {
88
//                        jfc.setAccessory(panelProperty);
89
//                    } else {
90
//                        jfc.setAccessory(new JPanel());
91
//                    }
92
//                    jfc.revalidate();
93
//                }
94
//                if (evt.getNewValue() instanceof String) {
95
//                    logger.info("evt.getNewValue(): "+evt.getNewValue());
96
//                }
97
//
98
//            }
99
//        });
100

  
101

  
102
        jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
103
        jfc.setAcceptAllFileFilterUsed(false);
104
// TODO Auto-generated method stub
105

  
106
    }
107

  
108
    protected JComponent loadPanelProperties(NewRasterStoreParameters params) {
109

  
110
//        if (params != null) {
111
//            FilesystemExplorerPropertiesPanelManager manager =
112
//                ApplicationLocator.getFilesystemExplorerPropertiesPanelManager();
113
//            FilesystemExplorerPropertiesPanel panel = manager.createPanel(params);
114
//            panel.setExcludeGeometryOptions(false);
115
//            return panel.asJComponent();
116
//        }
117

  
118
        return null;
119
    }
120

  
121
    /**
122
     * @author fdiaz
123
     *
124
     */
125
    public static class MyFileFilter extends javax.swing.filechooser.FileFilter {
126

  
127
        private FilesystemFileFilter fileFilter;
128

  
129
        /**
130
         * @param fileFilter
131
         */
132
        public MyFileFilter(FilesystemFileFilter fileFilter) {
133
            this.fileFilter = fileFilter;
134
        }
135

  
136
        @Override
137
        public boolean accept(File f) {
138
            if (f.isDirectory()) {
139
                return true;
140
            }
141
            return this.getFileFilter().accept(f);
142
        }
143

  
144
        @Override
145
        public String getDescription() {
146
            return this.getFileFilter().getDescription();
147
        }
148

  
149
        /**
150
         * @return the fileFilter
151
         */
152
        public FilesystemFileFilter getFileFilter() {
153
            return fileFilter;
154
        }
155

  
156
        // /**
157
        // * @param fileFilter the fileFilter to set
158
        // */
159
        // public void setFileFilter(FilesystemFileFilter fileFilter) {
160
        // this.fileFilter = fileFilter;
161
        // }
162

  
163
    }
164

  
165

  
166
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/impl/operations/OperationListTableModel.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.fmap.mapcontext.raster.swing.impl.operations;
24

  
25
import javax.swing.table.AbstractTableModel;
26

  
27
import org.slf4j.Logger;
28
import org.slf4j.LoggerFactory;
29

  
30
import org.gvsig.raster.lib.buffer.api.BufferLocator;
31
import org.gvsig.raster.lib.buffer.api.OperationManager;
32
import org.gvsig.raster.lib.buffer.api.operations.OperationList;
33
import org.gvsig.raster.lib.buffer.api.operations.OperationListEntry;
34
import org.gvsig.tools.ToolsLocator;
35
import org.gvsig.tools.i18n.I18nManager;
36

  
37

  
38

  
39
/**
40
 * @author fdiaz
41
 *
42
 */
43
public class OperationListTableModel extends AbstractTableModel {
44

  
45
    /**
46
     *
47
     */
48
    private static final long serialVersionUID = 5993288441174158255L;
49
    private static final Logger LOG = LoggerFactory.getLogger(OperationListTableModel.class);
50

  
51
    private static final int COLUMNS = 2;
52

  
53
    private static final int COLUMN_OPERATION = 0;
54
    private static final int COLUMN_IS_ACTIVE = 1;
55

  
56

  
57

  
58
    private OperationList operationList;
59

  
60
    /**
61
     *
62
     */
63
    public OperationListTableModel() {
64
        operationList = ((OperationManager)BufferLocator.getBufferManager()).createOperationList();
65
    }
66

  
67
    @Override
68
    public int getRowCount() {
69
        return operationList.size();
70
    }
71

  
72
    @Override
73
    public int getColumnCount() {
74
        return COLUMNS;
75
    }
76

  
77
    @Override
78
    public Object getValueAt(int rowIndex, int columnIndex) {
79
        OperationListEntry entry = operationList.get(rowIndex);
80
        switch (columnIndex) {
81
        case COLUMN_OPERATION:
82
            return entry.getOperation();
83
        case COLUMN_IS_ACTIVE:
84
            return entry.isActive();
85
        }
86
        return null;
87
    }
88

  
89
    @Override
90
    public String getColumnName(int column) {
91
        I18nManager i18nManager = ToolsLocator.getI18nManager();
92
        switch (column) {
93
        case COLUMN_OPERATION:
94
            return i18nManager.getTranslation("_operation");
95
        case COLUMN_IS_ACTIVE:
96
            return i18nManager.getTranslation("_active");
97
        }
98
        return null;
99
    }
100

  
101
    @Override
102
    public boolean isCellEditable(int rowIndex, int columnIndex) {
103
        if(columnIndex==COLUMN_IS_ACTIVE){
104
            return true;
105
        }
106
        return false;
107
    }
108

  
109
    @Override
110
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
111
        if (rowIndex < operationList.size()) {
112
            if (columnIndex < COLUMNS) {
113
                switch (columnIndex) {
114
                case COLUMN_IS_ACTIVE:
115
                    if (aValue == null) {
116
                        operationList.get(rowIndex).setActive(false);
117
                        break;
118
                    }
119
                    if (!(aValue instanceof Boolean)) {
120
                        throw new IllegalArgumentException("The object '" + aValue.toString() + "' must be a Boolean.");
121
                    }
122
                    operationList.get(rowIndex).setActive((Boolean) aValue);
123
                    this.fireTableDataChanged();
124
                    break;
125
                default:
126
                    super.setValueAt(aValue, rowIndex, columnIndex);
127
                    break;
128
                }
129
            }
130
            fireTableDataChanged();
131
        }
132
    }
133

  
134
    /**
135
     * @param rasterStoreBand
136
     */
137
    public void add(OperationListEntry operationListEntry) {
138
        operationList.add(operationListEntry);
139
        fireTableDataChanged();
140
    }
141

  
142
    /**
143
     * @param selectedRow
144
     */
145
    public void removeElementAt(int selectedRow) {
146
        operationList.remove(selectedRow);
147
        fireTableDataChanged();
148
    }
149

  
150
    public OperationListEntry getElementAt(int selectedRow) {
151
        return operationList.get(selectedRow);
152
    }
153

  
154
    /**
155
     * @param selectedRow
156
     */
157
    public void up(int selectedRow) {
158
        if(selectedRow>0){
159
            OperationListEntry operationListEntry = operationList.remove(selectedRow);
160
            operationList.add(selectedRow-1, operationListEntry);
161
            fireTableDataChanged();
162
        }
163
    }
164

  
165
    /**
166
     * @param selectedRow
167
     */
168
    public void down(int selectedRow) {
169
        if(selectedRow<operationList.size()){
170
            OperationListEntry operationListEntry = operationList.remove(selectedRow);
171
            operationList.add(selectedRow+1, operationListEntry);
172
            fireTableDataChanged();
173
        }
174
    }
175

  
176
    @Override
177
    public Class<?> getColumnClass(int col) {
178
        if (col == COLUMN_IS_ACTIVE) {
179
            return Boolean.class;
180
        }
181
        return super.getColumnClass(col);
182
    }
183

  
184
}
tags/org.gvsig.desktop-2.0.320/org.gvsig.desktop.library/org.gvsig.fmap.mapcontext.swing/org.gvsig.fmap.mapcontext.swing.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/impl/operations/OperationSelectorPanelController.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2017 gvSIG Association
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff