gvsig-projects-pool / org.gvsig.winmgr / trunk / org.gvsig.winmgr.app / org.gvsig.winmgr.app.mainplugin / src / main / java / org / gvsig / coreplugin / preferences / general / NotificationsPage.java @ 682
History | View | Annotate | Download (5.93 KB)
1 |
/*
|
---|---|
2 |
* To change this license header, choose License Headers in Project Properties.
|
3 |
* To change this template file, choose Tools | Templates
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
|
7 |
package org.gvsig.coreplugin.preferences.general; |
8 |
|
9 |
import java.awt.GridBagConstraints; |
10 |
import java.awt.GridBagLayout; |
11 |
import javax.swing.ImageIcon; |
12 |
import javax.swing.JCheckBox; |
13 |
import javax.swing.JLabel; |
14 |
import javax.swing.JPanel; |
15 |
import javax.swing.SwingConstants; |
16 |
import org.gvsig.andami.PluginServices; |
17 |
import org.gvsig.andami.PluginsLocator; |
18 |
import org.gvsig.andami.PluginsManager; |
19 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
20 |
import org.gvsig.andami.preferences.StoreException; |
21 |
import org.gvsig.coreplugin.PreferencesExtension; |
22 |
import org.gvsig.tools.ToolsLocator; |
23 |
import org.gvsig.tools.dynobject.DynObject; |
24 |
import org.gvsig.tools.i18n.I18nManager; |
25 |
|
26 |
/**
|
27 |
*
|
28 |
* @author usuario
|
29 |
*/
|
30 |
public class NotificationsPage extends AbstractPreferencePage { |
31 |
|
32 |
/**
|
33 |
* Creates new form NotificationsPage
|
34 |
*/
|
35 |
public NotificationsPage() {
|
36 |
initComponents(); |
37 |
translate(); |
38 |
} |
39 |
|
40 |
/**
|
41 |
* This method is called from within the constructor to
|
42 |
* initialize the form.
|
43 |
* WARNING: Do NOT modify this code. The content of this method is
|
44 |
* always regenerated by the Form Editor.
|
45 |
*/
|
46 |
@SuppressWarnings("unchecked") |
47 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
48 |
private void initComponents() { |
49 |
GridBagConstraints gridBagConstraints;
|
50 |
|
51 |
jLabel1 = new JLabel(); |
52 |
jchkShowInConsole = new JCheckBox(); |
53 |
jchkShowInStatusbar = new JCheckBox(); |
54 |
jLabel2 = new JLabel(); |
55 |
|
56 |
GridBagLayout layout = new GridBagLayout(); |
57 |
layout.columnWidths = new int[] {0, 5, 0}; |
58 |
layout.rowHeights = new int[] {0, 5, 0, 5, 0, 5, 0}; |
59 |
setLayout(layout); |
60 |
|
61 |
jLabel1.setText("Select the notification mode");
|
62 |
jLabel1.setHorizontalTextPosition(SwingConstants.LEFT);
|
63 |
gridBagConstraints = new GridBagConstraints(); |
64 |
gridBagConstraints.gridx = 0;
|
65 |
gridBagConstraints.gridy = 0;
|
66 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
67 |
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
68 |
add(jLabel1, gridBagConstraints); |
69 |
|
70 |
jchkShowInConsole.setText("Show notificacion in console window");
|
71 |
gridBagConstraints = new GridBagConstraints(); |
72 |
gridBagConstraints.gridx = 0;
|
73 |
gridBagConstraints.gridy = 4;
|
74 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
75 |
add(jchkShowInConsole, gridBagConstraints); |
76 |
|
77 |
jchkShowInStatusbar.setText("Show notifications in statusbar");
|
78 |
jchkShowInStatusbar.setHorizontalAlignment(SwingConstants.LEFT);
|
79 |
gridBagConstraints = new GridBagConstraints(); |
80 |
gridBagConstraints.gridx = 0;
|
81 |
gridBagConstraints.gridy = 2;
|
82 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
83 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
84 |
add(jchkShowInStatusbar, gridBagConstraints); |
85 |
|
86 |
jLabel2.setText("The changes take effect in next execution of the application");
|
87 |
gridBagConstraints = new GridBagConstraints(); |
88 |
gridBagConstraints.gridx = 0;
|
89 |
gridBagConstraints.gridy = 6;
|
90 |
add(jLabel2, gridBagConstraints); |
91 |
}// </editor-fold>//GEN-END:initComponents
|
92 |
|
93 |
|
94 |
// Variables declaration - do not modify//GEN-BEGIN:variables
|
95 |
protected JLabel jLabel1; |
96 |
protected JLabel jLabel2; |
97 |
protected JCheckBox jchkShowInConsole; |
98 |
protected JCheckBox jchkShowInStatusbar; |
99 |
// End of variables declaration//GEN-END:variables
|
100 |
|
101 |
private void translate() { |
102 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
103 |
|
104 |
jLabel1.setText(i18nManager.getTranslation("Select_the_notification_mode"));
|
105 |
jchkShowInConsole.setText(i18nManager.getTranslation("Show_notifications_in_the_console_window"));
|
106 |
jchkShowInStatusbar.setText(i18nManager.getTranslation("Show_notifications_in_the_statusbar"));
|
107 |
jLabel2.setText(i18nManager.getTranslation("Los_cambios_efectuados_sobre_estos_valores_se_aplicaran_al_reiniciar_la_aplicacion"));
|
108 |
} |
109 |
|
110 |
@Override
|
111 |
public void storeValues() throws StoreException { |
112 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
113 |
PluginServices plugin = pluginsManager.getPlugin(PreferencesExtension.class); |
114 |
|
115 |
DynObject pluginProperties = plugin.getPluginProperties(); |
116 |
pluginProperties.setDynValue( |
117 |
"showNotificationsInConsole",
|
118 |
new Boolean(jchkShowInConsole.isSelected()) |
119 |
); |
120 |
pluginProperties.setDynValue( |
121 |
"showNotificationsInStatusbar",
|
122 |
new Boolean(jchkShowInStatusbar.isSelected()) |
123 |
); |
124 |
plugin.savePluginProperties(); |
125 |
} |
126 |
|
127 |
@Override
|
128 |
public void setChangesApplied() { |
129 |
|
130 |
} |
131 |
|
132 |
public String getID() { |
133 |
return this.getClass().getName(); |
134 |
} |
135 |
|
136 |
public String getTitle() { |
137 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
138 |
return i18nManager.getTranslation("notifications_mode"); |
139 |
} |
140 |
|
141 |
public JPanel getPanel() { |
142 |
return this; |
143 |
} |
144 |
|
145 |
public void initializeValues() { |
146 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
147 |
PluginServices plugin = pluginsManager.getPlugin(PreferencesExtension.class); |
148 |
|
149 |
DynObject pluginProperties = plugin.getPluginProperties(); |
150 |
jchkShowInStatusbar.setSelected( |
151 |
((Boolean)pluginProperties.getDynValue("showNotificationsInStatusbar")).booleanValue()); |
152 |
jchkShowInConsole.setSelected( |
153 |
((Boolean)pluginProperties.getDynValue("showNotificationsInConsole")).booleanValue()); |
154 |
} |
155 |
|
156 |
public void initializeDefaults() { |
157 |
jchkShowInStatusbar.setSelected(true);
|
158 |
jchkShowInConsole.setSelected(false);
|
159 |
} |
160 |
|
161 |
public ImageIcon getIcon() { |
162 |
return null; |
163 |
} |
164 |
|
165 |
public boolean isValueChanged() { |
166 |
return true; |
167 |
} |
168 |
} |