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

History | View | Annotate | Download (2.81 KB)

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
 */
29
package org.gvsig.metadata.swing.basic.api;
30

    
31
import javax.swing.JPanel;
32

    
33
import org.gvsig.metadata.Metadata;
34

    
35

    
36
public abstract class AbstractSimpleMetadataPanel extends JPanel {
37

    
38
    /**
39
         * 
40
         */
41
        private static final long serialVersionUID = 8275085021104037254L;
42
        private AbstractSimpleMetadataPanel metadataComponent;
43
    private Metadata metadata;
44
        private boolean editable;
45

    
46
        protected MetadataSwingManager uiManager;
47

    
48
        public AbstractSimpleMetadataPanel(MetadataSwingManager uiManager,
49
                        Metadata metadata, boolean editable) {
50
        super();
51
                this.uiManager = uiManager;
52
                this.editable = editable;
53
        this.metadata = metadata;
54
                init();
55
        }
56

    
57
        private void init() {
58
        initManagers();
59
        initUI();
60
        setMetadata(metadata);
61
        }
62

    
63
        protected boolean isEditable() {
64
                return this.editable;
65
        }
66

    
67
        protected void setEditable(boolean isEditable) {
68
                this.editable = isEditable;
69
        }
70

    
71
        protected abstract void initManagers();
72

    
73
    protected abstract void initData();
74
    
75
    protected abstract void initUI();
76

    
77
    protected abstract AbstractSimpleMetadataPanel createMetadataComponent(Metadata metadata, boolean doRefresh);
78

    
79
    public void setMetadataComponent(AbstractSimpleMetadataPanel metadataComponent) {
80
        this.metadataComponent = metadataComponent;
81
    }
82

    
83
    public AbstractSimpleMetadataPanel getMetadataComponent() {
84
        return metadataComponent;
85
    }
86

    
87
    public void setMetadata(Metadata metadata) {
88
        this.metadata = metadata;
89
        initData();
90
        this.setMetadataComponent(createMetadataComponent(getMetadata(),true));           
91
        this.updateUI();
92
    }
93

    
94
    public Metadata getMetadata() {
95
        return metadata;
96
    }
97

    
98
    protected boolean hasMetadata() {
99
        return (this.metadata != null);
100
    }
101

    
102

    
103
}