svn-gvsig-desktop / trunk / org.gvsig.desktop / 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 @ 40608
History | View | Annotate | Download (2.92 KB)
1 | 40608 | jjdelcerro | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2010 Infrastructures and Transports Department
|
||
4 | * of the Valencian Gobernment (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 | * 2010 Institute of New Imaging Technologies (INIT):
|
||
26 | * http://www.init.uji.es
|
||
27 | * Geographic Information research group:
|
||
28 | * http://www.geoinfo.uji.es
|
||
29 | * Universitat Jaume I UJI, Spain
|
||
30 | */
|
||
31 | |||
32 | package org.gvsig.metadata.swing.basic.impl; |
||
33 | |||
34 | import org.gvsig.metadata.Metadata; |
||
35 | import org.gvsig.metadata.MetadataLocator; |
||
36 | import org.gvsig.metadata.MetadataManager; |
||
37 | import org.gvsig.metadata.exceptions.MetadataException; |
||
38 | import org.gvsig.metadata.swing.basic.api.JMetadataPanel; |
||
39 | import org.gvsig.metadata.swing.basic.api.MetadataSwingManager; |
||
40 | import org.gvsig.tools.ToolsLocator; |
||
41 | import org.gvsig.tools.i18n.I18nManager; |
||
42 | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
||
43 | import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
||
44 | |||
45 | /**
|
||
46 | *
|
||
47 | * 04/04/2010
|
||
48 | *
|
||
49 | * @author <a href="mailto:reinhold@uji.es">cmartin</a>
|
||
50 | */
|
||
51 | public class BasicMetadataSwingManager implements MetadataSwingManager { |
||
52 | |||
53 | private I18nManager i18nManager;
|
||
54 | |||
55 | public BasicMetadataSwingManager() {
|
||
56 | i18nManager = ToolsLocator.getI18nManager(); |
||
57 | } |
||
58 | |||
59 | public String translate(String message) { |
||
60 | if (message != null) { |
||
61 | return i18nManager.getTranslation(message);
|
||
62 | } |
||
63 | return ""; |
||
64 | } |
||
65 | |||
66 | public MetadataManager getManager() {
|
||
67 | return MetadataLocator.getMetadataManager();
|
||
68 | } |
||
69 | |||
70 | public JMetadataPanel createJMetadataPanel(Metadata metadata, boolean editable) { |
||
71 | try {
|
||
72 | this.getManager().loadMetadata(metadata);
|
||
73 | |||
74 | } catch (MetadataException e) {
|
||
75 | // TODO Auto-generated catch block
|
||
76 | e.printStackTrace(); |
||
77 | } |
||
78 | |||
79 | BasicJMetadataPanel panel = new BasicJMetadataPanel(this, metadata, |
||
80 | editable); |
||
81 | panel.setMetadata(metadata); |
||
82 | return panel;
|
||
83 | } |
||
84 | |||
85 | public JMetadataPanel createJMetadataPanel(Metadata metadata) {
|
||
86 | return this.createJMetadataPanel(metadata, true); |
||
87 | } |
||
88 | |||
89 | public UsabilitySwingManager getUIBuilder() {
|
||
90 | return ToolsSwingLocator.getUsabilitySwingManager();
|
||
91 | } |
||
92 | } |