Revision 20807

View differences:

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

  
26

  
27
#
28
# Plugin autorun
29
# 
30

  
31
PLUGIN_NAME=$(basename "$PLUGIN_FOLDER")
32

  
33
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PLUGIN_FOLDER/native"
34
GVSIG_NATIVE_LIBS="$GVSIG_NATIVE_LIBS:$PLUGIN_FOLDER/native"
35

  
36

  
37

  
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.fedora.x86/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

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

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

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

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

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

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${gvsig.package.info.code}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/package.info</source>
36
    </file>
37
  </files>
38

  
39
  <fileSets>
40
    <fileSet>
41
      <directory>target/org.gvsig.raster.app.common</directory>
42
      <outputDirectory>.</outputDirectory>
43
      <excludes>
44
      	<exclude>package.info</exclude>
45
      </excludes>
46
    </fileSet>
47
    <fileSet>
48
      <directory>target/native/lib</directory>
49
      <outputDirectory>native</outputDirectory>
50
    </fileSet>
51
    <fileSet>
52
      <directory>src/main/resources-plugin</directory>
53
      <outputDirectory>.</outputDirectory>
54
    </fileSet>
55
  </fileSets>
56

  
57

  
58
  <dependencySets>
59
    <dependencySet>
60
      <useProjectArtifact>false</useProjectArtifact>
61
      <useTransitiveDependencies>false</useTransitiveDependencies>
62
      <outputDirectory>lib</outputDirectory>
63
		<includes>
64
            <include>org.gvsig:org.gvsig.jpotrace:jar</include>
65
		</includes>
66
    </dependencySet>
67
  </dependencySets>
68

  
69
</assembly>
70

  
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.fedora.x86/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/maven-v4_0_0.xsd">
3
  <modelVersion>4.0.0</modelVersion>
4
  <artifactId>org.gvsig.raster.app.fedora.x86</artifactId>
5
  <packaging>jar</packaging>
6
   
7
 	<parent>
8
		<groupId>org.gvsig</groupId>
9
		<artifactId>org.gvsig.raster.app</artifactId>
10
    <version>2.2.4-SNAPSHOT</version>
11
	</parent>
12

  
13
  <properties>
14
    <gvsig.package.info.operatingSystem>fedora</gvsig.package.info.operatingSystem>
15
    <gvsig.package.info.architecture>x86</gvsig.package.info.architecture>
16
    
17
    <native.classifier>fedora11-i586-dynamic</native.classifier>
18
  </properties>
19

  
20
  <dependencyManagement>
21
      <dependencies>
22
        <dependency>
23
          <groupId>org.gvsig</groupId>
24
          <artifactId>org.gvsig.jpotrace</artifactId>
25
          <classifier>${native.classifier}</classifier>
26
          <type>tar.gz</type>
27
          <version>2.0.0-SNAPSHOT</version>
28
        </dependency> 
29
    </dependencies>
30
  </dependencyManagement>
31

  
32
  <dependencies>
33
        <dependency>
34
          <groupId>org.gvsig</groupId>
35
          <artifactId>org.gvsig.raster.app.common</artifactId>
36
          <type>zip</type>
37
        </dependency>
38
        <dependency>
39
          <groupId>org.gvsig</groupId>
40
          <artifactId>org.gvsig.jpotrace</artifactId>
41
          <scope>compile</scope>
42
        </dependency>
43
        <dependency>
44
          <groupId>org.gvsig</groupId>
45
          <artifactId>org.gvsig.jpotrace</artifactId>
46
          <classifier>${native.classifier}</classifier>
47
          <type>tar.gz</type>
48
          <scope>runtime</scope>
49
        </dependency>
50
  </dependencies>
51

  
52
  <build>
53
    <plugins>
54
  
55
      <plugin>
56
        <groupId>org.apache.maven.plugins</groupId>
57
        <artifactId>maven-dependency-plugin</artifactId>
58
        <executions>
59
          <execution>
60
          	<id>unpack</id>
61
	        <phase>process-sources</phase>
62
	        <goals>
63
	          <goal>unpack</goal>
64
	        </goals>
65
	        <configuration>
66
	          <artifactItems>
67
	            <artifactItem>
68
		            <groupId>org.gvsig</groupId>
69
		            <artifactId>org.gvsig.raster.app.common</artifactId>
70
		            <type>zip</type>
71
					      <overWrite>true</overWrite>
72
					      <outputDirectory>target</outputDirectory>
73
	            </artifactItem>
74
	            <artifactItem>
75
		            <groupId>org.gvsig</groupId>
76
                <artifactId>org.gvsig.jpotrace</artifactId>
77
		            <classifier>${native.classifier}</classifier>
78
		            <type>tar.gz</type>
79
					      <overWrite>true</overWrite>
80
					      <outputDirectory>target/native</outputDirectory>
81
	            </artifactItem>
82
	          </artifactItems>
83
	        </configuration>
84
          </execution>
85
        </executions>
86
	  </plugin>
87
  
88
  
89
    </plugins>
90
  </build>
91

  
92
  
93
</project>
94

  
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.fedora.x86/buildNumber.properties
1
#Fri Mar 28 13:59:39 CET 2014
2
buildNumber=12
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.lin.x86/buildNumber.properties
1
#Thu Oct 08 22:02:19 CEST 2015
2
buildNumber=26
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.lin.x86/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

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

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

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

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

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

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${gvsig.package.info.code}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/package.info</source>
36
    </file>
37
  </files>
38

  
39
  <fileSets>
40
    <fileSet>
41
      <directory>target/org.gvsig.raster.app.common</directory>
42
      <outputDirectory>.</outputDirectory>
43
      <excludes>
44
      	<exclude>package.info</exclude>
45
      </excludes>
46
    </fileSet>
47
    <fileSet>
48
      <directory>target/native/lib</directory>
49
      <outputDirectory>native</outputDirectory>
50
    </fileSet>
51
    <fileSet>
52
      <directory>src/main/resources-plugin</directory>
53
      <outputDirectory>.</outputDirectory>
54
    </fileSet>
55
  </fileSets>
56

  
57

  
58
  <dependencySets>
59
    <dependencySet>
60
      <useProjectArtifact>false</useProjectArtifact>
61
      <useTransitiveDependencies>false</useTransitiveDependencies>
62
      <outputDirectory>lib</outputDirectory>
63
		<includes>
64
            <include>org.gvsig:org.gvsig.jpotrace:jar</include>
65
		</includes>
66
    </dependencySet>
67
  </dependencySets>
68

  
69
</assembly>
70

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

  
26

  
27
#
28
# Plugin autorun
29
# 
30

  
31
PLUGIN_NAME=$(basename "$PLUGIN_FOLDER")
32

  
33
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PLUGIN_FOLDER/native"
34
GVSIG_NATIVE_LIBS="$GVSIG_NATIVE_LIBS:$PLUGIN_FOLDER/native"
35

  
36

  
37

  
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.lin.x86/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/maven-v4_0_0.xsd">
3
  <modelVersion>4.0.0</modelVersion>
4
  <artifactId>org.gvsig.raster.app.lin.x86</artifactId>
5
  <packaging>jar</packaging>
6
   
7
 	<parent>
8
		<groupId>org.gvsig</groupId>
9
		<artifactId>org.gvsig.raster.app</artifactId>
10
    <version>2.2.22-SNAPSHOT</version>
11
	</parent>
12

  
13
  <properties>
14
    <gvsig.package.info.operatingSystem>lin</gvsig.package.info.operatingSystem>
15
    <gvsig.package.info.architecture>x86</gvsig.package.info.architecture>
16
    
17
    <jpotrace.classifier>linux-all-gcc4-i386-dynamic</jpotrace.classifier>
18
    <jpotrace.version>2.0.0</jpotrace.version>
19
  </properties>
20

  
21
  <dependencyManagement>
22
      <dependencies>
23
        <dependency>
24
          <groupId>org.gvsig</groupId>
25
          <artifactId>org.gvsig.jpotrace</artifactId>
26
          <classifier>${jpotrace.classifier}</classifier>
27
          <version>${jpotrace.version}</version>
28
          <type>tar.gz</type>
29
        </dependency> 
30
    </dependencies>
31
  </dependencyManagement>
32

  
33
  <dependencies>
34
        <dependency>
35
          <groupId>org.gvsig</groupId>
36
          <artifactId>org.gvsig.raster.app.common</artifactId>
37
          <type>zip</type>
38
        </dependency>
39
        <dependency>
40
          <groupId>org.gvsig</groupId>
41
          <artifactId>org.gvsig.jpotrace</artifactId>
42
          <scope>compile</scope>
43
        </dependency>
44
        <dependency>
45
          <groupId>org.gvsig</groupId>
46
          <artifactId>org.gvsig.jpotrace</artifactId>
47
          <classifier>${jpotrace.classifier}</classifier>
48
          <version>${jpotrace.version}</version>
49
          <type>tar.gz</type>
50
          <scope>runtime</scope>
51
        </dependency>
52
  </dependencies>
53

  
54
  <build>
55
    <plugins>
56
  
57
      <plugin>
58
        <groupId>org.apache.maven.plugins</groupId>
59
        <artifactId>maven-dependency-plugin</artifactId>
60
        <executions>
61
          <execution>
62
          	<id>unpack</id>
63
	        <phase>process-sources</phase>
64
	        <goals>
65
	          <goal>unpack</goal>
66
	        </goals>
67
	        <configuration>
68
	          <artifactItems>
69
	            <artifactItem>
70
		            <groupId>org.gvsig</groupId>
71
		            <artifactId>org.gvsig.raster.app.common</artifactId>
72
		            <type>zip</type>
73
					      <overWrite>true</overWrite>
74
					      <outputDirectory>target</outputDirectory>
75
	            </artifactItem>
76
	            <artifactItem>
77
		            <groupId>org.gvsig</groupId>
78
                <artifactId>org.gvsig.jpotrace</artifactId>
79
                <classifier>${jpotrace.classifier}</classifier>
80
                <version>${jpotrace.version}</version>
81
		            <type>tar.gz</type>
82
					      <overWrite>true</overWrite>
83
					      <outputDirectory>target/native</outputDirectory>
84
	            </artifactItem>
85
	          </artifactItems>
86
	        </configuration>
87
          </execution>
88
        </executions>
89
	  </plugin>
90
  
91
  
92
    </plugins>
93
  </build>
94

  
95
  <!-- 
96
  The profiles only configure the automatic deploy of gvSIG plugin in the gvSIG
97
  configured in HOME/.gvsig-devel.properties
98
  -->
99
  <profiles>
100
  
101
    <profile>
102
      <id>gvsig-plugin-install-raster-linux-x86</id>
103
      <activation>
104
         <os>
105
             <family>unix</family>
106
             <name>linux</name>
107
             <arch>x86</arch>
108
         </os>
109
      </activation>
110
	    <properties>
111
	      <gvsig.install.plugin>true</gvsig.install.plugin>
112
	    </properties>
113
    </profile>
114

  
115
    <profile>
116
      <id>gvsig-plugin-install-raster-linux-i386</id>
117
      <activation>
118
         <os>
119
             <family>unix</family>
120
             <name>linux</name>
121
             <arch>i386</arch>
122
         </os>
123
      </activation>
124
      <properties>
125
         <gvsig.install.plugin>true</gvsig.install.plugin>
126
      </properties>
127
    </profile>
128

  
129
  </profiles>
130
  
131
</project>
132

  
0 133

  
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.common/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

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

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

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

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

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

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${project.artifactId}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/${project.artifactId}-${project.version}.jar</source>
36
      <outputDirectory>lib</outputDirectory>
37
    </file>
38
    <file>
39
      <source>target/package.info</source>
40
    </file>
41
  </files>
42

  
43
  <fileSets>
44
    <fileSet>
45
      <directory>src/main/resources-plugin</directory>
46
      <outputDirectory>.</outputDirectory>
47
    </fileSet>
48
  </fileSets>
49

  
50

  
51
  <dependencySets>
52
    <dependencySet>
53
      <useProjectArtifact>false</useProjectArtifact>
54
      <useTransitiveDependencies>false</useTransitiveDependencies>
55
      <outputDirectory>lib</outputDirectory>
56
		  <includes>
57
		    <include>org.gvsig:org.gvsig.raster.swing.api:jar</include>
58
		    <include>org.gvsig:org.gvsig.raster.swing.impl:jar</include>
59
		    <include>org.gvsig:org.gvsig.raster.cache.lib.api:jar</include>
60
		    <include>org.gvsig:org.gvsig.raster.cache.lib.impl:jar</include>
61
		    <include>org.gvsig:org.gvsig.raster.lib.api:jar</include>
62
		    <include>org.gvsig:org.gvsig.raster.lib.impl:jar</include>
63
		    <include>org.gvsig:org.gvsig.raster.algorithm:jar</include>
64
		    <include>org.gvsig:org.gvsig.raster.fmap:jar</include>
65
		    <!-- <include>org.gvsig:org.gvsig.timesupport.lib.api:jar</include>
66
		    <include>org.gvsig:org.gvsig.timesupport.lib.impl:jar</include>-->
67
		    <include>org.joda:joda-time:jar</include>		
68
		  </includes>
69
    </dependencySet>
70
  </dependencySets>
71

  
72
</assembly>
73

  
74

  
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.common/src/main/java/org/gvsig/raster/mainplugin/beans/createlayer/SelectDirectoryPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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
*/
22
package org.gvsig.raster.mainplugin.beans.createlayer;
23

  
24
import java.awt.Dimension;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27
import java.awt.Insets;
28
import java.awt.event.ActionEvent;
29
import java.awt.event.ActionListener;
30
import java.io.File;
31

  
32
import javax.swing.JButton;
33
import javax.swing.JLabel;
34
import javax.swing.JPanel;
35
import javax.swing.JTextField;
36

  
37
import org.gvsig.andami.PluginServices;
38
import org.gvsig.gui.beans.swing.JFileChooser;
39

  
40

  
41
/**
42
 * Panel para la selecci?n de directorios.
43
 * 
44
 * 13/05/2008
45
 * @author Nacho Brodin nachobrodin@gmail.com
46
 */
47
public class SelectDirectoryPanel extends JPanel implements ActionListener {
48
	private static final long  serialVersionUID     = 1L;
49
	private JTextField         directoryTextField   = null;
50
	private JLabel             jLabelDirectory      = null;
51
	private JButton            jBChooseDirectory    = null;
52
	private ActionListener     listener             = null;
53
	
54
	/**
55
	 * Constructor. 
56
	 * Inicializa los componentes gr?ficos
57
	 */
58
	public SelectDirectoryPanel() {
59
		init();
60
	}
61
	
62
	/**
63
	 * This method initializes jPNameFile
64
	 * @return javax.swing.JPanel
65
	 */
66
	private void init() {
67
		GridBagConstraints gridBagConstraints = null;
68

  
69
		setLayout(new GridBagLayout());
70

  
71
		gridBagConstraints = new GridBagConstraints();
72
		gridBagConstraints.insets = new Insets(2, 5, 5, 2);
73
		add(getJLabelDirectory(), gridBagConstraints);
74

  
75
		gridBagConstraints = new java.awt.GridBagConstraints();
76
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
77
		gridBagConstraints.weightx = 1.0;
78
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 5, 2);
79
		add(getDirectoryTextField(), gridBagConstraints);
80

  
81
		gridBagConstraints = new java.awt.GridBagConstraints();
82
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 5, 5);
83
		add(getJBChooseDirectory(), gridBagConstraints);
84

  
85
		getJBChooseDirectory().addActionListener(this);
86
	}
87
	
88
	public void setListener(ActionListener listener) {
89
		this.listener = listener;
90
	}
91
	
92
	/**
93
	 * Obtiene el bot?n de asignaci?n de directorio
94
	 * @return JButton
95
	 */
96
	public JButton getJBChooseDirectory() {
97
		if (jBChooseDirectory == null) {
98
			jBChooseDirectory = new JButton(PluginServices.getText(this, "cambiar_ruta"));
99
			jBChooseDirectory.setEnabled(false);
100
		}
101
		return jBChooseDirectory;
102
	}
103
	
104
	/**
105
	 * Obtiene la etiqueta con la ruta
106
	 * @return JLabel
107
	 */
108
	public JLabel getJLabelDirectory() {
109
		if (jLabelDirectory == null) {
110
			jLabelDirectory = new JLabel(PluginServices.getText(this, "ruta") + ":");
111
			jLabelDirectory.setEnabled(false);
112
		}
113
		return jLabelDirectory;
114
	}
115
	
116
	/**
117
	 * Obtiene el campo de texto con la ruta de directorio
118
	 * @return JTextField
119
	 */
120
	public JTextField getDirectoryTextField() {
121
		if (directoryTextField  == null) {
122
			directoryTextField = new JTextField();
123
			directoryTextField.setText(JFileChooser.getLastPath(this.getClass().getName(), (File) null).toString());
124
			directoryTextField.setEditable(false);
125
			directoryTextField.setEnabled(false);
126
			directoryTextField.setPreferredSize(new Dimension(200, directoryTextField.getPreferredSize().height));
127
		}
128
		return directoryTextField;
129
	}
130
	
131
	/**
132
	 * Accion que sucede cuando se pulsa el boton de cambiar directorio
133
	 */
134
	public void actionPerformed(ActionEvent e) {
135
		JFileChooser chooser = new JFileChooser(this.getClass().getName(), new File(getDirectoryTextField().getText()));
136
		chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
137
		chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_directorio"));
138

  
139
		if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
140
			getDirectoryTextField().setText(chooser.getSelectedFile().toString());
141
		else
142
			chooser.setLastPath(new File(getDirectoryTextField().getText()));
143
		
144
		if(listener != null)
145
			listener.actionPerformed(new ActionEvent(this, 0, getPath()));
146
	}
147
	
148
	/**
149
	 * Obtiene la ruta al directorio.
150
	 * @return String
151
	 */
152
	public String getPath() {
153
		return getDirectoryTextField().getText();
154
	}
155
}
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.common/src/main/java/org/gvsig/raster/mainplugin/beans/createlayer/WritableFolderPanel.java
1
package org.gvsig.raster.mainplugin.beans.createlayer;
2

  
3
import java.awt.GridBagConstraints;
4
import java.awt.GridBagLayout;
5
import java.awt.Point;
6
import java.awt.event.ActionEvent;
7
import java.awt.event.ActionListener;
8
import java.io.File;
9

  
10
import javax.swing.JButton;
11
import javax.swing.JCheckBox;
12
import javax.swing.JLabel;
13

  
14
import org.cresques.Messages;
15
import org.gvsig.andami.PluginServices;
16
import org.gvsig.andami.ui.mdiManager.IWindow;
17
import org.gvsig.andami.ui.mdiManager.WindowInfo;
18
import org.gvsig.raster.mainplugin.RasterMainPluginUtils;
19
import org.gvsig.raster.mainplugin.beans.createlayer.SelectDirectoryPanel;
20
import org.gvsig.raster.swing.basepanel.AbstractButtonsPanel;
21
import org.gvsig.raster.swing.basepanel.IButtonsPanel;
22

  
23
/**
24
 * Panel to select a writable folder
25
 * 
26
 * @author Nacho Brodin (nachobrodin@gmail.com)
27
 */
28
public class WritableFolderPanel extends AbstractButtonsPanel implements ActionListener, IWindow {
29
	private static final long           serialVersionUID       = 1L;
30
	private SelectDirectoryPanel        selectDirectoryPanel   = null;
31
	private JCheckBox                   allFiles               = null;
32
	private Point                       posWindow              = null;
33
	private int                         widthWindow            = 320;
34
	private int                         heightWindow           = 140;
35
	private String                      defaultFolder          = null;
36
	private String                      layerName              = null;
37
	private ActionListener              listener               = null;
38
	
39
	public WritableFolderPanel(String defaultFolder, ActionListener listener, String layerName) {
40
		this.defaultFolder = defaultFolder;
41
		this.layerName = layerName;
42
		setListener(listener);
43
		posWindow = RasterMainPluginUtils.iwindowPosition(widthWindow, heightWindow);
44
		initGUI();
45
		PluginServices.getMDIManager().addWindow(this);
46
	}
47
	
48
	private void initGUI() {
49
		JButton accept = getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT);
50
		JButton cancel = getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL);
51
		getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
52
		accept.setEnabled(false);
53
		accept.addActionListener(this);
54
		cancel.addActionListener(this);
55
		
56
		this.setLayout(new GridBagLayout());
57
		GridBagConstraints gbc = new GridBagConstraints();
58
		gbc.fill = GridBagConstraints.HORIZONTAL;
59
		gbc.weightx = 1;
60
		JLabel label = new JLabel();
61
		label.setText("<html><p>" + Messages.getText("folder_not_writable") + "</p></html>");
62
		
63
		gbc.gridy = 0;
64
		this.add(new JLabel("<html><p>" + layerName + "</p><BR></html>"), gbc);
65
		
66
		gbc.gridy = 1;
67
		this.add(label, gbc);
68
		
69
		gbc.gridy = 2;
70
		this.add(getSelectDirectoryPanel(), gbc);
71
		
72
		gbc.gridy = 3;
73
		this.add(getCheckOption(), gbc);
74
		
75
		getSelectDirectoryPanel().setListener(this);
76
	}
77
	
78
	public boolean aplyAllFiles() {
79
		return getCheckOption().isSelected();
80
	}
81
	
82
	public JCheckBox getCheckOption() {
83
		if (allFiles == null)
84
			allFiles = new JCheckBox(Messages.getText("apply_all"));
85
		return allFiles;
86
	}
87
	
88
	public SelectDirectoryPanel getSelectDirectoryPanel() {
89
		if(selectDirectoryPanel == null) {
90
			selectDirectoryPanel = new SelectDirectoryPanel();
91
			selectDirectoryPanel.getJLabelDirectory().setVisible(false);
92
			selectDirectoryPanel.getJBChooseDirectory().setEnabled(true);
93
			selectDirectoryPanel.getDirectoryTextField().setText(defaultFolder);
94
		}
95
		return selectDirectoryPanel;
96
	}
97
	
98
	public void setListener(ActionListener listener) {
99
		this.listener = listener;
100
	}
101

  
102
	public void actionPerformed(ActionEvent e) {
103
		if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT)) {
104
			if(listener != null)
105
				listener.actionPerformed(new ActionEvent(getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT), IButtonsPanel.BUTTON_ACCEPT, ""));
106
			PluginServices.getMDIManager().closeWindow(this);
107
		}
108
		
109
		if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL)) {
110
			if(listener != null)
111
				listener.actionPerformed(new ActionEvent(getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL), IButtonsPanel.BUTTON_CANCEL, ""));
112
			PluginServices.getMDIManager().closeWindow(this);
113
		}
114
		
115
		if(e.getSource() == getSelectDirectoryPanel()) {
116
			File f = new File(getSelectDirectoryPanel().getPath());
117
			if(f.exists() && f.isDirectory() && f.canWrite()) {
118
				getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).setEnabled(true);
119
				if(listener != null)
120
					listener.actionPerformed(new ActionEvent(getChangeFolderButton(), 0, getSelectDirectoryPanel().getPath()));
121
			} else {
122
				getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).setEnabled(false);
123
			}
124
		}
125
	}
126
	
127
	public JButton getChangeFolderButton() {
128
		return getSelectDirectoryPanel().getJBChooseDirectory();
129
	}
130
	
131
	public WindowInfo getWindowInfo() {
132
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
133
		m_viewinfo.setTitle(Messages.getText("warning"));
134
		m_viewinfo.setHeight(heightWindow);
135
		m_viewinfo.setWidth(widthWindow);
136
		if (posWindow != null) {
137
			m_viewinfo.setX((int) posWindow.getX());
138
			m_viewinfo.setY((int) posWindow.getY());
139
		}
140
		return m_viewinfo;
141
	}
142
	
143
	public Object getWindowProfile() {
144
		return WindowInfo.DIALOG_PROFILE;
145
	}
146
}
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.common/src/main/java/org/gvsig/raster/mainplugin/beans/createlayer/NewLayerPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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
*/
22
package org.gvsig.raster.mainplugin.beans.createlayer;
23

  
24
import java.awt.Component;
25
import java.awt.Dimension;
26
import java.awt.GridBagConstraints;
27
import java.awt.GridBagLayout;
28
import java.awt.Insets;
29
import java.awt.event.ItemEvent;
30
import java.awt.event.ItemListener;
31
import java.io.File;
32
import java.util.ArrayList;
33

  
34
import javax.swing.BorderFactory;
35
import javax.swing.ButtonGroup;
36
import javax.swing.JLabel;
37
import javax.swing.JPanel;
38
import javax.swing.JRadioButton;
39
import javax.swing.JTextField;
40
import javax.swing.filechooser.FileFilter;
41

  
42
import org.gvsig.andami.PluginServices;
43
import org.gvsig.andami.Utilities;
44
import org.gvsig.andami.ui.mdiManager.IWindow;
45
import org.gvsig.fmap.dal.coverage.RasterLocator;
46
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
47
import org.gvsig.fmap.dal.coverage.util.FileUtils;
48
import org.gvsig.fmap.dal.coverage.util.PropertyEvent;
49
import org.gvsig.fmap.dal.coverage.util.PropertyListener;
50
import org.gvsig.gui.beans.swing.JFileChooser;
51
import org.gvsig.raster.fmap.layers.FLyrRaster;
52
import org.gvsig.raster.swing.RasterSwingLibrary;
53
import org.gvsig.raster.util.ExtendedFileFilter;
54

  
55
/**
56
 *
57
 * @version 18/06/2008
58
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
59
 */
60
public class NewLayerPanel implements PropertyListener {
61
	private JPanel       panel              = null;
62
	private JRadioButton jRBFileGenerate    = null;
63
	private JRadioButton jRBOpenMemory      = null;
64
	private JTextField   filenameTextField  = null;
65
	private JLabel       labelFilename      = null;
66
	private JPanel       panelNameFile      = null;
67
	private boolean      compress           = false;
68
	private FLyrRaster   lyr                = null;
69
	protected FileUtils  fileUtil           = RasterLocator.getManager().getFileUtils();
70
	
71
	/**
72
	 * Constructor de un CreateLayerPanel
73
	 */
74
	public NewLayerPanel(FLyrRaster lyr) {
75
		this.lyr = lyr;
76
		initialize();
77
		translate();
78
	}
79

  
80
	/**
81
	 * Devuelve el panel principal
82
	 * @return
83
	 */
84
	public JPanel getJPanel() {
85
		if (panel == null) {
86
			panel = new JPanel();
87
		}
88
		return panel;
89
	}
90

  
91
	private void initialize() {
92
		ButtonGroup buttonGroup2;
93
		GridBagConstraints gridBagConstraints;
94

  
95
		getJPanel().setLayout(new GridBagLayout());
96

  
97
		getJPanel().setBorder(BorderFactory.createTitledBorder(""));
98
		buttonGroup2 = new ButtonGroup();
99
		buttonGroup2.add(getRadioFileGenerate());
100
		gridBagConstraints = new GridBagConstraints();
101
		gridBagConstraints.anchor = GridBagConstraints.WEST;
102
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
103
		gridBagConstraints.weightx = 1.0;
104
		getJPanel().add(getRadioFileGenerate(), gridBagConstraints);
105

  
106
		buttonGroup2.add(getRadioOpenMemory());
107
		gridBagConstraints = new GridBagConstraints();
108
		gridBagConstraints.gridx = 0;
109
		gridBagConstraints.gridy = 1;
110
		gridBagConstraints.anchor = GridBagConstraints.WEST;
111
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
112
		getJPanel().add(getRadioOpenMemory(), gridBagConstraints);
113
	}
114

  
115
	/**
116
	 * Seccion donde ir?n todas las traducciones invariables del componente
117
	 */
118
	private void translate() {
119
		getRadioFileGenerate().setText(PluginServices.getText(this, "generar_fichero"));
120
		getRadioOpenMemory().setText(PluginServices.getText(this, "abrir_memoria"));
121
		getLabelFilename().setText(PluginServices.getText(this, "nombre_capa") + ":");
122
	}
123

  
124
	/**
125
	 * Devuelve el JRadioButton de generar fichero
126
	 * @return
127
	 */
128
	public JRadioButton getRadioFileGenerate() {
129
		if (jRBFileGenerate == null) {
130
			jRBFileGenerate = new JRadioButton();
131
			jRBFileGenerate.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
132
			jRBFileGenerate.setMargin(new Insets(0, 0, 0, 0));
133
		}
134
		return jRBFileGenerate;
135
	}
136

  
137
	/**
138
	 * Devuelve el JRadioButton de Abrir en memoria
139
	 * @return
140
	 */
141
	public JRadioButton getRadioOpenMemory() {
142
		if (jRBOpenMemory == null) {
143
			jRBOpenMemory = new JRadioButton();
144
			jRBOpenMemory.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
145
			jRBOpenMemory.setMargin(new Insets(0, 0, 0, 0));
146

  
147
			jRBOpenMemory.addItemListener(new ItemListener() {
148
				public void itemStateChanged(ItemEvent evt) {
149
					jRBOpenMemoryStateChanged(evt);
150
				}
151
			});
152
			jRBOpenMemory.setSelected(true);
153
		}
154
		return jRBOpenMemory;
155
	}
156

  
157
	/**
158
	 * This method initializes filenameTextField
159
	 *
160
	 * @return javax.swing.JTextField
161
	 */
162
	private JTextField getFilenameTextField() {
163
		if (filenameTextField == null) {
164
			filenameTextField = new JTextField();
165
			filenameTextField.setPreferredSize(new Dimension(150, filenameTextField.getPreferredSize().height));
166
			fileUtil.addOnlyLayerNameListener(this);
167
		}
168
		return filenameTextField;
169
	}
170

  
171
	/**
172
	 * This method initializes jPNameFile
173
	 *
174
	 * @return javax.swing.JPanel
175
	 */
176
	public JPanel getFileNamePanel() {
177
		if (panelNameFile == null) {
178
			panelNameFile = new JPanel();
179
			panelNameFile.add(getLabelFilename());
180
			panelNameFile.add(getFilenameTextField());
181
			updateNewLayerText();
182
		}
183
		return panelNameFile;
184
	}
185

  
186
	private JLabel getLabelFilename() {
187
		if (labelFilename == null) {
188
			labelFilename = new JLabel();
189
		}
190
		return labelFilename;
191
	}
192

  
193
	/**
194
	 * Establece si esta habilitado o no el cuadro de texto de entrada de nombre de
195
	 * fichero
196
	 * @param value
197
	 */
198
	public void setFilenameEnabled(boolean value) {
199
		getFilenameTextField().setEnabled(value);
200
		getLabelFilename().setEnabled(value);
201
	}
202

  
203
	/**
204
	 * Poner los estados de los RadioButton en caso de que cambien de valor
205
	 * @param evt
206
	 */
207
	protected void jRBOpenMemoryStateChanged(ItemEvent evt) {
208
		if (getRadioOpenMemory().getSelectedObjects() != null) {
209
			setFilenameEnabled(true);
210
		} else {
211
			setFilenameEnabled(false);
212
		}
213
	}
214

  
215
	/**
216
	 * Especificar el nombre de la nueva capa para el recuadro de texto asignando
217
	 * en cada llamada un nombre consecutivo.
218
	 */
219
	public void updateNewLayerText() {
220
		getFilenameTextField().setText(fileUtil.getOnlyLayerName());
221
	}
222

  
223
	/**
224
	 * Establece el texto de la etiqueta del nombre de fichero
225
	 * @param text
226
	 */
227
	public void setLabelFilename(String text) {
228
		getLabelFilename().setText(text);
229
	}
230

  
231
	/**
232
	 * Asigna un valor para el par?metro que informa de si el raster de salida hay
233
	 * que comprimirlo o no. Este valor es necesario cuando el raster de salida
234
	 * es mayor de 4G ya que no se puede crear un tiff tan grande.
235
	 * @param compress true para comprimir el raster de salida y false para no hacerlo.
236
	 */
237
	public void setCompress(boolean compress) {
238
		this.compress = compress;
239
	}
240

  
241
	/**
242
	 * Devuelve la ruta del fichero donde se va a guardar, en caso de guardarse
243
	 * en memoria, calcula el nombre sin preguntar y devuelve la ruta.
244
	 * @return
245
	 */
246
	public String getFileSelected() {
247
		String path = "";
248
		if (getRadioFileGenerate().isSelected()) {
249
			JFileChooser chooser = new JFileChooser("NEW_LAYER_RASTER_PANEL", JFileChooser.getLastPath("NEW_LAYER_RASTER_PANEL", null));
250
			chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero"));
251

  
252
			// A?adimos las extensiones que hayan sido registradas en el driver
253
			ArrayList<String> extList = new ArrayList<String>();
254
			try {
255
				extList = RasterLocator.getManager().getProviderServices().getExtensionsSupported(
256
							lyr.getDataStore().getDataType()[0], 
257
							lyr.getDataStore().getBandCount());
258
			} catch (RasterDriverException e2) {
259
				RasterSwingLibrary.messageBoxError("error_extensiones_soportadas", chooser, e2);
260
				return null;
261
			}
262

  
263
			FileFilter selected = null;
264
			for (int i = 0; i < extList.size(); i++) {
265
				FileFilter filter = new ExtendedFileFilter((String) extList.get(i));
266
				if (extList.get(i).equals("tif")) {
267
					selected = filter;
268
				}
269
				chooser.addChoosableFileFilter(filter);
270
			}
271
			if (selected != null)
272
				chooser.setFileFilter(selected);
273

  
274
			// Cargamos el panel de propiedades en el selector
275
			chooser.setAcceptAllFileFilterUsed(false);
276

  
277
			IWindow w = PluginServices.getMDIManager().getActiveWindow();
278

  
279
			if (!(w instanceof Component))
280
				w = null;
281

  
282
 			if (chooser.showSaveDialog((Component) w) != JFileChooser.APPROVE_OPTION)
283
 				return null;
284

  
285
			JFileChooser.setLastPath("NEW_LAYER_RASTER_PANEL", chooser.getSelectedFile());
286

  
287
			ExtendedFileFilter fileFilter = (ExtendedFileFilter) chooser.getFileFilter();
288
			path = fileFilter.getNormalizedFilename(chooser.getSelectedFile());
289
		} else {
290

  
291
			String file = getFilenameTextField().getText();
292
			if (file.compareTo(fileUtil.getOnlyLayerName()) == 0)
293
				fileUtil.usesOnlyLayerName();
294

  
295
			if (!compress)
296
				path = Utilities.createTempDirectory() + File.separator + file + ".tif";
297
			else
298
				path = Utilities.createTempDirectory() + File.separator + file + ".jp2";
299
			updateNewLayerText();
300
		}
301
		return path;
302
	}
303

  
304
	/**
305
	 * Cuando alguien ha cambiado la propiedad del nombre de la
306
	 * capa se actualiza autom?ticamente
307
	 */
308
	public void actionValueChanged(PropertyEvent e) {
309
		updateNewLayerText();
310
	}
311

  
312
}
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.common/src/main/java/org/gvsig/raster/mainplugin/beans/createlayer/CreateLayerPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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
*/
22
package org.gvsig.raster.mainplugin.beans.createlayer;
23

  
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26
import java.awt.Insets;
27
import java.awt.event.ItemEvent;
28
import java.awt.event.ItemListener;
29

  
30
import javax.swing.BorderFactory;
31
import javax.swing.ButtonGroup;
32
import javax.swing.JPanel;
33
import javax.swing.JRadioButton;
34

  
35
import org.gvsig.andami.PluginServices;
36
import org.gvsig.raster.fmap.layers.FLyrRaster;
37

  
38
/**
39
 * Panel para unificar las propiedades de generacion de capas nuevas en ficheros
40
 * o solo en visualizacion.
41
 * 
42
 * @version 10/03/2008
43
 * @author BorSanZa - Borja S?nchez Zamorano 
44
 */
45
public class CreateLayerPanel {
46
	private JPanel        panel         = null;
47
	private JRadioButton  jRBOnlyView   = null;
48
	private JRadioButton  jRBNewLayer   = null;
49
	private NewLayerPanel panelNewLayer = null;
50
	private FLyrRaster    lyr           = null;
51

  
52
	/**
53
	 * Constructor de un CreateLayerPanel
54
	 */
55
	public CreateLayerPanel(FLyrRaster lyr) {
56
		this.lyr = lyr;
57
		initialize();
58
		translate();
59
	}
60
	
61
	/**
62
	 * Disables the new layer option. It is useful for remote
63
	 * services
64
	 */
65
	public void disableNewLayer() {
66
		getRadioOnlyView().setSelected(true);
67
		getRadioNewLayer().setEnabled(false);
68
	}
69
	
70
	/**
71
	 * Devuelve el panel principal
72
	 * @return
73
	 */
74
	public JPanel getJPanel() {
75
		if (panel == null) {
76
			panel = new JPanel();
77
		}
78
		return panel;
79
	}
80

  
81
	/**
82
	 * Seccion donde ir?n todas las traducciones invariables del componente
83
	 */
84
	private void translate() {
85
		getRadioOnlyView().setText(PluginServices.getText(this, "solo_visualizacion"));
86
		getRadioNewLayer().setText(PluginServices.getText(this, "capa_nueva"));
87
	}
88
	
89
	/**
90
	 * Inicializar el panel de CreateLayer
91
	 */
92
	private void initialize() {
93
		ButtonGroup buttonGroup1;
94
		GridBagConstraints gridBagConstraints;
95

  
96
		getJPanel().setLayout(new GridBagLayout());
97
		
98
		buttonGroup1 = new ButtonGroup();
99
		buttonGroup1.add(getRadioOnlyView());
100

  
101
		gridBagConstraints = new GridBagConstraints();
102
		gridBagConstraints.gridx = 0;
103
		gridBagConstraints.gridy = 0;
104
		gridBagConstraints.anchor = GridBagConstraints.WEST;
105
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
106
		getJPanel().add(getRadioOnlyView(), gridBagConstraints);
107

  
108
		buttonGroup1.add(getRadioNewLayer());
109

  
110
		gridBagConstraints = new GridBagConstraints();
111
		gridBagConstraints.gridx = 0;
112
		gridBagConstraints.gridy = 1;
113
		gridBagConstraints.anchor = GridBagConstraints.WEST;
114
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
115
		getJPanel().add(getRadioNewLayer(), gridBagConstraints);
116
		
117
		gridBagConstraints = new GridBagConstraints();
118
		gridBagConstraints.gridx = 0;
119
		gridBagConstraints.gridy = 2;
120
		gridBagConstraints.anchor = GridBagConstraints.WEST;
121
		gridBagConstraints.insets = new Insets(3, 3, 3, 3);
122
		getJPanel().add(getPanelNewLayer().getJPanel(), gridBagConstraints);
123
	}
124
	
125
	public NewLayerPanel getPanelNewLayer() {
126
		if (panelNewLayer == null)
127
			panelNewLayer = new NewLayerPanel(lyr);
128
		return panelNewLayer;
129
	}
130
	
131
	/**
132
	 * Poner los estados de los RadioButton en caso de que cambien de valor
133
	 * @param evt
134
	 */
135
	private void jRBNewLayerStateChanged(ItemEvent evt) {
136
		if (getRadioNewLayer().getSelectedObjects() != null) {
137
			getPanelNewLayer().getRadioFileGenerate().setEnabled(true);
138
			getPanelNewLayer().getRadioOpenMemory().setEnabled(true);
139
			if (getPanelNewLayer().getRadioOpenMemory().getSelectedObjects() != null)
140
				getPanelNewLayer().setFilenameEnabled(true);
141
			else
142
				getPanelNewLayer().setFilenameEnabled(false);
143
		} else {
144
			getPanelNewLayer().getRadioFileGenerate().setEnabled(false);
145
			getPanelNewLayer().getRadioOpenMemory().setEnabled(false);
146
			getPanelNewLayer().setFilenameEnabled(false);
147
		}
148
	}
149

  
150
	/**
151
	 * Especifica si se generara solo en la vista o se guardara en un fichero
152
	 * @param enabled
153
	 */
154
	public void setOnlyView(boolean enabled) {
155
		getRadioOnlyView().setSelected(enabled);
156
	}
157

  
158
	/**
159
	 * Devuelve el JRadioButton de Solo vista
160
	 * @return
161
	 */
162
	private JRadioButton getRadioOnlyView() {
163
		if (jRBOnlyView == null) {
164
			jRBOnlyView = new JRadioButton();
165
			jRBOnlyView.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
166
			jRBOnlyView.setMargin(new Insets(0, 0, 0, 0));
167
		}
168
		return jRBOnlyView;
169
	}
170
	
171
	/**
172
	 * Devuelve el JRadioButton de nueva capa
173
	 * @return
174
	 */
175
	private JRadioButton getRadioNewLayer() {
176
		if (jRBNewLayer == null) {
177
			jRBNewLayer = new JRadioButton();
178
			jRBNewLayer.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
179
			jRBNewLayer.setMargin(new Insets(0, 0, 0, 0));
180
			jRBNewLayer.addItemListener(new ItemListener() {
181
				public void itemStateChanged(ItemEvent evt) {
182
					jRBNewLayerStateChanged(evt);
183
				}
184
			});
185
			jRBNewLayer.setSelected(true);
186
		}
187
		return jRBNewLayer;
188
	}
189
	
190
	/**
191
	 * This method initializes jPNameFile
192
	 *
193
	 * @return javax.swing.JPanel
194
	 */
195
	public JPanel getFileNamePanel() {
196
		return getPanelNewLayer().getFileNamePanel();
197
	}
198
	
199
	/**
200
	 * Establece el texto de la etiqueta del nombre de fichero
201
	 * @param text
202
	 */
203
	public void setLabelFilename(String text) {
204
		getPanelNewLayer().setLabelFilename(text);
205
	}
206
	
207
	public boolean isNewLayerSelected() {
208
		return getRadioNewLayer().isSelected();
209
	}
210

  
211
	public boolean isOnlyViewSelected() {
212
		return getRadioOnlyView().isSelected();
213
	}
214
	
215
	/**
216
	 * Asigna un valor para el par?metro que informa de si el raster de salida hay
217
	 * que comprimirlo o no. Este valor es necesario cuando el raster de salida 
218
	 * es mayor de 4G ya que no se puede crear un tiff tan grande.
219
	 * @param compress true para comprimir el raster de salida y false para no hacerlo.
220
	 */
221
	public void setCompress(boolean compress) {
222
		getPanelNewLayer().setCompress(compress);
223
	}
224
	
225
	/**
226
	 * Devuelve la ruta del fichero donde se va a guardar, en caso de guardarse
227
	 * en memoria, calcula el nombre sin preguntar y devuelve la ruta.
228
	 * @return
229
	 */
230
	public String getFileSelected() {
231
		return getPanelNewLayer().getFileSelected();
232
	}
233
	
234
	public void updateNewLayerText() {
235
		getPanelNewLayer().updateNewLayerText();
236
	}
237
}
org.gvsig.raster/tags/org.gvsig.raster-2.2.246/org.gvsig.raster.app/org.gvsig.raster.app.common/src/main/java/org/gvsig/raster/mainplugin/GenericToolBarExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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
*/
22
package org.gvsig.raster.mainplugin;
23

  
24
import java.awt.Dimension;
25

  
26
import org.gvsig.andami.IconThemeHelper;
27
import org.gvsig.andami.PluginServices;
28
import org.gvsig.andami.plugins.Extension;
29
import org.gvsig.andami.ui.mdiFrame.MDIFrame;
30
import org.gvsig.app.project.documents.view.ViewDocument;
31
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
32
import org.gvsig.fmap.mapcontext.MapContext;
33
import org.gvsig.i18n.Messages;
34
import org.gvsig.raster.mainplugin.toolbar.GenericToolBarMenuItem;
35
import org.gvsig.raster.mainplugin.toolbar.GenericToolBarPanel;
36
import org.gvsig.tools.ToolsLocator;
37
import org.gvsig.tools.extensionpoint.ExtensionPoint;
38
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
39

  
40
/**
41
 * Extension para la barra de herramientas generica
42
 *
43
 * @author BorSanZa - Borja S?nchez Zamorano
44
 */
45
public class GenericToolBarExtension extends Extension {
46
	private GenericToolBarPanel toolBar = null;
47

  
48
	/**
49
	 * Crea y devuelve la barra de herramientas
50
	 * @return
51
	 */
52
	private GenericToolBarPanel getGenericToolBarPanel() {
53
		if (toolBar == null) {
54
			MDIFrame f = (MDIFrame) PluginServices.getMainFrame();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff