mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-25 22:18:48 -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 Component parent;
|
||||
private final Point pos;
|
||||
private final ElementAttributes elementAttributes;
|
||||
private final JPanel buttonPanel;
|
||||
private boolean changed = false;
|
||||
|
||||
@ -54,6 +55,7 @@ public class AttributeDialog extends JDialog {
|
||||
super(SwingUtilities.getWindowAncestor(parent), Lang.get("attr_dialogTitle"), ModalityType.APPLICATION_MODAL);
|
||||
this.parent = parent;
|
||||
this.pos = pos;
|
||||
this.elementAttributes = elementAttributes;
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
|
||||
panel = new JPanel(new DialogLayout());
|
||||
@ -72,9 +74,7 @@ public class AttributeDialog extends JDialog {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
setEditedValues(elementAttributes);
|
||||
changed = true;
|
||||
dispose();
|
||||
fireOk();
|
||||
} catch (RuntimeException err) {
|
||||
new ErrorMessage(Lang.get("msg_errorEditingValue")).addCause(err).setComponent(AttributeDialog.this).show();
|
||||
}
|
||||
@ -101,6 +101,15 @@ public class AttributeDialog extends JDialog {
|
||||
setAlwaysOnTop(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the dialog and stores modified values
|
||||
*/
|
||||
public void fireOk() {
|
||||
setEditedValues(elementAttributes);
|
||||
changed = true;
|
||||
dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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")) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getAttributeDialog().dispose();
|
||||
getAttributeDialog().fireOk();
|
||||
TestDataDialog dialog = new TestDataDialog(getAttributeDialog().getDialogParent(), data, key, elementAttributes);
|
||||
Main main = getAttributeDialog().getMain();
|
||||
if (main!=null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user