root / tags / v1_1_Build_1003 / frameworks / _fwAndami / src / com / iver / andami / preferences / AbstractPreferencePage.java @ 12271
History | View | Annotate | Download (3.55 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.andami.preferences; |
42 |
|
43 |
import java.util.Map; |
44 |
|
45 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
46 |
|
47 |
import com.iver.utiles.extensionPoints.IExtensionBuilder; |
48 |
/**
|
49 |
* The abstract class that any preference page should extend.
|
50 |
*
|
51 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
52 |
*
|
53 |
*/
|
54 |
public abstract class AbstractPreferencePage extends GridBagLayoutPanel implements IPreference, IExtensionBuilder{ |
55 |
/**
|
56 |
* The number of components already added to the layout manager.
|
57 |
*/
|
58 |
protected int y; |
59 |
|
60 |
private String title; |
61 |
|
62 |
protected String parentID = null; // Por defecto, nodo raiz |
63 |
|
64 |
|
65 |
public final void setParentID(String parentID) { |
66 |
this.parentID = parentID;
|
67 |
} |
68 |
|
69 |
public final String getParentID() { |
70 |
return parentID;
|
71 |
} |
72 |
|
73 |
public final void setTitle(String title) { |
74 |
this.title = title;
|
75 |
} |
76 |
|
77 |
public String toString() |
78 |
{ |
79 |
return title;
|
80 |
} |
81 |
|
82 |
public Object create() { |
83 |
return this; |
84 |
} |
85 |
|
86 |
public Object create(Object[] args) { |
87 |
return this; |
88 |
} |
89 |
|
90 |
public Object create(Map args) { |
91 |
return this; |
92 |
} |
93 |
|
94 |
public final void saveValues() throws StoreException { |
95 |
// Store the values.
|
96 |
storeValues(); |
97 |
|
98 |
// Tell the page that its changes are already applied
|
99 |
setChangesApplied(); |
100 |
} |
101 |
|
102 |
/**
|
103 |
* <p>
|
104 |
* Gathers the configurations and stores them in the system.<br>
|
105 |
* </p>
|
106 |
* <p>
|
107 |
* <b>storeValues()</b> and <b>setChangesApplied()</b> are methods from <b>AbstractPreferencePage</b>
|
108 |
* not from <b>IPreference</b>. They both perform in combination what saveValue() should do
|
109 |
* by itself, but they exist for performance issues. In fact, you <b>should not</b>
|
110 |
* invoke them outside your PreferencePage class, you only need to code them.
|
111 |
* </p>
|
112 |
* @throws StoreException
|
113 |
*/
|
114 |
public abstract void storeValues() throws StoreException; |
115 |
|
116 |
/**
|
117 |
* <p>
|
118 |
* After this method is invoked, the Preference page <b>must</b> return <b>true</b> as the
|
119 |
* result of invoking isValueChanged() method. It tells that the values have been
|
120 |
* saved in the system.<br>
|
121 |
* </p>
|
122 |
* <p>
|
123 |
* <b>storeValues()</b> and <b>setChangesApplied()</b> are methods from <b>AbstractPreferencePage</b>
|
124 |
* not from <b>IPreference</b>. They both perform in combination what storeValue() should
|
125 |
* by itself, but they exist for performance issues. In fact, you <b>should not</b>
|
126 |
* invoke them outside your PreferencePage class, you only need to code them.
|
127 |
* </p>
|
128 |
*/
|
129 |
public abstract void setChangesApplied(); |
130 |
} |