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 |
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; |
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(); |
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(); |