Back to string properties
-Listeners were not working with getting values from existing properties #refactor #story[15]
This commit is contained in:
@@ -20,6 +20,7 @@ public class BoatInRace extends Boat {
|
||||
private long timeFinished;
|
||||
private Color colour;
|
||||
private boolean finished = false;
|
||||
private StringProperty currentLegName;
|
||||
|
||||
/**
|
||||
* Constructor method.
|
||||
@@ -30,6 +31,7 @@ public class BoatInRace extends Boat {
|
||||
public BoatInRace(String name, double velocity, Color colour, String abbrev) {
|
||||
super(name, velocity, abbrev);
|
||||
setColour(colour);
|
||||
currentLegName = new SimpleStringProperty("");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,14 +92,10 @@ public class BoatInRace extends Boat {
|
||||
*/
|
||||
public void setCurrentLeg(Leg currentLeg) {
|
||||
this.currentLeg = currentLeg;
|
||||
this.currentLegName.setValue(currentLeg.getName());
|
||||
}
|
||||
|
||||
public StringProperty getCurrentLegName(){
|
||||
|
||||
StringProperty currentLegName = new SimpleStringProperty("");
|
||||
if (currentLeg != null) {
|
||||
currentLegName.setValue(currentLeg.getName());
|
||||
}
|
||||
return currentLegName;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user