Localized column heading and added rocket listener to update columns.
This commit is contained in:
parent
e36a90adfc
commit
fa7916f7b0
@ -175,6 +175,7 @@ debuglogdlg.lbl.Stacktrace = Stack trace:
|
||||
MotorChooserDialog.title = Select a rocket motor
|
||||
|
||||
! Edit Motor configuration dialog
|
||||
edtmotorconfdlg.col.configuration = Configuration
|
||||
edtmotorconfdlg.but.Removeconfiguration = Remove
|
||||
edtmotorconfdlg.but.Renameconfiguration = Rename
|
||||
edtmotorconfdlg.but.Newconfiguration = New
|
||||
|
@ -6,6 +6,8 @@ import java.util.List;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
|
||||
import net.sf.openrocket.rocketcomponent.MotorMount;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
@ -15,11 +17,11 @@ import net.sf.openrocket.util.Pair;
|
||||
/**
|
||||
* The table model for selecting and editing the motor configurations.
|
||||
*/
|
||||
class MotorConfigurationTableModel extends AbstractTableModel {
|
||||
class MotorConfigurationTableModel extends AbstractTableModel implements ComponentChangeListener {
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
private static final String CONFIGURATION = "Configuration";
|
||||
private static final String CONFIGURATION = trans.get("edtmotorconfdlg.col.configuration");
|
||||
|
||||
private final Rocket rocket;
|
||||
|
||||
@ -28,11 +30,19 @@ class MotorConfigurationTableModel extends AbstractTableModel {
|
||||
|
||||
public MotorConfigurationTableModel(Rocket rocket) {
|
||||
this.rocket = rocket;
|
||||
|
||||
this.rocket.addComponentChangeListener(this);
|
||||
initializeMotorMounts();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentChanged(ComponentChangeEvent e) {
|
||||
if ( e.isMotorChange() || e.isTreeChange() ) {
|
||||
initializeMotorMounts();
|
||||
fireTableStructureChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeMotorMounts() {
|
||||
motorMounts.clear();
|
||||
for (RocketComponent c : rocket) {
|
||||
|
@ -7,13 +7,15 @@ import java.util.List;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
|
||||
import net.sf.openrocket.rocketcomponent.RecoveryDevice;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.util.Pair;
|
||||
|
||||
class RecoveryTableModel extends AbstractTableModel {
|
||||
class RecoveryTableModel extends AbstractTableModel implements ComponentChangeListener {
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
@ -21,7 +23,7 @@ class RecoveryTableModel extends AbstractTableModel {
|
||||
|
||||
private final List<RecoveryDevice> recoveryDevices = new ArrayList<RecoveryDevice>();
|
||||
|
||||
private static final String CONFIGURATION = "Configuration";
|
||||
private static final String CONFIGURATION = trans.get("edtmotorconfdlg.col.configuration");
|
||||
|
||||
|
||||
/**
|
||||
@ -29,10 +31,19 @@ class RecoveryTableModel extends AbstractTableModel {
|
||||
*/
|
||||
RecoveryTableModel(Rocket rocket) {
|
||||
this.rocket = rocket;
|
||||
|
||||
this.rocket.addComponentChangeListener(this);
|
||||
initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentChanged(ComponentChangeEvent e) {
|
||||
if ( e.isTreeChange() ) {
|
||||
initialize();
|
||||
fireTableStructureChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initialize() {
|
||||
recoveryDevices.clear();
|
||||
Iterator<RocketComponent> it = rocket.iterator();
|
||||
|
@ -7,16 +7,15 @@ import java.util.List;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.RecoveryDevice;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.Stage;
|
||||
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
import net.sf.openrocket.util.Pair;
|
||||
|
||||
class SeparationTableModel extends AbstractTableModel {
|
||||
class SeparationTableModel extends AbstractTableModel implements ComponentChangeListener {
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
@ -24,14 +23,22 @@ class SeparationTableModel extends AbstractTableModel {
|
||||
|
||||
private final List<Stage> stages = new ArrayList<Stage>();
|
||||
|
||||
private static final String CONFIGURATION = "Configuration";
|
||||
private static final String CONFIGURATION = trans.get("edtmotorconfdlg.col.configuration");
|
||||
|
||||
SeparationTableModel(Rocket rocket ) {
|
||||
this.rocket = rocket;
|
||||
|
||||
this.rocket.addComponentChangeListener(this);
|
||||
initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentChanged(ComponentChangeEvent e) {
|
||||
if ( e.isTreeChange() ) {
|
||||
initialize();
|
||||
fireTableStructureChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
stages.clear();
|
||||
Iterator<RocketComponent> it = rocket.iterator();
|
||||
|
Loading…
x
Reference in New Issue
Block a user