mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-27 15:03:21 -04:00
fixed loss of values if test data dialog is opened in detached mode.
This commit is contained in:
parent
4f3154958f
commit
aaa1409908
@ -28,6 +28,7 @@ public class AttributeDialog extends JDialog {
|
|||||||
private final JPanel panel;
|
private final JPanel panel;
|
||||||
private final Component parent;
|
private final Component parent;
|
||||||
private final Point pos;
|
private final Point pos;
|
||||||
|
private final ElementAttributes elementAttributes;
|
||||||
private final JPanel buttonPanel;
|
private final JPanel buttonPanel;
|
||||||
private boolean changed = false;
|
private boolean changed = false;
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ public class AttributeDialog extends JDialog {
|
|||||||
super(SwingUtilities.getWindowAncestor(parent), Lang.get("attr_dialogTitle"), ModalityType.APPLICATION_MODAL);
|
super(SwingUtilities.getWindowAncestor(parent), Lang.get("attr_dialogTitle"), ModalityType.APPLICATION_MODAL);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
|
this.elementAttributes = elementAttributes;
|
||||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
panel = new JPanel(new DialogLayout());
|
panel = new JPanel(new DialogLayout());
|
||||||
@ -72,9 +74,7 @@ public class AttributeDialog extends JDialog {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
setEditedValues(elementAttributes);
|
fireOk();
|
||||||
changed = true;
|
|
||||||
dispose();
|
|
||||||
} catch (RuntimeException err) {
|
} catch (RuntimeException err) {
|
||||||
new ErrorMessage(Lang.get("msg_errorEditingValue")).addCause(err).setComponent(AttributeDialog.this).show();
|
new ErrorMessage(Lang.get("msg_errorEditingValue")).addCause(err).setComponent(AttributeDialog.this).show();
|
||||||
}
|
}
|
||||||
@ -101,6 +101,15 @@ public class AttributeDialog extends JDialog {
|
|||||||
setAlwaysOnTop(true);
|
setAlwaysOnTop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the dialog and stores modified values
|
||||||
|
*/
|
||||||
|
public void fireOk() {
|
||||||
|
setEditedValues(elementAttributes);
|
||||||
|
changed = true;
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a button to this dialog
|
* Adds a button to this dialog
|
||||||
*
|
*
|
||||||
|
@ -50,7 +50,7 @@ public class TestDataEditor extends EditorFactory.LabelEditor<TestData> {
|
|||||||
panel.add(new ToolTipAction(Lang.get("btn_editDetached")) {
|
panel.add(new ToolTipAction(Lang.get("btn_editDetached")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
getAttributeDialog().dispose();
|
getAttributeDialog().fireOk();
|
||||||
TestDataDialog dialog = new TestDataDialog(getAttributeDialog().getDialogParent(), data, key, elementAttributes);
|
TestDataDialog dialog = new TestDataDialog(getAttributeDialog().getDialogParent(), data, key, elementAttributes);
|
||||||
Main main = getAttributeDialog().getMain();
|
Main main = getAttributeDialog().getMain();
|
||||||
if (main!=null)
|
if (main!=null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user