/[schmitzm]/trunk/src/skrueger/swing/CancellableDialogAdapter.java
ViewVC logotype

Diff of /trunk/src/skrueger/swing/CancellableDialogAdapter.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 496 by alfonx, Tue Oct 13 09:22:23 2009 UTC revision 497 by alfonx, Fri Oct 23 18:43:58 2009 UTC
# Line 2  package skrueger.swing; Line 2  package skrueger.swing;
2    
3  import java.awt.Component;  import java.awt.Component;
4  import java.awt.Dialog;  import java.awt.Dialog;
5    import java.util.Locale;
6    
7  import javax.swing.JDialog;  import javax.swing.JDialog;
8  import javax.swing.JOptionPane;  import javax.swing.JOptionPane;
9    
10    import schmitzm.geotools.gui.GeotoolsGUIUtil;
11    import schmitzm.lang.LangUtil;
12    import schmitzm.lang.ResourceProvider;
13    
14  /**  /**
15   * An abstract {@link JDialog} that implements a basic structure of how   * An abstract {@link JDialog} that implements a basic structure of how
16   * cancellable {@link JDialog}s work. The {@link JDialog} is designed to work on   * cancellable {@link JDialog}s work. The {@link JDialog} is designed to work on
# Line 16  import javax.swing.JOptionPane; Line 21  import javax.swing.JOptionPane;
21   */   */
22  public abstract class CancellableDialogAdapter extends AtlasDialog implements  public abstract class CancellableDialogAdapter extends AtlasDialog implements
23                  CancellableDialog {                  CancellableDialog {
24            
25    
26            protected static ResourceProvider RESOURCE = new ResourceProvider(LangUtil
27                            .extendPackagePath(GeotoolsGUIUtil.class,
28                                            "resource.locales.GTResourceBundle"), Locale.ENGLISH);
29    
30          /** Has this dialog been canceled ?**/          /** Has this dialog been canceled ?**/
31          protected boolean cancelled = false;          protected boolean cancelled = false;
# Line 39  public abstract class CancellableDialogA Line 49  public abstract class CancellableDialogA
49           */           */
50          public boolean close() {          public boolean close() {
51                  int showConfirmDialog = JOptionPane.showConfirmDialog(                  int showConfirmDialog = JOptionPane.showConfirmDialog(
52                                  CancellableDialogAdapter.this, "Speichern?",                                  CancellableDialogAdapter.this,
53                                  "Ă„nderungen speichern?", JOptionPane.YES_NO_CANCEL_OPTION); // i8n                                  RESOURCE.getString("CancellableDialogAdapter.close.save.msg",getTitle()), RESOURCE.getString("CancellableDialogAdapter.close.save.title"), JOptionPane.YES_NO_CANCEL_OPTION);
54    
55                  if (showConfirmDialog == JOptionPane.YES_OPTION) {                  if (showConfirmDialog == JOptionPane.YES_OPTION) {
56                          return okClose();                          return okClose();
# Line 62  public abstract class CancellableDialogA Line 72  public abstract class CancellableDialogA
72          public void forceClose() {          public void forceClose() {
73    
74                  int res = JOptionPane.showConfirmDialog(                  int res = JOptionPane.showConfirmDialog(
75                                  CancellableDialogAdapter.this, "Speichern?",                                  CancellableDialogAdapter.this,
76                                  "Der Dialog muss nu gesclossen werden. Ă„nderungen speichern?", JOptionPane.YES_NO_OPTION); // i8n                                  RESOURCE.getString("CancellableDialogAdapter.forceClose.save.msg",getTitle()), RESOURCE.getString("CancellableDialogAdapter.close.save.title"), JOptionPane.YES_NO_OPTION);
77                                    
78                  if (res == JOptionPane.YES_OPTION) {                  if (res == JOptionPane.YES_OPTION) {
79                          okClose();                          okClose();

Legend:
Removed from v.496  
changed lines
  Added in v.497

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26