[Bugfix] .ORK I/O Bugfixes...
- Corrected FlightConfiguration, MotorConfiguration ID issues - output code no longer outputs extra FlightConfigurations - recovery Devices no longer print out FlightConfigurations w/o specific settings - Reverted Default Value for FlightConfigurationSet is just a member field - creates extraneous code when included in the map. - fixed corresponding display issues.
This commit is contained in:
parent
9551ddc0cb
commit
1719351a63
@ -10,7 +10,9 @@ import net.sf.openrocket.file.DocumentLoadingContext;
|
|||||||
import net.sf.openrocket.file.simplesax.AbstractElementHandler;
|
import net.sf.openrocket.file.simplesax.AbstractElementHandler;
|
||||||
import net.sf.openrocket.file.simplesax.ElementHandler;
|
import net.sf.openrocket.file.simplesax.ElementHandler;
|
||||||
import net.sf.openrocket.file.simplesax.PlainTextHandler;
|
import net.sf.openrocket.file.simplesax.PlainTextHandler;
|
||||||
|
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
|
import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
|
||||||
|
import net.sf.openrocket.rocketcomponent.FlightConfigurationSet;
|
||||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||||
|
|
||||||
class MotorConfigurationHandler extends AbstractElementHandler {
|
class MotorConfigurationHandler extends AbstractElementHandler {
|
||||||
@ -61,7 +63,10 @@ class MotorConfigurationHandler extends AbstractElementHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ("true".equals(attributes.remove("default"))) {
|
if ("true".equals(attributes.remove("default"))) {
|
||||||
rocket.getConfigurationSet().reset(fcid);
|
// associate this configuration with both this FCID and the default.
|
||||||
|
FlightConfigurationSet<FlightConfiguration> fcs = rocket.getConfigurationSet();
|
||||||
|
FlightConfiguration fc = fcs.get(fcid);
|
||||||
|
fcs.setDefault(fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.closeElement(element, attributes, content, warnings);
|
super.closeElement(element, attributes, content, warnings);
|
||||||
|
@ -31,21 +31,22 @@ public class RecoveryDeviceSaver extends MassObjectSaver {
|
|||||||
elements.addAll(deploymentConfiguration(defaultConfig, false));
|
elements.addAll(deploymentConfiguration(defaultConfig, false));
|
||||||
|
|
||||||
Rocket rocket = c.getRocket();
|
Rocket rocket = c.getRocket();
|
||||||
// Note - getFlightConfigurationIDs returns at least one element. The first element
|
|
||||||
// is null and means "default".
|
// DEBUG
|
||||||
|
//System.err.println("printing deployment info for: "+dev.getName());
|
||||||
|
//dev.getDeploymentConfigurations().printDebug();
|
||||||
|
// DEBUG
|
||||||
|
|
||||||
FlightConfigurationSet<FlightConfiguration> configList = rocket.getConfigurationSet();
|
FlightConfigurationSet<FlightConfiguration> configList = rocket.getConfigurationSet();
|
||||||
|
for (FlightConfigurationID fcid : configList.getSortedConfigurationIDs()) {
|
||||||
|
//System.err.println("checking FlightConfiguration:"+fcid.getShortKey()+ " save?");
|
||||||
|
|
||||||
if (configList.size() > 1) {
|
|
||||||
|
|
||||||
for (FlightConfiguration config : configList) {
|
|
||||||
FlightConfigurationID fcid = config.getFlightConfigurationID();
|
|
||||||
if (fcid == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (dev.getDeploymentConfigurations().isDefault(fcid)) {
|
if (dev.getDeploymentConfigurations().isDefault(fcid)) {
|
||||||
|
//System.err.println(" >> skipping: fcid="+fcid.getShortKey());
|
||||||
continue;
|
continue;
|
||||||
}
|
}else if( dev.getDeploymentConfigurations().containsKey(fcid)){
|
||||||
|
// only print configurations which override the default.
|
||||||
|
//System.err.println(" >> printing data.");
|
||||||
DeploymentConfiguration deployConfig = dev.getDeploymentConfigurations().get(fcid);
|
DeploymentConfiguration deployConfig = dev.getDeploymentConfigurations().get(fcid);
|
||||||
elements.add("<deploymentconfiguration configid=\"" + fcid.key + "\">");
|
elements.add("<deploymentconfiguration configid=\"" + fcid.key + "\">");
|
||||||
elements.addAll(deploymentConfiguration(deployConfig, true));
|
elements.addAll(deploymentConfiguration(deployConfig, true));
|
||||||
|
@ -6,6 +6,7 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
|
import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
|
||||||
|
import net.sf.openrocket.rocketcomponent.FlightConfigurationSet;
|
||||||
import net.sf.openrocket.rocketcomponent.ReferenceType;
|
import net.sf.openrocket.rocketcomponent.ReferenceType;
|
||||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||||
|
|
||||||
@ -42,23 +43,25 @@ public class RocketSaver extends RocketComponentSaver {
|
|||||||
|
|
||||||
|
|
||||||
// Motor configurations
|
// Motor configurations
|
||||||
FlightConfigurationID defId = rocket.getDefaultConfiguration().getFlightConfigurationID();
|
FlightConfigurationSet<FlightConfiguration> allConfigs = rocket.getConfigurationSet();
|
||||||
for (FlightConfiguration flightConfig : rocket.getConfigurationSet()) {
|
for (FlightConfigurationID fcid : allConfigs.getSortedConfigurationIDs()) {
|
||||||
FlightConfigurationID fcid = flightConfig.getFlightConfigurationID();
|
FlightConfiguration flightConfig = allConfigs.get(fcid);
|
||||||
if (fcid == null)
|
if (fcid == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String str = "<motorconfiguration configid=\"" + fcid.key + "\"";
|
String str = "<motorconfiguration configid=\"" + fcid.key + "\"";
|
||||||
if (fcid.equals(defId))
|
// if the configuration is the default, add the tag
|
||||||
|
if ( allConfigs.isDefault( flightConfig )){
|
||||||
str += " default=\"true\"";
|
str += " default=\"true\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flightConfig.isNameOverridden()){
|
||||||
if (rocket.getConfigurationSet().isDefault(flightConfig)) {
|
|
||||||
str += "/>";
|
|
||||||
} else {
|
|
||||||
str += "><name>" + net.sf.openrocket.util.TextUtil.escapeXML(flightConfig.getName())
|
str += "><name>" + net.sf.openrocket.util.TextUtil.escapeXML(flightConfig.getName())
|
||||||
+ "</name></motorconfiguration>";
|
+ "</name></motorconfiguration>";
|
||||||
|
} else {
|
||||||
|
str += "/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.add(str);
|
elements.add(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,8 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
this.fcid = _fcid;
|
this.fcid = _fcid;
|
||||||
}
|
}
|
||||||
this.rocket = rocket;
|
this.rocket = rocket;
|
||||||
this.setName( fcid.key);
|
this.overrideName = false;
|
||||||
|
this.configurationName = "<WARN: attempt to access unset configurationName. WARN!> ";
|
||||||
|
|
||||||
updateStageMap();
|
updateStageMap();
|
||||||
rocket.addComponentChangeListener(this);
|
rocket.addComponentChangeListener(this);
|
||||||
@ -461,10 +462,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setName( final String newName) {
|
public void setName( final String newName) {
|
||||||
if( this.getFlightConfigurationID().equals( FlightConfigurationID.DEFAULT_CONFIGURATION_FCID)){
|
if( null == newName ){
|
||||||
this.configurationName = FlightConfiguration.DEFAULT_CONFIGURATION_NAME;
|
|
||||||
return;
|
|
||||||
}else if( null == newName ){
|
|
||||||
this.overrideName = false;
|
this.overrideName = false;
|
||||||
}else if( "".equals(newName)){
|
}else if( "".equals(newName)){
|
||||||
return;
|
return;
|
||||||
@ -477,11 +475,15 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
this.configurationName = newName;
|
this.configurationName = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNameOverridden(){
|
||||||
|
return this.overrideName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if( overrideName ){
|
if( overrideName ){
|
||||||
return this.configurationName;
|
return this.configurationName;
|
||||||
}else{
|
}else{
|
||||||
return " NYI - motor digest string";
|
return fcid.key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ public final class FlightConfigurationID implements Comparable<FlightConfigurati
|
|||||||
final public String key;
|
final public String key;
|
||||||
|
|
||||||
private final static String ERROR_CONFIGURATION_KEYTEXT = "error_key_2489";
|
private final static String ERROR_CONFIGURATION_KEYTEXT = "error_key_2489";
|
||||||
private final static String DEFAULT_CONFIGURATION_KEYTEXT = "default_configuration_6602";
|
// private final static String DEFAULT_CONFIGURATION_KEYTEXT = "default_configuration_6602";
|
||||||
private final static String DEFAULT_VALUE_KEYTEXT = "default_value_5676";
|
// private final static String DEFAULT_VALUE_KEYTEXT = "default_value_5676";
|
||||||
|
|
||||||
public final static FlightConfigurationID ERROR_CONFIGURATION_FCID = new FlightConfigurationID( FlightConfigurationID.ERROR_CONFIGURATION_KEYTEXT);
|
public final static FlightConfigurationID ERROR_CONFIGURATION_FCID = new FlightConfigurationID( FlightConfigurationID.ERROR_CONFIGURATION_KEYTEXT);
|
||||||
public final static FlightConfigurationID DEFAULT_CONFIGURATION_FCID = new FlightConfigurationID( FlightConfigurationID.DEFAULT_CONFIGURATION_KEYTEXT );
|
// public final static FlightConfigurationID DEFAULT_CONFIGURATION_FCID = new FlightConfigurationID( FlightConfigurationID.DEFAULT_CONFIGURATION_KEYTEXT );
|
||||||
public final static FlightConfigurationID DEFAULT_VALUE_FCID = new FlightConfigurationID( FlightConfigurationID.DEFAULT_VALUE_KEYTEXT );
|
// public final static FlightConfigurationID DEFAULT_VALUE_FCID = new FlightConfigurationID( FlightConfigurationID.DEFAULT_VALUE_KEYTEXT );
|
||||||
|
|
||||||
public FlightConfigurationID() {
|
public FlightConfigurationID() {
|
||||||
this(UUID.randomUUID().toString());
|
this(UUID.randomUUID().toString());
|
||||||
@ -52,6 +52,10 @@ public final class FlightConfigurationID implements Comparable<FlightConfigurati
|
|||||||
return this.key.equals(otherFCID.key);
|
return this.key.equals(otherFCID.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getShortKey(){
|
||||||
|
return this.key.substring(0,8);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return this.key.hashCode();
|
return this.key.hashCode();
|
||||||
@ -73,15 +77,6 @@ public final class FlightConfigurationID implements Comparable<FlightConfigurati
|
|||||||
return this.key.length();
|
return this.key.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toShortKey(){
|
|
||||||
if( this == DEFAULT_VALUE_FCID ){
|
|
||||||
return "DEFVAL";
|
|
||||||
}else if( this == FlightConfigurationID.DEFAULT_CONFIGURATION_FCID){
|
|
||||||
return "DEFCONFIG";
|
|
||||||
}
|
|
||||||
return this.key.substring(0,8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.key;
|
return this.key;
|
||||||
|
@ -5,7 +5,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -24,8 +23,8 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(FlightConfigurationSet.class);
|
private static final Logger log = LoggerFactory.getLogger(FlightConfigurationSet.class);
|
||||||
protected final HashMap<FlightConfigurationID, E> map = new HashMap<FlightConfigurationID, E>();
|
protected final HashMap<FlightConfigurationID, E> map = new HashMap<FlightConfigurationID, E>();
|
||||||
protected final static FlightConfigurationID DEFAULT_VALUE_FCID = FlightConfigurationID.DEFAULT_VALUE_FCID;
|
|
||||||
|
|
||||||
|
protected E defaultValue;
|
||||||
protected final RocketComponent component;
|
protected final RocketComponent component;
|
||||||
protected final int eventType;
|
protected final int eventType;
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
this.component = component;
|
this.component = component;
|
||||||
this.eventType = eventType;
|
this.eventType = eventType;
|
||||||
|
|
||||||
this.map.put( DEFAULT_VALUE_FCID, _defaultValue );
|
this.defaultValue= _defaultValue;
|
||||||
|
|
||||||
addListener(_defaultValue);
|
addListener(_defaultValue);
|
||||||
}
|
}
|
||||||
@ -58,7 +57,7 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
this.component = component;
|
this.component = component;
|
||||||
this.eventType = eventType;
|
this.eventType = eventType;
|
||||||
|
|
||||||
this.map.put( DEFAULT_VALUE_FCID, flightConfiguration.getDefault().clone());
|
this.defaultValue= flightConfiguration.getDefault().clone();
|
||||||
for (FlightConfigurationID key : flightConfiguration.map.keySet()) {
|
for (FlightConfigurationID key : flightConfiguration.map.keySet()) {
|
||||||
this.map.put(key, flightConfiguration.map.get(key).clone());
|
this.map.put(key, flightConfiguration.map.get(key).clone());
|
||||||
}
|
}
|
||||||
@ -70,7 +69,7 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E getDefault(){
|
public E getDefault(){
|
||||||
return this.map.get(DEFAULT_VALUE_FCID);
|
return this.defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -81,7 +80,7 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
if( this.isDefault(nextDefaultValue)){
|
if( this.isDefault(nextDefaultValue)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.set( DEFAULT_VALUE_FCID, nextDefaultValue);
|
this.defaultValue = nextDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -127,14 +126,14 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
public List<FlightConfigurationID> getSortedConfigurationIDs(){
|
public List<FlightConfigurationID> getSortedConfigurationIDs(){
|
||||||
Vector<FlightConfigurationID> toReturn = new Vector<FlightConfigurationID>();
|
Vector<FlightConfigurationID> toReturn = new Vector<FlightConfigurationID>();
|
||||||
|
|
||||||
toReturn.addAll( this.getIDs() );
|
toReturn.addAll( this.map.keySet() );
|
||||||
toReturn.sort( null );
|
toReturn.sort( null );
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<FlightConfigurationID> getIDs(){
|
public List<FlightConfigurationID> getIDs(){
|
||||||
return this.map.keySet();
|
return this.getSortedConfigurationIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -146,11 +145,6 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
}
|
}
|
||||||
if ( nextValue == null) {
|
if ( nextValue == null) {
|
||||||
// null value means to delete this fcid
|
// null value means to delete this fcid
|
||||||
if ( DEFAULT_VALUE_FCID == fcid ) {
|
|
||||||
// NEVER delete the default value....
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
E previousValue = map.remove(fcid);
|
E previousValue = map.remove(fcid);
|
||||||
removeListener(previousValue);
|
removeListener(previousValue);
|
||||||
}else{
|
}else{
|
||||||
@ -168,7 +162,7 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDefault( FlightConfigurationID fcid) {
|
public boolean isDefault( FlightConfigurationID fcid) {
|
||||||
return (getDefault() == map.get(fcid));
|
return ( this.getDefault() == this.map.get(fcid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -219,17 +213,33 @@ public class FlightConfigurationSet<E extends FlightConfigurableParameter<E>> im
|
|||||||
System.err.println("====== Dumping ConfigurationSet for comp: '"+this.component.getName()+"' of type: "+this.component.getClass().getSimpleName()+" ======");
|
System.err.println("====== Dumping ConfigurationSet for comp: '"+this.component.getName()+"' of type: "+this.component.getClass().getSimpleName()+" ======");
|
||||||
System.err.println(" >> FlightConfigurationSet ("+this.size()+ " configurations)");
|
System.err.println(" >> FlightConfigurationSet ("+this.size()+ " configurations)");
|
||||||
|
|
||||||
for( FlightConfigurationID loopFCID : this.getSortedConfigurationIDs()){
|
if( 0 == this.size() ){
|
||||||
String shortKey = loopFCID.toShortKey();
|
String designation = "";
|
||||||
|
E inst = this.getDefault();
|
||||||
|
|
||||||
E inst = this.map.get(loopFCID);
|
|
||||||
String designation;
|
|
||||||
if( inst instanceof FlightConfiguration){
|
if( inst instanceof FlightConfiguration){
|
||||||
FlightConfiguration fc = (FlightConfiguration) inst;
|
designation = ((FlightConfiguration) inst).getFlightConfigurationID().getShortKey();
|
||||||
designation = fc.getName();
|
|
||||||
}else{
|
}else{
|
||||||
designation = inst.toString();
|
designation = inst.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.err.println(" ( DEFAULT_VALUE = "+designation + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
for( FlightConfigurationID loopFCID : this.getSortedConfigurationIDs()){
|
||||||
|
String shortKey = loopFCID.getShortKey();
|
||||||
|
String designation = "";
|
||||||
|
|
||||||
|
E inst = this.map.get(loopFCID);
|
||||||
|
if( inst instanceof FlightConfiguration){
|
||||||
|
FlightConfiguration fc = (FlightConfiguration) inst;
|
||||||
|
designation = ( fc.isNameOverridden() ? "" : fc.getName());
|
||||||
|
}else{
|
||||||
|
designation = inst.toString();
|
||||||
|
}
|
||||||
|
if( this.isDefault(inst)){
|
||||||
|
shortKey = "*"+shortKey+"*";
|
||||||
|
}
|
||||||
System.err.println(" >> ["+shortKey+"]= "+designation);
|
System.err.println(" >> ["+shortKey+"]= "+designation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class MotorConfigurationSet extends FlightConfigurationSet<MotorInstance>
|
|||||||
System.err.println(" >> motorSet ("+this.size()+ " motors)");
|
System.err.println(" >> motorSet ("+this.size()+ " motors)");
|
||||||
|
|
||||||
for( FlightConfigurationID loopFCID : this.map.keySet()){
|
for( FlightConfigurationID loopFCID : this.map.keySet()){
|
||||||
String shortKey = loopFCID.toShortKey();
|
String shortKey = loopFCID.getShortKey();
|
||||||
|
|
||||||
MotorInstance curInstance = this.map.get(loopFCID);
|
MotorInstance curInstance = this.map.get(loopFCID);
|
||||||
String designation;
|
String designation;
|
||||||
|
@ -83,8 +83,7 @@ public class Rocket extends RocketComponent {
|
|||||||
treeModID = modID;
|
treeModID = modID;
|
||||||
functionalModID = modID;
|
functionalModID = modID;
|
||||||
|
|
||||||
FlightConfigurationID defaultFCID = FlightConfigurationID.DEFAULT_CONFIGURATION_FCID;
|
FlightConfiguration defaultConfiguration = new FlightConfiguration( null, this);
|
||||||
FlightConfiguration defaultConfiguration = new FlightConfiguration( defaultFCID, this);
|
|
||||||
this.configurations = new FlightConfigurationSet<FlightConfiguration>(this, ComponentChangeEvent.ALL_CHANGE, defaultConfiguration);
|
this.configurations = new FlightConfigurationSet<FlightConfiguration>(this, ComponentChangeEvent.ALL_CHANGE, defaultConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class RenameConfigDialog extends JDialog {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String newName = textbox.getText();
|
String newName = textbox.getText();
|
||||||
rocket.getFlightConfiguration(fcid).setName( newName);
|
rocket.getFlightConfiguration(fcid).setName( newName);
|
||||||
System.err.println(" << just renamed: "+fcid.toShortKey()+" with: "+newName+" to: "+ rocket.getFlightConfiguration(fcid).getName());
|
System.err.println(" << just renamed: "+fcid.getShortKey()+" with: "+newName+" to: "+ rocket.getFlightConfiguration(fcid).getName());
|
||||||
rocket.getConfigurationSet().printDebug();
|
rocket.getConfigurationSet().printDebug();
|
||||||
RenameConfigDialog.this.setVisible(false);
|
RenameConfigDialog.this.setVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import net.sf.openrocket.startup.Application;
|
|||||||
import net.sf.openrocket.util.Pair;
|
import net.sf.openrocket.util.Pair;
|
||||||
|
|
||||||
public class FlightConfigurableTableModel<T extends FlightConfigurableComponent> extends AbstractTableModel implements ComponentChangeListener{
|
public class FlightConfigurableTableModel<T extends FlightConfigurableComponent> extends AbstractTableModel implements ComponentChangeListener{
|
||||||
|
|
||||||
private static final long serialVersionUID = 3168465083803936363L;
|
private static final long serialVersionUID = 3168465083803936363L;
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
private static final String CONFIGURATION = trans.get("edtmotorconfdlg.col.configuration");
|
private static final String CONFIGURATION = trans.get("edtmotorconfdlg.col.configuration");
|
||||||
@ -66,8 +65,7 @@ public class FlightConfigurableTableModel<T extends FlightConfigurableComponent>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRowCount() {
|
public int getRowCount() {
|
||||||
// the -1 removes the DEFAULT_VALUE row, which is hidden.
|
return rocket.getConfigurationCount();
|
||||||
return (rocket.getConfigurationCount()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -107,9 +105,8 @@ public class FlightConfigurableTableModel<T extends FlightConfigurableComponent>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private FlightConfigurationID getConfigurationID(int rowNum) {
|
private FlightConfigurationID getConfigurationID(int rowNum) {
|
||||||
if( rocket.getConfigurationCount() != (1+ ids.size() ) ){
|
if( rocket.getConfigurationCount() != (ids.size() ) ){
|
||||||
this.ids = rocket.getSortedConfigurationIDs();
|
this.ids = rocket.getSortedConfigurationIDs();
|
||||||
this.ids.remove(FlightConfigurationID.DEFAULT_VALUE_FCID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ids.get(rowNum);
|
return this.ids.get(rowNum);
|
||||||
|
@ -127,7 +127,6 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
FlightConfiguration newConfig = new FlightConfiguration( newFCID, rocket );
|
FlightConfiguration newConfig = new FlightConfiguration( newFCID, rocket );
|
||||||
|
|
||||||
rocket.setFlightConfiguration(newFCID, newConfig);
|
rocket.setFlightConfiguration(newFCID, newConfig);
|
||||||
//System.err.println("Adding new config: "+newFCID.key+" called: "+newConfig.getName()+" (sz: "+newConfig?+")");
|
|
||||||
|
|
||||||
// Create a new simulation for this configuration.
|
// Create a new simulation for this configuration.
|
||||||
createSimulationForNewConfiguration();
|
createSimulationForNewConfiguration();
|
||||||
|
@ -139,7 +139,6 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
protected JTable initializeTable() {
|
protected JTable initializeTable() {
|
||||||
//// Motor selection table.
|
//// Motor selection table.
|
||||||
configurationTableModel = new FlightConfigurableTableModel<MotorMount>(MotorMount.class,rocket) {
|
configurationTableModel = new FlightConfigurableTableModel<MotorMount>(MotorMount.class,rocket) {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1210899988369000567L;
|
private static final long serialVersionUID = -1210899988369000567L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -206,7 +205,6 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
if ( (null == fcid )||( null == curMount )){
|
if ( (null == fcid )||( null == curMount )){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.err.println("?? selected FCID: "+ fcid.key);
|
|
||||||
|
|
||||||
motorChooserDialog.setMotorMountAndConfig( fcid, curMount );
|
motorChooserDialog.setMotorMountAndConfig( fcid, curMount );
|
||||||
motorChooserDialog.setVisible(true);
|
motorChooserDialog.setVisible(true);
|
||||||
@ -286,6 +284,11 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
// if( mount instanceof BodyTube ){
|
// if( mount instanceof BodyTube ){
|
||||||
// System.err.println("Formatting Cell: fcid="+configId.key.substring(0, 8));
|
// System.err.println("Formatting Cell: fcid="+configId.key.substring(0, 8));
|
||||||
// ((BodyTube) mount).printMotorDebug();
|
// ((BodyTube) mount).printMotorDebug();
|
||||||
|
// }
|
||||||
|
// System.err.println("rendering "+configId.getShortKey()+" cell: " );
|
||||||
|
// if( rocket.getConfigurationSet().isDefault( configId) ){
|
||||||
|
// String newText = label.getText() + " (default)";
|
||||||
|
// System.err.println(" "+label.getText()+" >> "+newText);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
JLabel motorDescriptionLabel = new JLabel(motorString);
|
JLabel motorDescriptionLabel = new JLabel(motorString);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user