X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fconfigdialog%2FComponentConfigDialog.java;h=5bb3448bc5f8d0f698bc5b2925d2c28ec107ea46;hb=bae4608a5d01ff84ac6d020c0c47931d2e243250;hp=a04c65b61cb4f63e8c31ca89ef32cc1c75c91a62;hpb=2c2648eecec15b853ff80ad040bd98f3ebde645b;p=debian%2Fopenrocket diff --git a/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java b/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java index a04c65b6..5bb3448b 100644 --- a/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java +++ b/src/net/sf/openrocket/gui/configdialog/ComponentConfigDialog.java @@ -1,10 +1,7 @@ package net.sf.openrocket.gui.configdialog; -import java.awt.Point; import java.awt.Window; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -18,7 +15,6 @@ import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.GUIUtil; -import net.sf.openrocket.util.Prefs; import net.sf.openrocket.util.Reflection; /** @@ -44,7 +40,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis private final Window parent; private static final Translator trans = Application.getTranslator(); - + private ComponentConfigDialog(Window parent, OpenRocketDocument document, RocketComponent component) { super(parent); @@ -53,22 +49,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis setComponent(document, component); GUIUtil.setDisposableDialogOptions(this, null); - - // Set window position according to preferences, and set prefs when moving - Point position = Prefs.getWindowPosition(this.getClass()); - if (position != null) { - this.setLocationByPlatform(false); - this.setLocation(position); - } - - this.addComponentListener(new ComponentAdapter() { - @Override - public void componentMoved(ComponentEvent e) { - Prefs.setWindowPosition(ComponentConfigDialog.this.getClass(), - ComponentConfigDialog.this.getLocation()); - } - }); - + GUIUtil.rememberWindowPosition(this); } @@ -99,9 +80,6 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis //// configuration setTitle(trans.get("ComponentCfgDlg.configuration1") + " " + component.getComponentName() + " " + trans.get("ComponentCfgDlg.configuration")); - // Dimension pref = getPreferredSize(); - // Dimension real = getSize(); - // if (pref.width > real.width || pref.height > real.height) this.pack(); } @@ -113,7 +91,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis findDialogContentsConstructor(component); if (c != null) { try { - return c.newInstance(component); + return c.newInstance(document, component); } catch (InstantiationException e) { throw new BugException("BUG in constructor reflection", e); } catch (IllegalAccessException e) { @@ -181,7 +159,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis try { configclass = Class.forName(configclassname); c = (Constructor) - configclass.getConstructor(RocketComponent.class); + configclass.getConstructor(OpenRocketDocument.class, RocketComponent.class); return c; } catch (Exception ignore) { } @@ -231,27 +209,6 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis } - /** - * Add an undo position for the current document. This is intended for use only - * by the currently open dialog. - * - * @param description Description of the undoable action - */ - /*package*/static void addUndoPosition(String description) { - if (dialog == null) { - throw new IllegalStateException("Dialog not open, report bug!"); - } - dialog.document.addUndoPosition(description); - } - - /*package*/ - static String getUndoDescription() { - if (dialog == null) { - throw new IllegalStateException("Dialog not open, report bug!"); - } - return dialog.document.getUndoDescription(); - } - /** * Returns whether the singleton configuration dialog is currently visible or not. */