/[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

branches/1.0-gt2-2.6/src/skrueger/swing/CancellableDialogAdapter.java revision 497 by alfonx, Fri Oct 23 18:43:58 2009 UTC trunk/src/skrueger/swing/CancellableDialogAdapter.java revision 863 by alfonx, Sun May 23 13:42:13 2010 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.awt.event.ActionEvent;
6  import java.util.Locale;  import java.util.Locale;
7    
8    import javax.swing.AbstractAction;
9  import javax.swing.JDialog;  import javax.swing.JDialog;
10  import javax.swing.JOptionPane;  import javax.swing.JOptionPane;
11    
 import schmitzm.geotools.gui.GeotoolsGUIUtil;  
12  import schmitzm.lang.LangUtil;  import schmitzm.lang.LangUtil;
13  import schmitzm.lang.ResourceProvider;  import schmitzm.lang.ResourceProvider;
14    import schmitzm.swing.SwingUtil;
15    
16  /**  /**
17   * An abstract {@link JDialog} that implements a basic structure of how   * An abstract {@link JDialog} that implements a basic structure of how
# Line 22  import schmitzm.lang.ResourceProvider; Line 24  import schmitzm.lang.ResourceProvider;
24  public abstract class CancellableDialogAdapter extends AtlasDialog implements  public abstract class CancellableDialogAdapter extends AtlasDialog implements
25                  CancellableDialog {                  CancellableDialog {
26                    
   
27          protected static ResourceProvider RESOURCE = new ResourceProvider(LangUtil          protected static ResourceProvider RESOURCE = new ResourceProvider(LangUtil
28                          .extendPackagePath(GeotoolsGUIUtil.class,                          .extendPackagePath(SwingUtil.class,
29                                          "resource.locales.GTResourceBundle"), Locale.ENGLISH);                                          "resource.locales.SwingResourceBundle"), Locale.ENGLISH);
30    
31    
32          /** Has this dialog been canceled ?**/          /** Has this dialog been canceled ?**/
33          protected boolean cancelled = false;          protected boolean cancelled = false;
34    
35            private OkButton okButton;
36            
37            private CancelButton cancelButton;
38                    
39          public CancellableDialogAdapter(Component parentWindow) {          public CancellableDialogAdapter(Component parentWindow) {
40                  super(parentWindow);                  super(parentWindow);
# Line 90  public abstract class CancellableDialogA Line 96  public abstract class CancellableDialogA
96          @Override          @Override
97          public void cancelClose() {          public void cancelClose() {
98                  cancel();                  cancel();
99                    cancelled = true;
100                  dispose();                  dispose();
101          }          }
102    
# Line 107  public abstract class CancellableDialogA Line 114  public abstract class CancellableDialogA
114                  dispose();                  dispose();
115                  return true;                  return true;
116          }          }
117    
118            /**
119             * @return a default OkButton that will call {@link #okClose()}
120             */
121            protected OkButton getOkButton() {
122                    if (okButton == null) {
123                            okButton = new OkButton(new AbstractAction() {
124                                    
125                                    @Override
126                                    public void actionPerformed(ActionEvent e) {
127                                            okClose();
128                                    }
129                            });
130                    }
131                    return okButton;
132            }
133                    
134    
135            /**
136             * @return a default CancelButton that will call {@link #cancelClose()}
137             */
138            protected CancelButton getCancelButton() {
139                    if (cancelButton == null) {
140                            cancelButton = new CancelButton(new AbstractAction() {
141                                    
142                                    @Override
143                                    public void actionPerformed(ActionEvent e) {
144                                            cancelClose();
145                                    }
146                            });
147                    }
148                    return cancelButton;
149            }
150    
151  }  }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26