Fixed 3 issues kruland had with mass type.

1.  Mass tooltip only displays totals for components that have children.
2.  setMassComponentType now fires NON_FUNCTIONAL change event.
3.  Label now reads "Mass Type" and default is "Unspecified".
This commit is contained in:
Craig Earls 2014-12-15 20:34:14 -07:00
parent 8d74ea9e6f
commit ded4df8103
3 changed files with 11 additions and 6 deletions

View File

@ -921,7 +921,7 @@ MassComponentCfg.tab.ttip.Radialpos = Radial position configuration
MassComponentCfg.lbl.Radialdistance = Radial distance:
MassComponentCfg.lbl.Radialdirection = Radial direction:
MassComponentCfg.but.Reset = Reset
MassComponentCfg.lbl.type = Object type
MassComponentCfg.lbl.type = Mass type
! MotorConfig
MotorCfg.checkbox.compmotormount = This component is a motor mount
@ -1328,7 +1328,7 @@ TrapezoidFinSet.TrapezoidFinSet = Trapezoidal fin set
! FreeformFinSet
FreeformFinSet.FreeformFinSet = Freeform fin set
!MassComponent
MassComponent.MassComponent = Mass component
MassComponent.MassComponent = Unspecified
MassComponent.Altimeter = Altimeter
MassComponent.FlightComputer = Flight computer
MassComponent.DeploymentCharge = Deployment charge

View File

@ -102,7 +102,7 @@ public class MassComponent extends MassObject {
}
checkState();
this.massComponentType = compType;
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
}
@Override

View File

@ -69,11 +69,16 @@ public class ComponentTreeRenderer extends DefaultTreeCellRenderer {
sb.append("<b>").append(c.getName()).append("</b>");
if (c.isMassive() || c.isMassOverridden() ) {
sb.append(" (").append(UnitGroup.UNITS_MASS.toStringUnit(c.getMass())).append(" of ");
sb.append(UnitGroup.UNITS_MASS.toStringUnit(c.getSectionMass())).append( " total)");
sb.append(" (").append(UnitGroup.UNITS_MASS.toStringUnit(c.getMass()));
if(c.getChildCount()>0){
sb.append(" of ").append(UnitGroup.UNITS_MASS.toStringUnit(c.getSectionMass())).append( " total");
}
sb.append(")");
} else {
if((c.getChildCount()>0) && (c.getSectionMass()>0)){
sb.append(" (").append(UnitGroup.UNITS_MASS.toStringUnit(c.getSectionMass())).append( " total)");
}
}
if ( c.isMassOverridden() ) {
sb.append(" ").append(trans.get("ComponentTree.ttip.massoverride"));