Revision 204
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/java/org/gvsig/seismic/swing/gui/JSeismicWizard.java | ||
---|---|---|
1 |
package org.gvsig.seismic.swing.gui; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import javax.swing.JPanel; |
|
7 |
|
|
8 |
import org.cresques.cts.IProjection; |
|
9 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
10 |
import org.gvsig.fmap.dal.store.seismic.SeismicStoreParameters; |
|
11 |
import org.gvsig.seismic.Parser; |
|
12 |
import org.gvsig.seismic.swing.SeismicSwingManager; |
|
13 |
import org.gvsig.tools.dynobject.DynStruct; |
|
14 |
import org.gvsig.tools.observer.Observable; |
|
15 |
|
|
16 |
public interface JSeismicWizard extends Observable{ |
|
17 |
|
|
18 |
public void initializeWizard(); |
|
19 |
public boolean accept(); |
|
20 |
|
|
21 |
public void setParser(Parser parser); |
|
22 |
public Parser getParser(); |
|
23 |
|
|
24 |
public void setFile(File file); |
|
25 |
public File getFile(); |
|
26 |
|
|
27 |
public DynStruct getDataStruct(); |
|
28 |
public void setDataStruct(DynStruct dataStruct); |
|
29 |
public void setDataStruct(DynStruct dataStruct, List<String> fieldNames); |
|
30 |
|
|
31 |
public JPanel getJComponent(); |
|
32 |
|
|
33 |
public void setData(List<ServiceDefinition> parseFile); |
|
34 |
public List<ServiceDefinition> getData(); |
|
35 |
|
|
36 |
public SeismicSwingManager getDriverSwingManager(); |
|
37 |
|
|
38 |
public SeismicStoreParameters getDriverStoreParameters(); |
|
39 |
public EditableFeatureType getFeatureType(); |
|
40 |
|
|
41 |
} |
|
0 | 42 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/java/org/gvsig/seismic/swing/gui/JSeismicWizardPanel.java | ||
---|---|---|
1 |
package org.gvsig.seismic.swing.gui; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import javax.swing.JPanel; |
|
6 |
|
|
7 |
public interface JSeismicWizardPanel { |
|
8 |
|
|
9 |
public JPanel getJComponent(); |
|
10 |
|
|
11 |
public JSeismicWizard getJDriverWizard(); |
|
12 |
|
|
13 |
public void setData(List<ServiceDefinition> data); |
|
14 |
public List<ServiceDefinition> getData(); |
|
15 |
|
|
16 |
public boolean accept(); |
|
17 |
|
|
18 |
public void updateContent(); |
|
19 |
|
|
20 |
public void needsToUpdateContent(); |
|
21 |
|
|
22 |
public boolean isNeededToUpdate(); |
|
23 |
|
|
24 |
public boolean isFirstTime(); |
|
25 |
|
|
26 |
} |
|
0 | 27 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/java/org/gvsig/seismic/swing/gui/ServiceDefinition.java | ||
---|---|---|
1 |
package org.gvsig.seismic.swing.gui; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.cresques.cts.IProjection; |
|
7 |
import org.gvsig.seismic.Parser; |
|
8 |
import org.gvsig.tools.dynobject.DynObject; |
|
9 |
|
|
10 |
public class ServiceDefinition { |
|
11 |
|
|
12 |
private File file; |
|
13 |
private Parser parser; |
|
14 |
private IProjection projection; |
|
15 |
private List<DynObject> data; |
|
16 |
|
|
17 |
|
|
18 |
public File getFile() { |
|
19 |
return file; |
|
20 |
} |
|
21 |
|
|
22 |
public void setFile(File file) { |
|
23 |
this.file = file; |
|
24 |
} |
|
25 |
|
|
26 |
public Parser getParser() { |
|
27 |
return parser; |
|
28 |
} |
|
29 |
|
|
30 |
public void setParser(Parser parser) { |
|
31 |
this.parser = parser; |
|
32 |
} |
|
33 |
|
|
34 |
public IProjection getProjection() { |
|
35 |
return projection; |
|
36 |
} |
|
37 |
|
|
38 |
public void setProjection(IProjection projection) { |
|
39 |
this.projection = projection; |
|
40 |
} |
|
41 |
|
|
42 |
public List<DynObject> getData(){ |
|
43 |
return data; |
|
44 |
} |
|
45 |
|
|
46 |
public void setData(List<DynObject> data){ |
|
47 |
this.data = data; |
|
48 |
} |
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
public String toString(){ |
|
53 |
String aux = ""; |
|
54 |
if(this.file != null){ |
|
55 |
aux = this.file.getName(); |
|
56 |
} |
|
57 |
// if(this.file != null && this.projection != null){ |
|
58 |
// aux = aux + " (" + this.projection.getAbrev() + ")"; |
|
59 |
// } |
|
60 |
return aux; |
|
61 |
} |
|
62 |
|
|
63 |
public String getCorrectProjection() { |
|
64 |
if(projection == null){ |
|
65 |
return "---"; |
|
66 |
}else{ |
|
67 |
return projection.getAbrev(); |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
0 | 71 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/java/org/gvsig/seismic/swing/SeismicSwingLocator.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.seismic.swing; |
|
23 |
|
|
24 |
import org.gvsig.tools.locator.BaseLocator; |
|
25 |
|
|
26 |
/** |
|
27 |
* This locator is the entry point for the Chart swing library, |
|
28 |
* providing access to all Chart swing services through the |
|
29 |
* {@link SeismicSwingManager} . |
|
30 |
* |
|
31 |
* @author gvSIG team |
|
32 |
* @version $Id$ |
|
33 |
*/ |
|
34 |
public class SeismicSwingLocator extends BaseLocator { |
|
35 |
|
|
36 |
/** |
|
37 |
* Chart swing manager name. |
|
38 |
*/ |
|
39 |
public static final String SWING_MANAGER_NAME = |
|
40 |
"Driver.swing.manager"; |
|
41 |
|
|
42 |
/** |
|
43 |
* Chart swing manager description. |
|
44 |
*/ |
|
45 |
public static final String SWING_MANAGER_DESCRIPTION = |
|
46 |
"UIManager of Driver plugin"; |
|
47 |
|
|
48 |
private static final String LOCATOR_NAME = "Driver.swing.locator"; |
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance. |
|
52 |
*/ |
|
53 |
private static final SeismicSwingLocator INSTANCE = |
|
54 |
new SeismicSwingLocator(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Return the singleton instance. |
|
58 |
* |
|
59 |
* @return the singleton instance |
|
60 |
*/ |
|
61 |
public static SeismicSwingLocator getInstance() { |
|
62 |
return INSTANCE; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Return the Locator's name |
|
67 |
* |
|
68 |
* @return a String with the Locator's name |
|
69 |
*/ |
|
70 |
public final String getLocatorName() { |
|
71 |
return LOCATOR_NAME; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Registers the Class implementing the PersistenceManager interface. |
|
76 |
* |
|
77 |
* @param clazz |
|
78 |
* implementing the PersistenceManager interface |
|
79 |
*/ |
|
80 |
public static void registerDriverSwingManager( |
|
81 |
Class<? extends SeismicSwingManager> clazz) { |
|
82 |
getInstance().register(SWING_MANAGER_NAME, SWING_MANAGER_DESCRIPTION, |
|
83 |
clazz); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Gets the instance of the {@link ScriptingUIManager} registered. |
|
88 |
* |
|
89 |
* @return {@link ScriptingUIManager} |
|
90 |
*/ |
|
91 |
public static SeismicSwingManager getDriverSwingManager() { |
|
92 |
return (SeismicSwingManager) getInstance() |
|
93 |
.get(SWING_MANAGER_NAME); |
|
94 |
} |
|
95 |
|
|
96 |
} |
|
0 | 97 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/java/org/gvsig/seismic/swing/SeismicSwingLibrary.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.seismic.swing; |
|
23 |
|
|
24 |
import org.gvsig.seismic.SeismicLibrary; |
|
25 |
import org.gvsig.tools.library.AbstractLibrary; |
|
26 |
import org.gvsig.tools.library.LibraryException; |
|
27 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
28 |
|
|
29 |
/** |
|
30 |
* Library for Swing API initialization and configuration. |
|
31 |
* |
|
32 |
* @author gvSIG team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public class SeismicSwingLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
@Override |
|
38 |
public void doRegistration() { |
|
39 |
registerAsAPI(SeismicSwingLibrary.class); |
|
40 |
this.require(SeismicLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void doInitialize() throws LibraryException { |
|
45 |
// Do nothing |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doPostInitialize() throws LibraryException { |
|
50 |
// Validate there is any implementation registered. |
|
51 |
SeismicSwingManager manager = |
|
52 |
SeismicSwingLocator.getDriverSwingManager(); |
|
53 |
if (manager == null) { |
|
54 |
throw new ReferenceNotRegisteredException( |
|
55 |
SeismicSwingLocator.SWING_MANAGER_NAME, |
|
56 |
SeismicSwingLocator.getInstance()); |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
} |
|
0 | 61 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/java/org/gvsig/seismic/swing/SeismicSwingManager.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.seismic.swing; |
|
23 |
|
|
24 |
import org.cresques.cts.IProjection; |
|
25 |
import org.gvsig.seismic.SeismicManager; |
|
26 |
import org.gvsig.seismic.swing.gui.JSeismicWizard; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
* @see SeismicSwingManager |
|
32 |
* @author gvSIG team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public interface SeismicSwingManager { |
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* Returns the {@link DriverManager}. |
|
40 |
* |
|
41 |
* @return {@link DriverManager} |
|
42 |
* @see {@link DriverManager} |
|
43 |
*/ |
|
44 |
public SeismicManager getDriverManager(); |
|
45 |
|
|
46 |
/** |
|
47 |
* Returns the translation of a string. |
|
48 |
* |
|
49 |
* @param key |
|
50 |
* String to translate |
|
51 |
* @return a String with the translation of the string passed by parameter |
|
52 |
*/ |
|
53 |
public String getTranslation(String key); |
|
54 |
|
|
55 |
public JSeismicWizard createWizard(); |
|
56 |
public JSeismicWizard createWizard(IProjection proj); |
|
57 |
|
|
58 |
} |
|
0 | 59 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/java/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.landregistryviewer package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>LandRegistryViewer swing library API.</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
It allows to get swing panels to show LandRegistryViewer, and to include them in windows. |
|
14 |
</p> |
|
15 |
|
|
16 |
</body> |
|
17 |
</html> |
|
0 | 18 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.seismic.swing.SeismicSwingLibrary |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
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.seismic.swing.api</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.seismic.swing.api</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.seismic.swing</artifactId> |
|
10 |
<version>1.0.34</version> |
|
11 |
</parent> |
|
12 |
<build> |
|
13 |
<plugins> |
|
14 |
<plugin> |
|
15 |
<groupId>org.apache.maven.plugins</groupId> |
|
16 |
<artifactId>maven-jar-plugin</artifactId> |
|
17 |
<configuration> |
|
18 |
</configuration> |
|
19 |
<executions> |
|
20 |
<!-- |
|
21 |
Generates a jar file only with the test classes |
|
22 |
--> |
|
23 |
<execution> |
|
24 |
<goals> |
|
25 |
<goal>test-jar</goal> |
|
26 |
</goals> |
|
27 |
</execution> |
|
28 |
</executions> |
|
29 |
</plugin> |
|
30 |
</plugins> |
|
31 |
</build> |
|
32 |
<dependencies> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.seismic.lib.api</artifactId> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.seismic.provider</artifactId> |
|
40 |
</dependency> |
|
41 |
</dependencies> |
|
42 |
</project> |
|
0 | 43 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your test classes. |
|
2 |
|
|
3 |
This folder is added to the Tests classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your tests classes. |
|
0 | 9 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
org.gvsig.tools packages. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.tools"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
<category name="org.gvsig.chart"> |
|
26 |
<priority value="DEBUG" /> |
|
27 |
</category> |
|
28 |
|
|
29 |
<!-- |
|
30 |
By default, show only logging messages of INFO level or higher, |
|
31 |
through the previously configured CONSOLE appender. |
|
32 |
--> |
|
33 |
<root> |
|
34 |
<priority value="INFO" /> |
|
35 |
<appender-ref ref="CONSOLE" /> |
|
36 |
</root> |
|
37 |
</log4j:configuration> |
|
0 | 38 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/main/resources/org/gvsig/seismic/swing/impl/TestDefinition.xml | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<definitions> |
|
28 |
<version>1.0.0</version> |
|
29 |
<classes> |
|
30 |
<class name="DBFStoreParameters"> |
|
31 |
|
|
32 |
<description>Store the parameters need to open a dbf file</description> |
|
33 |
<fields> |
|
34 |
<field name="DbfFile" type="file" mandatory="true" group="Basic" order="1"> |
|
35 |
<description>dbf file</description> |
|
36 |
</field> |
|
37 |
<field name="ProviderName" type="string" mandatory="true" group="Advanced"> |
|
38 |
<description>Name of the provider</description> |
|
39 |
</field> |
|
40 |
<field name="description" type="string" subtype="text" mandatory="true" group="Advanced"> |
|
41 |
<description>Description ......</description> |
|
42 |
</field> |
|
43 |
|
|
44 |
<field name="Encoding" type="string" mandatory="false" group="Basic" defaultValue="UTF-16"> |
|
45 |
<description>Encoding used in this file</description> |
|
46 |
<availableValues> |
|
47 |
<value label="(default)"></value> |
|
48 |
<value label="US-ASCII">US-ASCII</value> |
|
49 |
<value label="ISO-8859-1">ISO-8859-1</value> |
|
50 |
<value label="ISO-8859-15">ISO-8859-15</value> |
|
51 |
<value label="windows-1250">windows-1250</value> |
|
52 |
<value label="windows-1252">windows-1252</value> |
|
53 |
<value label="UTF-8">UTF-8</value> |
|
54 |
<value label="UTF-16">UTF-16</value> |
|
55 |
<value label="UTF-16BE">UTF-16BE</value> |
|
56 |
<value label="UTF-16LE">UTF-16LE</value> |
|
57 |
</availableValues> |
|
58 |
</field> |
|
59 |
<field name="codePage" type="Integer" mandatory="false" group="Advanced"> |
|
60 |
<description>Code page used in this file</description> |
|
61 |
<availableValues> |
|
62 |
<value label="DOS USA">0x01</value> |
|
63 |
<value label="DOS Multilingual">0x02</value> |
|
64 |
<value label="Windows ANSI">0x03</value> |
|
65 |
<value label="Standard Macintosh">0x04</value> |
|
66 |
<value label="EE MS-DOS">0x64</value> |
|
67 |
<value label="Nordic MS-DOS">0x65</value> |
|
68 |
<value label="Russian MS-DOS">0x66</value> |
|
69 |
<value label="Icelandic MS-DOS">0x67</value> |
|
70 |
<value label="Kamenicky (Czech) MS-DOS">0x68</value> |
|
71 |
<value label="Mazovia (Polish) MS-DOS">0x69</value> |
|
72 |
<value label="Greek MS-DOS (437G)">0x6A</value> |
|
73 |
<value label="Turkish MS-DOS">0x6B</value> |
|
74 |
<value label="Russian Macintosh">0x96</value> |
|
75 |
<value label="Macintosh">0x97</value> |
|
76 |
<value label="Greek Macintosh">0x98</value> |
|
77 |
<value label="Windows EE">0xC8</value> |
|
78 |
<value label="Russian Windows">0xC9</value> |
|
79 |
<value label="Turkish Windows">0xCA</value> |
|
80 |
<value label="Greek Windows">0xCB</value> |
|
81 |
</availableValues> |
|
82 |
</field> |
|
83 |
|
|
84 |
<field label="un entero" name="entero" type="integer" minValue="10" maxValue="100" group="Test tipos"> |
|
85 |
</field> |
|
86 |
<field name="doble" type="double" group="Test tipos"> |
|
87 |
</field> |
|
88 |
<field name="float" type="float" group="Test tipos"> |
|
89 |
</field> |
|
90 |
<field name="boolean" type="boolean" group="Test tipos"> |
|
91 |
</field> |
|
92 |
<field name="date" type="date" group="Test tipos"> |
|
93 |
</field> |
|
94 |
<field name="time" type="time" group="Test tipos"> |
|
95 |
</field> |
|
96 |
<field name="timestamp" type="timestamp" group="Test tipos"> |
|
97 |
</field> |
|
98 |
<field name="byte" type="byte" group="Test tipos"> |
|
99 |
</field> |
|
100 |
<field name="folder" type="folder" group="Test tipos"> |
|
101 |
</field> |
|
102 |
<field name="url" type="url" group="Test tipos"> |
|
103 |
</field> |
|
104 |
<field name="uri" type="uri" group="Test tipos"> |
|
105 |
</field> |
|
106 |
<field name="long" type="long" group="Test tipos"> |
|
107 |
</field> |
|
108 |
<field name="char" type="char" group="Test tipos"> |
|
109 |
</field> |
|
110 |
<field name="version" type="version" group="Test tipos"> |
|
111 |
</field> |
|
112 |
|
|
113 |
<field name="dynobject" type="DYNOBJECT" group="Test containers"> |
|
114 |
</field> |
|
115 |
<field name="array" type="ARRAY" group="Test containers"> |
|
116 |
</field> |
|
117 |
<field name="list" type="LIST" group="Test containers"> |
|
118 |
</field> |
|
119 |
<field name="set" type="SET" group="Test containers"> |
|
120 |
</field> |
|
121 |
<field name="map" type="MAP" group="Test containers"> |
|
122 |
</field> |
|
123 |
|
|
124 |
|
|
125 |
</fields> |
|
126 |
</class> |
|
127 |
|
|
128 |
<class name="FormPackageinfo"> |
|
129 |
|
|
130 |
<description>Form definition for package.info data</description> |
|
131 |
<fields> |
|
132 |
<field name="code" label="Code" type="string" mandatory="true" order="1" group="General"> |
|
133 |
<description>Package code. It is usually a lowercase name separated by dots or dashes.</description> |
|
134 |
</field> |
|
135 |
|
|
136 |
<field name="name" label="Name" type="string" mandatory="true" group="General"> |
|
137 |
<description>Name of the package</description> |
|
138 |
</field> |
|
139 |
|
|
140 |
<field name="description" label="Description" type="string" subtype="text" group="General"> |
|
141 |
<description></description> |
|
142 |
</field> |
|
143 |
|
|
144 |
<field name="categories" label="Categories" type="string" group="General"> |
|
145 |
<description>Categories list separated by commas, for example: View,Vector</description> |
|
146 |
</field> |
|
147 |
|
|
148 |
<field name="version" label="Version" type="string" mandatory="true" defaultValue="1.0.0-0" group="General"> |
|
149 |
<description>Version number of the package. The last number should be the same as the number of build</description> |
|
150 |
</field> |
|
151 |
|
|
152 |
<field name="buildNumber" label="Build" type="integer" mandatory="true" defaultValue="0" group="General"> |
|
153 |
<description>Build number of the package</description> |
|
154 |
</field> |
|
155 |
|
|
156 |
<field name="state" label="State" type="string" mandatory="false" defaultValue="testing" group="General"> |
|
157 |
<description>State of the package</description> |
|
158 |
<availableValues> |
|
159 |
<value label="devel">devel</value> |
|
160 |
<value label="testing">testing</value> |
|
161 |
<value label="pilot">pilot</value> |
|
162 |
<value label="prototype">prototype</value> |
|
163 |
<value label="alpha1">alpha1</value> |
|
164 |
<value label="alpha2">alpha2</value> |
|
165 |
<value label="alpha3">alpha3</value> |
|
166 |
<value label="beta1">beta1</value> |
|
167 |
<value label="beta2">beta2</value> |
|
168 |
<value label="beta3">beta3</value> |
|
169 |
<value label="RC1">RC1</value> |
|
170 |
<value label="RC2">RC2</value> |
|
171 |
<value label="RC3">RC3</value> |
|
172 |
<value label="final">final</value> |
|
173 |
</availableValues> |
|
174 |
</field> |
|
175 |
|
|
176 |
<field name="official" label="Official" type="boolean" group="General"> |
|
177 |
<description>Check if the package is a official package of gvSIG project</description> |
|
178 |
</field> |
|
179 |
|
|
180 |
<field name="sources-url" label="Source code URL" type="URL" mandatory="false" group="General"> |
|
181 |
<description>URL to the source of the package</description> |
|
182 |
</field> |
|
183 |
|
|
184 |
<field name="owner" label="Package owner" type="string" mandatory="true" group="Owner"> |
|
185 |
<description>Package owner</description> |
|
186 |
</field> |
|
187 |
|
|
188 |
<field name="web-url" label="Package owner URL" type="URL" mandatory="false" group="Owner"> |
|
189 |
<description>URL to the home page of the package owner</description> |
|
190 |
</field> |
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
<field name="operating-system" label="Operating System" type="string" mandatory="true" defaultValue="all" group="Requeriments"> |
|
195 |
<description>Operating system that require this package</description> |
|
196 |
<availableValues> |
|
197 |
<value label="all">all</value> |
|
198 |
<value label="Linux">lin</value> |
|
199 |
<value label="Windows">win</value> |
|
200 |
<value label="MAC OSX 10.4">osx_10_4</value> |
|
201 |
<value label="MAC OSX 10.5">osx_10_5</value> |
|
202 |
<value label="MAC OSX 10.6">osx_10_6</value> |
|
203 |
<value label="MAC OSX 10.7">osx_10_7</value> |
|
204 |
<value label="MAC OSX 10.8">osx_10_8</value> |
|
205 |
<value label="MAC OSX 10.9">osx_10_9</value> |
|
206 |
</availableValues> |
|
207 |
</field> |
|
208 |
|
|
209 |
<field name="architecture" label="Architecture" type="string" mandatory="true" defaultValue="all" group="Requeriments"> |
|
210 |
<description>Operating system that require this package</description> |
|
211 |
<availableValues> |
|
212 |
<value label="all">all</value> |
|
213 |
<value label="x86">x86</value> |
|
214 |
<value label="x86_64/AMD64">x86_64</value> |
|
215 |
<value label="PowerPC">PowerPC</value> |
|
216 |
</availableValues> |
|
217 |
</field> |
|
218 |
|
|
219 |
<field name="java-version" label="Java version" type="string" mandatory="true" defaultValue="j1_5" group="Requeriments"> |
|
220 |
<description>Minimun java version required to run this package</description> |
|
221 |
<availableValues> |
|
222 |
<value label="Java 1.5">j1_5</value> |
|
223 |
<value label="Java 1.6">j1_6</value> |
|
224 |
<value label="Java 1.7">j1_7</value> |
|
225 |
<value label="Java 1.8">j1_8</value> |
|
226 |
</availableValues> |
|
227 |
</field> |
|
228 |
|
|
229 |
<field name="gvSIG-version" label="gvSIG version" type="string" mandatory="true" defaultValue="2.0.0" group="Requeriments"> |
|
230 |
<description>gvSIG version for which this package has been created</description> |
|
231 |
</field> |
|
232 |
|
|
233 |
<field name="dependencies" label="Dependencies" type="string" mandatory="false" group="Requeriments"> |
|
234 |
<description>Specifies the dependencies or conflicts with other packates</description> |
|
235 |
</field> |
|
236 |
|
|
237 |
<field name="code-alias" label="Code alias" type="string" mandatory="false" group="Others"> |
|
238 |
<description>Alternative value for the code. It is useful when a renamed package to maintain compatibility with dependencies that other packages might have with this.</description> |
|
239 |
</field> |
|
240 |
|
|
241 |
|
|
242 |
</fields> |
|
243 |
</class> |
|
244 |
|
|
245 |
</classes> |
|
246 |
</definitions> |
|
0 | 247 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.seismic.swing.impl.DefaultSeismicSwingLibrary |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/main/java/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.landregistryviewer package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>LandRegistryViewer swing library API default implementation.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
|
0 | 14 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/main/java/org/gvsig/seismic/swing/impl/DefaultSeismicSwingLibrary.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.seismic.swing.impl; |
|
23 |
|
|
24 |
import org.gvsig.andami.IconThemeHelper; |
|
25 |
import org.gvsig.seismic.swing.SeismicSwingLibrary; |
|
26 |
import org.gvsig.seismic.swing.SeismicSwingLocator; |
|
27 |
import org.gvsig.tools.library.AbstractLibrary; |
|
28 |
import org.gvsig.tools.library.LibraryException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Library for default swing implementation initialization and configuration. |
|
32 |
* |
|
33 |
* @author gvSIG team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class DefaultSeismicSwingLibrary extends AbstractLibrary { |
|
37 |
|
|
38 |
|
|
39 |
@Override |
|
40 |
public void doRegistration() { |
|
41 |
registerAsImplementationOf(SeismicSwingLibrary.class); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
protected void doInitialize() throws LibraryException { |
|
46 |
SeismicSwingLocator |
|
47 |
.registerDriverSwingManager(DefaultSeismicSwingManager.class); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
IconThemeHelper.registerIcon("seismic", "seismic-table-add", this); |
|
53 |
IconThemeHelper.registerIcon("seismic", "seismic-table-delete", this); |
|
54 |
} |
|
55 |
|
|
56 |
} |
|
0 | 57 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/main/java/org/gvsig/seismic/swing/impl/DefaultSeismicSwingManager.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.seismic.swing.impl; |
|
23 |
|
|
24 |
import org.cresques.cts.IProjection; |
|
25 |
import org.gvsig.seismic.SeismicLocator; |
|
26 |
import org.gvsig.seismic.SeismicManager; |
|
27 |
import org.gvsig.seismic.swing.SeismicSwingManager; |
|
28 |
import org.gvsig.seismic.swing.gui.JSeismicWizard; |
|
29 |
import org.gvsig.seismic.swing.impl.gui.DefaultJSeismicWizard; |
|
30 |
import org.gvsig.tools.ToolsLocator; |
|
31 |
import org.gvsig.tools.i18n.I18nManager; |
|
32 |
|
|
33 |
/** |
|
34 |
* Default implementation of the {@link ChartSwingManager}. |
|
35 |
* |
|
36 |
* @author gvSIG Team |
|
37 |
* @version $Id$ |
|
38 |
*/ |
|
39 |
public class DefaultSeismicSwingManager implements SeismicSwingManager { |
|
40 |
|
|
41 |
private SeismicManager driverManager; |
|
42 |
private I18nManager i18nmanager = null; |
|
43 |
|
|
44 |
public DefaultSeismicSwingManager() { |
|
45 |
this.i18nmanager = ToolsLocator.getI18nManager(); |
|
46 |
this.driverManager = SeismicLocator.getDriverManager(); |
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 |
public SeismicManager getServiceManager() { |
|
51 |
return this.driverManager; |
|
52 |
} |
|
53 |
|
|
54 |
public String getTranslation(String key) { |
|
55 |
return this.i18nmanager.getTranslation(key); |
|
56 |
} |
|
57 |
|
|
58 |
public JSeismicWizard createWizard() { |
|
59 |
return new DefaultJSeismicWizard(this); |
|
60 |
} |
|
61 |
|
|
62 |
public JSeismicWizard createWizard(IProjection proj) { |
|
63 |
return new DefaultJSeismicWizard(this, proj); |
|
64 |
} |
|
65 |
|
|
66 |
public SeismicManager getDriverManager() { |
|
67 |
return this.driverManager; |
|
68 |
} |
|
69 |
|
|
70 |
} |
|
0 | 71 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/main/java/org/gvsig/seismic/swing/impl/gui/utils/JFieldDefinitionField.java | ||
---|---|---|
1 |
package org.gvsig.seismic.swing.impl.gui.utils; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.awt.event.KeyEvent; |
|
6 |
import java.awt.event.KeyListener; |
|
7 |
import java.util.ArrayList; |
|
8 |
import java.util.HashMap; |
|
9 |
import java.util.Iterator; |
|
10 |
import java.util.List; |
|
11 |
import java.util.Map; |
|
12 |
import java.util.Map.Entry; |
|
13 |
|
|
14 |
import javax.swing.DefaultComboBoxModel; |
|
15 |
import javax.swing.JCheckBox; |
|
16 |
import javax.swing.JComboBox; |
|
17 |
import javax.swing.JPanel; |
|
18 |
import javax.swing.JTextField; |
|
19 |
|
|
20 |
import org.gvsig.fmap.geom.DataTypes; |
|
21 |
import org.gvsig.seismic.swing.SeismicSwingLocator; |
|
22 |
import org.gvsig.seismic.swing.SeismicSwingManager; |
|
23 |
import org.gvsig.tools.observer.Observable; |
|
24 |
import org.gvsig.tools.observer.Observer; |
|
25 |
|
|
26 |
|
|
27 |
public class JFieldDefinitionField extends JPanel implements Observable{ |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
*/ |
|
32 |
private static final long serialVersionUID = -4314653602583250681L; |
|
33 |
private JCheckBox selected; |
|
34 |
private JTextField name; |
|
35 |
private JComboBox type; |
|
36 |
private JCheckBox mandatory; |
|
37 |
|
|
38 |
private List<Observer> observers = new ArrayList<Observer>(); |
|
39 |
|
|
40 |
private Map<String,Integer> datatypes; |
|
41 |
private SeismicSwingManager swingManager; |
|
42 |
|
|
43 |
public JFieldDefinitionField(boolean selected, String name, int type, boolean mandatory){ |
|
44 |
swingManager = SeismicSwingLocator.getDriverSwingManager(); |
|
45 |
this.initializeDataTypes(); |
|
46 |
this.initializeComponent(); |
|
47 |
|
|
48 |
this.updateContent(selected,name,type,mandatory); |
|
49 |
} |
|
50 |
|
|
51 |
private void updateContent(boolean b, String string, int i, boolean c) { |
|
52 |
selected.setSelected(b); |
|
53 |
updateField(); |
|
54 |
name.setText(string); |
|
55 |
type.setSelectedItem(this.getTypeValue(i)); |
|
56 |
mandatory.setSelected(c); |
|
57 |
} |
|
58 |
|
|
59 |
private void initializeDataTypes() { |
|
60 |
datatypes = new HashMap<String,Integer>(); |
|
61 |
|
|
62 |
datatypes.put("String", DataTypes.STRING); |
|
63 |
datatypes.put("Integer", DataTypes.INT); |
|
64 |
datatypes.put("Float", DataTypes.FLOAT); |
|
65 |
datatypes.put("Double", DataTypes.DOUBLE); |
|
66 |
datatypes.put("File", DataTypes.FILE); |
|
67 |
datatypes.put("boolean", DataTypes.BOOLEAN); |
|
68 |
datatypes.put("Date", DataTypes.DATE); |
|
69 |
datatypes.put("Geometry", DataTypes.GEOMETRY); |
|
70 |
datatypes.put("Object", DataTypes.OBJECT); |
|
71 |
datatypes.put("Unknown", DataTypes.UNKNOWN); |
|
72 |
} |
|
73 |
|
|
74 |
private void initializeComponent() { |
|
75 |
selected = new JCheckBox(); |
|
76 |
selected.setSelected(true); |
|
77 |
selected.addActionListener(new ActionListener() { |
|
78 |
public void actionPerformed(ActionEvent arg0) { |
|
79 |
updateField(); |
|
80 |
getJField().notifyObservers(getJField(), ""); |
|
81 |
} |
|
82 |
}); |
|
83 |
|
|
84 |
name = new JTextField(18); |
|
85 |
name.addKeyListener(new KeyListener() { |
|
86 |
public void keyPressed(KeyEvent arg0) { |
|
87 |
// TODO Auto-generated method stub |
|
88 |
|
|
89 |
} |
|
90 |
|
|
91 |
public void keyReleased(KeyEvent arg0) { |
|
92 |
// TODO Auto-generated method stub |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
public void keyTyped(KeyEvent arg0) { |
|
97 |
getJField().notifyObservers(getJField(), ""); |
|
98 |
} |
|
99 |
}); |
|
100 |
|
|
101 |
type = new JComboBox(); |
|
102 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
|
103 |
Iterator it = datatypes.keySet().iterator(); |
|
104 |
while(it.hasNext()){ |
|
105 |
String typeName = (String)it.next(); |
|
106 |
model.addElement(typeName); |
|
107 |
} |
|
108 |
type.setModel(model); |
|
109 |
type.addActionListener(new ActionListener() { |
|
110 |
public void actionPerformed(ActionEvent arg0) { |
|
111 |
getJField().notifyObservers(getJField(), ""); |
|
112 |
} |
|
113 |
}); |
|
114 |
|
|
115 |
mandatory = new JCheckBox(this.swingManager.getTranslation("mandatory")); |
|
116 |
mandatory.addActionListener(new ActionListener() { |
|
117 |
public void actionPerformed(ActionEvent arg0) { |
|
118 |
getJField().notifyObservers(getJField(), ""); |
|
119 |
} |
|
120 |
}); |
|
121 |
|
|
122 |
add(selected); |
|
123 |
add(name); |
|
124 |
add(type); |
|
125 |
add(mandatory); |
|
126 |
} |
|
127 |
|
|
128 |
public JFieldDefinitionField getJField(){ |
|
129 |
return this; |
|
130 |
} |
|
131 |
|
|
132 |
private void updateField() { |
|
133 |
name.setEnabled(selected.isSelected()); |
|
134 |
name.setEditable(selected.isSelected()); |
|
135 |
type.setEnabled(selected.isSelected()); |
|
136 |
mandatory.setEnabled(selected.isSelected()); |
|
137 |
} |
|
138 |
|
|
139 |
public int getType(String name){ |
|
140 |
return datatypes.get(name); |
|
141 |
} |
|
142 |
|
|
143 |
private String getTypeValue(int value) { |
|
144 |
for (Entry<String, Integer> entry : datatypes.entrySet()) { |
|
145 |
if (value == entry.getValue()) { |
|
146 |
return entry.getKey(); |
|
147 |
} |
|
148 |
} |
|
149 |
return "Unknown"; |
|
150 |
} |
|
151 |
|
|
152 |
public boolean isFieldSelected(){ |
|
153 |
return selected.isSelected(); |
|
154 |
} |
|
155 |
|
|
156 |
public String getFieldName(){ |
|
157 |
return name.getText(); |
|
158 |
} |
|
159 |
|
|
160 |
public int getFieldType(){ |
|
161 |
String name = (String) type.getSelectedItem(); |
|
162 |
return this.getType(name); |
|
163 |
} |
|
164 |
|
|
165 |
public boolean isFieldMandatory(){ |
|
166 |
return mandatory.isSelected(); |
|
167 |
} |
|
168 |
|
|
169 |
public void addObserver(Observer o) { |
|
170 |
this.observers.add(o); |
|
171 |
} |
|
172 |
|
|
173 |
public void deleteObserver(Observer o) { |
|
174 |
this.observers.remove(o); |
|
175 |
} |
|
176 |
|
|
177 |
public void deleteObservers() { |
|
178 |
this.observers.clear(); |
|
179 |
} |
|
180 |
|
|
181 |
public synchronized void notifyObservers(Observable observable, Object tableName) { |
|
182 |
for(int i =0; i<this.observers.size(); i++ ) { |
|
183 |
Observer o = (Observer) this.observers.get(i); |
|
184 |
o.update(this, tableName); |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
} |
|
0 | 189 |
org.gvsig.seismic/tags/org.gvsig.seismic-1.0.34/org.gvsig.seismic/org.gvsig.seismic.swing/org.gvsig.seismic.swing.impl/src/main/java/org/gvsig/seismic/swing/impl/gui/utils/JFileField.java | ||
---|---|---|
1 |
package org.gvsig.seismic.swing.impl.gui.utils; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Color; |
|
5 |
import java.awt.Component; |
|
6 |
import java.awt.Dimension; |
|
7 |
import java.awt.FlowLayout; |
|
8 |
import java.awt.Font; |
|
9 |
import java.awt.event.ActionEvent; |
|
10 |
import java.awt.event.ActionListener; |
|
11 |
import java.io.File; |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import javax.swing.BorderFactory; |
|
16 |
import javax.swing.BoxLayout; |
|
17 |
import javax.swing.JButton; |
|
18 |
import javax.swing.JFileChooser; |
|
19 |
import javax.swing.JLabel; |
|
20 |
import javax.swing.JPanel; |
|
21 |
import javax.swing.JScrollPane; |
|
22 |
import javax.swing.JTable; |
|
23 |
import javax.swing.ListSelectionModel; |
|
24 |
import javax.swing.event.ListSelectionEvent; |
|
25 |
import javax.swing.event.ListSelectionListener; |
|
26 |
import javax.swing.event.TableModelEvent; |
|
27 |
import javax.swing.event.TableModelListener; |
|
28 |
import javax.swing.table.DefaultTableModel; |
|
29 |
import javax.swing.table.TableCellRenderer; |
|
30 |
import javax.swing.table.TableColumn; |
|
31 |
|
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
import org.gvsig.andami.PluginServices; |
|
34 |
import org.gvsig.seismic.swing.SeismicSwingLocator; |
|
35 |
import org.gvsig.seismic.swing.SeismicSwingManager; |
|
36 |
import org.gvsig.seismic.swing.gui.ServiceDefinition; |
|
37 |
import org.gvsig.tools.observer.Observable; |
|
38 |
import org.gvsig.tools.observer.Observer; |
|
39 |
|
|
40 |
public class JFileField extends JPanel implements Observable { |
|
41 |
/** |
|
42 |
* |
|
43 |
*/ |
|
44 |
private static final long serialVersionUID = 3492826158688074766L; |
|
45 |
private String textFieldLabel; |
|
46 |
private String buttonLabel; |
|
47 |
|
|
48 |
private JLabel label; |
|
49 |
private JTable tableField; |
|
50 |
private JButton addbutton; |
|
51 |
|
|
52 |
private JFileChooser fileChooser; |
|
53 |
|
|
54 |
private List<Observer> observers = new ArrayList<Observer>(); |
|
55 |
|
|
56 |
private int mode; |
|
57 |
private JButton removebutton; |
|
58 |
private ListSelectionListener listener; |
|
59 |
private SeismicSwingManager swingManager; |
|
60 |
|
|
61 |
|
|
62 |
public static final int MODE_OPEN = 1; |
|
63 |
public static final int MODE_SAVE = 2; |
|
64 |
|
|
65 |
public JFileField(String textFieldLabel, String buttonLabel) { |
|
66 |
this.swingManager = SeismicSwingLocator.getDriverSwingManager(); |
|
67 |
this.textFieldLabel = textFieldLabel; |
|
68 |
this.buttonLabel = buttonLabel; |
|
69 |
|
|
70 |
this.listener = new ListSelectionListener() { |
|
71 |
public void valueChanged(ListSelectionEvent e) { |
|
72 |
int index = tableField.getSelectedRow(); |
|
73 |
notifyObservers(JFileField.this, "Select"); |
|
74 |
} |
|
75 |
}; |
|
76 |
|
|
77 |
fileChooser = new JFileChooser(); |
|
78 |
fileChooser.setMultiSelectionEnabled(true); |
|
79 |
|
|
80 |
//setLayout(new FlowLayout(FlowLayout.CENTER, 2, 0)); |
|
81 |
setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
|
82 |
|
|
83 |
if(textFieldLabel!=null){ |
|
84 |
label = new JLabel(textFieldLabel); |
|
85 |
add(label); |
|
86 |
} |
|
87 |
|
|
88 |
DefaultTableModel tableModel = new DefaultTableModel(){ |
|
89 |
@Override |
|
90 |
public boolean isCellEditable(int row, int column) { |
|
91 |
return false; |
|
92 |
} |
|
93 |
}; |
|
94 |
tableModel.addColumn(this.swingManager.getTranslation("File")); |
|
95 |
tableModel.addColumn(this.swingManager.getTranslation("CRS")); |
|
96 |
tableField = new JTable(tableModel){ |
|
97 |
public Component prepareRenderer( |
|
98 |
TableCellRenderer renderer, int row, int column){ |
|
99 |
Component c = super.prepareRenderer(renderer, row, column); |
|
100 |
c.setForeground(Color.BLACK); |
|
101 |
|
|
102 |
if(tableField.getValueAt(row, 0) instanceof ServiceDefinition){ |
|
103 |
ServiceDefinition sd = (ServiceDefinition) tableField.getValueAt(row, 0); |
|
104 |
if(sd.getParser() == null){ |
|
105 |
c.setForeground(Color.RED); |
|
106 |
} |
|
107 |
} |
|
108 |
if(column == 1){ |
|
109 |
Font font = new Font(c.getFont().getFontName(), Font.BOLD, 10); |
|
110 |
c.setFont(font); |
|
111 |
} |
|
112 |
return c; |
|
113 |
} |
|
114 |
}; |
|
115 |
TableColumn column = tableField.getColumnModel().getColumn(1); |
|
116 |
column.setMaxWidth(200); |
|
117 |
tableField.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|
118 |
// tableField.setColumnSelectionAllowed(false); |
|
119 |
// tableField.setRowSelectionAllowed(true); |
|
120 |
ListSelectionModel cellSelectionModel = tableField.getSelectionModel(); |
|
121 |
|
|
122 |
cellSelectionModel.addListSelectionListener(this.listener); |
|
123 |
tableField.getModel().addTableModelListener(new TableModelListener() { |
|
124 |
public void tableChanged(TableModelEvent arg0) { |
|
125 |
if(tableField.getModel().getRowCount()>0){ |
|
126 |
removebutton.setEnabled(true); |
|
127 |
}else{ |
|
128 |
removebutton.setEnabled(false); |
|
129 |
} |
|
130 |
} |
|
131 |
}); |
|
132 |
|
|
133 |
JScrollPane scroll = new JScrollPane(tableField); |
|
134 |
scroll.setPreferredSize(new Dimension(400,125)); |
|
135 |
|
|
136 |
JPanel panel = new JPanel(); |
|
137 |
//panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); |
|
138 |
//panel.setPreferredSize(new Dimension(0, 50)); |
|
139 |
panel.setLayout(new FlowLayout(FlowLayout.LEADING)); |
|
140 |
JPanel subpanel = new JPanel(new BorderLayout()); |
|
141 |
//subpanel.setLayout(new BoxLayout(subpanel, BoxLayout.Y_AXIS)); |
|
142 |
addbutton = new JButton(); |
|
143 |
addbutton.setIcon(PluginServices.getIconTheme().get("seismic-table-add")); |
|
144 |
addbutton.setPreferredSize(new Dimension(35, 22)); |
|
145 |
subpanel.add(addbutton, BorderLayout.NORTH); |
|
146 |
//subpanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0)); |
|
147 |
|
|
148 |
addbutton.addActionListener(new ActionListener() { |
|
149 |
public void actionPerformed(ActionEvent evt) { |
|
150 |
tableField.getSelectionModel().removeListSelectionListener(listener); |
|
151 |
addbuttonActionPerformed(evt); |
|
152 |
tableField.getSelectionModel().addListSelectionListener(listener); |
|
153 |
} |
|
154 |
}); |
|
155 |
JPanel gap = new JPanel(); |
|
156 |
//gap.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); |
|
157 |
subpanel.add(gap, BorderLayout.CENTER); |
|
158 |
removebutton = new JButton(); |
|
159 |
removebutton.setEnabled(false); |
|
160 |
removebutton.setIcon(PluginServices.getIconTheme().get("seismic-table-delete")); |
|
161 |
removebutton.setPreferredSize(new Dimension(35, 22)); |
|
162 |
subpanel.add(removebutton, BorderLayout.SOUTH); |
|
163 |
subpanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
|
164 |
|
|
165 |
removebutton.addActionListener(new ActionListener() { |
|
166 |
public void actionPerformed(ActionEvent evt) { |
|
167 |
tableField.getSelectionModel().removeListSelectionListener(listener); |
|
168 |
removebuttonActionPerformed(evt); |
|
169 |
tableField.getSelectionModel().addListSelectionListener(listener); |
|
170 |
} |
|
171 |
}); |
|
172 |
// button1.setAlignmentY(BOTTOM_ALIGNMENT); |
|
173 |
removebutton.setAlignmentY(TOP_ALIGNMENT); |
|
174 |
panel.add(subpanel); |
|
175 |
|
|
176 |
|
|
177 |
add(scroll); |
|
178 |
add(panel); |
|
179 |
|
|
180 |
} |
|
181 |
|
|
182 |
private void addbuttonActionPerformed(ActionEvent evt) { |
|
183 |
if (mode == MODE_OPEN) { |
|
184 |
if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { |
|
185 |
File[] files = fileChooser.getSelectedFiles(); |
|
186 |
this.notifyObservers(this, "LoadData"); |
|
187 |
} |
|
188 |
} else if (mode == MODE_SAVE) { |
|
189 |
if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { |
|
190 |
File[] files = fileChooser.getSelectedFiles(); |
|
191 |
} |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
private void removebuttonActionPerformed(ActionEvent evt) { |
|
196 |
int index = tableField.getSelectedRow(); |
|
197 |
if(index >-1){ |
|
198 |
this.notifyObservers(this, "Delete"); |
|
199 |
((DefaultTableModel)tableField.getModel()).removeRow(index); |
|
200 |
} |
|
201 |
} |
|
202 |
|
|
203 |
|
|
204 |
public void addFileTypeFilter(String extension, String description) { |
|
205 |
FileTypeFilter filter = new FileTypeFilter(extension, description); |
|
206 |
fileChooser.addChoosableFileFilter(filter); |
|
207 |
} |
|
208 |
|
|
209 |
public void setMode(int mode) { |
|
210 |
this.mode = mode; |
|
211 |
} |
|
212 |
|
|
213 |
public File[] getSelectedFiles() { |
|
214 |
return this.fileChooser.getSelectedFiles(); |
|
215 |
} |
|
216 |
|
|
217 |
public JFileChooser getFileChooser() { |
|
218 |
return this.fileChooser; |
|
219 |
} |
|
220 |
|
|
221 |
public void addObserver(Observer o) { |
|
222 |
observers.add(o); |
|
223 |
} |
|
224 |
|
|
225 |
public void deleteObserver(Observer o) { |
|
226 |
observers.remove(o); |
|
227 |
} |
|
228 |
|
|
229 |
public void deleteObservers() { |
|
230 |
observers.clear(); |
|
231 |
} |
|
232 |
|
|
233 |
public synchronized void notifyObservers(Observable observable, Object tableName) { |
|
234 |
for(int i =0; i<this.observers.size(); i++ ) { |
|
235 |
Observer o = (Observer) this.observers.get(i); |
|
236 |
o.update(this, tableName); |
|
237 |
} |
|
238 |
} |
|
239 |
|
|
240 |
public JTable getJListComponent(){ |
Also available in: Unified diff