Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libCorePlugin / src / org / gvsig / coreplugin / preferences / general / IconThemeExtensionsPage.java @ 38564

History | View | Annotate | Download (2.25 KB)

1 38564 jjdelcerro
package org.gvsig.coreplugin.preferences.general;
2
3
import java.awt.BorderLayout;
4
import java.util.ArrayList;
5
import java.util.Iterator;
6
import java.util.List;
7
8
import javax.swing.ComboBoxModel;
9
import javax.swing.DefaultComboBoxModel;
10
import javax.swing.ImageIcon;
11
import javax.swing.JPanel;
12
13
import org.gvsig.andami.PluginServices;
14
import org.gvsig.andami.preferences.AbstractPreferencePage;
15
import org.gvsig.tools.swing.api.ToolsSwingLocator;
16
import org.gvsig.tools.swing.icontheme.IconTheme;
17
import org.gvsig.tools.swing.icontheme.IconThemeManager;
18
19
public class IconThemeExtensionsPage extends AbstractPreferencePage {
20
21
        /**
22
         *
23
         */
24
        private static final long serialVersionUID = 4369071892027860769L;
25
26
        private String id;
27
        private boolean changed = false;
28
29
        public IconThemeExtensionsPage() {
30
                super();
31
                initialize();
32
                id = this.getClass().getName();
33
                setParentID(GeneralPage.class.getName());
34
        }
35
36
        public String getID() {
37
                return id;
38
        }
39
40
        public String getTitle() {
41
                return PluginServices.getText(this, "_Icon_theme");
42
        }
43
44
        public JPanel getPanel() {
45
                return this;
46
        }
47
48
        public void initializeValues() {
49
        }
50
51
        public void storeValues() {
52
        }
53
54
        public void initializeDefaults() {
55
56
        }
57
58
        public ImageIcon getIcon() {
59
                return PluginServices.getIconTheme().get("edit-setup-icontheme");
60
        }
61
62
        public boolean isValueChanged() {
63
                return changed;
64
        }
65
66
        public void setChangesApplied() {
67
                changed = false;
68
        }
69
70
        private void initialize() {
71
                IconThemeManager iconManager = ToolsSwingLocator.getIconThemeManager();
72
                this.setLayout(new BorderLayout());
73
74
                IconThemePanelPage panel = new IconThemePanelPage();
75
76
                // LLenar la lista con los temas disponibles
77
                List<IconTheme> themes = new ArrayList<IconTheme>();
78
                Iterator<IconTheme> themesIt = iconManager.iterator();
79
                while( themesIt.hasNext() ) {
80
                        IconTheme theme = themesIt.next();
81
                        themes.add(theme);
82
                }
83
                ComboBoxModel model = new DefaultComboBoxModel(themes.toArray());
84
                panel.combo_selection.setModel(model);
85
86
                // Traducir las etiquetas del panel
87
                panel.label_title.setText(translate(panel.label_title.getText()));
88
                panel.label_selection.setText(translate(panel.label_selection.getText()));
89
90
                this.add(panel, BorderLayout.CENTER);
91
        }
92
93
        private String translate(String s) {
94
                return PluginServices.getText(this,s);
95
        }
96
97
}