Revision 43167
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/resources/org/gvsig/andami/text.properties | ||
---|---|---|
82 | 82 |
there_are_unsaved_resources=Hay recursos sin guardar |
83 | 83 |
The_following_resources_could_not_be_saved=Los siguientes recursos no han podido ser guardados |
84 | 84 |
unsaved_resources=Recursos no guardados |
85 |
_do_not_show_again=No volver a mostrar |
|
86 |
_Remember_answer_and_do_not_ask_again=Recordar la respuesta y no volver a preguntar |
|
85 | 87 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/resources/org/gvsig/andami/text_en.properties | ||
---|---|---|
78 | 78 |
_Or_click_the_close_button_to_close_the_application=Or click on 'Close' button to close the application |
79 | 79 |
there_are_unsaved_resources=There are unsaved resources |
80 | 80 |
The_following_resources_could_not_be_saved=The following resources could not be saved |
81 |
unsaved_resources=Unsaved resources |
|
81 |
unsaved_resources=Unsaved resources |
|
82 |
_do_not_show_again=Don't show again |
|
83 |
_Remember_answer_and_do_not_ask_again=Remember answer and don't ask again |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/mdiFrame/ThreadSafeDialogs.java | ||
---|---|---|
61 | 61 |
*/ |
62 | 62 |
public void messageDialog(String message, String messageArgs[], String title, int messageType); |
63 | 63 |
|
64 |
public void messageDialog(String message, String messageArgs[], String title, int messageType, String msgid); |
|
65 |
|
|
64 | 66 |
/** |
65 | 67 |
* Show a JOptionPane confirm dialog. |
66 | 68 |
* |
... | ... | |
79 | 81 |
*/ |
80 | 82 |
public int confirmDialog(String message, String title, int optionType, int messageType) ; |
81 | 83 |
|
84 |
public int confirmDialog(String message, String title, int optionType, int messageType, String msgid) ; |
|
85 |
|
|
82 | 86 |
/** |
83 | 87 |
* Show a JOptionPane input dialog. |
84 | 88 |
* |
... | ... | |
88 | 92 |
* |
89 | 93 |
* @param message |
90 | 94 |
* @param title |
91 |
* @param optionType |
|
92 |
* an integer designating the options available on the dialog: |
|
93 |
* YES_NO_OPTION, YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION |
|
94 | 95 |
* @param messageType |
95 | 96 |
* an integer designating the kind of message this is; |
96 | 97 |
* primarily used to determine the icon from the pluggable |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/mdiFrame/DefaultThreadSafeDialogs.java | ||
---|---|---|
31 | 31 |
import java.awt.event.ComponentListener; |
32 | 32 |
import java.io.File; |
33 | 33 |
import java.lang.reflect.Constructor; |
34 |
import javax.swing.JCheckBox; |
|
34 | 35 |
|
35 | 36 |
import javax.swing.JFileChooser; |
37 |
import javax.swing.JLabel; |
|
36 | 38 |
import javax.swing.JOptionPane; |
37 | 39 |
import javax.swing.JPanel; |
38 | 40 |
import javax.swing.SwingUtilities; |
39 | 41 |
import javax.swing.filechooser.FileFilter; |
40 | 42 |
|
41 | 43 |
import org.gvsig.andami.PluginServices; |
44 |
import org.gvsig.andami.PluginsLocator; |
|
42 | 45 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
43 | 46 |
import org.gvsig.andami.ui.mdiManager.MDIManager; |
44 | 47 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
48 |
import org.gvsig.dialogremember.DialogRememeber; |
|
49 |
import org.gvsig.tools.ToolsLocator; |
|
45 | 50 |
import org.gvsig.tools.task.CancellableTask; |
46 | 51 |
import org.gvsig.tools.task.RunnableWithParameters; |
47 | 52 |
import org.slf4j.Logger; |
... | ... | |
114 | 119 |
return msg; |
115 | 120 |
} |
116 | 121 |
|
122 |
@Override |
|
117 | 123 |
public int confirmDialog(final String message, final String title, final int optionType, |
118 | 124 |
final int messageType) { |
125 |
return this.confirmDialog(message, title, optionType, messageType, null); |
|
126 |
} |
|
127 |
|
|
128 |
private static class JMessageWithCheck extends JPanel { |
|
129 |
private final JLabel label; |
|
130 |
private final JCheckBox check; |
|
131 |
|
|
132 |
public JMessageWithCheck(String msg, String msgchk) { |
|
133 |
if( !msg.toLowerCase().trim().startsWith("<html>") ) { |
|
134 |
msg = "<html>" + msg.replace("\n", "<br>\n") + "</html>"; |
|
135 |
} |
|
136 |
this.label = new JLabel(msg); |
|
137 |
this.check = new JCheckBox(msgchk); |
|
138 |
this.setLayout(new BorderLayout(10,10)); |
|
139 |
this.add(this.label,BorderLayout.CENTER); |
|
140 |
this.add(this.check,BorderLayout.PAGE_END); |
|
141 |
} |
|
142 |
|
|
143 |
public boolean isCheckSelected() { |
|
144 |
return this.check.isSelected(); |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
|
149 |
public int confirmDialog(final String message, final String title, final int optionType, |
|
150 |
final int messageType, final String msgid) { |
|
119 | 151 |
RunnableWithParameters runnable = new RunnableWithParameters() { |
152 |
@Override |
|
120 | 153 |
public void run() { |
121 |
this.returnValue = JOptionPane.showConfirmDialog( |
|
122 |
getRootComponent(), message,title, optionType, messageType); |
|
154 |
DialogRememeber r = null; |
|
155 |
Object msg = message; |
|
156 |
if( msgid != null ) { |
|
157 |
r = PluginsLocator.getDialogRemembereManager().add(msgid); |
|
158 |
if( r.hasValue() ) { |
|
159 |
this.returnValue = r.getValue(); |
|
160 |
return; |
|
161 |
} |
|
162 |
msg = new JMessageWithCheck( |
|
163 |
message, |
|
164 |
ToolsLocator.getI18nManager().getTranslation("_Remember_answer_and_do_not_ask_again") |
|
165 |
); |
|
166 |
} |
|
167 |
this.returnValue = JOptionPane.showConfirmDialog( |
|
168 |
getRootComponent(), |
|
169 |
msg, |
|
170 |
title, |
|
171 |
optionType, |
|
172 |
messageType |
|
173 |
); |
|
174 |
if( r!=null ) { |
|
175 |
if( ((JMessageWithCheck)msg).isCheckSelected() ) { |
|
176 |
r.setValue(this.returnValue); |
|
177 |
} else { |
|
178 |
r.reset(); |
|
179 |
} |
|
180 |
} |
|
123 | 181 |
} |
124 | 182 |
}; |
125 | 183 |
if (SwingUtilities.isEventDispatchThread()) { |
... | ... | |
182 | 240 |
return (String) runnable.getReturnValue(); |
183 | 241 |
} |
184 | 242 |
|
243 |
@Override |
|
185 | 244 |
public void messageDialog(String message, String title, int messageType) { |
186 | 245 |
messageDialog(message, null, title, messageType); |
187 | 246 |
} |
188 | 247 |
|
189 | 248 |
public void messageDialog(final String message, final String messageArgs[], |
190 | 249 |
final String title, final int messageType) { |
191 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
192 |
try { |
|
193 |
SwingUtilities.invokeAndWait(new Runnable() { |
|
194 |
public void run() { |
|
195 |
messageDialog(message, messageArgs, title, messageType); |
|
196 |
} |
|
197 |
}); |
|
198 |
} catch (Exception e) { |
|
199 |
logger.info("Can't show message dialog '" + message |
|
200 |
+ "'. redirect to status bar", e); |
|
201 |
this.message(message, messageType); |
|
202 |
} |
|
203 |
return; |
|
204 |
} |
|
250 |
} |
|
251 |
|
|
252 |
@Override |
|
253 |
public void messageDialog(final String message, final String messageArgs[], |
|
254 |
final String title, final int messageType, final String msgid) { |
|
255 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
256 |
try { |
|
257 |
SwingUtilities.invokeAndWait(new Runnable() { |
|
258 |
@Override |
|
259 |
public void run() { |
|
260 |
messageDialog(message, messageArgs, title, messageType, msgid); |
|
261 |
} |
|
262 |
}); |
|
263 |
} catch (Exception e) { |
|
264 |
logger.info("Can't show message dialog '" + message |
|
265 |
+ "'. redirect to status bar", e); |
|
266 |
this.message(message, messageType); |
|
267 |
} |
|
268 |
return; |
|
269 |
} |
|
205 | 270 |
|
206 |
if (message == null) { |
|
207 |
logger.info("message if null, message dialog not show."); |
|
208 |
return; |
|
209 |
} |
|
210 |
JOptionPane.showMessageDialog(getRootComponent(), |
|
211 |
translate(message, messageArgs), translate(title), messageType); |
|
212 |
} |
|
271 |
if (message == null) { |
|
272 |
logger.info("message if null, message dialog not show."); |
|
273 |
return; |
|
274 |
} |
|
275 |
DialogRememeber r = null; |
|
276 |
Object msg = message; |
|
277 |
if (msgid != null) { |
|
278 |
r = PluginsLocator.getDialogRemembereManager().add(msgid); |
|
279 |
if (r.hasValue() && ((boolean)r.getValue()) ) { |
|
280 |
return; |
|
281 |
} |
|
282 |
msg = new JMessageWithCheck( |
|
283 |
message, |
|
284 |
ToolsLocator.getI18nManager().getTranslation("_do_not_show_again") |
|
285 |
); |
|
286 |
} |
|
287 |
JOptionPane.showMessageDialog(getRootComponent(), |
|
288 |
translate(message, messageArgs), translate(title), messageType); |
|
213 | 289 |
|
290 |
if (r != null) { |
|
291 |
if (((JMessageWithCheck) msg).isCheckSelected()) { |
|
292 |
r.setValue(true); |
|
293 |
} else { |
|
294 |
r.reset(); |
|
295 |
} |
|
296 |
} |
|
297 |
|
|
298 |
} |
|
299 |
|
|
214 | 300 |
public void showDialog(final Component contents, final String title) { |
215 | 301 |
if (SwingUtilities.isEventDispatchThread()) { |
216 | 302 |
final DialogWindow window = new DialogWindow(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/mdiFrame/MDIFrame.java | ||
---|---|---|
1920 | 1920 |
helper.messageDialog(message, messageArgs, title, messageType); |
1921 | 1921 |
} |
1922 | 1922 |
|
1923 |
@Override |
|
1924 |
public void messageDialog(String message, String[] messageArgs, |
|
1925 |
String title, int messageType, String msgid) { |
|
1926 |
DefaultThreadSafeDialogs helper = new DefaultThreadSafeDialogs(this, this.bEstado); |
|
1927 |
helper.messageDialog(message, messageArgs, title, messageType, msgid); |
|
1928 |
} |
|
1929 |
|
|
1930 |
@Override |
|
1923 | 1931 |
public int confirmDialog(String message, String title, int optionType, |
1924 | 1932 |
int messageType) { |
1925 | 1933 |
DefaultThreadSafeDialogs helper = new DefaultThreadSafeDialogs(this, this.bEstado); |
1926 | 1934 |
return helper.confirmDialog(message, title, optionType, messageType); |
1927 | 1935 |
} |
1928 | 1936 |
|
1937 |
@Override |
|
1938 |
public int confirmDialog(String message, String title, int optionType, |
|
1939 |
int messageType, String msgid) { |
|
1940 |
DefaultThreadSafeDialogs helper = new DefaultThreadSafeDialogs(this, this.bEstado); |
|
1941 |
return helper.confirmDialog(message, title, optionType, messageType, msgid); |
|
1942 |
} |
|
1943 |
|
|
1929 | 1944 |
public String inputDialog(String message, String title, int messageType, |
1930 | 1945 |
String initialValue) { |
1931 | 1946 |
DefaultThreadSafeDialogs helper = new DefaultThreadSafeDialogs(this, this.bEstado); |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/PluginsLocator.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import org.gvsig.andami.actioninfo.ActionInfoManager; |
27 | 27 |
import org.gvsig.andami.ui.mdiFrame.MainFrame; |
28 |
import org.gvsig.dialogremember.DialogRememberManager; |
|
28 | 29 |
import org.gvsig.tools.locator.AbstractLocator; |
29 | 30 |
import org.gvsig.tools.locator.Locator; |
30 | 31 |
import org.gvsig.tools.locator.LocatorException; |
... | ... | |
40 | 41 |
public static final String PLUGINS_MANAGER_NAME = "PluginsManager"; |
41 | 42 |
public static final String PLUGINS_ACTIONINFO_MANAGER_NAME = "PluginsActionInfoManager"; |
42 | 43 |
public static final String PLUGINS_LOCALE_MANAGER_NAME = "LocaleManager"; |
44 |
public static final String PLUGINS_DIALOGREMEMBERDER_MANAGER_NAME = "DialogReminderManager"; |
|
43 | 45 |
|
44 | 46 |
private static final String PLUGINS_MANAGER_DESCRIPTION = "PluginsManager of Andami framework"; |
45 | 47 |
private static final String PLUGINS_ACTIONINFO_MANAGER_DESCRIPTION = "PluginsActionInfoManager"; |
46 | 48 |
private static final String PLUGINS_LOCALE_MANAGER_DESCRIPTION = "LocaleManager"; |
49 |
private static final String PLUGINS_DIALOGREMEMBER_MANAGER_DESCRIPTION = "DialogReminderManager"; |
|
47 | 50 |
|
48 | 51 |
/** |
49 | 52 |
* Unique instance. |
... | ... | |
126 | 129 |
clazz); |
127 | 130 |
} |
128 | 131 |
|
132 |
public static DialogRememberManager getDialogRemembereManager() throws LocatorException { |
|
133 |
return (DialogRememberManager) getInstance().get(PLUGINS_DIALOGREMEMBERDER_MANAGER_NAME); |
|
134 |
} |
|
135 |
|
|
136 |
public static void registerDialogRememberManager(Class clazz) { |
|
137 |
getInstance().register(PLUGINS_DIALOGREMEMBERDER_MANAGER_NAME, PLUGINS_DIALOGREMEMBER_MANAGER_DESCRIPTION, |
|
138 |
clazz); |
|
139 |
} |
|
129 | 140 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/PluginsLibrary.java | ||
---|---|---|
30 | 30 |
import org.gvsig.andami.installer.icontheme.IconThemeInstallerFactory.RegisterIconThemeInstaller; |
31 | 31 |
import org.gvsig.andami.installer.translations.TranslationsInstallerFactory.RegisterTranslationsInstaller; |
32 | 32 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
33 |
import org.gvsig.dialogremember.impl.DefaultDialogRememberManager; |
|
33 | 34 |
import org.gvsig.installer.lib.api.InstallerLibrary; |
34 | 35 |
import org.gvsig.tools.ToolsLocator; |
35 | 36 |
import org.gvsig.tools.library.AbstractLibrary; |
... | ... | |
50 | 51 |
PluginsLocator.registerDefaultManager(DefaultPluginsManager.class); |
51 | 52 |
PluginsLocator.registerActionInfoManager(DefaultActionInfoManager.class); |
52 | 53 |
PluginsLocator.registerLocaleManager(DefaultLocaleManager.class); |
54 |
PluginsLocator.registerDialogRememberManager(DefaultDialogRememberManager.class); |
|
53 | 55 |
ToolsLocator.registerDefaultFirewallManager(DefaultFirewallConfiguration.class); |
54 | 56 |
|
55 | 57 |
// Force initialize of the LocaleManager |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/dialogremember/DialogRememberManager.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.dialogremember; |
|
3 |
|
|
4 |
import java.util.Iterator; |
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
|
|
8 |
public interface DialogRememberManager extends Iterable<DialogRememeber> { |
|
9 |
|
|
10 |
public boolean exists(String id); |
|
11 |
|
|
12 |
public DialogRememeber get(String id); |
|
13 |
|
|
14 |
public DialogRememeber add(String id); |
|
15 |
|
|
16 |
public DialogRememeber add(String id, int value); |
|
17 |
|
|
18 |
@Override |
|
19 |
public Iterator<DialogRememeber> iterator(); |
|
20 |
|
|
21 |
public List<DialogRememeber> remembers(); |
|
22 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/dialogremember/impl/DefaultDialogRememberManager.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.dialogremember.impl; |
|
3 |
|
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Collections; |
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.Iterator; |
|
8 |
import java.util.List; |
|
9 |
import java.util.Map; |
|
10 |
import org.gvsig.dialogremember.DialogRememeber; |
|
11 |
import org.gvsig.dialogremember.DialogRememberManager; |
|
12 |
|
|
13 |
|
|
14 |
public class DefaultDialogRememberManager implements DialogRememberManager { |
|
15 |
|
|
16 |
private Map<String,DialogRememeber> remembers; |
|
17 |
|
|
18 |
public DefaultDialogRememberManager() { |
|
19 |
this.remembers = new HashMap<>(); |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public boolean exists(String id) { |
|
24 |
return this.remembers.containsKey(id); |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public DialogRememeber get(String id) { |
|
29 |
return this.remembers.get(id); |
|
30 |
} |
|
31 |
|
|
32 |
@Override |
|
33 |
public DialogRememeber add(String id) { |
|
34 |
DialogRememeber r = this.get(id); |
|
35 |
if( r == null ) { |
|
36 |
r = new DefaultDialogRemember(id); |
|
37 |
this.remembers.put(id, r); |
|
38 |
} |
|
39 |
return r; |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public DialogRememeber add(String id, int value) { |
|
44 |
DialogRememeber r = this.add(id); |
|
45 |
r.setValue(value); |
|
46 |
return r; |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public Iterator<DialogRememeber> iterator() { |
|
51 |
return this.remembers.values().iterator(); |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
public List<DialogRememeber> remembers() { |
|
56 |
return Collections.unmodifiableList(new ArrayList<>(this.remembers.values())); |
|
57 |
} |
|
58 |
|
|
59 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/dialogremember/impl/DefaultDialogRemember.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.dialogremember.impl; |
|
3 |
|
|
4 |
import org.gvsig.dialogremember.DialogRememeber; |
|
5 |
|
|
6 |
|
|
7 |
public class DefaultDialogRemember implements DialogRememeber { |
|
8 |
private final String id; |
|
9 |
private Object value; |
|
10 |
|
|
11 |
public DefaultDialogRemember(String id) { |
|
12 |
this.id = id; |
|
13 |
this.value = null; |
|
14 |
} |
|
15 |
@Override |
|
16 |
public String getId() { |
|
17 |
return id; |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
public Object getValue() { |
|
22 |
return this.value; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void reset() { |
|
27 |
this.value = null; |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public boolean hasValue() { |
|
32 |
return this.value!=null; |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public void setValue(Object value) { |
|
37 |
this.value = value; |
|
38 |
} |
|
39 |
|
|
40 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/dialogremember/DialogRememeber.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.dialogremember; |
|
3 |
|
|
4 |
|
|
5 |
public interface DialogRememeber { |
|
6 |
|
|
7 |
public String getId(); |
|
8 |
|
|
9 |
public Object getValue(); |
|
10 |
|
|
11 |
public void setValue(Object value); |
|
12 |
|
|
13 |
public void reset(); |
|
14 |
|
|
15 |
public boolean hasValue(); |
|
16 |
|
|
17 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.installer/org.gvsig.desktop.selfextract.lin/data/.directory | ||
---|---|---|
1 |
[Dolphin] |
|
2 |
Timestamp=2016,2,21,18,25,46 |
|
3 |
Version=3 |
|
4 |
ViewMode=1 |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/dialogremember/DialogRememberView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jjdelcerro/datos/devel/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/dialogremember/DialogRememberView.xml</at> |
|
28 |
<at name="path">datos/devel/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/dialogremember/DialogRememberView.xml</at> |
|
29 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:2DLU:NONE</at> |
|
30 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
|
31 |
<at name="components"> |
|
32 |
<object classname="java.util.LinkedList"> |
|
33 |
<item > |
|
34 |
<at name="value"> |
|
35 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
36 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
37 |
<at name="cellconstraints"> |
|
38 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
39 |
<at name="column">2</at> |
|
40 |
<at name="row">4</at> |
|
41 |
<at name="colspan">1</at> |
|
42 |
<at name="rowspan">1</at> |
|
43 |
<at name="halign">default</at> |
|
44 |
<at name="valign">default</at> |
|
45 |
<at name="insets" object="insets">0,0,0,0</at> |
|
46 |
</object> |
|
47 |
</at> |
|
48 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
49 |
</super> |
|
50 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
51 |
<at name="beanclass">javax.swing.JList</at> |
|
52 |
<at name="beanproperties"> |
|
53 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
54 |
<at name="classname">javax.swing.JList</at> |
|
55 |
<at name="properties"> |
|
56 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
57 |
<at name="border"> |
|
58 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
59 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
60 |
<at name="name">border</at> |
|
61 |
</super> |
|
62 |
<at name="borders"> |
|
63 |
<object classname="java.util.LinkedList"> |
|
64 |
<item > |
|
65 |
<at name="value"> |
|
66 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
67 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
68 |
<at name="name">border</at> |
|
69 |
</super> |
|
70 |
</object> |
|
71 |
</at> |
|
72 |
</item> |
|
73 |
</object> |
|
74 |
</at> |
|
75 |
</object> |
|
76 |
</at> |
|
77 |
<at name="scrollableTracksViewportHeight">true</at> |
|
78 |
<at name="scrollableTracksViewportWidth">true</at> |
|
79 |
<at name="name">lstRemembers</at> |
|
80 |
<at name="width">913</at> |
|
81 |
<at name="items"> |
|
82 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
83 |
<at name="name">items</at> |
|
84 |
</object> |
|
85 |
</at> |
|
86 |
<at name="scollBars"> |
|
87 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
88 |
<at name="name">scollBars</at> |
|
89 |
<at name="verticalpolicy">20</at> |
|
90 |
<at name="horizontalpolicy">30</at> |
|
91 |
<at name="border"> |
|
92 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
93 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
94 |
<at name="name">border</at> |
|
95 |
</super> |
|
96 |
<at name="borders"> |
|
97 |
<object classname="java.util.LinkedList"> |
|
98 |
<item > |
|
99 |
<at name="value"> |
|
100 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
101 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
102 |
<at name="name">border</at> |
|
103 |
</super> |
|
104 |
</object> |
|
105 |
</at> |
|
106 |
</item> |
|
107 |
</object> |
|
108 |
</at> |
|
109 |
</object> |
|
110 |
</at> |
|
111 |
</object> |
|
112 |
</at> |
|
113 |
<at name="height">467</at> |
|
114 |
</object> |
|
115 |
</at> |
|
116 |
</object> |
|
117 |
</at> |
|
118 |
</object> |
|
119 |
</at> |
|
120 |
</item> |
|
121 |
<item > |
|
122 |
<at name="value"> |
|
123 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
124 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
125 |
<at name="cellconstraints"> |
|
126 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
127 |
<at name="column">2</at> |
|
128 |
<at name="row">2</at> |
|
129 |
<at name="colspan">1</at> |
|
130 |
<at name="rowspan">1</at> |
|
131 |
<at name="halign">default</at> |
|
132 |
<at name="valign">default</at> |
|
133 |
<at name="insets" object="insets">0,0,0,0</at> |
|
134 |
</object> |
|
135 |
</at> |
|
136 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
137 |
</super> |
|
138 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
139 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
140 |
<at name="beanproperties"> |
|
141 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
142 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
143 |
<at name="properties"> |
|
144 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
145 |
<at name="border"> |
|
146 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
147 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
148 |
<at name="name">border</at> |
|
149 |
</super> |
|
150 |
<at name="borders"> |
|
151 |
<object classname="java.util.LinkedList"> |
|
152 |
<item > |
|
153 |
<at name="value"> |
|
154 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
155 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
156 |
<at name="name">border</at> |
|
157 |
</super> |
|
158 |
</object> |
|
159 |
</at> |
|
160 |
</item> |
|
161 |
</object> |
|
162 |
</at> |
|
163 |
</object> |
|
164 |
</at> |
|
165 |
<at name="name">lblTitle</at> |
|
166 |
<at name="width">915</at> |
|
167 |
<at name="text">_Remember_responses_from_selected_dialogs</at> |
|
168 |
<at name="fill"> |
|
169 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
170 |
<at name="name">fill</at> |
|
171 |
</object> |
|
172 |
</at> |
|
173 |
<at name="height">14</at> |
|
174 |
</object> |
|
175 |
</at> |
|
176 |
</object> |
|
177 |
</at> |
|
178 |
</object> |
|
179 |
</at> |
|
180 |
</item> |
|
181 |
</object> |
|
182 |
</at> |
|
183 |
<at name="properties"> |
|
184 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
185 |
<at name="classname">com.jeta.forms.gui.form.GridView</at> |
|
186 |
<at name="properties"> |
|
187 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
188 |
<at name="border"> |
|
189 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
190 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
191 |
<at name="name">border</at> |
|
192 |
</super> |
|
193 |
<at name="borders"> |
|
194 |
<object classname="java.util.LinkedList"/> |
|
195 |
</at> |
|
196 |
</object> |
|
197 |
</at> |
|
198 |
<at name="name"/> |
|
199 |
<at name="fill"> |
|
200 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
201 |
<at name="name">fill</at> |
|
202 |
</object> |
|
203 |
</at> |
|
204 |
<at name="scollBars"> |
|
205 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
206 |
<at name="name">scollBars</at> |
|
207 |
<at name="verticalpolicy">21</at> |
|
208 |
<at name="horizontalpolicy">31</at> |
|
209 |
<at name="border"> |
|
210 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
211 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
212 |
<at name="name">border</at> |
|
213 |
</super> |
|
214 |
<at name="borders"> |
|
215 |
<object classname="java.util.LinkedList"> |
|
216 |
<item > |
|
217 |
<at name="value"> |
|
218 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
219 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
220 |
<at name="name">border</at> |
|
221 |
</super> |
|
222 |
</object> |
|
223 |
</at> |
|
224 |
</item> |
|
225 |
</object> |
|
226 |
</at> |
|
227 |
</object> |
|
228 |
</at> |
|
229 |
</object> |
|
230 |
</at> |
|
231 |
</object> |
|
232 |
</at> |
|
233 |
</object> |
|
234 |
</at> |
|
235 |
<at name="cellpainters"> |
|
236 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
237 |
<at name="rows"> |
|
238 |
<object classname="[Ljava.lang.Object;" size="5"> |
|
239 |
<at name="item" index="0"> |
|
240 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
241 |
</at> |
|
242 |
<at name="item" index="1"> |
|
243 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
244 |
</at> |
|
245 |
<at name="item" index="2"> |
|
246 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
247 |
</at> |
|
248 |
<at name="item" index="3"> |
|
249 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
250 |
</at> |
|
251 |
<at name="item" index="4"> |
|
252 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
253 |
</at> |
|
254 |
</object> |
|
255 |
</at> |
|
256 |
</object> |
|
257 |
</at> |
|
258 |
<at name="rowgroups"> |
|
259 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
260 |
<at name="groups"> |
|
261 |
<object classname="java.util.HashMap"/> |
|
262 |
</at> |
|
263 |
</object> |
|
264 |
</at> |
|
265 |
<at name="colgroups"> |
|
266 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
267 |
<at name="groups"> |
|
268 |
<object classname="java.util.HashMap"/> |
|
269 |
</at> |
|
270 |
</object> |
|
271 |
</at> |
|
272 |
</object> |
|
273 |
</at> |
|
274 |
</object> |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/dialogremember/DialogRememberView.java | ||
---|---|---|
1 |
package org.gvsig.app.gui.preferencespage.dialogremember; |
|
2 |
|
|
3 |
import com.jeta.open.i18n.I18NUtils; |
|
4 |
import com.jgoodies.forms.layout.CellConstraints; |
|
5 |
import com.jgoodies.forms.layout.FormLayout; |
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.ComponentOrientation; |
|
8 |
import java.awt.Container; |
|
9 |
import java.awt.Dimension; |
|
10 |
import javax.swing.Box; |
|
11 |
import javax.swing.ImageIcon; |
|
12 |
import javax.swing.JFrame; |
|
13 |
import javax.swing.JLabel; |
|
14 |
import javax.swing.JList; |
|
15 |
import javax.swing.JPanel; |
|
16 |
import javax.swing.JScrollPane; |
|
17 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
18 |
|
|
19 |
|
|
20 |
public abstract class DialogRememberView extends AbstractPreferencePage |
|
21 |
{ |
|
22 |
JList lstRemembers = new JList(); |
|
23 |
JLabel lblTitle = new JLabel(); |
|
24 |
|
|
25 |
/** |
|
26 |
* Default constructor |
|
27 |
*/ |
|
28 |
public DialogRememberView() |
|
29 |
{ |
|
30 |
initializePanel(); |
|
31 |
} |
|
32 |
|
|
33 |
/** |
|
34 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
35 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
36 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
37 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
38 |
*/ |
|
39 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
40 |
{ |
|
41 |
Dimension filler = new Dimension(10,10); |
|
42 |
|
|
43 |
boolean filled_cell_11 = false; |
|
44 |
CellConstraints cc = new CellConstraints(); |
|
45 |
if ( cols.length > 0 && rows.length > 0 ) |
|
46 |
{ |
|
47 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
48 |
{ |
|
49 |
/** add a rigid area */ |
|
50 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
51 |
filled_cell_11 = true; |
|
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
for( int index = 0; index < cols.length; index++ ) |
|
56 |
{ |
|
57 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
58 |
{ |
|
59 |
continue; |
|
60 |
} |
|
61 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
62 |
} |
|
63 |
|
|
64 |
for( int index = 0; index < rows.length; index++ ) |
|
65 |
{ |
|
66 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
67 |
{ |
|
68 |
continue; |
|
69 |
} |
|
70 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
71 |
} |
|
72 |
|
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Helper method to load an image file from the CLASSPATH |
|
77 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
78 |
* @return an ImageIcon instance with the specified image file |
|
79 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
80 |
*/ |
|
81 |
public ImageIcon loadImage( String imageName ) |
|
82 |
{ |
|
83 |
try |
|
84 |
{ |
|
85 |
ClassLoader classloader = getClass().getClassLoader(); |
|
86 |
java.net.URL url = classloader.getResource( imageName ); |
|
87 |
if ( url != null ) |
|
88 |
{ |
|
89 |
ImageIcon icon = new ImageIcon( url ); |
|
90 |
return icon; |
|
91 |
} |
|
92 |
} |
|
93 |
catch( Exception e ) |
|
94 |
{ |
|
95 |
e.printStackTrace(); |
|
96 |
} |
|
97 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Method for recalculating the component orientation for |
|
102 |
* right-to-left Locales. |
|
103 |
* @param orientation the component orientation to be applied |
|
104 |
*/ |
|
105 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
106 |
{ |
|
107 |
// Not yet implemented... |
|
108 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
109 |
super.applyComponentOrientation(orientation); |
|
110 |
} |
|
111 |
|
|
112 |
public JPanel createPanel() |
|
113 |
{ |
|
114 |
JPanel jpanel1 = new JPanel(); |
|
115 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:2DLU:NONE"); |
|
116 |
CellConstraints cc = new CellConstraints(); |
|
117 |
jpanel1.setLayout(formlayout1); |
|
118 |
|
|
119 |
lstRemembers.setName("lstRemembers"); |
|
120 |
JScrollPane jscrollpane1 = new JScrollPane(); |
|
121 |
jscrollpane1.setViewportView(lstRemembers); |
|
122 |
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
123 |
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
124 |
jpanel1.add(jscrollpane1,cc.xy(2,4)); |
|
125 |
|
|
126 |
lblTitle.setName("lblTitle"); |
|
127 |
lblTitle.setText("_Remember_responses_from_selected_dialogs"); |
|
128 |
jpanel1.add(lblTitle,cc.xy(2,2)); |
|
129 |
|
|
130 |
addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,2,3,4,5 }); |
|
131 |
return jpanel1; |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* Initializer |
|
136 |
*/ |
|
137 |
protected void initializePanel() |
|
138 |
{ |
|
139 |
setLayout(new BorderLayout()); |
|
140 |
add(createPanel(), BorderLayout.CENTER); |
|
141 |
} |
|
142 |
|
|
143 |
|
|
144 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/dialogremember/DialogRememberPage.java | ||
---|---|---|
1 |
package org.gvsig.app.gui.preferencespage.dialogremember; |
|
2 |
|
|
3 |
import javax.swing.DefaultListModel; |
|
4 |
import javax.swing.ImageIcon; |
|
5 |
import javax.swing.JPanel; |
|
6 |
import javax.swing.ListSelectionModel; |
|
7 |
import javax.swing.event.ListSelectionEvent; |
|
8 |
import javax.swing.event.ListSelectionListener; |
|
9 |
import org.gvsig.andami.IconThemeHelper; |
|
10 |
import org.gvsig.andami.PluginsLocator; |
|
11 |
import org.gvsig.andami.preferences.IPreference; |
|
12 |
import org.gvsig.andami.preferences.StoreException; |
|
13 |
import org.gvsig.dialogremember.DialogRememberManager; |
|
14 |
import org.gvsig.dialogremember.DialogRememeber; |
|
15 |
import org.gvsig.tools.ToolsLocator; |
|
16 |
import org.gvsig.tools.i18n.I18nManager; |
|
17 |
import org.gvsig.tools.swing.api.JListWithCheckbox; |
|
18 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
19 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
|
20 |
|
|
21 |
public class DialogRememberPage extends DialogRememberView implements IPreference { |
|
22 |
// |
|
23 |
// The class DialogRememberView can extend from AbstractPreferencePage, not JPanel, |
|
24 |
// if rereate it from the GUI builder change te class declaration to: |
|
25 |
// public abstract class DialogRememberView extends AbstractPreferencePage |
|
26 |
|
|
27 |
private JListWithCheckbox lstCheckdsRemembers; |
|
28 |
|
|
29 |
public static String id = DialogRememberPage.class.getName(); |
|
30 |
private ImageIcon icon; |
|
31 |
|
|
32 |
private static class ListElement<T> { |
|
33 |
private final String label; |
|
34 |
private final T value; |
|
35 |
|
|
36 |
public ListElement(String label, T value) { |
|
37 |
this.label = label; |
|
38 |
this.value = value; |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public String toString() { |
|
43 |
return this.label; |
|
44 |
} |
|
45 |
|
|
46 |
public T getValue() { |
|
47 |
return this.value; |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
public DialogRememberPage() { |
|
52 |
//setParentID(GeneralPage.class.getName()); |
|
53 |
initComponents(); |
|
54 |
} |
|
55 |
|
|
56 |
private void initComponents() { |
|
57 |
icon = IconThemeHelper.getImageIcon("dialog-remember-preferences"); |
|
58 |
ToolsSwingManager swingManager = ToolsSwingLocator.getToolsSwingManager(); |
|
59 |
this.lstCheckdsRemembers = swingManager.createJListWithCheckbox(this.lstRemembers); |
|
60 |
final ListSelectionModel checkModel = this.lstCheckdsRemembers.getCheckedModel(); |
|
61 |
checkModel.addListSelectionListener(new ListSelectionListener() { |
|
62 |
|
|
63 |
@Override |
|
64 |
public void valueChanged(ListSelectionEvent e) { |
|
65 |
if( e.getValueIsAdjusting() ) { |
|
66 |
return; |
|
67 |
} |
|
68 |
int n = e.getFirstIndex(); |
|
69 |
if( n<0 ) { |
|
70 |
return; |
|
71 |
} |
|
72 |
ListElement<DialogRememeber> element = (ListElement) lstCheckdsRemembers.getModel().getElementAt(n); |
|
73 |
if( element==null ) { |
|
74 |
return; |
|
75 |
} |
|
76 |
if( checkModel.isSelectedIndex(n) && !element.getValue().hasValue() ) { |
|
77 |
checkModel.removeIndexInterval(n, n); |
|
78 |
} |
|
79 |
} |
|
80 |
}); |
|
81 |
translateAll(); |
|
82 |
} |
|
83 |
|
|
84 |
private void translateAll() { |
|
85 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
86 |
|
|
87 |
this.lblTitle.setText(i18n.getTranslation(this.lblTitle.getText())); |
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
public boolean isResizeable() { |
|
92 |
return true; |
|
93 |
} |
|
94 |
|
|
95 |
@Override |
|
96 |
public void initializeValues() { |
|
97 |
DialogRememberManager remembers = PluginsLocator.getDialogRemembereManager(); |
|
98 |
|
|
99 |
DefaultListModel model = new DefaultListModel(); |
|
100 |
ListSelectionModel checkModel = this.lstCheckdsRemembers.getCheckedModel(); |
|
101 |
checkModel.clearSelection(); |
|
102 |
int n=0; |
|
103 |
for(DialogRememeber remember : remembers.remembers() ) { |
|
104 |
model.addElement(new ListElement<>(remember.getId(), remember)); |
|
105 |
if( remember.hasValue() ) { |
|
106 |
checkModel.addSelectionInterval(n, n); |
|
107 |
} |
|
108 |
n++; |
|
109 |
} |
|
110 |
this.lstCheckdsRemembers.setModel(model); |
|
111 |
} |
|
112 |
|
|
113 |
@Override |
|
114 |
public void initializeDefaults() { |
|
115 |
DialogRememberManager remembers = PluginsLocator.getDialogRemembereManager(); |
|
116 |
|
|
117 |
DefaultListModel model = new DefaultListModel(); |
|
118 |
ListSelectionModel checkModel = this.lstCheckdsRemembers.getCheckedModel(); |
|
119 |
for(DialogRememeber remember : remembers.remembers() ) { |
|
120 |
model.addElement(new ListElement<>(remember.getId(), remember)); |
|
121 |
} |
|
122 |
this.lstCheckdsRemembers.setModel(model); |
|
123 |
checkModel.clearSelection(); |
|
124 |
} |
|
125 |
|
|
126 |
@Override |
|
127 |
public String getID() { |
|
128 |
return id; |
|
129 |
} |
|
130 |
|
|
131 |
@Override |
|
132 |
public String getTitle() { |
|
133 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
134 |
return i18nManager.getTranslation("_Remembered_dialogs"); |
|
135 |
} |
|
136 |
|
|
137 |
@Override |
|
138 |
public JPanel getPanel() { |
|
139 |
return this; |
|
140 |
} |
|
141 |
|
|
142 |
|
|
143 |
@Override |
|
144 |
public void storeValues() throws StoreException { |
|
145 |
DialogRememberManager remembers = PluginsLocator.getDialogRemembereManager(); |
|
146 |
|
|
147 |
ListSelectionModel checkModel = this.lstCheckdsRemembers.getCheckedModel(); |
|
148 |
int n=0; |
|
149 |
for(DialogRememeber remember : remembers.remembers() ) { |
|
150 |
if( ! checkModel.isSelectedIndex(n) ) { |
|
151 |
remember.reset(); |
|
152 |
} |
|
153 |
n++; |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
@Override |
|
158 |
public ImageIcon getIcon() { |
|
159 |
return icon; |
|
160 |
} |
|
161 |
|
|
162 |
@Override |
|
163 |
public boolean isValueChanged() { |
|
164 |
DialogRememberManager remembers = PluginsLocator.getDialogRemembereManager(); |
|
165 |
|
|
166 |
ListSelectionModel checkModel = this.lstCheckdsRemembers.getCheckedModel(); |
|
167 |
int n=0; |
|
168 |
for(DialogRememeber remember : remembers.remembers() ) { |
|
169 |
if( checkModel.isSelectedIndex(n) != remember.hasValue() ) { |
|
170 |
return true; |
|
171 |
} |
|
172 |
n++; |
|
173 |
} |
|
174 |
return false; |
|
175 |
} |
|
176 |
|
|
177 |
@Override |
|
178 |
public void setChangesApplied() { |
|
179 |
// Do nothing |
|
180 |
} |
|
181 |
|
|
182 |
|
|
183 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/imp/DefaultApplicationManager.java | ||
---|---|---|
443 | 443 |
main.messageDialog(message, messageArgs, title, messageType); |
444 | 444 |
} |
445 | 445 |
|
446 |
@Override |
|
447 |
public void messageDialog(String message, String[] messageArgs, String title, int messageType, String msgid) { |
|
448 |
MainFrame main = PluginServices.getMainFrame(); |
|
449 |
main.messageDialog(message, messageArgs, title, messageType, msgid); |
|
450 |
} |
|
451 |
|
|
452 |
@Override |
|
446 | 453 |
public int confirmDialog(String message, String title, int optionType, |
447 | 454 |
int messageType) { |
448 | 455 |
MainFrame main = PluginServices.getMainFrame(); |
449 | 456 |
return main.confirmDialog(message, title, optionType, messageType); |
450 | 457 |
} |
451 | 458 |
|
459 |
@Override |
|
460 |
public int confirmDialog(String message, String title, int optionType, |
|
461 |
int messageType, String msgid) { |
|
462 |
MainFrame main = PluginServices.getMainFrame(); |
|
463 |
return main.confirmDialog(message, title, optionType, messageType, msgid); |
|
464 |
} |
|
465 |
|
|
452 | 466 |
public String inputDialog(String message, String title, int messageType, |
453 | 467 |
String initialValue) { |
454 | 468 |
MainFrame main = PluginServices.getMainFrame(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewControls.java | ||
---|---|---|
35 | 35 |
import org.gvsig.app.ApplicationLocator; |
36 | 36 |
import org.gvsig.app.ApplicationManager; |
37 | 37 |
import org.gvsig.app.gui.preferencespage.ViewPage; |
38 |
import org.gvsig.app.gui.preferencespage.dialogremember.DialogRememberPage; |
|
38 | 39 |
import org.gvsig.app.project.Project; |
39 | 40 |
import org.gvsig.app.project.ProjectManager; |
40 | 41 |
import org.gvsig.app.project.documents.view.Encuadrator; |
... | ... | |
233 | 234 |
IconThemeHelper.registerIcon("action", "edit-undo-redo-actions-add", this); |
234 | 235 |
IconThemeHelper.registerIcon("action", "edit-undo-redo-actions-delete", this); |
235 | 236 |
|
237 |
IconThemeHelper.registerIcon("preferences", "dialog-remember-preferences", this); |
|
236 | 238 |
} |
237 | 239 |
|
238 | 240 |
public boolean isEnabled() { |
... | ... | |
254 | 256 |
} |
255 | 257 |
|
256 | 258 |
public IPreference[] getPreferencesPages() { |
257 |
IPreference[] preferences = new IPreference[1];
|
|
259 |
IPreference[] preferences = new IPreference[2];
|
|
258 | 260 |
preferences[0] = getViewPropertiesPage(); |
259 |
// GridPage gridPage = new GridPage(); |
|
260 |
// preferences[1] = gridPage; |
|
261 |
preferences[1] = new DialogRememberPage(); |
|
261 | 262 |
return preferences; |
262 | 263 |
} |
263 | 264 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1189 | 1189 |
_upper_right_corner=Upper right corner |
1190 | 1190 |
_lower_right_corner=Lower right corner |
1191 | 1191 |
_lower_left_corner=Lower left corner |
1192 |
_Remembered_dialogs=Remembered dialogs |
|
1193 |
_Remember_responses_from_selected_dialogs=Remember responses from selected dialogs |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1270 | 1270 |
_upper_right_corner=Esquina superior derecha |
1271 | 1271 |
_lower_right_corner=Esquina inferior derecha |
1272 | 1272 |
_lower_left_corner=Esquina inferior izquierda |
1273 |
_Remembered_dialogs=Dialogos recordados |
|
1274 |
_Remember_responses_from_selected_dialogs=Respuestas recordadas para los siguientes dialogos |
Also available in: Unified diff