Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / preferences / AbstractPreferencePage.java @ 44526

History | View | Annotate | Download (3.47 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
package org.gvsig.andami.preferences;
25

    
26
import java.util.Map;
27

    
28
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
29
import org.gvsig.tools.extensionpoint.ExtensionBuilder;
30
/**
31
 * The abstract class that any preference page should extend.
32
 *
33
 * @author jaume dominguez faus - jaume.dominguez@iver.es
34
 *
35
 */
36
public abstract class AbstractPreferencePage extends GridBagLayoutPanel implements IPreference, ExtensionBuilder{
37
        /**
38
         * The number of components already added to the layout manager.
39
         */
40
        protected int y;
41

    
42
        private String title;
43

    
44
        protected String parentID = null; // Por defecto, nodo raiz
45

    
46

    
47
        public final void setParentID(String parentID) {
48
                this.parentID = parentID;
49
        }
50

    
51
        public String getParentID() {
52
                return parentID;
53
        }
54

    
55
        public final void setTitle(String title) {
56
                this.title = title;
57
        }
58

    
59
        public String toString()
60
        {
61
                return getTitle();
62
        }
63

    
64
        public Object create() {
65
                return this;
66
        }
67

    
68
        public Object create(Object[] args) {
69
                return this;
70
        }
71

    
72
        public Object create(Map args) {
73
                return this;
74
        }
75

    
76
        /**
77
         * Devuelve true si el Panel debe estar en un BorderLayout centrado o false si
78
         * tiene un tama?o fijo.
79
         * @return
80
         */
81
        public boolean isResizeable() {
82
                return false;
83
        }
84

    
85

    
86
        public final void saveValues() throws StoreException {
87
                // Store the values.
88
                storeValues();
89

    
90
                // Tell the page that its changes are already applied
91
                setChangesApplied();
92
        }
93

    
94
        /**
95
         * <p>
96
         * Gathers the configurations and stores them in the system.<br>
97
         * </p>
98
         * <p>
99
         * <b>storeValues()</b> and  <b>setChangesApplied()</b> are methods from <b>AbstractPreferencePage</b>
100
         * not from <b>IPreference</b>. They both perform in combination what saveValue() should do
101
         * by itself, but they exist for performance issues. In fact, you <b>should not</b>
102
         * invoke them outside your PreferencePage class, you only need to code them.
103
         * </p>
104
         * @throws StoreException
105
         */
106
        public abstract void storeValues() throws StoreException;
107

    
108
        /**
109
         * <p>
110
         * After this method is invoked, the Preference page <b>must</b> return <b>true</b> as the
111
         * result of invoking isValueChanged() method. It tells that the values have been
112
         * saved in the system.<br>
113
         * </p>
114
         * <p>
115
         * <b>storeValues()</b> and  <b>setChangesApplied()</b> are methods from  <b>AbstractPreferencePage</b>
116
         * not from  <b>IPreference</b>. They both perform in combination what storeValue() should
117
         * by itself, but they exist for performance issues. In fact, you <b>should not</b>
118
         * invoke them outside your PreferencePage class, you only need to code them.
119
         * </p>
120
         */
121
        public abstract void setChangesApplied();
122
}