[fixes #358] Dispose of ComponentConfigDialog instead of hiding it
This is to ensure proper invalidation of the previous dialog. Just setting the dialog invisible would cause problems with configListeners not invalidating.
This commit is contained in:
parent
9a77baf643
commit
9324d2a7ed
@ -142,7 +142,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
if (e.isTreeChange() || e.isUndoChange()) {
|
if (e.isTreeChange() || e.isUndoChange()) {
|
||||||
|
|
||||||
// Hide dialog in case of tree or undo change
|
// Hide dialog in case of tree or undo change
|
||||||
hideDialog();
|
disposeDialog();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -241,11 +241,11 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the configuration dialog. May be used even if not currently visible.
|
* Disposes the configuration dialog. May be used even if not currently visible.
|
||||||
*/
|
*/
|
||||||
public static void hideDialog() {
|
public static void disposeDialog() {
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
dialog.setVisible(false);
|
dialog.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,13 +30,11 @@ import net.sf.openrocket.l10n.Translator;
|
|||||||
import net.sf.openrocket.logging.Markers;
|
import net.sf.openrocket.logging.Markers;
|
||||||
import net.sf.openrocket.material.Material;
|
import net.sf.openrocket.material.Material;
|
||||||
import net.sf.openrocket.rocketcomponent.CenteringRing;
|
import net.sf.openrocket.rocketcomponent.CenteringRing;
|
||||||
import net.sf.openrocket.rocketcomponent.Coaxial;
|
|
||||||
import net.sf.openrocket.rocketcomponent.FinSet;
|
import net.sf.openrocket.rocketcomponent.FinSet;
|
||||||
import net.sf.openrocket.rocketcomponent.FreeformFinSet;
|
import net.sf.openrocket.rocketcomponent.FreeformFinSet;
|
||||||
import net.sf.openrocket.rocketcomponent.InnerTube;
|
import net.sf.openrocket.rocketcomponent.InnerTube;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
import net.sf.openrocket.rocketcomponent.SymmetricComponent;
|
import net.sf.openrocket.rocketcomponent.SymmetricComponent;
|
||||||
import net.sf.openrocket.rocketcomponent.Transition;
|
|
||||||
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
@ -97,7 +95,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -135,7 +133,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
split.setEnabled(((FinSet) component).getFinCount() > 1);
|
split.setEnabled(((FinSet) component).getFinCount() > 1);
|
||||||
|
@ -142,7 +142,7 @@ public class RocketComponentConfig extends JPanel {
|
|||||||
closeButton.addActionListener(new ActionListener() {
|
closeButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
buttonPanel.add(closeButton, "right, gap 30lp");
|
buttonPanel.add(closeButton, "right, gap 30lp");
|
||||||
|
@ -1582,7 +1582,7 @@ public class BasicFrame extends JFrame {
|
|||||||
private boolean closeAction() {
|
private boolean closeAction() {
|
||||||
if (!document.isSaved()) {
|
if (!document.isSaved()) {
|
||||||
log.info("Confirming whether to save the design");
|
log.info("Confirming whether to save the design");
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
int result = JOptionPane.showConfirmDialog(this,
|
int result = JOptionPane.showConfirmDialog(this,
|
||||||
trans.get("BasicFrame.dlg.lbl1") + rocket.getName() +
|
trans.get("BasicFrame.dlg.lbl1") + rocket.getName() +
|
||||||
trans.get("BasicFrame.dlg.lbl2") + " " +
|
trans.get("BasicFrame.dlg.lbl2") + " " +
|
||||||
@ -1610,7 +1610,7 @@ public class BasicFrame extends JFrame {
|
|||||||
log.debug("Disposing window");
|
log.debug("Disposing window");
|
||||||
this.dispose();
|
this.dispose();
|
||||||
|
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
ComponentAnalysisDialog.hideDialog();
|
ComponentAnalysisDialog.hideDialog();
|
||||||
|
|
||||||
frames.remove(this);
|
frames.remove(this);
|
||||||
|
@ -475,7 +475,7 @@ public class RocketActions {
|
|||||||
|
|
||||||
private void deleteComponent(RocketComponent component) {
|
private void deleteComponent(RocketComponent component) {
|
||||||
if (isDeletable(component)) {
|
if (isDeletable(component)) {
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
component.getRocket().removeComponentChangeListener(ComponentConfigDialog.getDialog());
|
component.getRocket().removeComponentChangeListener(ComponentConfigDialog.getDialog());
|
||||||
@ -596,7 +596,7 @@ public class RocketActions {
|
|||||||
Simulation[] sims = selectionModel.getSelectedSimulations();
|
Simulation[] sims = selectionModel.getSelectedSimulations();
|
||||||
|
|
||||||
if (isDeletable(components) && isCopyable(components)) {
|
if (isDeletable(components) && isCopyable(components)) {
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
|
|
||||||
if (components.size() == 1) {
|
if (components.size() == 1) {
|
||||||
document.addUndoPosition("Cut " + components.get(0).getComponentName());
|
document.addUndoPosition("Cut " + components.get(0).getComponentName());
|
||||||
@ -712,7 +712,7 @@ public class RocketActions {
|
|||||||
Simulation[] sims = OpenRocketClipboard.getClipboardSimulations();
|
Simulation[] sims = OpenRocketClipboard.getClipboardSimulations();
|
||||||
|
|
||||||
if (components.size() > 0) {
|
if (components.size() > 0) {
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
|
|
||||||
List<RocketComponent> pasted = new LinkedList<>();
|
List<RocketComponent> pasted = new LinkedList<>();
|
||||||
for (RocketComponent component : components) {
|
for (RocketComponent component : components) {
|
||||||
@ -850,7 +850,7 @@ public class RocketActions {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
|
|
||||||
RocketComponent stage = new AxialStage();
|
RocketComponent stage = new AxialStage();
|
||||||
|
|
||||||
@ -913,7 +913,7 @@ public class RocketActions {
|
|||||||
if (!canMove(component))
|
if (!canMove(component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
|
|
||||||
RocketComponent parent = component.getParent();
|
RocketComponent parent = component.getParent();
|
||||||
parent.moveChild(component, parent.getChildPosition(component) - 1);
|
parent.moveChild(component, parent.getChildPosition(component) - 1);
|
||||||
@ -988,7 +988,7 @@ public class RocketActions {
|
|||||||
if (!canMove(component))
|
if (!canMove(component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ComponentConfigDialog.hideDialog();
|
ComponentConfigDialog.disposeDialog();
|
||||||
|
|
||||||
RocketComponent parent = component.getParent();
|
RocketComponent parent = component.getParent();
|
||||||
parent.moveChild(component, parent.getChildPosition(component) + 1);
|
parent.moveChild(component, parent.getChildPosition(component) + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user