Don't remember previous tab for stages
This commit is contained in:
parent
13fa275ff9
commit
d398d48d55
@ -14,6 +14,7 @@ import net.sf.openrocket.document.OpenRocketDocument;
|
|||||||
import net.sf.openrocket.gui.util.GUIUtil;
|
import net.sf.openrocket.gui.util.GUIUtil;
|
||||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
|
import net.sf.openrocket.rocketcomponent.AxialStage;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
|
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
@ -38,7 +39,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
private static ComponentConfigDialog dialog = null;
|
private static ComponentConfigDialog dialog = null;
|
||||||
|
|
||||||
private OpenRocketDocument document = null;
|
private OpenRocketDocument document = null;
|
||||||
protected static RocketComponent component = null;
|
protected RocketComponent component = null;
|
||||||
private RocketComponentConfig configurator = null;
|
private RocketComponentConfig configurator = null;
|
||||||
protected static boolean clearConfigListeners = true;
|
protected static boolean clearConfigListeners = true;
|
||||||
private static String previousSelectedTab = null; // Name of the previous selected tab
|
private static String previousSelectedTab = null; // Name of the previous selected tab
|
||||||
@ -119,6 +120,10 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
this.pack();
|
this.pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RocketComponent getComponent() {
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
public static ComponentConfigDialog getDialog() {
|
public static ComponentConfigDialog getDialog() {
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
@ -221,10 +226,16 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
*/
|
*/
|
||||||
public static void showDialog(Window parent, OpenRocketDocument document, RocketComponent component, boolean rememberPreviousTab) {
|
public static void showDialog(Window parent, OpenRocketDocument document, RocketComponent component, boolean rememberPreviousTab) {
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
|
// Don't remember the previous tab for stages, because this will leave you in the override tab for
|
||||||
|
// the next component, which is generally not what you want.
|
||||||
|
if (dialog.getComponent() instanceof AxialStage && !(component instanceof AxialStage)) {
|
||||||
|
previousSelectedTab = null;
|
||||||
|
} else {
|
||||||
previousSelectedTab = dialog.getSelectedTabName();
|
previousSelectedTab = dialog.getSelectedTabName();
|
||||||
|
}
|
||||||
// If the component is the same as the ComponentConfigDialog component, and the dialog is still visible,
|
// If the component is the same as the ComponentConfigDialog component, and the dialog is still visible,
|
||||||
// that means that the user did a ctr/cmd click on a new component => don't remove the config listeners of component
|
// that means that the user did a ctr/cmd click on a new component => don't remove the config listeners of component
|
||||||
if (component.equals(ComponentConfigDialog.component)) {
|
if (component == dialog.getComponent()) {
|
||||||
ComponentConfigDialog.clearConfigListeners = false;
|
ComponentConfigDialog.clearConfigListeners = false;
|
||||||
}
|
}
|
||||||
dialog.dispose();
|
dialog.dispose();
|
||||||
@ -281,6 +292,10 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
return (dialog != null) && (dialog.isVisible());
|
return (dialog != null) && (dialog.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSelectedTabIndex() {
|
||||||
|
return configurator.getSelectedTabIndex();
|
||||||
|
}
|
||||||
|
|
||||||
public String getSelectedTabName() {
|
public String getSelectedTabName() {
|
||||||
if (configurator != null) {
|
if (configurator != null) {
|
||||||
return configurator.getSelectedTabName();
|
return configurator.getSelectedTabName();
|
||||||
|
@ -317,6 +317,10 @@ public class RocketComponentConfig extends JPanel {
|
|||||||
return subPanel;
|
return subPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSelectedTabIndex() {
|
||||||
|
return tabbedPane.getSelectedIndex();
|
||||||
|
}
|
||||||
|
|
||||||
public String getSelectedTabName() {
|
public String getSelectedTabName() {
|
||||||
if (tabbedPane != null) {
|
if (tabbedPane != null) {
|
||||||
return tabbedPane.getTitleAt(tabbedPane.getSelectedIndex());
|
return tabbedPane.getTitleAt(tabbedPane.getSelectedIndex());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user