Merge pull request #269 from teyrana/configfix
Moved 'no motors' text to translation system.
This commit is contained in:
commit
7e68a01780
@ -1477,6 +1477,10 @@ MotorMount.IgnitionEvent.short.EJECTION_CHARGE = Ejection charge
|
|||||||
MotorMount.IgnitionEvent.short.BURNOUT = Burnout
|
MotorMount.IgnitionEvent.short.BURNOUT = Burnout
|
||||||
MotorMount.IgnitionEvent.short.NEVER = Never
|
MotorMount.IgnitionEvent.short.NEVER = Never
|
||||||
|
|
||||||
|
FlightConfiguration.noMotors = No motors
|
||||||
|
|
||||||
|
MotorConfiguration.empty = None
|
||||||
|
|
||||||
|
|
||||||
!ComponentIcons
|
!ComponentIcons
|
||||||
ComponentIcons.Stage = Axial Stage
|
ComponentIcons.Stage = Axial Stage
|
||||||
|
@ -41,13 +41,13 @@ public class RocketSaver extends RocketComponentSaver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Motor configurations
|
// Flight configurations
|
||||||
for (FlightConfigurationId fcid : rocket.getIds()) {
|
for (FlightConfigurationId fcid : rocket.getIds()) {
|
||||||
FlightConfiguration flightConfig = rocket.getFlightConfiguration(fcid);
|
FlightConfiguration flightConfig = rocket.getFlightConfiguration(fcid);
|
||||||
if (fcid == null)
|
if (fcid == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// these are actually FlightConfigurationIds, buuuuuuuuuut backwards-compatible tags.
|
// these are actually FlightConfigurationIds, but the old tag name is preserved for backwards-compatibility.
|
||||||
String str = "<motorconfiguration configid=\"" + fcid.key + "\"";
|
String str = "<motorconfiguration configid=\"" + fcid.key + "\"";
|
||||||
// if the configuration is the default, add the tag
|
// if the configuration is the default, add the tag
|
||||||
if ( rocket.getSelectedConfiguration().equals( flightConfig )){
|
if ( rocket.getSelectedConfiguration().equals( flightConfig )){
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package net.sf.openrocket.motor;
|
package net.sf.openrocket.motor;
|
||||||
|
|
||||||
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfigurableParameter;
|
import net.sf.openrocket.rocketcomponent.FlightConfigurableParameter;
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
|
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
|
||||||
import net.sf.openrocket.rocketcomponent.InnerTube;
|
import net.sf.openrocket.rocketcomponent.InnerTube;
|
||||||
import net.sf.openrocket.rocketcomponent.MotorMount;
|
import net.sf.openrocket.rocketcomponent.MotorMount;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
import net.sf.openrocket.util.Inertia;
|
import net.sf.openrocket.util.Inertia;
|
||||||
|
|
||||||
@ -14,8 +16,8 @@ import net.sf.openrocket.util.Inertia;
|
|||||||
*/
|
*/
|
||||||
public class MotorConfiguration implements FlightConfigurableParameter<MotorConfiguration> {
|
public class MotorConfiguration implements FlightConfigurableParameter<MotorConfiguration> {
|
||||||
|
|
||||||
public static final String EMPTY_DESCRIPTION = "Empty Motor Configuration".intern();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
private final MotorMount mount;
|
private final MotorMount mount;
|
||||||
private final FlightConfigurationId fcid;
|
private final FlightConfigurationId fcid;
|
||||||
private final MotorConfigurationId mid;
|
private final MotorConfigurationId mid;
|
||||||
@ -60,7 +62,7 @@ public class MotorConfiguration implements FlightConfigurableParameter<MotorConf
|
|||||||
|
|
||||||
public String toMotorDescription(){
|
public String toMotorDescription(){
|
||||||
if( motor == null ){
|
if( motor == null ){
|
||||||
return "<Empty>";
|
return trans.get("empty");
|
||||||
}else{
|
}else{
|
||||||
return this.motor.getDesignation() + "-" + (int)this.getEjectionDelay();
|
return this.motor.getDesignation() + "-" + (int)this.getEjectionDelay();
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import java.util.Queue;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.motor.MotorConfiguration;
|
import net.sf.openrocket.motor.MotorConfiguration;
|
||||||
import net.sf.openrocket.motor.MotorConfigurationId;
|
import net.sf.openrocket.motor.MotorConfigurationId;
|
||||||
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.util.ArrayList;
|
import net.sf.openrocket.util.ArrayList;
|
||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
@ -27,9 +29,7 @@ import net.sf.openrocket.util.Monitorable;
|
|||||||
*/
|
*/
|
||||||
public class FlightConfiguration implements FlightConfigurableParameter<FlightConfiguration>, Monitorable {
|
public class FlightConfiguration implements FlightConfigurableParameter<FlightConfiguration>, Monitorable {
|
||||||
private static final Logger log = LoggerFactory.getLogger(FlightConfiguration.class);
|
private static final Logger log = LoggerFactory.getLogger(FlightConfiguration.class);
|
||||||
|
private static final Translator trans = Application.getTranslator();
|
||||||
private final static String NO_MOTORS_NAME = "[No Motors Defined]";
|
|
||||||
private final static String DEFAULT_CONFIGURATION_NAME = NO_MOTORS_NAME;
|
|
||||||
|
|
||||||
private String configurationName=null;
|
private String configurationName=null;
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( 0 == activeMotorCount ){
|
if( 0 == activeMotorCount ){
|
||||||
return DEFAULT_CONFIGURATION_NAME;
|
return trans.get("noMotors");
|
||||||
}
|
}
|
||||||
buff.append("]");
|
buff.append("]");
|
||||||
return buff.toString();
|
return buff.toString();
|
||||||
@ -331,7 +331,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
*/
|
*/
|
||||||
public void addMotor(MotorConfiguration motorConfig) {
|
public void addMotor(MotorConfiguration motorConfig) {
|
||||||
if( motorConfig.isEmpty() ){
|
if( motorConfig.isEmpty() ){
|
||||||
throw new IllegalArgumentException("MotorInstance is empty.");
|
log.error("attempt to add an empty motorConfig! ignoring. ", new IllegalArgumentException("empty MotorInstance: "+motorConfig.toDebugDetail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.motors.put( motorConfig.getID(), motorConfig);
|
this.motors.put( motorConfig.getID(), motorConfig);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user