Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_899 / extensions / extCAD / src / com / iver / cit / gvsig / gui / preferences / DialogEditionPreferences.java @ 10517

History | View | Annotate | Download (4.54 KB)

1 5793 fjp
/* 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 5813 fjp
import com.iver.andami.preferences.AbstractPreferencePage;
50
import com.iver.andami.preferences.DlgPreferences;
51 5793 fjp
import com.iver.cit.gvsig.fmap.layers.FLayers;
52
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
53
54
public class DialogEditionPreferences  {
55 5813 fjp
        public class TestPref extends AbstractPreferencePage
56 5793 fjp
        {
57 5813 fjp
                String id;
58 5793 fjp
                public TestPref(String title)
59
                {
60
                        super();
61 5813 fjp
                        id = title;
62 5793 fjp
                        setTitle(title);
63
                }
64
                public JPanel getPanel() {
65 5813 fjp
                        return this;
66 5793 fjp
                }
67
                public void initializeValues() {
68
                        // TODO Auto-generated method stub
69 6606 caballero
70 5793 fjp
                }
71 6660 caballero
                public void storeValues() {
72 5793 fjp
                }
73
                public void initializeDefaults() {
74
                        // TODO Auto-generated method stub
75 6606 caballero
76 5793 fjp
                }
77
                public ImageIcon getIcon() {
78
                        // TODO Auto-generated method stub
79
                        return null;
80
                }
81 5813 fjp
                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 6805 jaume
90
                public boolean isValueChanged() {
91 6606 caballero
                        // TODO Auto-generated method stub
92 6805 jaume
                        return false;
93 6606 caballero
                }
94 6811 jaume
                public void setChangesApplied() {
95
                        // TODO Auto-generated method stub
96 6606 caballero
97 6811 jaume
                }
98
99 5793 fjp
        }
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 6606 caballero
108 5793 fjp
                DialogEditionPreferences test = new DialogEditionPreferences();
109
                // test.configureUI();
110
                test.test();
111 6606 caballero
112 5793 fjp
        }
113 6606 caballero
114 5793 fjp
           /**
115 6606 caballero
     * Configures the UI; tries to set the system look on Mac,
116 5793 fjp
     * <code>WindowsLookAndFeel</code> on general Windows, and
117
     * <code>Plastic3DLookAndFeel</code> on Windows XP and all other OS.<p>
118 6606 caballero
     *
119 5793 fjp
     * 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 6606 caballero
                DlgPreferences panel = DlgPreferences.getInstance();
145
146 5793 fjp
                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 6337 jmvivo
                        //panel.addPreferencePage(newPref);
153 6606 caballero
154 5793 fjp
                }
155 6606 caballero
156 5793 fjp
                FLayers layers = new FLayers(null, null);
157
                FLyrVect lyrVect = new FLyrVect();
158
                lyrVect.setName("Hola");
159
                layers.addLayer(lyrVect);
160 6606 caballero
161 5793 fjp
                EditionPreferencePage edPref = new EditionPreferencePage();
162 6337 jmvivo
                //panel.addPreferencePage(edPref);
163 8765 jjdelcerro
                // edPref.setLayers(layers);
164 5793 fjp
165
                dlg.getContentPane().add(panel);
166
                dlg.pack();
167
                dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
168
169
                dlg.setVisible(true);
170
171
172 6606 caballero
173 5793 fjp
                System.exit(0);
174
        }
175
176
}