Revision 25889
tags/tmp_build/extensions/extMetadata/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry kind="src" path="src-test"/> |
|
5 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
|
6 |
<classpathentry kind="var" path="GVSIG_INSTALL_DIR/bin/andami.jar"/> |
|
7 |
<classpathentry kind="lib" path="lib/org.gvsig.metadata.jar"/> |
|
8 |
<classpathentry kind="var" path="GVSIG_INSTALL_DIR/bin/lib/org.gvsig.tools.jar" sourcepath="/libToolsDIR"/> |
|
9 |
<classpathentry kind="lib" path="/libMetadata/lib/junit-4.4.jar"/> |
|
10 |
<classpathentry kind="var" path="GVSIG_INSTALL_DIR/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.jar" sourcepath="/appgvSIGDIR"/> |
|
11 |
<classpathentry kind="var" path="GVSIG_INSTALL_DIR/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/fmap.jar"/> |
|
12 |
<classpathentry kind="var" path="GVSIG_INSTALL_DIR/bin/lib/org.gvsig.ui.jar"/> |
|
13 |
<classpathentry kind="lib" path="lib/miglayout-3.6.jar"/> |
|
14 |
<classpathentry kind="lib" path="lib/org.gvsig.personaldb.jar"/> |
|
15 |
<classpathentry kind="var" path="GVSIG_INSTALL_DIR/bin/lib/iver-utiles.jar"/> |
|
16 |
<classpathentry kind="output" path="bin"/> |
|
17 |
</classpath> |
tags/tmp_build/extensions/extMetadata/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>extMetadata</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
</buildSpec> |
|
14 |
<natures> |
|
15 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
16 |
</natures> |
|
17 |
</projectDescription> |
tags/tmp_build/extensions/extMetadata/src-test/org/gvsig/metadata/extended/manager/MDElementImplTest.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extended.manager; |
|
32 |
|
|
33 |
import java.util.Locale; |
|
34 |
|
|
35 |
import org.gvsig.metadata.extended.MDElement; |
|
36 |
import org.gvsig.metadata.extended.manager.MDElementImpl; |
|
37 |
import org.gvsig.metadata.extended.registry.objects.MDElementDefinition; |
|
38 |
|
|
39 |
import junit.framework.TestCase; |
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
public class MDElementImplTest extends TestCase { |
|
44 |
|
|
45 |
//@BeforeClass |
|
46 |
public static void setUpBeforeClass() throws Exception { |
|
47 |
} |
|
48 |
|
|
49 |
//@AfterClass |
|
50 |
public static void tearDownAfterClass() throws Exception { |
|
51 |
} |
|
52 |
|
|
53 |
//@Before |
|
54 |
public void setUp() throws Exception { |
|
55 |
} |
|
56 |
|
|
57 |
//@After |
|
58 |
public void tearDown() throws Exception { |
|
59 |
} |
|
60 |
|
|
61 |
public void testGetId() { |
|
62 |
MDElement mde = new MDElementImpl(); |
|
63 |
mde.setId("123"); |
|
64 |
assertEquals("123", mde.getId()); |
|
65 |
} |
|
66 |
|
|
67 |
public void testGetValue() { |
|
68 |
MDElement mde = new MDElementImpl(); |
|
69 |
mde.setValue("Default value"); |
|
70 |
assertEquals("Default value", mde.getValue()); |
|
71 |
} |
|
72 |
|
|
73 |
public void testGetType() { |
|
74 |
MDElementDefinition mded = new MDElementDefinition("prueba", null, null, null, null); |
|
75 |
MDElement mde = new MDElementImpl(); |
|
76 |
mde.setType(mded); |
|
77 |
assertEquals(mded, mde.getType()); |
|
78 |
} |
|
79 |
|
|
80 |
public void testGetLocale() { |
|
81 |
MDElement mde = new MDElementImpl(); |
|
82 |
mde.setLocale(Locale.ENGLISH); |
|
83 |
assertEquals(Locale.ENGLISH, mde.getLocale()); |
|
84 |
} |
|
85 |
|
|
86 |
} |
tags/tmp_build/extensions/extMetadata/src-test/org/gvsig/metadata/extended/manager/ExtendedMDManagerImplTest.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extended.manager; |
|
32 |
|
|
33 |
import org.gvsig.metadata.Metadata; |
|
34 |
import org.gvsig.metadata.extended.ExtendedMDManager; |
|
35 |
import org.gvsig.metadata.extended.MDElement; |
|
36 |
import org.gvsig.metadata.extended.manager.ExtendedMDManagerImpl; |
|
37 |
import org.gvsig.metadata.extended.manager.ExtendedMetadataImpl; |
|
38 |
import org.gvsig.metadata.extended.manager.MDElementImpl; |
|
39 |
import org.gvsig.metadata.extended.registry.objects.MDElementDefinition; |
|
40 |
|
|
41 |
import junit.framework.TestCase; |
|
42 |
|
|
43 |
public class ExtendedMDManagerImplTest extends TestCase { |
|
44 |
|
|
45 |
//@BeforeClass |
|
46 |
public static void setUpBeforeClass() throws Exception { |
|
47 |
} |
|
48 |
|
|
49 |
//@AfterClass |
|
50 |
public static void tearDownAfterClass() throws Exception { |
|
51 |
} |
|
52 |
|
|
53 |
//@Before |
|
54 |
public void setUp() throws Exception { |
|
55 |
} |
|
56 |
|
|
57 |
//@After |
|
58 |
public void tearDown() throws Exception { |
|
59 |
} |
|
60 |
|
|
61 |
public void testCreateMD() { |
|
62 |
ExtendedMDManager emdm = new ExtendedMDManagerImpl(); |
|
63 |
Metadata md = emdm.createMD("prueba"); |
|
64 |
System.out.println("Metadata -> " + md.getClass()); |
|
65 |
assertEquals(new ExtendedMetadataImpl("prueba").getClass(), md.getClass()); |
|
66 |
assertEquals("prueba", ((ExtendedMetadataImpl) md).getName()); |
|
67 |
} |
|
68 |
|
|
69 |
public void testCreateMDElement() { |
|
70 |
ExtendedMDManager emdm = new ExtendedMDManagerImpl(); |
|
71 |
MDElement mde = emdm.createMDElement("prueba"); |
|
72 |
MDElementDefinition mded = new MDElementDefinition("prueba", null, null, null, null); |
|
73 |
assertEquals(new MDElementImpl(null, mded, null).getClass(), mde.getClass()); |
|
74 |
assertEquals("prueba", mde.getType().getName()); |
|
75 |
} |
|
76 |
|
|
77 |
} |
tags/tmp_build/extensions/extMetadata/src-test/org/gvsig/metadata/extended/manager/ExtendedMetadataImplTest.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extended.manager; |
|
32 |
|
|
33 |
import java.util.Date; |
|
34 |
|
|
35 |
import junit.framework.TestCase; |
|
36 |
|
|
37 |
import org.gvsig.metadata.exceptions.NamedMetadataNotFoundException; |
|
38 |
import org.gvsig.metadata.extended.ExtendedMetadata; |
|
39 |
import org.gvsig.metadata.extended.MDElement; |
|
40 |
import org.gvsig.metadata.extended.manager.ExtendedMetadataImpl; |
|
41 |
import org.gvsig.metadata.extended.manager.MDElementImpl; |
|
42 |
import org.gvsig.metadata.extended.registry.objects.MDDefinition; |
|
43 |
import org.gvsig.metadata.extended.registry.objects.MDElementDefinition; |
|
44 |
|
|
45 |
|
|
46 |
public class ExtendedMetadataImplTest extends TestCase { |
|
47 |
|
|
48 |
//@BeforeClass |
|
49 |
public static void setUpBeforeClass() throws Exception { |
|
50 |
} |
|
51 |
|
|
52 |
//@AfterClass |
|
53 |
public static void tearDownAfterClass() throws Exception { |
|
54 |
} |
|
55 |
|
|
56 |
//@Before |
|
57 |
public void setUp() throws Exception { |
|
58 |
} |
|
59 |
|
|
60 |
//@After |
|
61 |
public void tearDown() throws Exception { |
|
62 |
} |
|
63 |
|
|
64 |
public void testGet() throws NamedMetadataNotFoundException { |
|
65 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
66 |
md.set("Author", "Arturo"); |
|
67 |
assertEquals("Arturo", md.get("Author")); |
|
68 |
} |
|
69 |
|
|
70 |
public void testNamedMetadataNotFoundException() { |
|
71 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
72 |
try { |
|
73 |
md.get("Topic"); |
|
74 |
fail("get() should have thrown a NamedMetadataNotFoundException!"); |
|
75 |
} |
|
76 |
catch (NamedMetadataNotFoundException ex) { |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
public void testGetBoolean() throws ClassCastException, NamedMetadataNotFoundException { |
|
81 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
82 |
md.setBoolean("Available", true); |
|
83 |
assertEquals(true, md.getBoolean("Available")); |
|
84 |
} |
|
85 |
|
|
86 |
public void testGetDouble() throws ClassCastException, NamedMetadataNotFoundException { |
|
87 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
88 |
md.setDouble("Area", (double) 500); |
|
89 |
assertEquals((double) 500, md.getDouble("Area"), 0); |
|
90 |
} |
|
91 |
|
|
92 |
public void testGetInt() throws ClassCastException, NamedMetadataNotFoundException { |
|
93 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
94 |
md.setInt("Number", 5); |
|
95 |
assertEquals(5, md.getInt("Number")); |
|
96 |
} |
|
97 |
|
|
98 |
public void testGetString() throws ClassCastException, NamedMetadataNotFoundException { |
|
99 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
100 |
md.setString("Author", "Alejandro Llaves"); |
|
101 |
assertEquals("Alejandro Llaves", md.getString("Author")); |
|
102 |
} |
|
103 |
|
|
104 |
public void testGetDate() throws ClassCastException, NamedMetadataNotFoundException { |
|
105 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
106 |
md.setDate("Date", new Date(0L)); |
|
107 |
assertEquals(new Date(0l), md.getDate("Date")); |
|
108 |
} |
|
109 |
|
|
110 |
public void testHasValue() { |
|
111 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
112 |
assertEquals(md.hasValue("Author"), false); |
|
113 |
md.set("Author", "Alejandro Llaves"); |
|
114 |
assertEquals(md.hasValue("Author"), true); |
|
115 |
} |
|
116 |
|
|
117 |
public void testIsEmpty() { |
|
118 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
119 |
assertEquals(md.isEmpty(), true); |
|
120 |
md.set("Author", "Alejandro Llaves"); |
|
121 |
assertEquals(md.isEmpty(), false); |
|
122 |
} |
|
123 |
|
|
124 |
public void testGetElement() throws ClassCastException, NamedMetadataNotFoundException { |
|
125 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
126 |
MDElementDefinition mded = new MDElementDefinition("elemento de prueba", null, null, null, null); |
|
127 |
MDElement mde = new MDElementImpl("elem", mded, null); |
|
128 |
md.setElement(mde); |
|
129 |
assertEquals(mde, md.getElement("elemento de prueba")); |
|
130 |
} |
|
131 |
|
|
132 |
public void testGetName() { |
|
133 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
134 |
assertEquals("prueba", md.getName()); |
|
135 |
((ExtendedMetadataImpl) md).setName("2a_prueba"); |
|
136 |
assertEquals("2a_prueba", md.getName()); |
|
137 |
} |
|
138 |
|
|
139 |
public void testGetDescription() { |
|
140 |
ExtendedMetadata md = new ExtendedMetadataImpl("prueba"); |
|
141 |
((ExtendedMetadataImpl) md).setDescription("Objeto Metadata de prueba"); |
|
142 |
assertEquals("Objeto Metadata de prueba", md.getDescription()); |
|
143 |
} |
|
144 |
|
|
145 |
public void testGetType() { |
|
146 |
MDDefinition mdd = new MDDefinition("prueba", "Objeto Metadata de prueba"); |
|
147 |
ExtendedMetadata md = new ExtendedMetadataImpl(mdd, null); |
|
148 |
assertEquals(mdd, md.getType()); |
|
149 |
} |
|
150 |
} |
tags/tmp_build/extensions/extMetadata/src-test/org/gvsig/metadata/extended/ExtendedMDLibraryTest.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extended; |
|
32 |
|
|
33 |
import junit.framework.TestCase; |
|
34 |
|
|
35 |
import org.gvsig.metadata.MDLibrary; |
|
36 |
import org.gvsig.metadata.MDLocator; |
|
37 |
import org.gvsig.metadata.extended.manager.ExtendedMDManagerImpl; |
|
38 |
import org.gvsig.tools.locator.Library; |
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
public class ExtendedMDLibraryTest extends TestCase{ |
|
43 |
|
|
44 |
/** |
|
45 |
* Test method for {@link org.gvsig.metadata.extended.ExtendedMDLibrary#initialize()}. |
|
46 |
*/ |
|
47 |
public void testInitialize() { |
|
48 |
Library api = new MDLibrary(); |
|
49 |
Library impl = new ExtendedMDLibrary(); |
|
50 |
|
|
51 |
// 1: Initialize the Libraries |
|
52 |
api.initialize(); |
|
53 |
impl.initialize(); |
|
54 |
|
|
55 |
// 2: postInitialize them |
|
56 |
// if the library is not correctly initialized, |
|
57 |
// an Exception will be thrown |
|
58 |
api.postInitialize(); |
|
59 |
impl.postInitialize(); |
|
60 |
|
|
61 |
// Check if the correct implementation is returned |
|
62 |
assertEquals(ExtendedMDManagerImpl.class, MDLocator.getMDManager() |
|
63 |
.getClass()); |
|
64 |
} |
|
65 |
} |
tags/tmp_build/extensions/extMetadata/config/text.properties | ||
---|---|---|
1 |
# extMetadata |
|
2 |
Metadata=Metadatos |
|
3 |
|
|
4 |
# PreferencesPanel |
|
5 |
Base_Datos=Base de Datos |
|
6 |
Personal_DB_Button=Base de Datos Personal |
|
7 |
Corporative_DB_Button=Base de Datos Corporativa |
|
8 |
|
|
9 |
# MDBasicGUIPanel |
|
10 |
edit_checkbox=Activar Edici?n |
|
11 |
LayerMetadata=Metadatos de la Capa |
tags/tmp_build/extensions/extMetadata/config/text_en.properties | ||
---|---|---|
1 |
# extMetadata |
|
2 |
Metadata=Metadata |
|
3 |
|
|
4 |
# PreferencesPanel |
|
5 |
Base_Datos=Data Base |
|
6 |
Personal_DB_Button=Personal Data Base |
|
7 |
Corporative_DB_Button=Corporative Data Base |
|
8 |
|
|
9 |
# MDBasicGUIPanel |
|
10 |
edit_checkbox=Allow Edition |
|
11 |
LayerMetadata=Layer Metadata |
tags/tmp_build/extensions/extMetadata/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<plugin-config> |
|
4 |
<depends plugin-name="com.iver.cit.gvsig" /> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<libraries library-dir="."/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.metadata.extension.MetadataExtension" |
|
9 |
description="Metadata Extension (GUI + Metadata Publish Assistant)" |
|
10 |
active="true" |
|
11 |
priority="1"> |
|
12 |
</extension> |
|
13 |
</extensions> |
|
14 |
</plugin-config> |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extension/MetadataExtension.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extension; |
|
32 |
|
|
33 |
import org.gvsig.metadata.MDLibrary; |
|
34 |
import org.gvsig.metadata.MDLocator; |
|
35 |
import org.gvsig.metadata.MDManager; |
|
36 |
import org.gvsig.metadata.extended.ExtendedMDLibrary; |
|
37 |
import org.gvsig.metadata.extension.gui.DBPreferencesPage; |
|
38 |
import org.gvsig.metadata.extension.gui.MDGUITab; |
|
39 |
import org.gvsig.metadata.extension.gui.MDPreferencesPage; |
|
40 |
import org.gvsig.metadata.simple.SimpleMDLibrary; |
|
41 |
import org.gvsig.personaldb.PersonalDBLibrary; |
|
42 |
import org.gvsig.tools.locator.Library; |
|
43 |
|
|
44 |
import com.iver.andami.plugins.Extension; |
|
45 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
46 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.ThemeManagerWindow; |
|
47 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
|
48 |
|
|
49 |
public class MetadataExtension extends Extension { |
|
50 |
|
|
51 |
public void initialize() { |
|
52 |
|
|
53 |
System.out.println("\nInitializing Metadata Extension...\n"); |
|
54 |
|
|
55 |
// PROVISIONAL ------------------------------------------------------------------ |
|
56 |
// Instalamos la implementaci?n Simple, se debe realizar en el arranque de gvSIG. |
|
57 |
Library api = new MDLibrary(); |
|
58 |
api.initialize(); |
|
59 |
Library impl = new SimpleMDLibrary(); |
|
60 |
impl.initialize(); |
|
61 |
Library db = new PersonalDBLibrary(); |
|
62 |
db.initialize(); |
|
63 |
|
|
64 |
// EXTENDED Implementation Setup ------------------------------------------------ |
|
65 |
Library implExt = new ExtendedMDLibrary(); |
|
66 |
implExt.initialize(); |
|
67 |
|
|
68 |
// ADD MD Properties TAB in SHP Layers ------------------------------------------ |
|
69 |
ThemeManagerWindow.addPage(MDGUITab.class); |
|
70 |
ThemeManagerWindow.setTabEnabledForLayer(MDGUITab.class, FLyrVect.class, true); |
|
71 |
|
|
72 |
// ADD MD Preferences Panels ---------------------------------------------------- |
|
73 |
ExtensionPointsSingleton.getInstance().add("AplicationPreferences", "MDPreferencesPage", new MDPreferencesPage()); |
|
74 |
ExtensionPointsSingleton.getInstance().add("AplicationPreferences", "DBPreferencesPage", new DBPreferencesPage()); |
|
75 |
|
|
76 |
// ------------------------------------------------------------------------------ |
|
77 |
|
|
78 |
} |
|
79 |
|
|
80 |
public void postInitialize() { |
|
81 |
|
|
82 |
System.out.println("\nPostitializing Metadata Extension..."); |
|
83 |
|
|
84 |
// PROVISIONAL ------------------------------------------------------------------ |
|
85 |
Library api = new MDLibrary(); |
|
86 |
api.postInitialize(); |
|
87 |
Library impl = new SimpleMDLibrary(); |
|
88 |
impl.postInitialize(); |
|
89 |
Library db = new PersonalDBLibrary(); |
|
90 |
db.postInitialize(); |
|
91 |
|
|
92 |
// EXTENDED Implementation Setup ------------------------------------------------ |
|
93 |
Library implExt = new ExtendedMDLibrary(); |
|
94 |
implExt.postInitialize(); |
|
95 |
|
|
96 |
// TEST ------------------------------------------------------------------------- |
|
97 |
MDManager mdm = MDLocator.getInstance().getMDManager(); |
|
98 |
System.out.println("MDManager Implementation: " + mdm.getClass().getName() + "\n"); |
|
99 |
|
|
100 |
// ------------------------------------------------------------------------------ |
|
101 |
} |
|
102 |
|
|
103 |
public void execute(String arg0) { |
|
104 |
// TODO Auto-generated method stub |
|
105 |
} |
|
106 |
|
|
107 |
public boolean isEnabled() { |
|
108 |
// TODO Auto-generated method stub |
|
109 |
return true; |
|
110 |
} |
|
111 |
|
|
112 |
public boolean isVisible() { |
|
113 |
// TODO Auto-generated method stub |
|
114 |
return true; |
|
115 |
} |
|
116 |
|
|
117 |
} |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extension/gui/MDBasicGUIPanel.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extension.gui; |
|
32 |
|
|
33 |
import java.util.ArrayList; |
|
34 |
import java.util.Iterator; |
|
35 |
import java.util.List; |
|
36 |
import java.util.Map; |
|
37 |
|
|
38 |
import javax.swing.BorderFactory; |
|
39 |
import javax.swing.JComponent; |
|
40 |
import javax.swing.JLabel; |
|
41 |
import javax.swing.JPanel; |
|
42 |
import javax.swing.JTextField; |
|
43 |
import javax.swing.border.EtchedBorder; |
|
44 |
import javax.swing.border.TitledBorder; |
|
45 |
|
|
46 |
import net.miginfocom.swing.MigLayout; |
|
47 |
|
|
48 |
import org.gvsig.metadata.extended.registry.MDRegistry; |
|
49 |
import org.gvsig.metadata.extended.registry.MDRegistryImpl; |
|
50 |
import org.gvsig.metadata.extended.registry.objects.MDDefinition; |
|
51 |
import org.gvsig.metadata.extended.registry.objects.MDElementDefinition; |
|
52 |
|
|
53 |
import com.iver.andami.PluginServices; |
|
54 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
public class MDBasicGUIPanel extends JPanel{ |
|
59 |
|
|
60 |
private static final long serialVersionUID = -2005251151677378280L; |
|
61 |
private FLayer layer; |
|
62 |
private List<JComponent> uiElements; |
|
63 |
|
|
64 |
|
|
65 |
public MDBasicGUIPanel(FLayer fl) { |
|
66 |
this.layer = fl; |
|
67 |
this.uiElements = new ArrayList<JComponent>(); |
|
68 |
|
|
69 |
System.out.println("Metadata for: " + layer.getName()); |
|
70 |
|
|
71 |
MDRegistry reg = new MDRegistryImpl(); |
|
72 |
MDDefinition mdd = reg.getMDDefinition("FLayer"); |
|
73 |
|
|
74 |
//MDDefinition mdd2 = reg.getMDDefinition("NO_EXISTE"); |
|
75 |
|
|
76 |
setBorder(BorderFactory.createTitledBorder( |
|
77 |
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), |
|
78 |
PluginServices.getText(this, mdd.getName()), |
|
79 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
80 |
TitledBorder.DEFAULT_POSITION, null, null) |
|
81 |
); |
|
82 |
setLayout(new MigLayout()); |
|
83 |
|
|
84 |
Iterator it = mdd.iterator(); |
|
85 |
while (it.hasNext()) { |
|
86 |
Map.Entry e = (Map.Entry)it.next(); |
|
87 |
add(new JLabel(((MDElementDefinition)e.getValue()).getName() + ": ")); |
|
88 |
JTextField auxJTF = new JTextField(20); |
|
89 |
auxJTF.setEnabled(false); |
|
90 |
|
|
91 |
// Provisional, el valor se deberia leer del respectivo atributo de la capa |
|
92 |
auxJTF.setText(((MDElementDefinition)e.getValue()).getDefaultValue().toString()); |
|
93 |
|
|
94 |
add(auxJTF, "wrap"); |
|
95 |
uiElements.add(auxJTF); |
|
96 |
} |
|
97 |
|
|
98 |
} |
|
99 |
|
|
100 |
|
|
101 |
public void allowEdition() { |
|
102 |
Iterator it = uiElements.iterator(); |
|
103 |
while (it.hasNext()) { |
|
104 |
JComponent jc = (JComponent)it.next(); |
|
105 |
jc.setEnabled(true); |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
public void closeEdition() { |
|
110 |
Iterator it = uiElements.iterator(); |
|
111 |
while (it.hasNext()) { |
|
112 |
JComponent jc = (JComponent)it.next(); |
|
113 |
jc.setEnabled(false); |
|
114 |
} |
|
115 |
} |
|
116 |
|
|
117 |
public void saveChanges() { |
|
118 |
// TODO Auto-generated method stub |
|
119 |
|
|
120 |
} |
|
121 |
|
|
122 |
} |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extension/gui/MDGUITab.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extension.gui; |
|
32 |
|
|
33 |
import java.awt.BorderLayout; |
|
34 |
import java.awt.event.ItemEvent; |
|
35 |
import java.awt.event.ItemListener; |
|
36 |
|
|
37 |
import javax.swing.JCheckBox; |
|
38 |
import javax.swing.JPanel; |
|
39 |
|
|
40 |
import net.miginfocom.swing.MigLayout; |
|
41 |
|
|
42 |
import org.gvsig.gui.beans.swing.JBlank; |
|
43 |
|
|
44 |
import com.iver.andami.PluginServices; |
|
45 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
46 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
47 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
|
48 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
49 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage; |
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
public class MDGUITab extends AbstractThemeManagerPage { |
|
54 |
|
|
55 |
private static final long serialVersionUID = 1L; |
|
56 |
|
|
57 |
private FLayer layer; |
|
58 |
private MDBasicGUIPanel mdPanel; |
|
59 |
private JCheckBox editCB; |
|
60 |
private boolean edited; |
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
/** |
|
65 |
* This is the default constructor. |
|
66 |
*/ |
|
67 |
public MDGUITab() { |
|
68 |
super(); |
|
69 |
|
|
70 |
// GET ACTIVE LAYER -------------------------------- |
|
71 |
FLayers al = this.getFLayers(); |
|
72 |
FLayer[] ll = al.getActives(); |
|
73 |
|
|
74 |
layer = al.getLayer(0); |
|
75 |
if(ll.length > 0) |
|
76 |
layer = ll[0]; |
|
77 |
// ------------------------------------------------- |
|
78 |
|
|
79 |
mdPanel = new MDBasicGUIPanel(layer); |
|
80 |
|
|
81 |
setLayout(new BorderLayout()); |
|
82 |
add(mdPanel, BorderLayout.CENTER); |
|
83 |
add(new JBlank(5, 10), BorderLayout.WEST); |
|
84 |
add(new JBlank(5, 10), BorderLayout.EAST); |
|
85 |
add(getSouthPanel(), BorderLayout.SOUTH); |
|
86 |
} |
|
87 |
|
|
88 |
private JPanel getSouthPanel() { |
|
89 |
|
|
90 |
editCB = new JCheckBox(PluginServices.getText(this, "edit_checkbox"), false); |
|
91 |
editCB.addItemListener( new ItemListener() { |
|
92 |
public void itemStateChanged(ItemEvent e) { |
|
93 |
if(e.getStateChange() == ItemEvent.SELECTED) { |
|
94 |
mdPanel.allowEdition(); |
|
95 |
edited = true; |
|
96 |
} else |
|
97 |
mdPanel.closeEdition(); |
|
98 |
} |
|
99 |
} |
|
100 |
); |
|
101 |
edited = false; |
|
102 |
|
|
103 |
JPanel auxPanel = new JPanel(); |
|
104 |
auxPanel.setLayout(new MigLayout()); |
|
105 |
auxPanel.add(editCB); |
|
106 |
return auxPanel; |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* (non-Javadoc) |
|
111 |
* @see java.awt.Component#getName() |
|
112 |
*/ |
|
113 |
public String getName() { |
|
114 |
return PluginServices.getText(this, "Metadata"); |
|
115 |
} |
|
116 |
|
|
117 |
/** |
|
118 |
* Sets the necessary properties in the panel. |
|
119 |
* @param FLayer layer |
|
120 |
*/ |
|
121 |
public void setModel(FLayer layer) { |
|
122 |
this.layer = layer; |
|
123 |
} |
|
124 |
|
|
125 |
public void acceptAction() { |
|
126 |
if(edited) |
|
127 |
mdPanel.saveChanges(); |
|
128 |
} |
|
129 |
|
|
130 |
public void cancelAction() { |
|
131 |
//if(edited) -> Lanzar alert sobre guardar posibles cambios? |
|
132 |
} |
|
133 |
|
|
134 |
public void applyAction() { |
|
135 |
if(edited) { |
|
136 |
mdPanel.closeEdition(); |
|
137 |
mdPanel.saveChanges(); |
|
138 |
} |
|
139 |
} |
|
140 |
|
|
141 |
private FLayers getFLayers () { |
|
142 |
FLayers flyrs = null; |
|
143 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
144 |
|
|
145 |
if( !(window instanceof View) ) { |
|
146 |
IWindow[] windowList = PluginServices.getMDIManager().getAllWindows(); |
|
147 |
for (int i = 0; i < windowList.length; i++) { |
|
148 |
if(windowList[i] instanceof View) { |
|
149 |
window = windowList[i]; |
|
150 |
break; |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
if ( window != null && window instanceof View ) |
|
156 |
if ( ((View) window).getMapControl() != null ) |
|
157 |
if ( ((View) window).getMapControl().getMapContext() != null ) |
|
158 |
flyrs = ((View) window).getMapControl().getMapContext().getLayers(); |
|
159 |
return flyrs; |
|
160 |
} |
|
161 |
|
|
162 |
} |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extension/gui/MDPreferencesPage.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extension.gui; |
|
32 |
|
|
33 |
import javax.swing.ImageIcon; |
|
34 |
import javax.swing.JPanel; |
|
35 |
|
|
36 |
import com.iver.andami.PluginServices; |
|
37 |
import com.iver.andami.preferences.AbstractPreferencePage; |
|
38 |
import com.iver.andami.preferences.StoreException; |
|
39 |
|
|
40 |
public class MDPreferencesPage extends AbstractPreferencePage { |
|
41 |
|
|
42 |
private static final long serialVersionUID = 2640567471202937755L; |
|
43 |
private final ImageIcon icon; |
|
44 |
public static String id; |
|
45 |
|
|
46 |
public MDPreferencesPage () { |
|
47 |
super(); |
|
48 |
icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/metadata-emblem.png")); |
|
49 |
id = getID(); |
|
50 |
} |
|
51 |
|
|
52 |
public String getID () { |
|
53 |
return this.getClass().getName(); |
|
54 |
} |
|
55 |
|
|
56 |
public String getTitle () { |
|
57 |
return PluginServices.getText(this, "Metadata"); |
|
58 |
} |
|
59 |
|
|
60 |
public JPanel getPanel () { |
|
61 |
return this; |
|
62 |
} |
|
63 |
|
|
64 |
public ImageIcon getIcon () { |
|
65 |
return icon; |
|
66 |
} |
|
67 |
|
|
68 |
public void setChangesApplied () { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
public void storeValues () throws StoreException { |
|
74 |
// TODO Auto-generated method stub |
|
75 |
|
|
76 |
} |
|
77 |
|
|
78 |
public void initializeDefaults () { |
|
79 |
// TODO Auto-generated method stub |
|
80 |
|
|
81 |
} |
|
82 |
|
|
83 |
public void initializeValues () { |
|
84 |
// TODO Auto-generated method stub |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
public boolean isValueChanged () { |
|
89 |
// TODO Auto-generated method stub |
|
90 |
return false; |
|
91 |
} |
|
92 |
|
|
93 |
} |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extension/gui/DBPreferencesPage.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.extension.gui; |
|
32 |
|
|
33 |
import java.awt.event.ActionEvent; |
|
34 |
import java.awt.event.ActionListener; |
|
35 |
|
|
36 |
import javax.swing.ButtonGroup; |
|
37 |
import javax.swing.ImageIcon; |
|
38 |
import javax.swing.JPanel; |
|
39 |
import javax.swing.JRadioButton; |
|
40 |
|
|
41 |
import net.miginfocom.swing.MigLayout; |
|
42 |
|
|
43 |
import com.iver.andami.PluginServices; |
|
44 |
import com.iver.andami.preferences.AbstractPreferencePage; |
|
45 |
import com.iver.andami.preferences.StoreException; |
|
46 |
|
|
47 |
public class DBPreferencesPage extends AbstractPreferencePage implements ActionListener { |
|
48 |
|
|
49 |
private static final long serialVersionUID = -1100950358368412672L; |
|
50 |
private final ImageIcon icon; |
|
51 |
public static String id; |
|
52 |
|
|
53 |
private JRadioButton personalButton; |
|
54 |
private JRadioButton corporativeButton; |
|
55 |
|
|
56 |
|
|
57 |
public DBPreferencesPage () { |
|
58 |
super(); |
|
59 |
this.setParentID(MDPreferencesPage.id); |
|
60 |
icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/dataBase.png")); |
|
61 |
id = getID(); |
|
62 |
|
|
63 |
// tratar como un panel |
|
64 |
setLayout(new MigLayout()); |
|
65 |
|
|
66 |
personalButton = new JRadioButton(PluginServices.getText(this, "Personal_DB_Button")); |
|
67 |
personalButton.setActionCommand("personal"); |
|
68 |
personalButton.addActionListener(this); |
|
69 |
personalButton.setSelected(true); |
|
70 |
|
|
71 |
corporativeButton = new JRadioButton(PluginServices.getText(this, "Corporative_DB_Button")); |
|
72 |
corporativeButton.setActionCommand("corporative"); |
|
73 |
corporativeButton.addActionListener(this); |
|
74 |
corporativeButton.setEnabled(false); |
|
75 |
|
|
76 |
ButtonGroup group = new ButtonGroup(); |
|
77 |
group.add(personalButton); |
|
78 |
group.add(corporativeButton); |
|
79 |
|
|
80 |
add(personalButton, "wrap"); |
|
81 |
add(corporativeButton, "wrap"); |
|
82 |
} |
|
83 |
|
|
84 |
public String getID () { |
|
85 |
return this.getClass().getName(); |
|
86 |
} |
|
87 |
|
|
88 |
public String getTitle () { |
|
89 |
return PluginServices.getText(this, "Base_Datos"); |
|
90 |
} |
|
91 |
|
|
92 |
public JPanel getPanel () { |
|
93 |
return this; |
|
94 |
} |
|
95 |
|
|
96 |
public ImageIcon getIcon () { |
|
97 |
return icon; |
|
98 |
} |
|
99 |
|
|
100 |
public void setChangesApplied () { |
|
101 |
// TODO Auto-generated method stub |
|
102 |
|
|
103 |
} |
|
104 |
|
|
105 |
public void storeValues () throws StoreException { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
public void initializeDefaults () { |
|
111 |
// TODO Auto-generated method stub |
|
112 |
|
|
113 |
} |
|
114 |
|
|
115 |
public void initializeValues () { |
|
116 |
// TODO Auto-generated method stub |
|
117 |
|
|
118 |
} |
|
119 |
|
|
120 |
public boolean isValueChanged () { |
|
121 |
// TODO Auto-generated method stub |
|
122 |
return false; |
|
123 |
} |
|
124 |
|
|
125 |
public void actionPerformed(ActionEvent e) { |
|
126 |
// TODO Auto-generated method stub |
|
127 |
// e.getActionCommand() nos devuelve "personal" o "corporative" dependiendo del boton seleccionado |
|
128 |
} |
|
129 |
} |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extended/registry/MDRegistry.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
package org.gvsig.metadata.extended.registry; |
|
34 |
|
|
35 |
import org.gvsig.metadata.extended.registry.objects.MDDefinition; |
|
36 |
import org.gvsig.metadata.extended.registry.objects.MDElementDefinition; |
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
public interface MDRegistry { |
|
41 |
|
|
42 |
public MDDefinition getMDDefinition(String name); |
|
43 |
public boolean setMDDefinition(MDDefinition mdd); |
|
44 |
public boolean setMDElementDefinition(MDElementDefinition mded); |
|
45 |
|
|
46 |
} |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extended/registry/objects/MDDefinition.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
|
|
32 |
package org.gvsig.metadata.extended.registry.objects; |
|
33 |
|
|
34 |
import java.util.Iterator; |
|
35 |
import java.util.LinkedHashMap; |
|
36 |
import java.util.Map; |
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
public class MDDefinition { |
|
41 |
private int id; |
|
42 |
private String name; |
|
43 |
private String description; |
|
44 |
private MDDefinition father; |
|
45 |
private Map<String, MDElementDefinition> elements; |
|
46 |
private boolean changed, persisted; |
|
47 |
|
|
48 |
//eliminar este construtor |
|
49 |
public MDDefinition() { |
|
50 |
this.id = 0; |
|
51 |
this.name = ""; |
|
52 |
this.description = ""; |
|
53 |
this.father = null; |
|
54 |
this.elements = new LinkedHashMap<String, MDElementDefinition>(); |
|
55 |
} |
|
56 |
|
|
57 |
public MDDefinition(String name, String description) { |
|
58 |
this.id = 0; |
|
59 |
this.name = name; |
|
60 |
this.description = description; |
|
61 |
this.father = null; |
|
62 |
this.elements = new LinkedHashMap<String, MDElementDefinition>(); |
|
63 |
this.changed = true; |
|
64 |
this.persisted = false; |
|
65 |
} |
|
66 |
|
|
67 |
public MDDefinition(int id, String name, String description) { |
|
68 |
this.id = id; |
|
69 |
this.name = name; |
|
70 |
this.description = description; |
|
71 |
this.father = null; |
|
72 |
this.elements = new LinkedHashMap<String, MDElementDefinition>(); |
|
73 |
this.changed = false; |
|
74 |
this.persisted = true; |
|
75 |
} |
|
76 |
|
|
77 |
|
|
78 |
/** |
|
79 |
* @return the id |
|
80 |
*/ |
|
81 |
public int getId() { |
|
82 |
return id; |
|
83 |
} |
|
84 |
|
|
85 |
public String getName() { |
|
86 |
return this.name; |
|
87 |
} |
|
88 |
|
|
89 |
public String getDescription() { |
|
90 |
return this.description; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* @return the father |
|
95 |
*/ |
|
96 |
public MDDefinition getFather() { |
|
97 |
return father; |
|
98 |
} |
|
99 |
|
|
100 |
public void setName(String name) { |
|
101 |
this.name = name; |
|
102 |
this.changed = true; |
|
103 |
} |
|
104 |
|
|
105 |
public void setDescription(String description) { |
|
106 |
this.description = description; |
|
107 |
this.changed = true; |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* @param father the father to set |
|
112 |
*/ |
|
113 |
public void setFather(MDDefinition father) { |
|
114 |
this.father = father; |
|
115 |
this.changed = true; |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* @param id the id to set |
|
120 |
*/ |
|
121 |
public void setId(int id) { |
|
122 |
this.id = id; |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* @return the changed |
|
127 |
*/ |
|
128 |
public boolean isChanged() { |
|
129 |
return changed; |
|
130 |
} |
|
131 |
|
|
132 |
/** |
|
133 |
* @param changed the changed to set |
|
134 |
*/ |
|
135 |
public void setChanged(boolean changed) { |
|
136 |
this.changed = changed; |
|
137 |
} |
|
138 |
|
|
139 |
public Iterator iterator() { |
|
140 |
return elements.entrySet().iterator(); |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* @return the persisted |
|
145 |
*/ |
|
146 |
public boolean isPersisted() { |
|
147 |
return persisted; |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* @param persisted the persisted to set |
|
152 |
*/ |
|
153 |
public void setPersisted(boolean persisted) { |
|
154 |
this.persisted = persisted; |
|
155 |
} |
|
156 |
|
|
157 |
public void addMDElementDefinition(MDElementDefinition mded) { |
|
158 |
elements.put(mded.getName(), mded); |
|
159 |
this.changed = true; |
|
160 |
} |
|
161 |
|
|
162 |
public MDElementDefinition getMDElementDefinition(String name) { |
|
163 |
return elements.get(name); |
|
164 |
} |
|
165 |
|
|
166 |
} |
tags/tmp_build/extensions/extMetadata/src/org/gvsig/metadata/extended/registry/objects/MDType.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
package org.gvsig.metadata.extended.registry.objects; |
|
34 |
|
|
35 |
import java.sql.Types; |
|
36 |
|
|
37 |
public class MDType { |
|
38 |
private String id; |
|
39 |
private String name; |
|
40 |
private Types type; |
|
41 |
|
|
42 |
public MDType() { |
|
43 |
this.id = ""; |
|
44 |
this.name = ""; |
|
45 |
this.type = null; |
|
46 |
} |
|
47 |
|
|
48 |
public MDType(String name, Types type) { |
|
49 |
this.id = ""; |
|
50 |
this.name = name; |
|
51 |
this.type = type; |
|
52 |
} |
|
53 |
|
|
54 |
public String getName() { |
|
55 |
return name; |
|
56 |
} |
|
57 |
|
|
58 |
public void setName(String name) { |
|
59 |
this.name = name; |
|
60 |
} |
|
61 |
|
|
62 |
public Types getType() { |
|
63 |
return type; |
|
64 |
} |
|
65 |
|
|
66 |
public void setType(Types type) { |
|
67 |
this.type = type; |
|
68 |
} |
Also available in: Unified diff