Statistics
| Revision:

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 @ 41551

History | View | Annotate | Download (2.73 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 modify it under
7
 * the terms of the GNU General Public License as published by the Free Software
8
 * Foundation; either version 3 of the License, or (at your option) any later
9
 * version.
10
 *
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14
 * details.
15
 *
16
 * You should have received a copy of the GNU General Public License along with
17
 * this program; if not, write to the Free Software Foundation, Inc., 51
18
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.metadata.swing.basic.api;
24

    
25
import javax.swing.JPanel;
26

    
27
import org.gvsig.metadata.Metadata;
28

    
29
public abstract class AbstractSimpleMetadataPanel extends JPanel {
30

    
31
    /**
32
     *
33
     */
34
    private static final long serialVersionUID = 8275085021104037254L;
35
    private AbstractSimpleMetadataPanel metadataComponent;
36
    private Metadata metadata;
37
    private boolean editable;
38

    
39
    protected MetadataSwingManager uiManager;
40

    
41
    public AbstractSimpleMetadataPanel(MetadataSwingManager uiManager,
42
            Metadata metadata, boolean editable) {
43
        super();
44
        this.uiManager = uiManager;
45
        this.editable = editable;
46
        this.metadata = metadata;
47
        init();
48
    }
49

    
50
    private void init() {
51
        initManagers();
52
        initUI();
53
        setMetadata(metadata);
54
    }
55

    
56
    protected boolean isEditable() {
57
        return this.editable;
58
    }
59

    
60
    protected void setEditable(boolean isEditable) {
61
        this.editable = isEditable;
62
    }
63

    
64
    protected abstract void initManagers();
65

    
66
    protected abstract void initData();
67

    
68
    protected abstract void initUI();
69

    
70
    protected abstract AbstractSimpleMetadataPanel createMetadataComponent(Metadata metadata, boolean doRefresh);
71

    
72
    public void setMetadataComponent(AbstractSimpleMetadataPanel metadataComponent) {
73
        this.metadataComponent = metadataComponent;
74
    }
75

    
76
    public AbstractSimpleMetadataPanel getMetadataComponent() {
77
        return metadataComponent;
78
    }
79

    
80
    public void setMetadata(Metadata metadata) {
81
        this.metadata = metadata;
82
        initData();
83
        this.setMetadataComponent(createMetadataComponent(getMetadata(), true));
84
        this.updateUI();
85
    }
86

    
87
    public Metadata getMetadata() {
88
        return metadata;
89
    }
90

    
91
    protected boolean hasMetadata() {
92
        return (this.metadata != null);
93
    }
94

    
95
}