Gui now correctly initializes chosen relTo stage pulldown (minor)
This commit is contained in:
parent
8755777924
commit
3b1de9c291
@ -23,16 +23,16 @@ public class StageSelectModel extends AbstractListModel<Stage> implements ComboB
|
|||||||
private static final long serialVersionUID = 1311302134934033684L;
|
private static final long serialVersionUID = 1311302134934033684L;
|
||||||
private static final Logger log = LoggerFactory.getLogger(StageSelectModel.class);
|
private static final Logger log = LoggerFactory.getLogger(StageSelectModel.class);
|
||||||
|
|
||||||
protected final String nullText;//?
|
// protected final String nullText;
|
||||||
|
|
||||||
protected Stage sourceStage = null;
|
protected Stage sourceStage = null;
|
||||||
protected ArrayList<Stage> displayValues = new ArrayList<Stage>();
|
protected ArrayList<Stage> displayValues = new ArrayList<Stage>();
|
||||||
protected Stage selectedStage = null;
|
protected Stage selectedStage = null;
|
||||||
|
|
||||||
//@SuppressWarnings("unchecked")
|
//@SuppressWarnings("unchecked")
|
||||||
public StageSelectModel( final Stage _stage, String nullText) {
|
public StageSelectModel( final Stage _stage) {
|
||||||
this.sourceStage = _stage;
|
this.sourceStage = _stage;
|
||||||
this.nullText = nullText;
|
// this.nullText = nullText;
|
||||||
|
|
||||||
populateDisplayValues();
|
populateDisplayValues();
|
||||||
|
|
||||||
@ -40,10 +40,6 @@ public class StageSelectModel extends AbstractListModel<Stage> implements ComboB
|
|||||||
this.sourceStage.addChangeListener(this);
|
this.sourceStage.addChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StageSelectModel( final Stage _stage ){
|
|
||||||
this( _stage, "(no stage selected)");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateDisplayValues(){
|
private void populateDisplayValues(){
|
||||||
Rocket rocket = this.sourceStage.getRocket();
|
Rocket rocket = this.sourceStage.getRocket();
|
||||||
|
|
||||||
@ -110,18 +106,18 @@ public class StageSelectModel extends AbstractListModel<Stage> implements ComboB
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stateChanged(EventObject eo) {
|
public void stateChanged(EventObject eo) {
|
||||||
if(( null == this.sourceStage)||(null==this.selectedStage)){
|
if( null == this.sourceStage){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Rocket rkt = sourceStage.getRocket();
|
||||||
int sourceRelToIndex = this.sourceStage.getRelativeToStage();
|
int sourceRelToIndex = this.sourceStage.getRelativeToStage();
|
||||||
int selectedRelIndex = this.selectedStage.getStageNumber();
|
int selectedStageIndex = -1;
|
||||||
if ( selectedRelIndex != sourceRelToIndex){
|
if( null != this.selectedStage ){
|
||||||
this.selectedStage = (Stage)sourceStage.getRocket().getChild(sourceRelToIndex);
|
selectedStageIndex = this.selectedStage.getStageNumber();
|
||||||
|
}
|
||||||
// I don't think this is required -- we're not changing the list, just the selected item.
|
if ( selectedStageIndex != sourceRelToIndex){
|
||||||
//this.fireContentsChanged(this, 0, values.length);
|
this.selectedStage = (Stage)rkt.getChild(sourceRelToIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user