Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.editing.app / org.gvsig.editing.app.mainplugin / src / main / java / org / gvsig / editing / gui / preferences / DialogEditionPreferences.java @ 40557

History | View | Annotate | Download (4.33 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.editing.gui.preferences;
25

    
26
import java.util.Random;
27

    
28
import javax.swing.ImageIcon;
29
import javax.swing.JDialog;
30
import javax.swing.JPanel;
31

    
32
import org.gvsig.andami.preferences.AbstractPreferencePage;
33
import org.gvsig.andami.preferences.DlgPreferences;
34
import org.gvsig.fmap.mapcontext.layers.FLayers;
35
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
36

    
37

    
38

    
39
public class DialogEditionPreferences  {
40
        public class TestPref extends AbstractPreferencePage
41
        {
42
                String id;
43
                public TestPref(String title)
44
                {
45
                        super();
46
                        id = title;
47
                        setTitle(title);
48
                }
49
                public JPanel getPanel() {
50
                        return this;
51
                }
52
                public void initializeValues() {
53
                        // TODO Auto-generated method stub
54

    
55
                }
56
                public void storeValues() {
57
                }
58
                public void initializeDefaults() {
59
                        // TODO Auto-generated method stub
60

    
61
                }
62
                public ImageIcon getIcon() {
63
                        // TODO Auto-generated method stub
64
                        return null;
65
                }
66
                public String getID() {
67
                        // TODO Auto-generated method stub
68
                        return null;
69
                }
70
                public String getTitle() {
71
                        // TODO Auto-generated method stub
72
                        return null;
73
                }
74

    
75
                public boolean isValueChanged() {
76
                        // TODO Auto-generated method stub
77
                        return false;
78
                }
79
                public void setChangesApplied() {
80
                        // TODO Auto-generated method stub
81

    
82
                }
83

    
84
        }
85
        public static void main(String[] args) {
86
                try {
87
                        // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
88
                        // UIManager.setLookAndFeel(Options.JGOODIES_WINDOWS_NAME);
89
                } catch (Exception e) {
90
                        e.printStackTrace();
91
                }
92

    
93
                DialogEditionPreferences test = new DialogEditionPreferences();
94
                // test.configureUI();
95
                test.test();
96

    
97
        }
98

    
99
           /**
100
     * Configures the UI; tries to set the system look on Mac,
101
     * <code>WindowsLookAndFeel</code> on general Windows, and
102
     * <code>Plastic3DLookAndFeel</code> on Windows XP and all other OS.<p>
103
     *
104
     * The JGoodies Swing Suite's <code>ApplicationStarter</code>,
105
     * <code>ExtUIManager</code>, and <code>LookChoiceStrategies</code>
106
     * classes provide a much more fine grained algorithm to choose and
107
     * restore a look and theme.
108
     */
109
//    private void configureUI() {
110
//        UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
111
//        Options.setDefaultIconSize(new Dimension(18, 18));
112
//
113
//        String lafName =
114
//            LookUtils.IS_OS_WINDOWS_XP
115
//                ? Options.getCrossPlatformLookAndFeelClassName()
116
//                : Options.getSystemLookAndFeelClassName();
117
//
118
//        try {
119
//            UIManager.setLookAndFeel(lafName);
120
//        } catch (Exception e) {
121
//            System.err.println("Can't set look & feel:" + e);
122
//        }
123
//    }
124
        private void test() {
125
                JDialog dlg = new JDialog();
126
                dlg.setModal(true);
127
                dlg.setTitle("Preferences");
128

    
129
                DlgPreferences panel = DlgPreferences.getInstance();
130

    
131
                for (int i=0; i< 20; i++)
132
                {
133
                        TestPref newPref = new TestPref("Titulo " + i);
134
                        Random rnd = new Random();
135
                        if (i> 5)
136
                                newPref.setParentID("Titulo " + rnd.nextInt(i));
137
                        //panel.addPreferencePage(newPref);
138

    
139
                }
140

    
141
                FLayers layers = new FLayers();//(null,null);
142
                FLyrVect lyrVect = new FLyrVect();
143
                lyrVect.setName("Hola");
144
                layers.addLayer(lyrVect);
145

    
146
                EditionPreferencePage edPref = new EditionPreferencePage();
147
                //panel.addPreferencePage(edPref);
148
                // edPref.setLayers(layers);
149

    
150
                dlg.getContentPane().add(panel);
151
                dlg.pack();
152
                dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
153

    
154
                dlg.setVisible(true);
155
                lyrVect.dispose();
156

    
157

    
158
                System.exit(0);
159
        }
160

    
161
}