Enforce register in interface
This commit is contained in:
parent
ac16bc5820
commit
131f26e1c5
@ -65,7 +65,7 @@ import net.sf.openrocket.util.ORColor;
|
|||||||
import net.sf.openrocket.util.StateChangeListener;
|
import net.sf.openrocket.util.StateChangeListener;
|
||||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||||
|
|
||||||
public class AppearancePanel extends JPanel implements Invalidatable {
|
public class AppearancePanel extends JPanel implements Invalidatable, InvalidatingWidget {
|
||||||
private static final long serialVersionUID = 2709187552673202019L;
|
private static final long serialVersionUID = 2709187552673202019L;
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
@ -776,7 +776,8 @@ public class AppearancePanel extends JPanel implements Invalidatable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void register(Invalidatable model) {
|
@Override
|
||||||
|
public void register(Invalidatable model) {
|
||||||
this.invalidatables.add(model);
|
this.invalidatables.add(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Panel for configuring a component's duplication instances.
|
* Panel for configuring a component's duplication instances.
|
||||||
*/
|
*/
|
||||||
public class InstancesPanel extends JPanel implements Invalidatable {
|
public class InstancesPanel extends JPanel implements Invalidatable, InvalidatingWidget {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
private final List<Invalidatable> invalidatables = new ArrayList<>();
|
private final List<Invalidatable> invalidatables = new ArrayList<>();
|
||||||
|
|
||||||
@ -64,7 +64,8 @@ public class InstancesPanel extends JPanel implements Invalidatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void register(Invalidatable model) {
|
@Override
|
||||||
|
public void register(Invalidatable model) {
|
||||||
this.invalidatables.add(model);
|
this.invalidatables.add(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package net.sf.openrocket.gui.configdialog;
|
||||||
|
|
||||||
|
import net.sf.openrocket.util.Invalidatable;
|
||||||
|
|
||||||
|
public interface InvalidatingWidget {
|
||||||
|
/**
|
||||||
|
* Register a model to be invalidated when this widget is invalidated.
|
||||||
|
* @param model the model to register
|
||||||
|
*/
|
||||||
|
void register(Invalidatable model);
|
||||||
|
}
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Panel for configuring a component's material and finish properties.
|
* Panel for configuring a component's material and finish properties.
|
||||||
*/
|
*/
|
||||||
public class MaterialPanel extends JPanel implements Invalidatable {
|
public class MaterialPanel extends JPanel implements Invalidatable, InvalidatingWidget {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
private final List<Invalidatable> invalidatables = new ArrayList<>();
|
private final List<Invalidatable> invalidatables = new ArrayList<>();
|
||||||
|
|
||||||
@ -108,7 +108,8 @@ public class MaterialPanel extends JPanel implements Invalidatable {
|
|||||||
trans.get("MaterialPanel.lbl.ComponentFinish"), "Material", order);
|
trans.get("MaterialPanel.lbl.ComponentFinish"), "Material", order);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void register(Invalidatable model) {
|
@Override
|
||||||
|
public void register(Invalidatable model) {
|
||||||
this.invalidatables.add(model);
|
this.invalidatables.add(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import net.sf.openrocket.startup.Application;
|
|||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
import net.sf.openrocket.util.Invalidatable;
|
import net.sf.openrocket.util.Invalidatable;
|
||||||
|
|
||||||
public class MotorConfig extends JPanel implements Invalidatable {
|
public class MotorConfig extends JPanel implements Invalidatable, InvalidatingWidget {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4974509134239867067L;
|
private static final long serialVersionUID = -4974509134239867067L;
|
||||||
private final MotorMount mount;
|
private final MotorMount mount;
|
||||||
@ -144,7 +144,8 @@ public class MotorConfig extends JPanel implements Invalidatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void register(Invalidatable model) {
|
@Override
|
||||||
|
public void register(Invalidatable model) {
|
||||||
this.invalidatables.add(model);
|
this.invalidatables.add(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Panel for configuring a component's placement relative to its parent.
|
* Panel for configuring a component's placement relative to its parent.
|
||||||
*/
|
*/
|
||||||
public class PlacementPanel extends JPanel implements Invalidatable {
|
public class PlacementPanel extends JPanel implements Invalidatable, InvalidatingWidget {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
private final List<Invalidatable> invalidatables = new ArrayList<>();
|
private final List<Invalidatable> invalidatables = new ArrayList<>();
|
||||||
|
|
||||||
@ -69,7 +69,8 @@ public class PlacementPanel extends JPanel implements Invalidatable {
|
|||||||
"w 100lp");
|
"w 100lp");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void register(Invalidatable model) {
|
@Override
|
||||||
|
public void register(Invalidatable model) {
|
||||||
this.invalidatables.add(model);
|
this.invalidatables.add(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ import net.sf.openrocket.startup.Preferences;
|
|||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
import net.sf.openrocket.util.Invalidatable;
|
import net.sf.openrocket.util.Invalidatable;
|
||||||
|
|
||||||
public class RocketComponentConfig extends JPanel {
|
public class RocketComponentConfig extends JPanel implements InvalidatingWidget {
|
||||||
private static final long serialVersionUID = -2925484062132243982L;
|
private static final long serialVersionUID = -2925484062132243982L;
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
@ -1004,8 +1004,8 @@ public class RocketComponentConfig extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void register(Invalidatable model) {
|
public void register(Invalidatable model) {
|
||||||
this.invalidatables.add(model);
|
this.invalidatables.add(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user