Revision 41376
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.metadata.swing.basic.impl</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
|
|
7 |
<name>org.gvsig.metadata.swing.basic.impl</name> |
|
8 |
<description /> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.metadata.basic.swing</artifactId> |
|
12 |
<version>2.0.35</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<dependencies> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.metadata.swing.basic.api</artifactId> |
|
27 |
</dependency> |
|
28 |
<!-- FIXME: No deberia tener una dependencia con la implementacion --> |
|
29 |
<!-- |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId> |
|
33 |
</dependency> |
|
34 |
--> |
|
35 |
</dependencies> |
|
36 |
</project> |
|
0 | 37 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/resources/org/gvsig/metadata/swing/impl/i18n/text.properties | ||
---|---|---|
1 |
# Resource bundle texts for the Spanish language locale (es) |
|
2 |
Example.returns_value=devuelve el valor |
|
0 | 3 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/resources/org/gvsig/metadata/swing/impl/i18n/text_en.properties | ||
---|---|---|
1 |
# Resource bundle texts for the English language locale (en) |
|
2 |
Example.returns_value=returns value |
|
0 | 3 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your library classes. |
|
2 |
|
|
3 |
This folder is added to the runtime classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, into this folder you can find some examples of resource bundle |
|
7 |
property files that may be used by your library classes. |
|
0 | 8 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.metadata.swing.basic.impl.BasicMetadataSwingLibrary |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/java/org/gvsig/metadata/swing/basic/impl/BasicMetadataSwingManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.impl; |
|
25 |
|
|
26 |
import org.gvsig.metadata.Metadata; |
|
27 |
import org.gvsig.metadata.MetadataLocator; |
|
28 |
import org.gvsig.metadata.MetadataManager; |
|
29 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
30 |
import org.gvsig.metadata.swing.basic.api.JMetadataPanel; |
|
31 |
import org.gvsig.metadata.swing.basic.api.MetadataSwingManager; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.i18n.I18nManager; |
|
34 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
35 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
36 |
|
|
37 |
/** |
|
38 |
* |
|
39 |
* 04/04/2010 |
|
40 |
* |
|
41 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
42 |
*/ |
|
43 |
public class BasicMetadataSwingManager implements MetadataSwingManager { |
|
44 |
|
|
45 |
private I18nManager i18nManager; |
|
46 |
|
|
47 |
public BasicMetadataSwingManager() { |
|
48 |
i18nManager = ToolsLocator.getI18nManager(); |
|
49 |
} |
|
50 |
|
|
51 |
public String translate(String message) { |
|
52 |
if (message != null) { |
|
53 |
return i18nManager.getTranslation(message); |
|
54 |
} |
|
55 |
return ""; |
|
56 |
} |
|
57 |
|
|
58 |
public MetadataManager getManager() { |
|
59 |
return MetadataLocator.getMetadataManager(); |
|
60 |
} |
|
61 |
|
|
62 |
public JMetadataPanel createJMetadataPanel(Metadata metadata, boolean editable) { |
|
63 |
try { |
|
64 |
this.getManager().loadMetadata(metadata); |
|
65 |
|
|
66 |
} catch (MetadataException e) { |
|
67 |
// TODO Auto-generated catch block |
|
68 |
e.printStackTrace(); |
|
69 |
} |
|
70 |
|
|
71 |
BasicJMetadataPanel panel = new BasicJMetadataPanel(this, metadata, |
|
72 |
editable); |
|
73 |
panel.setMetadata(metadata); |
|
74 |
return panel; |
|
75 |
} |
|
76 |
|
|
77 |
public JMetadataPanel createJMetadataPanel(Metadata metadata) { |
|
78 |
return this.createJMetadataPanel(metadata, true); |
|
79 |
} |
|
80 |
|
|
81 |
public UsabilitySwingManager getUIBuilder() { |
|
82 |
return ToolsSwingLocator.getUsabilitySwingManager(); |
|
83 |
} |
|
84 |
} |
|
0 | 85 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/java/org/gvsig/metadata/swing/basic/impl/BasicJMetadataPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.impl; |
|
25 |
|
|
26 |
import java.awt.BorderLayout; |
|
27 |
import java.awt.Component; |
|
28 |
import java.util.HashMap; |
|
29 |
import java.util.Map; |
|
30 |
|
|
31 |
import javax.swing.JComponent; |
|
32 |
import javax.swing.JLabel; |
|
33 |
import javax.swing.JPanel; |
|
34 |
import javax.swing.JScrollPane; |
|
35 |
|
|
36 |
import org.gvsig.metadata.Metadata; |
|
37 |
import org.gvsig.metadata.MetadataLocator; |
|
38 |
import org.gvsig.metadata.MetadataManager; |
|
39 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
40 |
import org.gvsig.metadata.swing.basic.api.AbstractSimpleMetadataPanel; |
|
41 |
import org.gvsig.metadata.swing.basic.api.JMetadataPanel; |
|
42 |
import org.gvsig.metadata.swing.basic.api.MetadataSwingManager; |
|
43 |
import org.gvsig.tools.dynobject.DynStruct; |
|
44 |
import org.gvsig.tools.dynobject.exception.DynObjectValidateException; |
|
45 |
import org.gvsig.tools.service.ServiceException; |
|
46 |
import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent; |
|
47 |
|
|
48 |
public class BasicJMetadataPanel extends JMetadataPanel { |
|
49 |
|
|
50 |
private static final long serialVersionUID = 6514865354393558940L; |
|
51 |
private JLabel lblName; |
|
52 |
private MetadataManager manager; |
|
53 |
private JDynObjectComponent component; |
|
54 |
private JComponent inputComponent; |
|
55 |
private Map nodeList; |
|
56 |
private Map nodeComponentsList; |
|
57 |
|
|
58 |
public BasicJMetadataPanel(MetadataSwingManager uiManager, |
|
59 |
Metadata metadata, boolean editable) { |
|
60 |
super(uiManager, metadata, editable); |
|
61 |
} |
|
62 |
|
|
63 |
protected void initManagers() { |
|
64 |
manager = MetadataLocator.getMetadataManager(); |
|
65 |
} |
|
66 |
|
|
67 |
protected void initData() { |
|
68 |
String metadataName = ""; |
|
69 |
if (!this.hasMetadata()) |
|
70 |
return; |
|
71 |
|
|
72 |
try { |
|
73 |
|
|
74 |
metadataName = getMetadata().getMetadataName(); |
|
75 |
this.lblName.setText("Metadata Layer of " + metadataName + ":"); |
|
76 |
|
|
77 |
} catch (MetadataException e) { |
|
78 |
// TODO Auto-generated catch block |
|
79 |
e.printStackTrace(); |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
protected void initUI() { |
|
85 |
this.setLayout(new BorderLayout()); |
|
86 |
this.lblName = new JLabel(); |
|
87 |
|
|
88 |
this.add(this.lblName, BorderLayout.NORTH); |
|
89 |
} |
|
90 |
|
|
91 |
public void saveMetadata() throws DynObjectValidateException { |
|
92 |
try { |
|
93 |
this.component.saveStatus(); |
|
94 |
Metadata theNewMetadata = (Metadata) this.component.getValue(); |
|
95 |
this.getMetadata().getDynClass().validate(theNewMetadata); |
|
96 |
manager.storeMetadata(this.getMetadata()); |
|
97 |
} catch (MetadataException e) { |
|
98 |
e.printStackTrace(); |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
public void setMetadata(Metadata metadata) { |
|
103 |
|
|
104 |
// Metadata ids must be different if both are not null |
|
105 |
// if (((this.hasMetadata()) && (this.getMetadata() != null) && (this.getMetadata() |
|
106 |
// .getDynClass().getFullName().equals(metadata.getDynClass() |
|
107 |
// .getFullName())))) { |
|
108 |
// return; |
|
109 |
// } |
|
110 |
if (inputComponent != null) { |
|
111 |
this.remove(inputComponent); |
|
112 |
} |
|
113 |
|
|
114 |
super.setMetadata(metadata); |
|
115 |
|
|
116 |
createMetadataComponent(metadata, true); |
|
117 |
|
|
118 |
} |
|
119 |
|
|
120 |
|
|
121 |
protected AbstractSimpleMetadataPanel createMetadataComponent(Metadata metadata, boolean refresh) { |
|
122 |
if (metadata == null){ |
|
123 |
metadata = getMetadata(); |
|
124 |
} |
|
125 |
|
|
126 |
try { |
|
127 |
|
|
128 |
component = (JDynObjectComponent) getNodeElements().get(metadata.getDynClass()); |
|
129 |
inputComponent = |
|
130 |
(JComponent) getComponentElements().get(metadata.getDynClass()); |
|
131 |
|
|
132 |
if (!((component != null)&&(refresh==false))) { |
|
133 |
component = createJDynObjectComponent( |
|
134 |
getMetadata().getDynClass(), getMetadata(), true); |
|
135 |
|
|
136 |
}else{ |
|
137 |
component.setValue(metadata); |
|
138 |
} |
|
139 |
inputComponent = component.asJComponent(); |
|
140 |
putElement(getMetadata().getDynClass(), component); |
|
141 |
putComponent(getMetadata().getDynClass(), inputComponent); |
|
142 |
|
|
143 |
if (getMetadata() != null) { |
|
144 |
this.add(createJScrollPane(inputComponent)); |
|
145 |
} |
|
146 |
|
|
147 |
this.updateUI(); |
|
148 |
} catch (ServiceException e) { |
|
149 |
// TODO Auto-generated catch block |
|
150 |
e.printStackTrace(); |
|
151 |
} |
|
152 |
return this; |
|
153 |
} |
|
154 |
|
|
155 |
private Component createJScrollPane(JComponent inputComponent) { |
|
156 |
if (inputComponent instanceof JPanel) { |
|
157 |
return new JScrollPane(inputComponent); |
|
158 |
} |
|
159 |
return inputComponent; |
|
160 |
} |
|
161 |
|
|
162 |
private Map getNodeElements() { |
|
163 |
if (nodeList == null) { |
|
164 |
nodeList = new HashMap(); |
|
165 |
} |
|
166 |
return nodeList; |
|
167 |
} |
|
168 |
|
|
169 |
private void putElement(DynStruct metadata, JDynObjectComponent component) { |
|
170 |
|
|
171 |
getNodeElements().put(metadata, component); |
|
172 |
} |
|
173 |
|
|
174 |
private void putComponent(DynStruct metadata, JComponent component) { |
|
175 |
|
|
176 |
getComponentElements().put(metadata, component); |
|
177 |
} |
|
178 |
|
|
179 |
private Map getComponentElements() { |
|
180 |
if (nodeComponentsList == null) { |
|
181 |
nodeComponentsList = new HashMap(); |
|
182 |
} |
|
183 |
return nodeComponentsList; |
|
184 |
} |
|
185 |
} |
|
0 | 186 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/java/org/gvsig/metadata/swing/basic/impl/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.metadata.swing.impl package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library description.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#packagecomment">Javadoc Tool documentation about the package file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
|
0 | 16 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/java/org/gvsig/metadata/swing/basic/impl/BasicMetadataSwingLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.impl; |
|
25 |
|
|
26 |
import org.gvsig.metadata.MetadataLibrary; |
|
27 |
import org.gvsig.metadata.swing.basic.api.MetadataSwingLibrary; |
|
28 |
import org.gvsig.metadata.swing.basic.api.MetadataSwingLocator; |
|
29 |
import org.gvsig.tools.ToolsLocator; |
|
30 |
import org.gvsig.tools.i18n.I18nManager; |
|
31 |
import org.gvsig.tools.library.AbstractLibrary; |
|
32 |
import org.gvsig.tools.library.LibraryException; |
|
33 |
import org.gvsig.tools.swing.api.ToolsSwingLibrary; |
|
34 |
|
|
35 |
/** |
|
36 |
* |
|
37 |
* @author gvSIG Team |
|
38 |
* @version $Id$ |
|
39 |
* |
|
40 |
*/ |
|
41 |
public class BasicMetadataSwingLibrary extends AbstractLibrary { |
|
42 |
|
|
43 |
public void doRegistration() { |
|
44 |
super.doRegistration(); |
|
45 |
this.registerAsImplementationOf(MetadataSwingLibrary.class); |
|
46 |
require(ToolsSwingLibrary.class); |
|
47 |
require(MetadataLibrary.class); |
|
48 |
} |
|
49 |
|
|
50 |
protected void doInitialize() throws LibraryException { |
|
51 |
MetadataSwingLocator |
|
52 |
.registerDefaultMetadataSwingManager(BasicMetadataSwingManager.class); |
|
53 |
|
|
54 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
55 |
|
|
56 |
i18nManager.addResourceFamily( |
|
57 |
"org.gvsig.metadata.swing.basic.impl.i18n.text", |
|
58 |
BasicMetadataSwingLibrary.class.getClassLoader(), |
|
59 |
BasicMetadataSwingLibrary.class.getClass().getName()); |
|
60 |
} |
|
61 |
|
|
62 |
protected void doPostInitialize() throws LibraryException { |
|
63 |
|
|
64 |
} |
|
65 |
|
|
66 |
} |
|
0 | 67 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/java/org/gvsig/metadata/swing/basic/impl/JMetadataEditorPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.impl; |
|
25 |
|
|
26 |
import java.awt.BorderLayout; |
|
27 |
|
|
28 |
import javax.swing.JComponent; |
|
29 |
|
|
30 |
import org.gvsig.metadata.Metadata; |
|
31 |
import org.gvsig.metadata.MetadataLocator; |
|
32 |
import org.gvsig.metadata.MetadataManager; |
|
33 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
34 |
import org.gvsig.metadata.swing.basic.api.AbstractSimpleMetadataPanel; |
|
35 |
import org.gvsig.metadata.swing.basic.api.JMetadataPanel; |
|
36 |
import org.gvsig.metadata.swing.basic.api.MetadataSwingManager; |
|
37 |
import org.gvsig.tools.dynobject.exception.DynObjectValidateException; |
|
38 |
import org.gvsig.tools.service.ServiceException; |
|
39 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
40 |
import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent; |
|
41 |
|
|
42 |
public class JMetadataEditorPanel extends JMetadataPanel { |
|
43 |
|
|
44 |
/** |
|
45 |
* |
|
46 |
*/ |
|
47 |
private static final long serialVersionUID = -5680452321763343711L; |
|
48 |
private JDynObjectComponent component; |
|
49 |
private JComponent inputComponent; |
|
50 |
private MetadataManager manager; |
|
51 |
|
|
52 |
public JMetadataEditorPanel(MetadataSwingManager uiManager, |
|
53 |
Metadata metadata, boolean isEditable) { |
|
54 |
super(uiManager, metadata, isEditable); |
|
55 |
} |
|
56 |
|
|
57 |
protected AbstractSimpleMetadataPanel createMetadataComponent( |
|
58 |
Metadata metadata, boolean doRefresh) { |
|
59 |
if (metadata == null) { |
|
60 |
metadata = getMetadata(); |
|
61 |
} |
|
62 |
if (inputComponent != null) { |
|
63 |
remove(inputComponent); |
|
64 |
inputComponent = null; |
|
65 |
} |
|
66 |
try { |
|
67 |
component = ToolsSwingLocator.getDynObjectSwingManager() |
|
68 |
.createJDynObjectComponent(metadata, this.isEditable()); |
|
69 |
|
|
70 |
this.add(inputComponent, BorderLayout.CENTER); |
|
71 |
} catch (ServiceException e) { |
|
72 |
// TODO Auto-generated catch block |
|
73 |
e.printStackTrace(); |
|
74 |
} |
|
75 |
return this; |
|
76 |
} |
|
77 |
|
|
78 |
protected void initManagers() { |
|
79 |
manager = MetadataLocator.getMetadataManager(); |
|
80 |
} |
|
81 |
|
|
82 |
public void saveMetadata() throws DynObjectValidateException { |
|
83 |
try { |
|
84 |
this.component.saveStatus(); |
|
85 |
this.getMetadata().getDynClass().validate(this.getMetadata()); |
|
86 |
manager.storeMetadata(this.getMetadata()); |
|
87 |
} catch (MetadataException e) { |
|
88 |
e.printStackTrace(); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
protected void initData() { |
|
93 |
// TODO Auto-generated method stub |
|
94 |
|
|
95 |
} |
|
96 |
|
|
97 |
protected void initUI() { |
|
98 |
// TODO Auto-generated method stub |
|
99 |
|
|
100 |
} |
|
101 |
|
|
102 |
} |
|
0 | 103 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/main/javadoc/overview.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.metadata.swing.impl package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library overview.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
|
0 | 16 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
Put into this folder the resources needed by your test classes. |
|
5 |
|
|
6 |
This folder is added to the Tests classpath, so you can load any resources |
|
7 |
through the ClassLoader. |
|
8 |
|
|
9 |
By default, in this folder you can find an example of log4j configuration, |
|
10 |
prepared to log messages through the console, so logging works when you |
|
11 |
run your tests classes. |
|
0 | 12 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
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 |
DefaultExampleManager class. |
|
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.metadata.swing.impl.impl.DefaultExampleManager"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
|
|
26 |
<!-- |
|
27 |
By default, show only logging messages of INFO level or higher, |
|
28 |
through the previously configured CONSOLE appender. |
|
29 |
--> |
|
30 |
<root> |
|
31 |
<priority value="INFO" /> |
|
32 |
<appender-ref ref="CONSOLE" /> |
|
33 |
</root> |
|
34 |
</log4j:configuration> |
|
0 | 35 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.impl/src/test/java/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
For each class you are going to test, create one Test class with the same |
|
5 |
name as the class to test, ending with Test. |
|
6 |
|
|
7 |
For example, the unit tests of the "ExampleLibrary" class are performed |
|
8 |
by the "ExampleLibraryTest" class. |
|
0 | 9 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.metadata.basic.swing</artifactId> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<packaging>pom</packaging> |
|
9 |
<description>This project contains the basic metadata features.</description> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.metadata.basic</artifactId> |
|
13 |
<version>2.0.35</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<modules> |
|
17 |
<module>org.gvsig.metadata.swing.basic.api</module> |
|
18 |
<module>org.gvsig.metadata.swing.basic.impl</module> |
|
19 |
</modules> |
|
20 |
|
|
21 |
</project> |
|
0 | 22 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your library classes. |
|
2 |
|
|
3 |
This folder is added to the runtime classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, into this folder you can find some examples of resource bundle |
|
7 |
property files that may be used by your library classes. |
|
0 | 8 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.metadata.swing.basic.api.MetadataSwingLibrary |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/resources/org/gvsig/metadata/swing/api/i18n/text.properties | ||
---|---|---|
1 |
# Resource bundle texts for the Spanish language locale (es) |
|
2 |
Example.returns_value=devuelve el valor |
|
0 | 3 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/resources/org/gvsig/metadata/swing/api/i18n/text_en.properties | ||
---|---|---|
1 |
# Resource bundle texts for the English language locale (en) |
|
2 |
Example.returns_value=returns value |
|
0 | 3 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/java/org/gvsig/metadata/swing/basic/api/CreateJMetadataPanelException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.api; |
|
25 |
|
|
26 |
import org.gvsig.metadata.Metadata; |
|
27 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
28 |
|
|
29 |
public class CreateJMetadataPanelException extends MetadataException { |
|
30 |
|
|
31 |
/** |
|
32 |
* |
|
33 |
*/ |
|
34 |
private static final long serialVersionUID = 7989045357127054749L; |
|
35 |
|
|
36 |
public CreateJMetadataPanelException(Metadata metadata, Throwable cause) { |
|
37 |
super( |
|
38 |
"Can't create a JMetadataPanel based on this metadata: '%(metadata)'", |
|
39 |
cause, |
|
40 |
"_cant_create_a_JMetadataPanel_based_on_this_metadata_XmetadataX", |
|
41 |
serialVersionUID |
|
42 |
); |
|
43 |
String name; |
|
44 |
try { |
|
45 |
name = metadata.getMetadataName(); |
|
46 |
} catch(Exception e) { |
|
47 |
name = null; |
|
48 |
} |
|
49 |
if( name==null ) { |
|
50 |
name = "(unknow)"; |
|
51 |
} |
|
52 |
setValue("metadata", name); |
|
53 |
} |
|
54 |
} |
|
0 | 55 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/java/org/gvsig/metadata/swing/basic/api/MetadataSwingLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.api; |
|
25 |
|
|
26 |
import org.gvsig.metadata.MetadataLocator; |
|
27 |
import org.gvsig.metadata.MetadataManager; |
|
28 |
import org.gvsig.tools.library.AbstractLibrary; |
|
29 |
import org.gvsig.tools.library.LibraryException; |
|
30 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
31 |
import org.gvsig.tools.swing.api.ToolsSwingLibrary; |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
* Initialization of the basic Metadata API Library. |
|
36 |
* |
|
37 |
* @author gvSIG Team |
|
38 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
39 |
* @version $Id$ |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class MetadataSwingLibrary extends AbstractLibrary { |
|
43 |
|
|
44 |
public void doRegistration() { |
|
45 |
super.doRegistration(); |
|
46 |
registerAsAPI(MetadataSwingLibrary.class); |
|
47 |
require(ToolsSwingLibrary.class); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Performs all the initializations of the library, only related to himself: |
|
52 |
* register implementation classes through the Locator, start services, etc. |
|
53 |
* |
|
54 |
* @throws LibraryException |
|
55 |
* if there is an error while performing the initialization of |
|
56 |
* the library |
|
57 |
*/ |
|
58 |
protected void doInitialize() throws LibraryException { |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Performs all the initializations or validations related to the library |
|
64 |
* dependencies, as getting references to objects through other libraries |
|
65 |
* Locators. |
|
66 |
* |
|
67 |
* @throws LibraryException |
|
68 |
* if there is an error while loading an implementation of the |
|
69 |
* library |
|
70 |
*/ |
|
71 |
protected void doPostInitialize() throws LibraryException { |
|
72 |
// Validate there is any implementation registered. |
|
73 |
MetadataManager manager = MetadataLocator.getMetadataManager(); |
|
74 |
|
|
75 |
if (manager == null) { |
|
76 |
throw new ReferenceNotRegisteredException( |
|
77 |
MetadataLocator.METADATA_MANAGER_NAME, MetadataLocator.getInstance()); |
|
78 |
} |
|
79 |
/* |
|
80 |
* Validates if there is at least an implementation of the |
|
81 |
* MetadataManager registered. |
|
82 |
*/ |
|
83 |
MetadataSwingManager swingManager = MetadataSwingLocator.getMetadataSwingManager(); |
|
84 |
|
|
85 |
if (swingManager == null) { |
|
86 |
throw new ReferenceNotRegisteredException( |
|
87 |
MetadataSwingLocator.METADATA_MANAGER_NAME, |
|
88 |
MetadataSwingLocator.getInstance()); |
|
89 |
} |
|
90 |
} |
|
91 |
} |
|
0 | 92 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/java/org/gvsig/metadata/swing/basic/api/AbstractSimpleMetadataPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.metadata.swing.basic.api; |
|
26 |
|
|
27 |
import javax.swing.JPanel; |
|
28 |
|
|
29 |
import org.gvsig.metadata.Metadata; |
|
30 |
|
|
31 |
|
|
32 |
public abstract class AbstractSimpleMetadataPanel extends JPanel { |
|
33 |
|
|
34 |
/** |
|
35 |
* |
|
36 |
*/ |
|
37 |
private static final long serialVersionUID = 8275085021104037254L; |
|
38 |
private AbstractSimpleMetadataPanel metadataComponent; |
|
39 |
private Metadata metadata; |
|
40 |
private boolean editable; |
|
41 |
|
|
42 |
protected MetadataSwingManager uiManager; |
|
43 |
|
|
44 |
public AbstractSimpleMetadataPanel(MetadataSwingManager uiManager, |
|
45 |
Metadata metadata, boolean editable) { |
|
46 |
super(); |
|
47 |
this.uiManager = uiManager; |
|
48 |
this.editable = editable; |
|
49 |
this.metadata = metadata; |
|
50 |
init(); |
|
51 |
} |
|
52 |
|
|
53 |
private void init() { |
|
54 |
initManagers(); |
|
55 |
initUI(); |
|
56 |
setMetadata(metadata); |
|
57 |
} |
|
58 |
|
|
59 |
protected boolean isEditable() { |
|
60 |
return this.editable; |
|
61 |
} |
|
62 |
|
|
63 |
protected void setEditable(boolean isEditable) { |
|
64 |
this.editable = isEditable; |
|
65 |
} |
|
66 |
|
|
67 |
protected abstract void initManagers(); |
|
68 |
|
|
69 |
protected abstract void initData(); |
|
70 |
|
|
71 |
protected abstract void initUI(); |
|
72 |
|
|
73 |
protected abstract AbstractSimpleMetadataPanel createMetadataComponent(Metadata metadata, boolean doRefresh); |
|
74 |
|
|
75 |
public void setMetadataComponent(AbstractSimpleMetadataPanel metadataComponent) { |
|
76 |
this.metadataComponent = metadataComponent; |
|
77 |
} |
|
78 |
|
|
79 |
public AbstractSimpleMetadataPanel getMetadataComponent() { |
|
80 |
return metadataComponent; |
|
81 |
} |
|
82 |
|
|
83 |
public void setMetadata(Metadata metadata) { |
|
84 |
this.metadata = metadata; |
|
85 |
initData(); |
|
86 |
this.setMetadataComponent(createMetadataComponent(getMetadata(),true)); |
|
87 |
this.updateUI(); |
|
88 |
} |
|
89 |
|
|
90 |
public Metadata getMetadata() { |
|
91 |
return metadata; |
|
92 |
} |
|
93 |
|
|
94 |
protected boolean hasMetadata() { |
|
95 |
return (this.metadata != null); |
|
96 |
} |
|
97 |
|
|
98 |
|
|
99 |
} |
|
0 | 100 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/java/org/gvsig/metadata/swing/basic/api/MetadataPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.api; |
|
25 |
|
|
26 |
import java.awt.Component; |
|
27 |
|
|
28 |
import org.gvsig.metadata.Metadata; |
|
29 |
import org.gvsig.tools.dynobject.DynField; |
|
30 |
|
|
31 |
public interface MetadataPanel { |
|
32 |
|
|
33 |
public Metadata getMetadata(); |
|
34 |
|
|
35 |
public void save(); |
|
36 |
|
|
37 |
public DynField getDynField(); |
|
38 |
|
|
39 |
public Component asJComponent(); |
|
40 |
|
|
41 |
} |
|
0 | 42 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/java/org/gvsig/metadata/swing/basic/api/MetadataSwingManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.api; |
|
25 |
|
|
26 |
import org.gvsig.metadata.Metadata; |
|
27 |
import org.gvsig.metadata.MetadataManager; |
|
28 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
29 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
30 |
|
|
31 |
/** |
|
32 |
* |
|
33 |
* A basic metadata swing manager to provide a metadata GUI editor. |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
37 |
* @version $Id$ |
|
38 |
* |
|
39 |
*/ |
|
40 |
public interface MetadataSwingManager { |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* Given a text, it looks for its translation. If none is found, then the |
|
45 |
* original text is shown. |
|
46 |
* |
|
47 |
* @param text |
|
48 |
* to be translated. |
|
49 |
* @return the translation text result. |
|
50 |
*/ |
|
51 |
public String translate(String message); |
|
52 |
|
|
53 |
/** |
|
54 |
* Gets the main manager that allows interacting with metadata objects. |
|
55 |
* |
|
56 |
* @return the metadata Manager |
|
57 |
*/ |
|
58 |
public MetadataManager getManager(); |
|
59 |
|
|
60 |
/** |
|
61 |
* Creates the JPanel in which users can edit and visualize metadata |
|
62 |
* objects. Editable by default. |
|
63 |
* |
|
64 |
* @param metadata |
|
65 |
* the metadata to be displayed. |
|
66 |
* @return the metadata editor Panel |
|
67 |
* @throws MetadataException |
|
68 |
*/ |
|
69 |
public JMetadataPanel createJMetadataPanel(Metadata metadata); |
|
70 |
|
|
71 |
/** |
|
72 |
* Creates the JPanel in which users can edit and visualize metadata |
|
73 |
* objects. |
|
74 |
* |
|
75 |
* @param metadata |
|
76 |
* the metadata to be displayed. |
|
77 |
* @param editable |
|
78 |
* if the metadata panel should be editable or not. |
|
79 |
* @return the metadata editor Panel |
|
80 |
* @throws MetadataException |
|
81 |
*/ |
|
82 |
public JMetadataPanel createJMetadataPanel(Metadata metadata, |
|
83 |
boolean editable); |
|
84 |
|
|
85 |
/** |
|
86 |
* Gets the ToolsLocator usability swing manager to create UI components |
|
87 |
* based on gvSIG standards. |
|
88 |
* |
|
89 |
* @return |
|
90 |
*/ |
|
91 |
public UsabilitySwingManager getUIBuilder(); |
|
92 |
|
|
93 |
} |
|
0 | 94 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/java/org/gvsig/metadata/swing/basic/api/JMetadataPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.api; |
|
25 |
|
|
26 |
import java.awt.Component; |
|
27 |
|
|
28 |
import org.gvsig.metadata.Metadata; |
|
29 |
import org.gvsig.tools.dynobject.DynClass; |
|
30 |
import org.gvsig.tools.dynobject.DynField; |
|
31 |
import org.gvsig.tools.dynobject.exception.DynObjectValidateException; |
|
32 |
import org.gvsig.tools.service.ServiceException; |
|
33 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
34 |
import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent; |
|
35 |
|
|
36 |
/** |
|
37 |
* |
|
38 |
* The metadata editor panel. |
|
39 |
* |
|
40 |
* @author gvSIG Team |
|
41 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
42 |
* @version $Id$ |
|
43 |
* |
|
44 |
*/ |
|
45 |
public abstract class JMetadataPanel extends AbstractSimpleMetadataPanel |
|
46 |
implements MetadataPanel { |
|
47 |
|
|
48 |
private static final long serialVersionUID = 3029756241879733963L; |
|
49 |
|
|
50 |
public JMetadataPanel(MetadataSwingManager uiManager, Metadata metadata, |
|
51 |
boolean editable) { |
|
52 |
super(uiManager, metadata, editable); |
|
53 |
} |
|
54 |
|
|
55 |
protected JDynObjectComponent createJDynObjectComponent(DynClass dynClass, |
|
56 |
Metadata metadata, boolean isEditable) throws ServiceException { |
|
57 |
return ToolsSwingLocator.getDynObjectSwingManager() |
|
58 |
.createJDynObjectComponent(dynClass, metadata, isEditable); |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Saves the current status of the GUI into the Metadata object |
|
63 |
* |
|
64 |
* @throws DynObjectValidateException |
|
65 |
* |
|
66 |
*/ |
|
67 |
public abstract void saveMetadata() throws DynObjectValidateException; |
|
68 |
|
|
69 |
public void save() { |
|
70 |
try { |
|
71 |
saveMetadata(); |
|
72 |
} catch (DynObjectValidateException e) { |
|
73 |
// TODO Auto-generated catch block |
|
74 |
e.printStackTrace(); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
public DynField getDynField() { |
|
79 |
// TODO Auto-generated method stub |
|
80 |
return null; |
|
81 |
} |
|
82 |
|
|
83 |
public Component asJComponent() { |
|
84 |
return this; |
|
85 |
} |
|
86 |
|
|
87 |
} |
|
0 | 88 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/java/org/gvsig/metadata/swing/basic/api/MetadataSwingLocator.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.metadata.swing.basic.api; |
|
25 |
|
|
26 |
import org.gvsig.tools.locator.BaseLocator; |
|
27 |
import org.gvsig.tools.locator.Locator; |
|
28 |
import org.gvsig.tools.locator.LocatorException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Locator for the Metadata Library main object instances. |
|
32 |
* |
|
33 |
* Replaces the MetadataManager by its own services, by adding as many constants |
|
34 |
* and methods as needed, taking the MetadataManager as a guide. |
|
35 |
* |
|
36 |
* @author gvSIG Team |
|
37 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
38 |
* @version $Id$ |
|
39 |
* |
|
40 |
*/ |
|
41 |
public class MetadataSwingLocator extends BaseLocator { |
|
42 |
|
|
43 |
/** |
|
44 |
* Unique instance. |
|
45 |
*/ |
|
46 |
private static final MetadataSwingLocator instance = new MetadataSwingLocator(); |
|
47 |
|
|
48 |
private static final String METADATA_MANAGER_DESCRIPTION = "Metadata API Library Manager"; |
|
49 |
|
|
50 |
public static final String METADATA_MANAGER_NAME = "org.gvsig.metadata.swing.basic.api.manager"; |
|
51 |
|
|
52 |
/** |
|
53 |
* Returns the Metadata singleton instance. |
|
54 |
* |
|
55 |
* @return the Metadata singleton instance |
|
56 |
*/ |
|
57 |
public static MetadataSwingLocator getInstance() { |
|
58 |
return instance; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Returns a reference to the MetadataManager. |
|
63 |
* |
|
64 |
* @return a reference to MetadataManager |
|
65 |
* @throws LocatorException |
|
66 |
* if there is no access to the class or the class cannot be |
|
67 |
* instantiated |
|
68 |
* @see Locator#get(String) |
|
69 |
*/ |
|
70 |
public static MetadataSwingManager getMetadataSwingManager() |
|
71 |
throws LocatorException { |
|
72 |
return (MetadataSwingManager) getInstance().get(METADATA_MANAGER_NAME); |
|
73 |
} |
|
74 |
|
|
75 |
public static void registerDefaultMetadataSwingManager(Class clazz) { |
|
76 |
getInstance().registerDefault(METADATA_MANAGER_NAME, |
|
77 |
METADATA_MANAGER_DESCRIPTION, clazz); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Registers the Class implementing the MetadataManager interface. |
|
82 |
* |
|
83 |
* @param clazz |
|
84 |
* implementing the MetadataManager interface |
|
85 |
*/ |
|
86 |
public static void registerMetadataSwingManager(Class clazz) { |
|
87 |
getInstance().register(METADATA_MANAGER_NAME, |
|
88 |
METADATA_MANAGER_DESCRIPTION, clazz); |
|
89 |
} |
|
90 |
} |
|
0 | 91 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/main/javadoc/overview.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.metadata.swing.api package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library overview.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
|
0 | 16 |
tags/org.gvsig.desktop-2.0.35/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.swing/org.gvsig.metadata.swing.basic.api/src/test/resources/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
Put into this folder the resources needed by your test classes. |
|
5 |
|
|
6 |
This folder is added to the Tests classpath, so you can load any resources |
|
7 |
through the ClassLoader. |
|
8 |
|
|
9 |
By default, in this folder you can find an example of log4j configuration, |
|
10 |
prepared to log messages through the console, so logging works when you |
|
11 |
run your tests classes. |
Also available in: Unified diff