root / tags / v1_0_2_Build_901 / extensions / extCAD / src / com / iver / cit / gvsig / gui / preferences / DialogEditionPreferences.java @ 10571
History | View | Annotate | Download (4.54 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.cit.gvsig.gui.preferences; |
42 |
|
43 |
import java.util.Random; |
44 |
|
45 |
import javax.swing.ImageIcon; |
46 |
import javax.swing.JDialog; |
47 |
import javax.swing.JPanel; |
48 |
|
49 |
import com.iver.andami.preferences.AbstractPreferencePage; |
50 |
import com.iver.andami.preferences.DlgPreferences; |
51 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
52 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
53 |
|
54 |
public class DialogEditionPreferences { |
55 |
public class TestPref extends AbstractPreferencePage |
56 |
{ |
57 |
String id;
|
58 |
public TestPref(String title) |
59 |
{ |
60 |
super();
|
61 |
id = title; |
62 |
setTitle(title); |
63 |
} |
64 |
public JPanel getPanel() { |
65 |
return this; |
66 |
} |
67 |
public void initializeValues() { |
68 |
// TODO Auto-generated method stub
|
69 |
|
70 |
} |
71 |
public void storeValues() { |
72 |
} |
73 |
public void initializeDefaults() { |
74 |
// TODO Auto-generated method stub
|
75 |
|
76 |
} |
77 |
public ImageIcon getIcon() { |
78 |
// TODO Auto-generated method stub
|
79 |
return null; |
80 |
} |
81 |
public String getID() { |
82 |
// TODO Auto-generated method stub
|
83 |
return null; |
84 |
} |
85 |
public String getTitle() { |
86 |
// TODO Auto-generated method stub
|
87 |
return null; |
88 |
} |
89 |
|
90 |
public boolean isValueChanged() { |
91 |
// TODO Auto-generated method stub
|
92 |
return false; |
93 |
} |
94 |
public void setChangesApplied() { |
95 |
// TODO Auto-generated method stub
|
96 |
|
97 |
} |
98 |
|
99 |
} |
100 |
public static void main(String[] args) { |
101 |
try {
|
102 |
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
103 |
// UIManager.setLookAndFeel(Options.JGOODIES_WINDOWS_NAME);
|
104 |
} catch (Exception e) { |
105 |
e.printStackTrace(); |
106 |
} |
107 |
|
108 |
DialogEditionPreferences test = new DialogEditionPreferences();
|
109 |
// test.configureUI();
|
110 |
test.test(); |
111 |
|
112 |
} |
113 |
|
114 |
/**
|
115 |
* Configures the UI; tries to set the system look on Mac,
|
116 |
* <code>WindowsLookAndFeel</code> on general Windows, and
|
117 |
* <code>Plastic3DLookAndFeel</code> on Windows XP and all other OS.<p>
|
118 |
*
|
119 |
* The JGoodies Swing Suite's <code>ApplicationStarter</code>,
|
120 |
* <code>ExtUIManager</code>, and <code>LookChoiceStrategies</code>
|
121 |
* classes provide a much more fine grained algorithm to choose and
|
122 |
* restore a look and theme.
|
123 |
*/
|
124 |
// private void configureUI() {
|
125 |
// UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
|
126 |
// Options.setDefaultIconSize(new Dimension(18, 18));
|
127 |
//
|
128 |
// String lafName =
|
129 |
// LookUtils.IS_OS_WINDOWS_XP
|
130 |
// ? Options.getCrossPlatformLookAndFeelClassName()
|
131 |
// : Options.getSystemLookAndFeelClassName();
|
132 |
//
|
133 |
// try {
|
134 |
// UIManager.setLookAndFeel(lafName);
|
135 |
// } catch (Exception e) {
|
136 |
// System.err.println("Can't set look & feel:" + e);
|
137 |
// }
|
138 |
// }
|
139 |
private void test() { |
140 |
JDialog dlg = new JDialog(); |
141 |
dlg.setModal(true);
|
142 |
dlg.setTitle("Preferences");
|
143 |
|
144 |
DlgPreferences panel = DlgPreferences.getInstance(); |
145 |
|
146 |
for (int i=0; i< 20; i++) |
147 |
{ |
148 |
TestPref newPref = new TestPref("Titulo " + i); |
149 |
Random rnd = new Random(); |
150 |
if (i> 5) |
151 |
newPref.setParentID("Titulo " + rnd.nextInt(i));
|
152 |
//panel.addPreferencePage(newPref);
|
153 |
|
154 |
} |
155 |
|
156 |
FLayers layers = new FLayers(null, null); |
157 |
FLyrVect lyrVect = new FLyrVect();
|
158 |
lyrVect.setName("Hola");
|
159 |
layers.addLayer(lyrVect); |
160 |
|
161 |
EditionPreferencePage edPref = new EditionPreferencePage();
|
162 |
//panel.addPreferencePage(edPref);
|
163 |
// edPref.setLayers(layers);
|
164 |
|
165 |
dlg.getContentPane().add(panel); |
166 |
dlg.pack(); |
167 |
dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
168 |
|
169 |
dlg.setVisible(true);
|
170 |
|
171 |
|
172 |
|
173 |
System.exit(0); |
174 |
} |
175 |
|
176 |
} |