- Timestamp:
- 2009-12-31T13:13:43+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r2715 r2718 31 31 public class ExtendedDialog extends JDialog { 32 32 private int result = 0; 33 public static final int DialogNotShown = -99;34 33 public static final int DialogClosedOtherwise = 0; 35 34 private boolean toggleable = false; … … 37 36 private WindowGeometry defaultWindowGeometry = null; 38 37 private String togglePref = ""; 38 private int toggleValue = -1; 39 39 private String toggleCheckboxText = tr("Do not show again"); 40 40 private JCheckBox toggleCheckbox = null; … … 169 169 // Check if the user has set the dialog to not be shown again 170 170 if(toggleCheckState(togglePref)) { 171 result = ExtendedDialog.DialogNotShown;171 result = toggleValue; 172 172 return this; 173 173 } … … 185 185 * @return int * The selected button. The count starts with 1. 186 186 * * A return value of ExtendedDialog.DialogClosedOtherwise means the dialog has been closed otherwise. 187 * * A return value of ExtendedDialog.DialogNotShown means the188 * dialog has been toggled off in the past189 187 */ 190 188 public int getValue() { … … 373 371 * Calling this will offer the user a "Do not show again" checkbox for the 374 372 * dialog. Default is to not offer the choice; the dialog will be shown 375 * every time. If the dialog is not shown due to the previous choice of the 376 * user, the result <code>ExtendedDialog.DialogNotShown</code> is returned 373 * every time. 377 374 * @param togglePref The preference to save the checkbox state to 378 375 */ … … 428 425 toggleable = togglePref != null && !togglePref.equals(""); 429 426 427 toggleValue = Main.pref.getInteger("message."+togglePref+".value", -1); 430 428 // No identifier given, so return false (= show the dialog) 431 if(!toggleable) 429 if(!toggleable || toggleValue == -1) 432 430 return false; 433 431 this.togglePref = togglePref; … … 444 442 return; 445 443 Main.pref.put("message."+ togglePref, !toggleCheckbox.isSelected()); 444 Main.pref.putInteger("message."+togglePref+".value", result); 446 445 } 447 446
Note:
See TracChangeset
for help on using the changeset viewer.