Revision 369
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/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 |
|
|
5 |
<groupId>org.gvsig</groupId> |
|
6 |
<artifactId>org.gvsig.toolbox</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<version>1.0.65</version> |
|
10 |
|
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.desktop</artifactId> |
|
14 |
<version>2.0.248</version> |
|
15 |
</parent> |
|
16 |
|
|
17 |
<scm> |
|
18 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-toolbox/org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65</connection> |
|
19 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-toolbox/org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65</developerConnection> |
|
20 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-toolbox/repository/show/org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65</url> |
|
21 |
</scm> |
|
22 |
|
|
23 |
<repositories> |
|
24 |
<repository> |
|
25 |
<id>gvsig-public-http-repository</id> |
|
26 |
<name>gvSIG maven public HTTP repository</name> |
|
27 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
28 |
<releases> |
|
29 |
<enabled>true</enabled> |
|
30 |
<updatePolicy>daily</updatePolicy> |
|
31 |
<checksumPolicy>warn</checksumPolicy> |
|
32 |
</releases> |
|
33 |
<snapshots> |
|
34 |
<enabled>true</enabled> |
|
35 |
<updatePolicy>daily</updatePolicy> |
|
36 |
<checksumPolicy>warn</checksumPolicy> |
|
37 |
</snapshots> |
|
38 |
</repository> |
|
39 |
</repositories> |
|
40 |
|
|
41 |
<properties> |
|
42 |
<maven.compiler.source>1.6</maven.compiler.source> |
|
43 |
<maven.compiler.target>1.6</maven.compiler.target> |
|
44 |
</properties> |
|
45 |
|
|
46 |
<build> |
|
47 |
|
|
48 |
<pluginManagement> |
|
49 |
<plugins> |
|
50 |
<plugin> |
|
51 |
<groupId>org.codehaus.mojo</groupId> |
|
52 |
<artifactId>animal-sniffer-maven-plugin</artifactId> |
|
53 |
<version>1.7</version> |
|
54 |
</plugin> |
|
55 |
</plugins> |
|
56 |
</pluginManagement> |
|
57 |
|
|
58 |
<plugins> |
|
59 |
<plugin> |
|
60 |
<groupId>org.apache.maven.plugins</groupId> |
|
61 |
<artifactId>maven-compiler-plugin</artifactId> |
|
62 |
<version>2.0.2</version> |
|
63 |
<configuration> |
|
64 |
<source>1.6</source> |
|
65 |
<target>1.6</target> |
|
66 |
<encoding>ISO-8859-1</encoding> |
|
67 |
</configuration> |
|
68 |
</plugin> |
|
69 |
|
|
70 |
<plugin> |
|
71 |
<groupId>org.codehaus.mojo</groupId> |
|
72 |
<artifactId>animal-sniffer-maven-plugin</artifactId> |
|
73 |
<executions> |
|
74 |
<execution> |
|
75 |
<id>check-java-api</id> |
|
76 |
<phase>test</phase> |
|
77 |
<goals> |
|
78 |
<goal>check</goal> |
|
79 |
</goals> |
|
80 |
<configuration> |
|
81 |
<signature> |
|
82 |
<groupId>org.codehaus.mojo.signature |
|
83 |
</groupId> |
|
84 |
<artifactId>java16</artifactId> |
|
85 |
<version>1.0</version> |
|
86 |
</signature> |
|
87 |
</configuration> |
|
88 |
</execution> |
|
89 |
</executions> |
|
90 |
</plugin> |
|
91 |
|
|
92 |
<plugin> |
|
93 |
<groupId>org.apache.maven.plugins</groupId> |
|
94 |
<artifactId>maven-release-plugin</artifactId> |
|
95 |
<configuration> |
|
96 |
<tagBase>https://devel.gvsig.org/svn/gvsig-toolbox/org.gvsig.toolbox/tags/</tagBase> |
|
97 |
<goals>deploy</goals> |
|
98 |
</configuration> |
|
99 |
</plugin> |
|
100 |
|
|
101 |
</plugins> |
|
102 |
</build> |
|
103 |
|
|
104 |
<dependencyManagement> |
|
105 |
<dependencies> |
|
106 |
<dependency> |
|
107 |
<groupId>gishur</groupId> |
|
108 |
<artifactId>gishur_x</artifactId> |
|
109 |
<version>unknown</version> |
|
110 |
</dependency> |
|
111 |
<dependency> |
|
112 |
<groupId>gishur</groupId> |
|
113 |
<artifactId>gishur_core</artifactId> |
|
114 |
<version>unknown</version> |
|
115 |
</dependency> |
|
116 |
<dependency> |
|
117 |
<groupId>com.vividsolutions</groupId> |
|
118 |
<artifactId>jts</artifactId> |
|
119 |
<version>1.13</version> |
|
120 |
</dependency> |
|
121 |
<dependency> |
|
122 |
<groupId>org.gvsig</groupId> |
|
123 |
<artifactId>org.gvsig.toolbox.algorithm</artifactId> |
|
124 |
<version>1.0.65</version> |
|
125 |
</dependency> |
|
126 |
<dependency> |
|
127 |
<groupId>org.gvsig</groupId> |
|
128 |
<artifactId>org.gvsig.toolbox.core</artifactId> |
|
129 |
<version>1.0.65</version> |
|
130 |
</dependency> |
|
131 |
<dependency> |
|
132 |
<groupId>org.gvsig</groupId> |
|
133 |
<artifactId>org.gvsig.toolbox.gui</artifactId> |
|
134 |
<version>1.0.65</version> |
|
135 |
</dependency> |
|
136 |
<dependency> |
|
137 |
<groupId>org.gvsig</groupId> |
|
138 |
<artifactId>org.gvsig.toolbox.math</artifactId> |
|
139 |
<version>1.0.65</version> |
|
140 |
</dependency> |
|
141 |
<dependency> |
|
142 |
<groupId>gnu.trove</groupId> |
|
143 |
<artifactId>trove</artifactId> |
|
144 |
<version>0.1.8</version> |
|
145 |
</dependency> |
|
146 |
<dependency> |
|
147 |
<groupId>org.gvsig.legacy</groupId> |
|
148 |
<artifactId>jama</artifactId> |
|
149 |
<version>1.0.2</version> |
|
150 |
</dependency> |
|
151 |
<dependency> |
|
152 |
<groupId>org.nfunk</groupId> |
|
153 |
<artifactId>jep</artifactId> |
|
154 |
<version>2.4.0</version> |
|
155 |
</dependency> |
|
156 |
<dependency> |
|
157 |
<groupId>commons-codec</groupId> |
|
158 |
<artifactId>commons-codec</artifactId> |
|
159 |
<version>1.8</version> |
|
160 |
</dependency> |
|
161 |
<dependency> |
|
162 |
<groupId>es.unex</groupId> |
|
163 |
<artifactId>sextante_wps</artifactId> |
|
164 |
<version>0.6.0</version> |
|
165 |
</dependency> |
|
166 |
<dependency> |
|
167 |
<groupId>es.unex</groupId> |
|
168 |
<artifactId>libDocEngines</artifactId> |
|
169 |
<version>0.6.0</version> |
|
170 |
</dependency> |
|
171 |
<dependency> |
|
172 |
<groupId>org.beanshell</groupId> |
|
173 |
<artifactId>bsh</artifactId> |
|
174 |
<version>2.0b4</version> |
|
175 |
</dependency> |
|
176 |
<dependency> |
|
177 |
<groupId>org.japura</groupId> |
|
178 |
<artifactId>org.japura</artifactId> |
|
179 |
<version>1.14.0</version> |
|
180 |
</dependency> |
|
181 |
<!-- <dependency> |
|
182 |
<groupId>commons-codec</groupId> |
|
183 |
<artifactId>commons-codec</artifactId> |
|
184 |
<version>1.8</version> |
|
185 |
</dependency>--> |
|
186 |
</dependencies> |
|
187 |
</dependencyManagement> |
|
188 |
|
|
189 |
<modules> |
|
190 |
<module>org.gvsig.toolbox.math</module> |
|
191 |
<module>org.gvsig.toolbox.gui</module> |
|
192 |
<module>org.gvsig.toolbox.core</module> |
|
193 |
<module>org.gvsig.toolbox.algorithm</module> |
|
194 |
</modules> |
|
195 |
</project> |
|
0 | 196 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/build.xml | ||
---|---|---|
1 |
<project name="SEXTANTE_LIB" default="generate-without-source" basedir="."> |
|
2 |
<description> |
|
3 |
SEXTANTE_GUI |
|
4 |
</description> |
|
5 |
<property name="version.number" value="0.7"/> |
|
6 |
|
|
7 |
<target name="generate-without-source" |
|
8 |
description="generate the distribution without the source file"> |
|
9 |
|
|
10 |
<tstamp> |
|
11 |
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" /> |
|
12 |
</tstamp> |
|
13 |
|
|
14 |
<manifest file="MANIFEST.MF"> |
|
15 |
<attribute name="Implementation-Version" |
|
16 |
value="${version.number}"/> |
|
17 |
<attribute name="Built-Date" value="${TODAY}"/> |
|
18 |
</manifest> |
|
19 |
|
|
20 |
<jar jarfile="../dist/sextante_gui.jar" manifest="MANIFEST.MF"> |
|
21 |
<fileset dir="bin"> |
|
22 |
<include name="**"/> |
|
23 |
</fileset> |
|
24 |
</jar> |
|
25 |
|
|
26 |
<jar jarfile="../dist/sextante_gui.jar" update ="true"> |
|
27 |
<fileset dir="."> |
|
28 |
<include name="i18n/**"/> |
|
29 |
</fileset> |
|
30 |
</jar> |
|
31 |
|
|
32 |
<jar jarfile="../dist/sextante_gui.jar" update ="true"> |
|
33 |
<fileset dir="."> |
|
34 |
<include name="images/**"/> |
|
35 |
<include name="grass/**"/> |
|
36 |
</fileset> |
|
37 |
</jar> |
|
38 |
|
|
39 |
<copy todir="../dist"> |
|
40 |
<fileset dir="lib" includes="**"/> |
|
41 |
</copy> |
|
42 |
|
|
43 |
</target> |
|
44 |
|
|
45 |
</project> |
|
0 | 46 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/sextante_grass.bat | ||
---|---|---|
1 |
set HOME=%USERPROFILE% |
|
2 |
set PATH=%GRASSDIR%\msys\bin;%PATH% |
|
3 |
set PATH=%GRASSDIR%\extrabin;%GRASSDIR%\extralib;%PATH% |
|
4 |
set PATH=%GRASSDIR%\tcl-tk\bin;%GRASSDIR%\sqlite\bin;%GRASSDIR%\gpsbabel;%PATH% |
|
5 |
set GRASS_HTML_BROWSER=%PROGRAMFILES%/Internet Explorer/iexplore.exe |
|
6 |
set GRASS_PROJSHARE=%GRASSDIR%\proj |
|
7 |
set PYTHONHOME=%GRASSDIR%\Python25 |
|
8 |
set WINGISBASE=%GRASSDIR% |
|
9 |
set GISBASE=%GRASSDIR% |
|
10 |
set SAVEPATH=%PATH% |
|
11 |
set PATH=%WINGISBASE%\bin;%WINGISBASE%\lib;%PATH% |
|
12 |
set GISRC=%HOME%\.grassrc6 |
|
13 |
|
|
14 |
g.gisenv set="MAPSET=%MAPSET%" |
|
15 |
g.gisenv set="LOCATION=%LOCATION_NAME%" |
|
16 |
g.gisenv set="LOCATION_NAME=%LOCATION_NAME%" |
|
17 |
g.gisenv set="GISDBASE=%GISDBASE%" |
|
18 |
|
|
19 |
set GRASS_VERSION=6.4.0RC5 |
|
20 |
|
|
21 |
set GRASS_PAGER=more |
|
22 |
if "%GRASS_WISH%"=="" set GRASS_WISH=wish.exe |
|
23 |
if "%GRASS_SH%"=="" set GRASS_SH=c:\msys\1.0\bin\sh.exe |
|
24 |
if "%GRASS_HTML_BROWSER%"=="" set GRASS_HTML_BROWSER=%SYSTEMDRIVE%/PROGRA~1/INTERN~1/IEXPLORE.EXE |
|
25 |
if "%GRASS_PROJSHARE%"=="" set GRASS_PROJSHARE=/c/Programs/GIS/OSGeo4W/share/proj |
|
26 |
|
|
27 |
set PATHEXT=%PATHEXT%;.PY |
|
28 |
|
|
29 |
g.gisenv "set=GRASS_GUI=text" |
|
30 |
|
|
31 |
call "%GRASS_BATCH_JOB%" |
|
32 |
|
|
33 |
"%WINGISBASE%\etc\clean_temp" > NUL: |
|
34 |
|
|
35 |
set PATH=%SAVEPATH% |
|
36 |
set SAVEPATH= |
|
37 |
|
|
38 |
rem exit |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/MANIFEST.MF | ||
---|---|---|
1 |
Manifest-Version: 1.0 |
|
2 |
Ant-Version: Apache Ant 1.7.1 |
|
3 |
Created-By: 20.1-b02 (Sun Microsystems Inc.) |
|
4 |
Implementation-Version: 0.7 |
|
5 |
Built-Date: 2013-03-04 16:06:37 |
|
6 |
|
|
0 | 7 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/MultipleInputSelectionPanel.java | ||
---|---|---|
1 |
//package es.unex.sextante.gui.algorithm; |
|
2 |
// |
|
3 |
//import info.clearthought.layout.TableLayout; |
|
4 |
//import info.clearthought.layout.TableLayoutConstants; |
|
5 |
// |
|
6 |
//import java.awt.Frame; |
|
7 |
//import java.awt.event.ActionEvent; |
|
8 |
//import java.awt.event.ActionListener; |
|
9 |
//import java.util.ArrayList; |
|
10 |
// |
|
11 |
//import javax.swing.JButton; |
|
12 |
//import javax.swing.JPanel; |
|
13 |
//import javax.swing.JTextField; |
|
14 |
// |
|
15 |
//import es.unex.sextante.core.Sextante; |
|
16 |
// |
|
17 |
///** |
|
18 |
// * A panel with a text field and a button. The text field displays a text representation of a multiple selection. Clicking the |
|
19 |
// * button shows a dialog to perform a multiple selection |
|
20 |
// * |
|
21 |
// * @author volaya |
|
22 |
// * |
|
23 |
// */ |
|
24 |
//public class MultipleInputSelectionPanel |
|
25 |
// extends |
|
26 |
// JPanel { |
|
27 |
// |
|
28 |
// private final Object[] m_Values; |
|
29 |
// private ArrayList m_SelectedIndices = new ArrayList(); |
|
30 |
// private JTextField textField; |
|
31 |
// private JButton button; |
|
32 |
// |
|
33 |
// |
|
34 |
// /** |
|
35 |
// * Creates a new panel |
|
36 |
// * |
|
37 |
// * @param values |
|
38 |
// * an array of values to select from |
|
39 |
// */ |
|
40 |
// public MultipleInputSelectionPanel(final Object[] values) { |
|
41 |
// |
|
42 |
// super(); |
|
43 |
// |
|
44 |
// m_Values = values; |
|
45 |
// |
|
46 |
// initGUI(); |
|
47 |
// |
|
48 |
// } |
|
49 |
// |
|
50 |
// |
|
51 |
// private void initGUI() { |
|
52 |
// |
|
53 |
// button = new JButton("..."); |
|
54 |
// textField = new JTextField(Sextante.getText("0_elements_selected")); |
|
55 |
// textField.setEditable(false); |
|
56 |
// |
|
57 |
// button.addActionListener(new ActionListener() { |
|
58 |
// public void actionPerformed(final ActionEvent evt) { |
|
59 |
// btnActionPerformed(evt); |
|
60 |
// } |
|
61 |
// }); |
|
62 |
// |
|
63 |
// final TableLayout thisLayout = new TableLayout(new double[][] { { TableLayoutConstants.FILL, 25.0 }, { TableLayoutConstants.FILL } }); |
|
64 |
// this.setLayout(thisLayout); |
|
65 |
// this.add(textField, "0, 0"); |
|
66 |
// this.add(button, "1, 0"); |
|
67 |
// } |
|
68 |
// |
|
69 |
// |
|
70 |
// /** |
|
71 |
// * Returns a list of all the objects selected using this panel |
|
72 |
// * |
|
73 |
// * @return a list of selected objects |
|
74 |
// */ |
|
75 |
// public ArrayList getSelectedObjects() { |
|
76 |
// |
|
77 |
// int iIndex; |
|
78 |
// final ArrayList selected = new ArrayList(); |
|
79 |
// |
|
80 |
// for (int i = 0; i < m_SelectedIndices.size(); i++) { |
|
81 |
// iIndex = ((Integer) m_SelectedIndices.get(i)).intValue(); |
|
82 |
// selected.add(this.m_Values[iIndex]); |
|
83 |
// } |
|
84 |
// |
|
85 |
// return selected; |
|
86 |
// |
|
87 |
// } |
|
88 |
// |
|
89 |
// |
|
90 |
// private void btnActionPerformed(final ActionEvent e) { |
|
91 |
// |
|
92 |
// int iCount; |
|
93 |
// final StringBuffer sText = new StringBuffer(); |
|
94 |
// |
|
95 |
// final Frame window = new Frame(); |
|
96 |
// |
|
97 |
// final MultipleInputSelectionDialog dialog = new MultipleInputSelectionDialog(window, m_Values, m_SelectedIndices); |
|
98 |
// |
|
99 |
// dialog.pack(); |
|
100 |
// dialog.setVisible(true); |
|
101 |
// |
|
102 |
// iCount = m_SelectedIndices.size(); |
|
103 |
// sText.append(Integer.toString(iCount)); |
|
104 |
// if (iCount == 1) { |
|
105 |
// sText.append(" " + Sextante.getText("element_selected")); |
|
106 |
// } |
|
107 |
// else { |
|
108 |
// sText.append(" " + Sextante.getText("elements_selected")); |
|
109 |
// } |
|
110 |
// |
|
111 |
// textField.setText(sText.toString()); |
|
112 |
// |
|
113 |
// } |
|
114 |
// |
|
115 |
// |
|
116 |
// public Object[] getValues() { |
|
117 |
// |
|
118 |
// return m_Values; |
|
119 |
// |
|
120 |
// } |
|
121 |
// |
|
122 |
// |
|
123 |
// public void setSelectedIndices(final ArrayList selectedIndices) { |
|
124 |
// |
|
125 |
// m_SelectedIndices = selectedIndices; |
|
126 |
// final StringBuffer sText = new StringBuffer(); |
|
127 |
// final int iCount = m_SelectedIndices.size(); |
|
128 |
// sText.append(Integer.toString(iCount)); |
|
129 |
// if (iCount == 1) { |
|
130 |
// sText.append(" " + Sextante.getText("element_selected")); |
|
131 |
// } |
|
132 |
// else { |
|
133 |
// sText.append(" " + Sextante.getText("elements_selected")); |
|
134 |
// } |
|
135 |
// |
|
136 |
// textField.setText(sText.toString()); |
|
137 |
// |
|
138 |
// } |
|
139 |
// |
|
140 |
//} |
|
0 | 141 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/MultipleInputSelectionDialog.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.algorithm; |
|
2 |
|
|
3 |
import info.clearthought.layout.TableLayout; |
|
4 |
import info.clearthought.layout.TableLayoutConstants; |
|
5 |
|
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.Frame; |
|
8 |
import java.awt.event.ActionEvent; |
|
9 |
import java.awt.event.ActionListener; |
|
10 |
import java.util.ArrayList; |
|
11 |
|
|
12 |
import javax.swing.BorderFactory; |
|
13 |
import javax.swing.JButton; |
|
14 |
import javax.swing.JCheckBox; |
|
15 |
import javax.swing.JDialog; |
|
16 |
import javax.swing.JPanel; |
|
17 |
import javax.swing.JScrollPane; |
|
18 |
import javax.swing.border.BevelBorder; |
|
19 |
|
|
20 |
import es.unex.sextante.core.Sextante; |
|
21 |
|
|
22 |
/** |
|
23 |
* A dialog for selecting multiples elements (raster layers, vector layers or tables) |
|
24 |
* |
|
25 |
* @author volaya |
|
26 |
* |
|
27 |
*/ |
|
28 |
public class MultipleInputSelectionDialog |
|
29 |
extends |
|
30 |
JDialog { |
|
31 |
|
|
32 |
private final ArrayList m_SelectedIndices; |
|
33 |
private final ArrayList m_SelectedIndicesOrg; |
|
34 |
|
|
35 |
private JPanel jPanelMain; |
|
36 |
private CheckBoxList jList; |
|
37 |
private JButton jButtonCancel; |
|
38 |
private JButton jButtonOK; |
|
39 |
private JScrollPane jScrollPane; |
|
40 |
private JButton jButtonSelectAll; |
|
41 |
private JButton jButtonDeselectAll; |
|
42 |
|
|
43 |
|
|
44 |
/** |
|
45 |
* Creates a new dialog |
|
46 |
* |
|
47 |
* @param window |
|
48 |
* the parent window |
|
49 |
* @param values |
|
50 |
* an array of possible values |
|
51 |
* @param selectedIndices |
|
52 |
* a list the indices of the values to show as selected when opening this dialog. If the user selects ok, the |
|
53 |
* new selection will be stored in this arraylist, clearing the previous selection. If not, it will be left |
|
54 |
* unchanged |
|
55 |
*/ |
|
56 |
public MultipleInputSelectionDialog(final Frame window, |
|
57 |
final Object[] values, |
|
58 |
final ArrayList selectedIndices) { |
|
59 |
|
|
60 |
super(window, "", true); |
|
61 |
|
|
62 |
this.setResizable(false); |
|
63 |
|
|
64 |
m_SelectedIndicesOrg = selectedIndices; |
|
65 |
m_SelectedIndices = (ArrayList) selectedIndices.clone(); |
|
66 |
initGUI(values); |
|
67 |
|
|
68 |
} |
|
69 |
|
|
70 |
|
|
71 |
private void initGUI(final Object[] values) { |
|
72 |
|
|
73 |
int i; |
|
74 |
int iIndex; |
|
75 |
final JCheckBox[] checkBox = new JCheckBox[values.length]; |
|
76 |
|
|
77 |
try { |
|
78 |
this.setTitle(Sextante.getText("Multiple_selection")); |
|
79 |
for (i = 0; i < values.length; i++) { |
|
80 |
checkBox[i] = new JCheckBox(values[i].toString()); |
|
81 |
} |
|
82 |
{ |
|
83 |
jPanelMain = new JPanel(); |
|
84 |
final TableLayout jPanelMainLayout = new TableLayout(new double[][] { { 5, TableLayoutConstants.FILL, 5, TableLayoutConstants.FILL, 5.0 }, |
|
85 |
{ 5, TableLayoutConstants.FILL, 5, 25, 5, 25, 5 } }); |
|
86 |
jPanelMain.setLayout(jPanelMainLayout); |
|
87 |
getContentPane().add(jPanelMain, BorderLayout.CENTER); |
|
88 |
jPanelMain.setPreferredSize(new java.awt.Dimension(357, 335)); |
|
89 |
{ |
|
90 |
|
|
91 |
jList = new CheckBoxList(); |
|
92 |
jList.setListData(checkBox); |
|
93 |
jList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); |
|
94 |
jScrollPane = new JScrollPane(); |
|
95 |
jScrollPane.setViewportView(jList); |
|
96 |
jPanelMain.add(jScrollPane, "1,1,3,1"); |
|
97 |
} |
|
98 |
{ |
|
99 |
jButtonOK = new JButton(); |
|
100 |
jPanelMain.add(jButtonOK, "1,5"); |
|
101 |
jButtonOK.setText(Sextante.getText("OK")); |
|
102 |
jButtonOK.addActionListener(new ActionListener() { |
|
103 |
public void actionPerformed(final ActionEvent evt) { |
|
104 |
btnOKActionPerformed(evt); |
|
105 |
} |
|
106 |
}); |
|
107 |
} |
|
108 |
{ |
|
109 |
jButtonCancel = new JButton(); |
|
110 |
jPanelMain.add(jButtonCancel, "3,5"); |
|
111 |
jButtonCancel.setText(Sextante.getText("Cancel")); |
|
112 |
jButtonCancel.addActionListener(new ActionListener() { |
|
113 |
public void actionPerformed(final ActionEvent evt) { |
|
114 |
btnCancelActionPerformed(evt); |
|
115 |
} |
|
116 |
}); |
|
117 |
} |
|
118 |
{ |
|
119 |
jButtonSelectAll = new JButton(); |
|
120 |
jPanelMain.add(jButtonSelectAll, "1,3"); |
|
121 |
jButtonSelectAll.setText(Sextante.getText("Select_all")); |
|
122 |
jButtonSelectAll.addActionListener(new ActionListener() { |
|
123 |
public void actionPerformed(final ActionEvent evt) { |
|
124 |
selectAll(true); |
|
125 |
} |
|
126 |
}); |
|
127 |
} |
|
128 |
{ |
|
129 |
jButtonDeselectAll = new JButton(); |
|
130 |
jPanelMain.add(jButtonDeselectAll, "3,3"); |
|
131 |
jButtonDeselectAll.setText(Sextante.getText("Deselect_all")); |
|
132 |
jButtonDeselectAll.addActionListener(new ActionListener() { |
|
133 |
public void actionPerformed(final ActionEvent evt) { |
|
134 |
selectAll(false); |
|
135 |
} |
|
136 |
}); |
|
137 |
} |
|
138 |
} |
|
139 |
for (i = 0; i < m_SelectedIndices.size(); i++) { |
|
140 |
iIndex = ((Integer) m_SelectedIndices.get(i)).intValue(); |
|
141 |
checkBox[iIndex].setSelected(true); |
|
142 |
} |
|
143 |
{ |
|
144 |
this.setSize(365, 369); |
|
145 |
} |
|
146 |
} |
|
147 |
catch (final Exception e) { |
|
148 |
Sextante.addErrorToLog(e); |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
|
|
153 |
protected void selectAll(final boolean bSelect) { |
|
154 |
|
|
155 |
int i; |
|
156 |
|
|
157 |
for (i = 0; i < jList.getModel().getSize(); i++) { |
|
158 |
final JCheckBox checkBox = (JCheckBox) jList.getModel().getElementAt(i); |
|
159 |
checkBox.setSelected(bSelect); |
|
160 |
} |
|
161 |
jList.updateUI(); |
|
162 |
|
|
163 |
} |
|
164 |
|
|
165 |
|
|
166 |
private void btnOKActionPerformed(final ActionEvent evt) { |
|
167 |
|
|
168 |
int i; |
|
169 |
m_SelectedIndicesOrg.clear(); |
|
170 |
|
|
171 |
for (i = 0; i < jList.getModel().getSize(); i++) { |
|
172 |
final JCheckBox checkBox = (JCheckBox) jList.getModel().getElementAt(i); |
|
173 |
if (checkBox.isSelected()) { |
|
174 |
m_SelectedIndicesOrg.add(new Integer(i)); |
|
175 |
} |
|
176 |
} |
|
177 |
|
|
178 |
dispose(); |
|
179 |
setVisible(false); |
|
180 |
|
|
181 |
} |
|
182 |
|
|
183 |
|
|
184 |
private void btnCancelActionPerformed(final ActionEvent evt) { |
|
185 |
|
|
186 |
dispose(); |
|
187 |
setVisible(false); |
|
188 |
|
|
189 |
|
|
190 |
} |
|
191 |
} |
|
0 | 192 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/FieldComboBoxRenderer.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.algorithm; |
|
2 |
|
|
3 |
/* |
|
4 |
* To change this license header, choose License Headers in Project Properties. |
|
5 |
* To change this template file, choose Tools | Templates |
|
6 |
* and open the template in the editor. |
|
7 |
*/ |
|
8 |
import java.awt.Component; |
|
9 |
|
|
10 |
import javax.swing.DefaultListCellRenderer; |
|
11 |
import javax.swing.Icon; |
|
12 |
import javax.swing.JLabel; |
|
13 |
import javax.swing.JList; |
|
14 |
import javax.swing.ListCellRenderer; |
|
15 |
|
|
16 |
public class FieldComboBoxRenderer implements ListCellRenderer { |
|
17 |
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer(); |
|
18 |
|
|
19 |
@Override |
|
20 |
public Component getListCellRendererComponent(JList list, Object value, int index, |
|
21 |
boolean isSelected, boolean cellHasFocus) { |
|
22 |
|
|
23 |
JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, |
|
24 |
isSelected, cellHasFocus); |
|
25 |
|
|
26 |
if (value instanceof FieldDescriptionComboBox) { |
|
27 |
FieldDescriptionComboBox v = (FieldDescriptionComboBox) value; |
|
28 |
Icon theIcon = new IconFieldComboBoxRenderer(v.getFieldType()); |
|
29 |
String name = v.getDescription() + " ["+v.getFieldType()+"]"; |
|
30 |
|
|
31 |
renderer.setIcon(theIcon); |
|
32 |
renderer.setText(name); |
|
33 |
} |
|
34 |
return renderer; |
|
35 |
} |
|
36 |
} |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/OutputParameterContainer.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.algorithm; |
|
2 |
|
|
3 |
/** |
|
4 |
* A class representing a output object key and the component used to introduce its value (i.e. its associated filename) |
|
5 |
* |
|
6 |
* @author volaya |
|
7 |
* |
|
8 |
*/ |
|
9 |
public class OutputParameterContainer { |
|
10 |
|
|
11 |
Object m_Container; |
|
12 |
String m_sParameterName; |
|
13 |
|
|
14 |
|
|
15 |
public OutputParameterContainer(final String sName, |
|
16 |
final Object container) { |
|
17 |
|
|
18 |
m_sParameterName = sName; |
|
19 |
m_Container = container; |
|
20 |
|
|
21 |
} |
|
22 |
|
|
23 |
|
|
24 |
public Object getContainer() { |
|
25 |
|
|
26 |
return m_Container; |
|
27 |
|
|
28 |
} |
|
29 |
|
|
30 |
|
|
31 |
public void setContainer(final Object container) { |
|
32 |
|
|
33 |
m_Container = container; |
|
34 |
|
|
35 |
} |
|
36 |
|
|
37 |
|
|
38 |
public String getName() { |
|
39 |
|
|
40 |
return m_sParameterName; |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
|
|
45 |
public void setName(final String sName) { |
|
46 |
|
|
47 |
m_sParameterName = sName; |
|
48 |
|
|
49 |
} |
|
50 |
|
|
51 |
|
|
52 |
} |
|
0 | 53 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/DatabaseOutputChannelSelectionPanel.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.algorithm; |
|
2 |
|
|
3 |
import java.awt.event.ActionListener; |
|
4 |
|
|
5 |
import javax.swing.JPanel; |
|
6 |
|
|
7 |
public class DatabaseOutputChannelSelectionPanel |
|
8 |
extends |
|
9 |
JPanel { |
|
10 |
|
|
11 |
public DatabaseOutputChannelSelectionPanel(final String sDescription, |
|
12 |
final ActionListener listener) { |
|
13 |
// TODO Auto-generated constructor stub |
|
14 |
} |
|
15 |
|
|
16 |
} |
|
0 | 17 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/IconLayerComboBoxRenderer.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package es.unex.sextante.gui.algorithm; |
|
7 |
|
|
8 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
9 |
import java.awt.Color; |
|
10 |
import javax.swing.Icon; |
|
11 |
import java.awt.Component; |
|
12 |
import java.awt.Graphics; |
|
13 |
/** |
|
14 |
* |
|
15 |
* @author osc |
|
16 |
*/ |
|
17 |
public class IconLayerComboBoxRenderer implements Icon { |
|
18 |
public int layerType; |
|
19 |
public boolean hasSelection; |
|
20 |
|
|
21 |
public IconLayerComboBoxRenderer(int layerType, boolean hasSelection) { |
|
22 |
this.layerType = layerType; |
|
23 |
this.hasSelection = hasSelection; |
|
24 |
} |
|
25 |
|
|
26 |
public int getIconHeight() { |
|
27 |
return 20; |
|
28 |
} |
|
29 |
|
|
30 |
public int getIconWidth() { |
|
31 |
return 20; |
|
32 |
} |
|
33 |
|
|
34 |
public void paintIcon(Component c, Graphics g, int x, int y) { |
|
35 |
// public static final int SHAPE_TYPE_POINT = 0; |
|
36 |
// public static final int SHAPE_TYPE_LINE = 1; |
|
37 |
// public static final int SHAPE_TYPE_POLYGON = 2; |
|
38 |
// public static final int SHAPE_TYPE_MIXED = 3; |
|
39 |
// |
|
40 |
// //Types to create a multilayer in gvSIG. Don't use for anything more |
|
41 |
// public static final int SHAPE_TYPE_MULTIPOINT = 4; |
|
42 |
// public static final int SHAPE_TYPE_MULTILINE = 5; |
|
43 |
// public static final int SHAPE_TYPE_MULTIPOLYGON = 6; |
|
44 |
if (this.hasSelection==true) { |
|
45 |
g.setColor(Color.YELLOW); |
|
46 |
g.fillOval(1, 1, 10, 10); |
|
47 |
} |
|
48 |
if (this.layerType == IVectorLayer.SHAPE_TYPE_POLYGON) { |
|
49 |
g.setColor(Color.RED); |
|
50 |
g.drawRect(2, 2, 10, 10); |
|
51 |
} else if (this.layerType == IVectorLayer.SHAPE_TYPE_LINE) { |
|
52 |
g.setColor(Color.RED); |
|
53 |
g.drawLine(2, 2, 10, 10); |
|
54 |
} else if (this.layerType == IVectorLayer.SHAPE_TYPE_POINT) { |
|
55 |
g.setColor(Color.RED); |
|
56 |
g.drawOval(5, 5, 2, 2); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/FileSelectionPanel.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.algorithm; |
|
2 |
|
|
3 |
import info.clearthought.layout.TableLayout; |
|
4 |
import info.clearthought.layout.TableLayoutConstants; |
|
5 |
|
|
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.JFileChooser; |
|
12 |
import javax.swing.JPanel; |
|
13 |
import javax.swing.JTextField; |
|
14 |
|
|
15 |
/** |
|
16 |
* A panel with a text field and a button, which pops-up a file selection dialog and puts the selected file in the text field |
|
17 |
* |
|
18 |
* @author volaya |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class FileSelectionPanel |
|
22 |
extends |
|
23 |
JPanel { |
|
24 |
|
|
25 |
private JTextField textField; |
|
26 |
private JButton button; |
|
27 |
private final String[] m_sExtensions; |
|
28 |
private boolean m_bFolder = false; |
|
29 |
private boolean m_bOpen = false; |
|
30 |
private final String m_sDescription; |
|
31 |
private String m_sSelected = null; |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* Creates a new file selection panel. |
|
36 |
* |
|
37 |
* @param bFolder |
|
38 |
* true if the selection must be a folder instead of a file |
|
39 |
* @param bOpen |
|
40 |
* true to show a open file dialog. False to show a save file one |
|
41 |
* @param sExts |
|
42 |
* a list of permitted file extensions |
|
43 |
* @param sDescription |
|
44 |
* a description of the panel to show in the file dialog |
|
45 |
*/ |
|
46 |
public FileSelectionPanel(final boolean bFolder, |
|
47 |
final boolean bOpen, |
|
48 |
final String[] sExts, |
|
49 |
final String sDescription) { |
|
50 |
|
|
51 |
super(); |
|
52 |
|
|
53 |
m_bFolder = bFolder; |
|
54 |
m_bOpen = bOpen; |
|
55 |
m_sExtensions = sExts; |
|
56 |
m_sDescription = sDescription; |
|
57 |
|
|
58 |
initGUI(); |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
|
|
63 |
/** |
|
64 |
* Creates a new file selection panel. Allows just one extension. |
|
65 |
* |
|
66 |
* @param bFolder |
|
67 |
* true if the selection must be a folder instead of a file |
|
68 |
* @param bOpen |
|
69 |
* true to show a open file dialog. False to show a save file one |
|
70 |
* @param sExt |
|
71 |
* a file extension |
|
72 |
* @param sDescription |
|
73 |
* a description of the panel to show in the file dialog |
|
74 |
*/ |
|
75 |
public FileSelectionPanel(final boolean bFolder, |
|
76 |
final boolean bOpen, |
|
77 |
final String sExt, |
|
78 |
final String sDescription) { |
|
79 |
|
|
80 |
this(bFolder, bOpen, new String[] { sExt }, sDescription); |
|
81 |
|
|
82 |
} |
|
83 |
|
|
84 |
|
|
85 |
/** |
|
86 |
* Creates a new file selection panel |
|
87 |
* |
|
88 |
* @param bFolder |
|
89 |
* true if the selection must be a folder instead of a file |
|
90 |
* @param bOpen |
|
91 |
* true to show a open file dialog. False to show a save file one |
|
92 |
* @param sExt |
|
93 |
* the permitted file extension |
|
94 |
* @param sDescription |
|
95 |
* a description of the panel to show in the file dialog |
|
96 |
* @param sSelection |
|
97 |
* the name of the default selected file or folder |
|
98 |
*/ |
|
99 |
public FileSelectionPanel(final boolean bFolder, |
|
100 |
final boolean bOpen, |
|
101 |
final String sExt, |
|
102 |
final String sDescription, |
|
103 |
final String sSelection) { |
|
104 |
|
|
105 |
this(bFolder, bOpen, new String[] { sExt }, sDescription); |
|
106 |
m_sSelected = sSelection; |
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
|
|
111 |
/** |
|
112 |
* Creates a new file selection panel |
|
113 |
* |
|
114 |
* @param bFolder |
|
115 |
* true if the selection must be a folder instead of a file |
|
116 |
* @param bOpen |
|
117 |
* true to show a open file dialog. False to show a save file one |
|
118 |
* @param sExt |
|
119 |
* a file extensions |
|
120 |
* @param sDescription |
|
121 |
* a description of the panel to show in the file dialog |
|
122 |
* @param sSelection |
|
123 |
* the name of the default selected file or folder |
|
124 |
*/ |
|
125 |
public FileSelectionPanel(final boolean bFolder, |
|
126 |
final boolean bOpen, |
|
127 |
final String sExt[], |
|
128 |
final String sDescription, |
|
129 |
final String sSelection) { |
|
130 |
|
|
131 |
this(bFolder, bOpen, sExt, sDescription); |
|
132 |
m_sSelected = sSelection; |
|
133 |
|
|
134 |
} |
|
135 |
|
|
136 |
|
|
137 |
private void initGUI() { |
|
138 |
|
|
139 |
button = new JButton("..."); |
|
140 |
|
|
141 |
textField = new JTextField(""); |
|
142 |
textField.setMaximumSize(new java.awt.Dimension(340, 18)); |
|
143 |
button.addActionListener(new ActionListener() { |
|
144 |
public void actionPerformed(final ActionEvent evt) { |
|
145 |
btnActionPerformed(); |
|
146 |
} |
|
147 |
}); |
|
148 |
|
|
149 |
final TableLayout thisLayout = new TableLayout(new double[][] { { TableLayoutConstants.FILL, 25.0 }, |
|
150 |
{ TableLayoutConstants.FILL } }); |
|
151 |
this.setLayout(thisLayout); |
|
152 |
this.add(textField, "0, 0"); |
|
153 |
this.add(button, "1, 0"); |
|
154 |
|
|
155 |
} |
|
156 |
|
|
157 |
|
|
158 |
/** |
|
159 |
* Returns the filepath currently shown in the text field |
|
160 |
* |
|
161 |
* @return the filepath currently shown in the text field |
|
162 |
*/ |
|
163 |
public String getFilepath() { |
|
164 |
|
|
165 |
return textField.getText(); |
|
166 |
|
|
167 |
} |
|
168 |
|
|
169 |
/** |
|
170 |
* Returns this panel's JTextField widget. |
|
171 |
* |
|
172 |
* @return the text field widget used to input/store the selected file's path and name |
|
173 |
*/ |
|
174 |
public JTextField getTextField() { |
|
175 |
|
|
176 |
return (this.textField); |
|
177 |
|
|
178 |
} |
|
179 |
|
|
180 |
|
|
181 |
/** |
|
182 |
* Returns this panel's JButton widget. |
|
183 |
* |
|
184 |
* @return the button widget used to pop up the file selector widget |
|
185 |
*/ |
|
186 |
public JButton getButton() { |
|
187 |
|
|
188 |
return (this.button); |
|
189 |
|
|
190 |
} |
|
191 |
|
|
192 |
|
|
193 |
private void btnActionPerformed() { |
|
194 |
|
|
195 |
int returnVal; |
|
196 |
JFileChooser fc = new JFileChooser(); |
|
197 |
|
|
198 |
fc.setDialogTitle(m_sDescription); |
|
199 |
|
|
200 |
if (m_bFolder) { |
|
201 |
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
|
202 |
} |
|
203 |
|
|
204 |
if (m_sSelected != null) { |
|
205 |
fc.setSelectedFile(new File(m_sSelected)); |
|
206 |
} |
|
207 |
|
|
208 |
if ((m_sExtensions != null) && !m_bFolder) { |
|
209 |
fc.setFileFilter(new GenericFileFilter(m_sExtensions, m_sDescription)); |
|
210 |
} |
|
211 |
|
|
212 |
if (m_bOpen) { |
|
213 |
returnVal = fc.showOpenDialog(this.getParent().getParent()); |
|
214 |
} |
|
215 |
else { |
|
216 |
returnVal = fc.showSaveDialog(this.getParent().getParent()); |
|
217 |
} |
|
218 |
|
|
219 |
if (returnVal == JFileChooser.APPROVE_OPTION) { |
|
220 |
textField.setText(fc.getSelectedFile().getAbsolutePath()); |
|
221 |
} |
|
222 |
|
|
223 |
} |
|
224 |
|
|
225 |
|
|
226 |
/** |
|
227 |
* Sets the current filepath to be shown in the text field |
|
228 |
* |
|
229 |
* @param sFilepath |
|
230 |
* the new filepath to set |
|
231 |
*/ |
|
232 |
public void setFilepath(final String sFilepath) { |
|
233 |
|
|
234 |
textField.setText(sFilepath); |
|
235 |
|
|
236 |
} |
|
237 |
|
|
238 |
|
|
239 |
@Override |
|
240 |
public void setToolTipText(final String sText) { |
|
241 |
|
|
242 |
textField.setToolTipText(sText); |
|
243 |
|
|
244 |
} |
|
245 |
} |
|
0 | 246 |
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.65/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/algorithm/AlgorithmDialog.java | ||
---|---|---|
1 |
package es.unex.sextante.gui.algorithm; |
|
2 |
|
|
3 |
import info.clearthought.layout.TableLayout; |
|
4 |
import info.clearthought.layout.TableLayoutConstants; |
|
5 |
|
|
6 |
import java.awt.Font; |
|
7 |
import java.awt.event.ActionEvent; |
|
8 |
import java.awt.event.ActionListener; |
|
9 |
import java.util.ArrayList; |
|
10 |
|
|
11 |
import javax.swing.ImageIcon; |
|
12 |
import javax.swing.JButton; |
|
13 |
import javax.swing.JDialog; |
|
14 |
import javax.swing.JOptionPane; |
|
15 |
import javax.swing.JPanel; |
|
16 |
import javax.swing.JTabbedPane; |
|
17 |
import javax.swing.JTextField; |
|
18 |
|
|
19 |
import es.unex.sextante.core.AnalysisExtent; |
|
20 |
import es.unex.sextante.core.GeoAlgorithm; |
|
21 |
import es.unex.sextante.core.OutputObjectsSet; |
|
22 |
import es.unex.sextante.core.ParametersSet; |
|
23 |
import es.unex.sextante.core.Sextante; |
|
24 |
import es.unex.sextante.exceptions.WrongAnalysisExtentException; |
|
25 |
import es.unex.sextante.exceptions.WrongInputException; |
|
26 |
import es.unex.sextante.gui.core.IGUIFactory; |
|
27 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
28 |
import es.unex.sextante.gui.exceptions.LayerCannotBeOverwrittenException; |
|
29 |
import es.unex.sextante.gui.exceptions.OverwrittingNotAllowedException; |
|
30 |
import es.unex.sextante.gui.exceptions.TooLargeGridExtentException; |
|
31 |
import es.unex.sextante.gui.history.DateAndCommand; |
|
32 |
import es.unex.sextante.gui.history.History; |
|
33 |
import es.unex.sextante.outputs.Output; |
|
34 |
import es.unex.sextante.outputs.Output3DRasterLayer; |
|
35 |
import es.unex.sextante.outputs.OutputRasterLayer; |
|
36 |
import es.unex.sextante.outputs.OutputTable; |
|
37 |
import es.unex.sextante.outputs.OutputVectorLayer; |
|
38 |
import es.unex.sextante.parameters.Parameter; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* A dialog used to introduce all the necessary input for a geoalgorithm (input parameters and raster extent if needed. see |
|
43 |
* {@link es.unex.sextante.core.GeoAlgorithm#getUserCanDefineAnalysisExtent()}) for a given algorithm |
|
44 |
* |
|
45 |
* @author volaya |
|
46 |
* |
|
47 |
*/ |
|
48 |
public class AlgorithmDialog |
|
49 |
extends |
|
50 |
JDialog { |
|
51 |
|
|
52 |
protected GeoAlgorithm m_Algorithm; |
|
53 |
protected JTabbedPane jTabbedPane1; |
|
54 |
private JPanel jPanelButtons; |
|
55 |
private JPanel jMainPanel; |
|
56 |
protected JButton jButtonCancel; |
|
57 |
protected JButton jButtonOK; |
|
58 |
|
|
59 |
private int m_iDialogReturn; |
|
60 |
|
|
61 |
protected GeoAlgorithmParametersPanel jPanelParametersMain = null; |
|
62 |
private AnalysisExtentPanel jAnalysisExtentPanel; |
|
63 |
private JButton jButtonHelp; |
|
64 |
private String[] m_PreviousParameters; |
|
65 |
private String[] m_Extents; |
|
66 |
private JTextField jLabelCommand; |
|
67 |
private JButton jButtonPrevious; |
|
68 |
private JButton jButtonNext; |
|
69 |
private int m_iPreviousCommandIndex; |
|
70 |
private final ArrayList<DateAndCommand> m_sCommand; |
|
71 |
|
|
72 |
|
|
73 |
/** |
|
74 |
* Creates a new dialog for a given algorithm. |
|
75 |
* |
|
76 |
* @param algorithm |
|
77 |
* the algorithm |
|
78 |
* @param parent |
|
79 |
* the parent dialog |
|
80 |
* @param panel |
|
81 |
* the parameters panel to use. Doesn't have to be initialized using its init(Geoalgorithm) method. This |
|
82 |
* constructor will initialize it |
|
83 |
* @param commands |
|
84 |
* a list of DateAndCommand objects to use as previous parameters set. Must include both the "runalg" commands |
|
85 |
* and the "extent" ones, in case you want them to be used for algorithms generating new raster layers. If null, |
|
86 |
* all suitable commands from history are used |
|
87 |
*/ |
|
88 |
public AlgorithmDialog(final GeoAlgorithm algorithm, |
|
89 |
final JDialog parent, |
|
90 |
final GeoAlgorithmParametersPanel panel, |
|
91 |
final ArrayList<DateAndCommand> commands) { |
|
92 |
|
|
93 |
super(parent, algorithm.getName(), true); |
|
94 |
|
|
95 |
setResizable(false); |
|
96 |
|
|
97 |
m_Algorithm = algorithm; |
|
98 |
m_sCommand = commands; |
|
99 |
|
|
100 |
jPanelParametersMain = panel; |
|
101 |
jPanelParametersMain.init(m_Algorithm); |
|
102 |
|
|
103 |
initGUI(); |
|
104 |
setLocationRelativeTo(null); |
|
105 |
|
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
/** |
|
110 |
* Creates a new dialog for a given algorithm. The main frame of the UI is used as the parent component |
|
111 |
* |
|
112 |
* @param algorithm |
|
113 |
* the algorithm |
|
114 |
* @param panel |
|
115 |
* the parameters panel to use. Doesn't have to be initialized using its init(Geoalgorithm) method. This |
|
116 |
* constructor will initialize it |
|
117 |
* @param comands |
|
118 |
* a list of DateAndCommand objects to use as previous parameters set. Must include both the "runalg" commands |
|
119 |
* and the "extent" ones, in case you want them to be used for algorithms generating new raster layers. If null, |
|
120 |
* all suitable commands from history are used |
|
121 |
*/ |
|
122 |
public AlgorithmDialog(final GeoAlgorithm algorithm, |
|
123 |
final GeoAlgorithmParametersPanel panel, |
|
124 |
final ArrayList<DateAndCommand> commands) { |
|
125 |
|
|
126 |
super(SextanteGUI.getMainFrame(), algorithm.getName(), true); |
|
127 |
|
|
128 |
setResizable(false); |
|
129 |
|
|
130 |
m_sCommand = commands; |
|
131 |
m_Algorithm = algorithm; |
|
132 |
|
|
133 |
jPanelParametersMain = panel; |
|
134 |
jPanelParametersMain.init(m_Algorithm); |
|
135 |
|
|
136 |
initGUI(); |
|
137 |
setLocationRelativeTo(null); |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
|
|
142 |
private void initGUI() { |
|
143 |
|
|
144 |
|
|
145 |
jMainPanel = new JPanel(); |
|
146 |
|
|
147 |
this.add(jMainPanel); |
|
148 |
|
|
149 |
final TableLayout thisLayout = new TableLayout(new double[][] { { 10.0, TableLayoutConstants.FILL, 10. }, |
|
150 |
{ 1.0, 338.0, 37.0 } }); |
|
151 |
jMainPanel.setLayout(thisLayout); |
|
152 |
this.setSize(696, 446); |
|
153 |
{ |
|
154 |
jTabbedPane1 = new JTabbedPane(); |
|
155 |
jMainPanel.add(jTabbedPane1, "1, 1"); |
|
156 |
{ |
|
157 |
jTabbedPane1.addTab(Sextante.getText("Parameters"), null, jPanelParametersMain, null); |
|
158 |
} |
|
159 |
{ |
|
160 |
if (m_Algorithm.getUserCanDefineAnalysisExtent()) { |
|
161 |
jTabbedPane1.addTab(Sextante.getText("Raster_output"), null, getAnalysisExtentPanel(), null); |
|
162 |
} |
|
163 |
} |
|
164 |
} |
|
165 |
{ |
|
166 |
jPanelButtons = new JPanel(); |
|
167 |
final TableLayout jPanelButtonsLayout = new TableLayout(new double[][] { |
|
168 |
{ 5.0, 45.0, 120.0, 120.0, 45.0, TableLayoutConstants.FILL, 90.0, 90.0, 25.0, 15.0 }, |
|
169 |
{ TableLayoutConstants.FILL, 25.0, TableLayoutConstants.FILL } }); |
|
170 |
jPanelButtonsLayout.setHGap(5); |
|
171 |
jPanelButtonsLayout.setVGap(5); |
|
172 |
jPanelButtons.setLayout(jPanelButtonsLayout); |
|
173 |
jMainPanel.add(jPanelButtons, "1, 2"); |
|
174 |
jPanelButtons.setFocusable(false); |
|
175 |
{ |
|
176 |
jButtonOK = new JButton(); |
|
177 |
jPanelButtons.add(jButtonOK, "6, 1"); |
|
178 |
jButtonOK.setText(Sextante.getText("OK")); |
|
179 |
jButtonOK.addActionListener(new java.awt.event.ActionListener() { |
|
180 |
public void actionPerformed(final java.awt.event.ActionEvent e) { |
|
181 |
executeAlgorithm(); |
|
182 |
} |
|
183 |
}); |
|
184 |
} |
|
185 |
{ |
|
186 |
jButtonHelp = new JButton(); |
|
187 |
jPanelButtons.add(jButtonHelp, "8, 1"); |
|
188 |
jButtonHelp.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/info.gif"))); |
|
189 |
jButtonHelp.setPreferredSize(new java.awt.Dimension(33, 0)); |
|
190 |
jButtonHelp.addActionListener(new ActionListener() { |
|
191 |
public void actionPerformed(final ActionEvent evt) { |
|
192 |
showHelp(); |
|
193 |
} |
|
194 |
}); |
|
195 |
} |
|
196 |
{ |
|
197 |
jButtonCancel = new JButton(); |
|
198 |
jPanelButtons.add(jButtonCancel, "7, 1"); |
|
199 |
jButtonCancel.setText(Sextante.getText("Cancel")); |
|
200 |
jButtonCancel.addActionListener(new java.awt.event.ActionListener() { |
|
201 |
public void actionPerformed(final java.awt.event.ActionEvent e) { |
|
202 |
m_iDialogReturn = IGUIFactory.CANCEL; |
|
203 |
dispose(); |
|
204 |
setVisible(false); |
|
205 |
} |
|
206 |
}); |
|
207 |
} |
|
208 |
|
|
209 |
} |
|
210 |
|
|
211 |
retrievePreviouslyUsedParametersFromHistory(); |
|
212 |
if (m_PreviousParameters != null) { |
|
213 |
try { |
|
214 |
{ |
|
215 |
jButtonPrevious = new JButton(); |
|
216 |
jPanelButtons.add(jButtonPrevious, "1, 1"); |
|
217 |
jButtonPrevious.setText("<"); |
|
218 |
jButtonPrevious.addActionListener(new ActionListener() { |
|
219 |
public void actionPerformed(final ActionEvent evt) { |
|
220 |
setPreviousSetOfPreviouslyUsedCommand(); |
|
221 |
} |
|
222 |
}); |
|
223 |
} |
|
224 |
{ |
|
225 |
jButtonNext = new JButton(); |
|
226 |
jPanelButtons.add(jButtonNext, "4, 1"); |
|
227 |
jButtonNext.setText(">"); |
|
228 |
jButtonNext.addActionListener(new ActionListener() { |
|
229 |
public void actionPerformed(final ActionEvent evt) { |
|
230 |
setNextSetOfPreviouslyUsedCommand(); |
|
231 |
} |
|
232 |
}); |
|
233 |
} |
|
234 |
{ |
|
235 |
jLabelCommand = new JTextField(); |
|
236 |
jLabelCommand.setFont(new Font("Monospaced", Font.PLAIN, 10)); |
|
237 |
jLabelCommand.setEditable(false); |
|
238 |
jPanelButtons.add(jLabelCommand, "2, 1, 3, 1"); |
|
239 |
} |
|
240 |
|
|
241 |
m_iPreviousCommandIndex = m_PreviousParameters.length - 1; |
|
242 |
setPreviouslyUsedParameters(m_iPreviousCommandIndex); |
|
243 |
} |
|
244 |
catch (final Exception e) { |
|
245 |
// do nothing |
|
246 |
} |
|
247 |
} |
|
248 |
|
|
249 |
} |
|
250 |
|
|
251 |
|
|
252 |
private void setPreviouslyUsedParameters(final int iIndex) { |
|
253 |
|
|
254 |
int i; |
|
255 |
Parameter param; |
|
256 |
String[] args; |
|
257 |
String sArg; |
|
258 |
|
|
259 |
jLabelCommand.setText("[" + Integer.toString(iIndex + 1) + "] " + m_PreviousParameters[iIndex]); |
|
260 |
args = m_PreviousParameters[iIndex].split("\""); |
|
261 |
|
|
262 |
for (int j = 0; j < 2; j++) { //twice to handle dependencies |
|
263 |
final ParametersSet ps = m_Algorithm.getParameters(); |
|
264 |
for (i = 0; i < m_Algorithm.getNumberOfParameters(); i++) { |
|
265 |
param = ps.getParameter(i); |
|
266 |
sArg = args[i * 2 + 3]; |
|
267 |
jPanelParametersMain.setParameterValue(param.getParameterName(), sArg.trim()); |
|
268 |
} |
|
269 |
int iOutputIndex = i * 2 + 3; |
|
270 |
final OutputObjectsSet ooSet = m_Algorithm.getOutputObjects(); |
|
271 |
for (i = 0; i < ooSet.getOutputObjectsCount(); i++) { |
|
272 |
final Output out = ooSet.getOutput(i); |
|
273 |
if ((out instanceof OutputRasterLayer) || (out instanceof Output3DRasterLayer) || (out instanceof OutputVectorLayer) |
|
274 |
|| (out instanceof OutputTable)) { |
|
275 |
final String sValue = args[iOutputIndex].trim(); |
|
276 |
jPanelParametersMain.setOutputValue(out.getName(), sValue); |
|
277 |
iOutputIndex += 2; |
|
278 |
} |
|
279 |
} |
|
280 |
} |
|
281 |
|
|
282 |
if (m_Algorithm.getUserCanDefineAnalysisExtent()) { |
|
283 |
String sExtent = m_Extents[iIndex]; |
|
284 |
if (sExtent != null) { |
|
285 |
sExtent = sExtent.substring(sExtent.indexOf("(") + 1, sExtent.indexOf(")")); |
|
286 |
final AnalysisExtent ae = new AnalysisExtent(); |
|
287 |
final String[] sCoords = sExtent.split(","); |
|
288 |
final double dCellSize = Double.parseDouble(sCoords[6]); |
|
289 |
final double dCellSizeZ = Double.parseDouble(sCoords[7]); |
|
290 |
ae.setCellSize(dCellSize); |
|
291 |
ae.setCellSizeZ(dCellSizeZ); |
|
292 |
final double xMin = Double.parseDouble(sCoords[0]); |
|
293 |
final double xMax = Double.parseDouble(sCoords[3]); |
|
294 |
ae.setXRange(xMin, xMax, true); |
|
295 |
final double yMin = Double.parseDouble(sCoords[1]); |
|
296 |
final double yMax = Double.parseDouble(sCoords[4]); |
|
297 |
ae.setYRange(yMin, yMax, true); |
|
298 |
final double zMin = Double.parseDouble(sCoords[2]); |
|
299 |
final double zMax = Double.parseDouble(sCoords[5]); |
|
300 |
ae.setZRange(zMin, zMax, true); |
|
301 |
getAnalysisExtentPanel().setExtent(ae); |
|
302 |
} |
|
303 |
else { |
|
304 |
getAnalysisExtentPanel().setAutoExtent(); |
|
305 |
} |
|
306 |
} |
|
307 |
|
|
308 |
} |
|
309 |
|
|
310 |
|
|
311 |
private void retrievePreviouslyUsedParametersFromHistory() { |
|
312 |
|
|
313 |
ArrayList<DateAndCommand> dac; |
|
314 |
if (m_sCommand != null) { |
|
315 |
dac = m_sCommand; |
|
316 |
} |
|
317 |
else { |
|
318 |
dac = History.getHistory(); |
|
319 |
} |
|
320 |
final ArrayList<String> previousParameters = new ArrayList<String>(); |
|
321 |
final ArrayList<String> extents = new ArrayList<String>(); |
|
322 |
for (int i = 0; i < dac.size(); i++) { |
|
323 |
String command = dac.get(i).getCommand(); |
|
324 |
if (command.startsWith("runalg(\"" + m_Algorithm.getCommandLineName() + "\"")) { |
|
325 |
previousParameters.add(command); |
|
326 |
if (m_Algorithm.getUserCanDefineAnalysisExtent() && (i != 0)) { |
|
327 |
command = dac.get(i - 1).getCommand(); |
Also available in: Unified diff