if game points empty default value is 0
changed to variable names
This commit is contained in:
parent
db51f2f3cd
commit
d3a4b4cc87
|
@ -84,11 +84,11 @@ public class FactoryDecorator implements IsObservable{
|
||||||
|
|
||||||
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
|
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
|
||||||
|
|
||||||
List<GameDecorator> gameDecorators = new ArrayList<>();
|
List<GameDecorator> gameDecoratorsList = new ArrayList<>();
|
||||||
double gameBoxHeight = 0;
|
double gameBoxHeight = 0;
|
||||||
double spacingFactor = 0;
|
double spacingFactor = 0;
|
||||||
for (int i = 0; i < gameList.size(); i++) {
|
for (int i = 0; i < gameList.size(); i++) {
|
||||||
List<GameDecorator> newGameDecorators = new ArrayList<>();
|
List<GameDecorator> newGameDecoratorsList = new ArrayList<>();
|
||||||
VBox vBox = new VBox();
|
VBox vBox = new VBox();
|
||||||
if(treeView){
|
if(treeView){
|
||||||
vBox.setAlignment(Pos.CENTER);
|
vBox.setAlignment(Pos.CENTER);
|
||||||
|
@ -99,13 +99,13 @@ public class FactoryDecorator implements IsObservable{
|
||||||
spacingFactor = spacingFactor * 2 + 1;
|
spacingFactor = spacingFactor * 2 + 1;
|
||||||
for (int j = 0; j < gameList.get(i).size(); j++) {
|
for (int j = 0; j < gameList.get(i).size(); j++) {
|
||||||
GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j));
|
GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j));
|
||||||
newGameDecorators.add(gameDecorator);
|
newGameDecoratorsList.add(gameDecorator);
|
||||||
GameController controller = openGameView(vBox,gameDecorator);
|
GameController gameController = openGameView(vBox,gameDecorator);
|
||||||
if(i>0){
|
if(i>0){
|
||||||
controller.addListener(gameDecorators.get(j*2));
|
gameController.addListener(gameDecoratorsList.get(j*2));
|
||||||
controller.addListener(gameDecorators.get(j*2+1));
|
gameController.addListener(gameDecoratorsList.get(j*2+1));
|
||||||
} else if(gameBoxHeight == 0) {
|
} else if(gameBoxHeight == 0) {
|
||||||
gameBoxHeight = controller.getGameBoxHeigth();
|
gameBoxHeight = gameController.getGameBoxHeigth();
|
||||||
}
|
}
|
||||||
gameDecorator.addListener(new IsObserver() {
|
gameDecorator.addListener(new IsObserver() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -113,14 +113,14 @@ public class FactoryDecorator implements IsObservable{
|
||||||
tournamentDecorator.saveTournament();
|
tournamentDecorator.saveTournament();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
controller.loadContent();
|
gameController.loadContent();
|
||||||
}
|
}
|
||||||
hBoxCenter.getChildren().add(vBox);
|
hBoxCenter.getChildren().add(vBox);
|
||||||
if(treeView){
|
if(treeView){
|
||||||
if(i+1 < gameList.size())
|
if(i+1 < gameList.size())
|
||||||
hBoxCenter.getChildren().add(drawLines(vBox, gameBoxHeight, 30));
|
hBoxCenter.getChildren().add(drawLines(vBox, gameBoxHeight, 30));
|
||||||
}
|
}
|
||||||
gameDecorators = newGameDecorators;
|
gameDecoratorsList = newGameDecoratorsList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,13 @@ public class GameDecorator implements IsObservable{
|
||||||
public void saveGameResult(String points1, String points2){
|
public void saveGameResult(String points1, String points2){
|
||||||
if(points1.length() > 0){
|
if(points1.length() > 0){
|
||||||
game.setPoints1(Integer.parseInt(points1));
|
game.setPoints1(Integer.parseInt(points1));
|
||||||
|
} else {
|
||||||
|
game.setPoints1(0);
|
||||||
}
|
}
|
||||||
if(points2.length() > 0) {
|
if(points2.length() > 0) {
|
||||||
game.setPoints2(Integer.parseInt(points2));
|
game.setPoints2(Integer.parseInt(points2));
|
||||||
|
} else {
|
||||||
|
game.setPoints2(0);
|
||||||
}
|
}
|
||||||
informListener();
|
informListener();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue