Revision 47032

View differences:

tags/org.gvsig.desktop-2.0.410/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.410/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.410/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.410/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.410/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.410</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.410/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/DefaultMapContextRasterSwingManager.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;
24

  
25
import java.util.List;
26

  
27
import org.gvsig.fmap.dal.raster.BandDescriptor;
28
import org.gvsig.fmap.mapcontext.raster.swing.MapContextRasterSwingManager;
29
import org.gvsig.fmap.mapcontext.raster.swing.SelectableBandDescriptorsTableModel;
30
import org.gvsig.fmap.mapcontext.raster.swing.bands.BandsPanel;
31
import org.gvsig.fmap.mapcontext.raster.swing.export.ExportRasterPanel;
32
import org.gvsig.fmap.mapcontext.raster.swing.impl.bands.BandsPanelController;
33
import org.gvsig.fmap.mapcontext.raster.swing.impl.export.DefaultExportRasterPanel;
34
import org.gvsig.fmap.mapcontext.raster.swing.impl.operations.OperationListPanelController;
35
import org.gvsig.fmap.mapcontext.raster.swing.impl.operations.OperationSelectorPanelController;
36
import org.gvsig.fmap.mapcontext.raster.swing.impl.previewer.DefaultOneLayerPreviewer;
37
import org.gvsig.fmap.mapcontext.raster.swing.impl.transparency.TransparencyPanelController;
38
import org.gvsig.fmap.mapcontext.raster.swing.operations.OperationListPanel;
39
import org.gvsig.fmap.mapcontext.raster.swing.operations.OperationSelectorPanel;
40
import org.gvsig.fmap.mapcontext.raster.swing.previewer.OneLayerPreviewer;
41
import org.gvsig.fmap.mapcontext.raster.swing.transparency.TransparencyPanel;
42
import org.gvsig.tools.dynobject.DynObject;
43
import org.gvsig.tools.service.Service;
44
import org.gvsig.tools.service.ServiceException;
45

  
46

  
47
/**
48
 * @author fdiaz
49
 *
50
 */
51
public class DefaultMapContextRasterSwingManager implements MapContextRasterSwingManager{
52

  
53
    @Override
54
    public DynObject createServiceParameters(String serviceName) throws ServiceException {
55
        // TODO Auto-generated method stub
56
        return null;
57
    }
58

  
59
    @Override
60
    public Service getService(DynObject parameters) throws ServiceException {
61
        // TODO Auto-generated method stub
62
        return null;
63
    }
64

  
65
    @Override
66
    public SelectableBandDescriptorsTableModel createSelectableBandDescriptorsTableModel(List<BandDescriptor> descriptors) {
67
        return new DefaultSelectableBandDescriptorsTableModel(descriptors);
68
    }
69

  
70
    @Override
71
    public TransparencyPanel createTransparencyPanel() {
72
        return new TransparencyPanelController();
73
    }
74

  
75
    @Override
76
    public BandsPanel createBandsPanel() {
77
        return new BandsPanelController();
78
    }
79

  
80
    @Override
81
    public ExportRasterPanel createExportRaster() {
82
        return new DefaultExportRasterPanel();
83
    }
84

  
85
    @Override
86
    public OneLayerPreviewer createOneLayerPreviewer() {
87
        return new DefaultOneLayerPreviewer();
88
    }
89

  
90
    @Override
91
    public OperationListPanel createOperationListPanel() {
92
        return new OperationListPanelController();
93
    }
94

  
95
    @Override
96
    public OperationSelectorPanel createOperationSelectorPanel() {
97
        return new OperationSelectorPanelController();
98
    }
99

  
100
}
tags/org.gvsig.desktop-2.0.410/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.410/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/OperationEntryNameCellRenderer.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 java.awt.Component;
26

  
27
import javax.swing.JTable;
28
import javax.swing.table.DefaultTableCellRenderer;
29

  
30
import org.gvsig.raster.lib.buffer.api.BufferLocator;
31
import org.gvsig.raster.lib.buffer.api.operations.Operation;
32
import org.gvsig.raster.lib.buffer.api.operations.OperationListEntry;
33

  
34

  
35
/**
36
 * @author fdiaz
37
 *
38
 */
39
public class OperationEntryNameCellRenderer extends DefaultTableCellRenderer {
40

  
41
    /**
42
     *
43
     */
44
    private static final long serialVersionUID = 5418744699617313073L;
45

  
46
    @Override
47
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
48
        int row, int column) {
49

  
50
        Component cellComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
51

  
52
        Operation operation = ((Operation) value);
53
        setText(operation.getFactory().getName());
54

  
55
        return cellComponent;
56
    }
57
}
tags/org.gvsig.desktop-2.0.410/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/OperationSelectorPanelView.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<object classname="com.jeta.forms.store.memento.FormPackage">
4
 <at name="fileversion">
5
  <object classname="com.jeta.forms.store.memento.FormsVersion2">
6
   <at name="major">2</at>
7
   <at name="minor">0</at>
8
   <at name="sub">0</at>
9
  </object>
10
 </at>
11
 <at name="form">
12
  <object classname="com.jeta.forms.store.memento.FormMemento">
13
   <super classname="com.jeta.forms.store.memento.ComponentMemento">
14
    <at name="cellconstraints">
15
     <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
16
      <at name="column">1</at>
17
      <at name="row">1</at>
18
      <at name="colspan">1</at>
19
      <at name="rowspan">1</at>
20
      <at name="halign">default</at>
21
      <at name="valign">default</at>
22
      <at name="insets" object="insets">0,0,0,0</at>
23
     </object>
24
    </at>
25
    <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
26
   </super>
27
   <at name="id">/home/paco/projects/externals/gvsig-desktop/RasterRefactoring/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.mapcontext.raster.swing/org.gvsig.fmap.mapcontext.raster.swing.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/impl/operations/OperationSelectorPanelView.xml</at>
28
   <at name="path">RasterRefactoring/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.mapcontext.raster.swing/org.gvsig.fmap.mapcontext.raster.swing.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/swing/impl/operations/OperationSelectorPanelView.xml</at>
29
   <at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE</at>
30
   <at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at>
31
   <at name="components">
32
    <object classname="java.util.LinkedList">
33
     <item >
34
      <at name="value">
35
       <object classname="com.jeta.forms.store.memento.BeanMemento">
36
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
37
         <at name="cellconstraints">
38
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
39
           <at name="column">2</at>
40
           <at name="row">2</at>
41
           <at name="colspan">1</at>
42
           <at name="rowspan">1</at>
43
           <at name="halign">fill</at>
44
           <at name="valign">fill</at>
45
           <at name="insets" object="insets">0,0,0,0</at>
46
          </object>
47
         </at>
48
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
49
        </super>
50
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
51
        <at name="beanclass">javax.swing.JList</at>
52
        <at name="beanproperties">
53
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
54
          <at name="classname">javax.swing.JList</at>
55
          <at name="properties">
56
           <object classname="com.jeta.forms.store.support.PropertyMap">
57
            <at name="border">
58
             <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
59
              <super classname="com.jeta.forms.store.properties.BorderProperty">
60
               <at name="name">border</at>
61
              </super>
62
              <at name="borders">
63
               <object classname="java.util.LinkedList">
64
                <item >
65
                 <at name="value">
66
                  <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
67
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
68
                    <at name="name">border</at>
69
                   </super>
70
                  </object>
71
                 </at>
72
                </item>
73
               </object>
74
              </at>
75
             </object>
76
            </at>
77
            <at name="scrollableTracksViewportHeight">true</at>
78
            <at name="scrollableTracksViewportWidth">true</at>
79
            <at name="name">lstOperations</at>
80
            <at name="width">930</at>
81
            <at name="items">
82
             <object classname="com.jeta.forms.store.properties.ItemsProperty">
83
              <at name="name">items</at>
84
             </object>
85
            </at>
86
            <at name="scollBars">
87
             <object classname="com.jeta.forms.store.properties.ScrollBarsProperty">
88
              <at name="name">scollBars</at>
89
              <at name="verticalpolicy">20</at>
90
              <at name="horizontalpolicy">30</at>
91
             </object>
92
            </at>
93
            <at name="toolTipText">_operations_selector</at>
94
            <at name="height">549</at>
95
           </object>
96
          </at>
97
         </object>
98
        </at>
99
       </object>
100
      </at>
101
     </item>
102
    </object>
103
   </at>
104
   <at name="properties">
105
    <object classname="com.jeta.forms.store.memento.PropertiesMemento">
106
     <at name="classname">com.jeta.forms.gui.form.GridView</at>
107
     <at name="properties">
108
      <object classname="com.jeta.forms.store.support.PropertyMap">
109
       <at name="border">
110
        <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
111
         <super classname="com.jeta.forms.store.properties.BorderProperty">
112
          <at name="name">border</at>
113
         </super>
114
         <at name="borders">
115
          <object classname="java.util.LinkedList"/>
116
         </at>
117
        </object>
118
       </at>
119
       <at name="name"/>
120
       <at name="fill">
121
        <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
122
         <at name="name">fill</at>
123
        </object>
124
       </at>
125
       <at name="scollBars">
126
        <object classname="com.jeta.forms.store.properties.ScrollBarsProperty">
127
         <at name="name">scollBars</at>
128
         <at name="verticalpolicy">21</at>
129
         <at name="horizontalpolicy">31</at>
130
         <at name="border">
131
          <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
132
           <super classname="com.jeta.forms.store.properties.BorderProperty">
133
            <at name="name">border</at>
134
           </super>
135
           <at name="borders">
136
            <object classname="java.util.LinkedList">
137
             <item >
138
              <at name="value">
139
               <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
140
                <super classname="com.jeta.forms.store.properties.BorderProperty">
141
                 <at name="name">border</at>
142
                </super>
143
               </object>
144
              </at>
145
             </item>
146
            </object>
147
           </at>
148
          </object>
149
         </at>
150
        </object>
151
       </at>
152
      </object>
153
     </at>
154
    </object>
155
   </at>
156
   <at name="cellpainters">
157
    <object classname="com.jeta.forms.store.support.Matrix">
158
     <at name="rows">
159
      <object classname="[Ljava.lang.Object;" size="3">
160
       <at name="item" index="0">
161
        <object classname="[Ljava.lang.Object;" size="3"/>
162
       </at>
163
       <at name="item" index="1">
164
        <object classname="[Ljava.lang.Object;" size="3"/>
165
       </at>
166
       <at name="item" index="2">
167
        <object classname="[Ljava.lang.Object;" size="3"/>
168
       </at>
169
      </object>
170
     </at>
171
    </object>
172
   </at>
173
   <at name="rowgroups">
174
    <object classname="com.jeta.forms.store.memento.FormGroupSet">
175
     <at name="groups">
176
      <object classname="java.util.HashMap"/>
177
     </at>
178
    </object>
179
   </at>
180
   <at name="colgroups">
181
    <object classname="com.jeta.forms.store.memento.FormGroupSet">
182
     <at name="groups">
183
      <object classname="java.util.HashMap"/>
184
     </at>
185
    </object>
186
   </at>
187
  </object>
188
 </at>
189
</object>
tags/org.gvsig.desktop-2.0.410/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/OperationSelectorPanelView.java
1
package org.gvsig.fmap.mapcontext.raster.swing.impl.operations;
2

  
3
import java.awt.BorderLayout;
4
import java.awt.ComponentOrientation;
5
import java.awt.Container;
6
import java.awt.Dimension;
7

  
8
import javax.swing.Box;
9
import javax.swing.ImageIcon;
10
import javax.swing.JList;
11
import javax.swing.JPanel;
12
import javax.swing.JScrollPane;
13

  
14
import com.jgoodies.forms.layout.CellConstraints;
15
import com.jgoodies.forms.layout.FormLayout;
16

  
17

  
18
public class OperationSelectorPanelView extends JPanel
19
{
20
   JList lstOperations = new JList();
21

  
22
   /**
23
    * Default constructor
24
    */
25
   public OperationSelectorPanelView()
26
   {
27
      initializePanel();
28
   }
29

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

  
40
      boolean filled_cell_11 = false;
41
      CellConstraints cc = new CellConstraints();
42
      if ( cols.length > 0 && rows.length > 0 )
43
      {
44
         if ( cols[0] == 1 && rows[0] == 1 )
45
         {
46
            /** add a rigid area  */
47
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
48
            filled_cell_11 = true;
49
         }
50
      }
51

  
52
      for( int index = 0; index < cols.length; index++ )
53
      {
54
         if ( cols[index] == 1 && filled_cell_11 )
55
         {
56
            continue;
57
         }
58
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
59
      }
60

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

  
70
   }
71

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

  
97
   /**
98
    * Method for recalculating the component orientation for
99
    * right-to-left Locales.
100
    * @param orientation the component orientation to be applied
101
    */
102
   public void applyComponentOrientation( ComponentOrientation orientation )
103
   {
104
      // Not yet implemented...
105
      // I18NUtils.applyComponentOrientation(this, orientation);
106
      super.applyComponentOrientation(orientation);
107
   }
108

  
109
   public JPanel createPanel()
110
   {
111
      JPanel jpanel1 = new JPanel();
112
      FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE");
113
      CellConstraints cc = new CellConstraints();
114
      jpanel1.setLayout(formlayout1);
115

  
116
      lstOperations.setName("lstOperations");
117
      lstOperations.setToolTipText("_operations_selector");
118
      JScrollPane jscrollpane1 = new JScrollPane();
119
      jscrollpane1.setViewportView(lstOperations);
120
      jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
121
      jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
122
      jpanel1.add(jscrollpane1,new CellConstraints(2,2,1,1,CellConstraints.FILL,CellConstraints.FILL));
123

  
124
      addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,2,3 });
125
      return jpanel1;
126
   }
127

  
128
   /**
129
    * Initializer
130
    */
131
   protected void initializePanel()
132
   {
133
      setLayout(new BorderLayout());
134
      add(createPanel(), BorderLayout.CENTER);
135
   }
136

  
137

  
138
}
tags/org.gvsig.desktop-2.0.410/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/OperationFactoryCellRenderer.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 java.awt.Component;
26

  
27
import javax.swing.DefaultListCellRenderer;
28
import javax.swing.JList;
29

  
30
import org.gvsig.raster.lib.buffer.api.operations.OperationFactory;
31

  
32

  
33
/**
34
 * @author fdiaz
35
 *
36
 */
37
public class OperationFactoryCellRenderer extends DefaultListCellRenderer {
38

  
39
    @Override
40
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
41
        boolean cellHasFocus) {
42
        Component cellComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
43
        OperationFactory factory = ((OperationFactory) value);
44
        setText(factory.getName());
45

  
46
        return cellComponent;
47
    }
48

  
49
}
tags/org.gvsig.desktop-2.0.410/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/OperationListPanelController.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 java.awt.event.ActionEvent;
26
import java.awt.event.ActionListener;
27
import java.util.Iterator;
28
import java.util.Locale;
29

  
30
import javax.swing.JComponent;
31
import javax.swing.ListSelectionModel;
32
import javax.swing.event.ListSelectionEvent;
33
import javax.swing.event.ListSelectionListener;
34
import javax.swing.event.TableModelListener;
35
import javax.swing.table.DefaultTableColumnModel;
36
import javax.swing.table.TableColumn;
37
import javax.swing.table.TableColumnModel;
38

  
39
import org.slf4j.Logger;
40
import org.slf4j.LoggerFactory;
41

  
42
import org.gvsig.fmap.mapcontext.raster.swing.operations.OperationListPanel;
43
import org.gvsig.raster.lib.buffer.api.operations.OperationList;
44
import org.gvsig.raster.lib.buffer.api.operations.OperationListEntry;
45
import org.gvsig.tools.ToolsLocator;
46
import org.gvsig.tools.i18n.I18nManager;
47
import org.gvsig.tools.swing.api.ToolsSwingLocator;
48
import org.gvsig.tools.swing.icontheme.IconTheme;
49

  
50
/**
51
 * @author fdiaz
52
 *
53
 */
54
public class OperationListPanelController extends OperationListPanelView implements OperationListPanel {
55

  
56
    /**
57
     *
58
     */
59
    private static final long serialVersionUID = 938628147696863910L;
60
    @SuppressWarnings("unused")
61
    private static final Logger LOG = LoggerFactory.getLogger(OperationListPanelController.class);
62

  
63
    /**
64
     * @param factories
65
     */
66
    @SuppressWarnings("unchecked")
67
    public OperationListPanelController() {
68
        translate();
69
        initializeComponents();
70
    }
71

  
72
    private void initializeComponents() {
73
        // this.btnAdd.addActionListener(this);
74
        this.btnAdd.setActionCommand(this.ADD_ACTION_COMMAND);
75
        this.btnUpdate.setActionCommand(this.UPDATE_ACTION_COMMAND);
76
        this.btnRemove.setActionCommand(this.REMOVE_ACTION_COMMAND);
77
        this.btnRemove.addActionListener(new ActionListener() {
78

  
79
            @Override
80
            public void actionPerformed(ActionEvent e) {
81
                OperationListTableModel model = (OperationListTableModel) tblOperationList.getModel();
82
                int selectedRow = tblOperationList.getSelectedRow();
83
                int index = selectedRow;
84
                model.removeElementAt(tblOperationList.getSelectedRow());
85
                if (index >= tblOperationList.getRowCount()) {
86
                    index = tblOperationList.getRowCount() - 1;
87
                }
88
                if (index >= 0) {
89
                    tblOperationList.getSelectionModel().setSelectionInterval(index, index);
90
                }
91
            }
92
        });
93

  
94
        this.btnUp.setActionCommand(this.UP_ACTION_COMMAND);
95
        this.btnUp.addActionListener(new ActionListener() {
96

  
97
            @Override
98
            public void actionPerformed(ActionEvent e) {
99
                OperationListTableModel model = (OperationListTableModel) tblOperationList.getModel();
100
                int selectedRow = tblOperationList.getSelectedRow();
101
                int index = selectedRow;
102
                if (selectedRow > 0) {
103
                    index--;
104
                }
105
                model.up(selectedRow);
106
                tblOperationList.getSelectionModel().setSelectionInterval(index, index);
107
            }
108
        });
109
        this.btnUp.setActionCommand(this.DOWN_ACTION_COMMAND);
110
        this.btnDown.addActionListener(new ActionListener() {
111

  
112
            @Override
113
            public void actionPerformed(ActionEvent e) {
114
                OperationListTableModel model = (OperationListTableModel) tblOperationList.getModel();
115
                int selectedRow = tblOperationList.getSelectedRow();
116
                int index = selectedRow;
117
                if (selectedRow < tblOperationList.getRowCount()) {
118
                    index++;
119
                }
120
                model.down(selectedRow);
121
                tblOperationList.getSelectionModel().setSelectionInterval(index, index);
122
            }
123
        });
124

  
125
        btnUp.setEnabled(false);
126
        btnDown.setEnabled(false);
127
        btnUpdate.setEnabled(false);
128

  
129
        IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent();
130
        this.btnAdd.setIcon(iconTheme.get("add-operation-icon"));
131
        this.btnRemove.setIcon(iconTheme.get("remove-operation-icon"));
132
        this.btnUp.setIcon(iconTheme.get("up-operation-icon"));
133
        this.btnDown.setIcon(iconTheme.get("down-operation-icon"));
134
        this.btnUpdate.setIcon(iconTheme.get("update-operation-icon"));
135

  
136
        tblOperationList.setRowSelectionAllowed(true);
137
        tblOperationList.setColumnSelectionAllowed(false);
138
        tblOperationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
139
        OperationListTableModel model = new OperationListTableModel();
140
        tblOperationList.setModel(model);
141

  
142
        tblOperationList.setColumnModel(new DefaultTableColumnModel());
143
        TableColumnModel columnModel = tblOperationList.getColumnModel();
144
        columnModel.setColumnSelectionAllowed(false);
145
        for (int i = 0; i < model.getColumnCount(); i++) {
146
            TableColumn tableColumn = new TableColumn(i);
147
            tableColumn.setIdentifier(model.getColumnName(i));
148
            tableColumn.setHeaderValue(model.getColumnName(i));
149
            columnModel.addColumn(tableColumn);
150
        }
151

  
152
        columnModel.getColumn(0).setCellRenderer(new OperationEntryNameCellRenderer());
153

  
154
        tblOperationList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
155

  
156
            @Override
157
            public void valueChanged(ListSelectionEvent e) {
158
                int selectedRow = tblOperationList.getSelectedRow();
159
                btnUp.setEnabled(selectedRow >= 0);
160
                btnDown.setEnabled(selectedRow >= 0);
161
                btnUpdate.setEnabled(selectedRow >= 0);
162
                btnRemove.setEnabled(selectedRow >= 0);
163
            }
164
        });
165
    }
166

  
167
    private void translate() {
168
        I18nManager i18nManager = ToolsLocator.getI18nManager();
169
        btnAdd.setText(""); // i18nManager.getTranslation(btnAdd.getText()));
170
        btnAdd.setToolTipText(i18nManager.getTranslation(btnAdd.getToolTipText()));
171
        btnRemove.setText(""); // i18nManager.getTranslation(btnRemove.getText()));
172
        btnRemove.setToolTipText(i18nManager.getTranslation(btnRemove.getToolTipText()));
173
        btnUp.setText(""); // i18nManager.getTranslation(btnUp.getText()));
174
        btnUp.setToolTipText(i18nManager.getTranslation(btnUp.getToolTipText()));
175
        btnDown.setText(""); // i18nManager.getTranslation(btnDown.getText()));
176
        btnDown.setToolTipText(i18nManager.getTranslation(btnDown.getToolTipText()));
177
        btnUpdate.setText(""); // i18nManager.getTranslation(btnAdd.getText()));
178
        btnUpdate.setToolTipText(i18nManager.getTranslation(btnAdd.getToolTipText()));
179
    }
180

  
181
    /**
182
     * @param locale
183
     *
184
     */
185
    public void setLocate(Locale locale) {
186
        Locale l = super.getLocale();
187
        if (!l.equals(locale)) {
188
            translate();
189
        }
190
        super.setLocale(locale);
191
    }
192

  
193
    /**
194
     * @param operationList
195
     */
196
    @SuppressWarnings("unchecked")
197
    public void set(OperationList operationList) {
198
        addOperations(operationList);
199
    }
200

  
201
    /**
202
     * @param colorInterpretation
203
     * @param store
204
     * @param model
205
     */
206
    private void addOperations(OperationList operationList) {
207
        OperationListTableModel model = ((OperationListTableModel) tblOperationList.getModel());
208
        for (Iterator iterator = operationList.iterator(); iterator.hasNext();) {
209
            OperationListEntry operationListEntry = (OperationListEntry) iterator.next();
210
            try {
211
                model.add((OperationListEntry) operationListEntry.clone());
212
            } catch (CloneNotSupportedException e) {
213
                LOG.warn("Can't clone operation list entry", e);
214
            }
215
            model.fireTableDataChanged();
216
        }
217
    }
218

  
219
    /**
220
     * @param layer
221
     */
222
    public boolean fetch(OperationList operationList) {
223
        OperationListTableModel model = (OperationListTableModel) tblOperationList.getModel();
224
        for (int i = 0; i < model.getRowCount(); i++) {
225
            OperationListEntry entry = model.getElementAt(i);
226
            try {
227
                operationList.add((OperationListEntry) entry.clone());
228
            } catch (CloneNotSupportedException e) {
229
                LOG.warn("Can't get the operation list.");
230
                return false;
231
            }
232
        }
233
        return true;
234
    }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff