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.api / src / main / java / org / gvsig / metadata / swing / basic / api / AbstractSimpleMetadataPanel.java @ 40769
History | View | Annotate | Download (2.67 KB)
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 |
} |