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<GameDecorator> gameDecorators = new ArrayList<>();
|
||||
List<GameDecorator> gameDecoratorsList = new ArrayList<>();
|
||||
double gameBoxHeight = 0;
|
||||
double spacingFactor = 0;
|
||||
for (int i = 0; i < gameList.size(); i++) {
|
||||
List<GameDecorator> newGameDecorators = new ArrayList<>();
|
||||
List<GameDecorator> newGameDecoratorsList = new ArrayList<>();
|
||||
VBox vBox = new VBox();
|
||||
if(treeView){
|
||||
vBox.setAlignment(Pos.CENTER);
|
||||
|
@ -99,13 +99,13 @@ public class FactoryDecorator implements IsObservable{
|
|||
spacingFactor = spacingFactor * 2 + 1;
|
||||
for (int j = 0; j < gameList.get(i).size(); j++) {
|
||||
GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j));
|
||||
newGameDecorators.add(gameDecorator);
|
||||
GameController controller = openGameView(vBox,gameDecorator);
|
||||
newGameDecoratorsList.add(gameDecorator);
|
||||
GameController gameController = openGameView(vBox,gameDecorator);
|
||||
if(i>0){
|
||||
controller.addListener(gameDecorators.get(j*2));
|
||||
controller.addListener(gameDecorators.get(j*2+1));
|
||||
gameController.addListener(gameDecoratorsList.get(j*2));
|
||||
gameController.addListener(gameDecoratorsList.get(j*2+1));
|
||||
} else if(gameBoxHeight == 0) {
|
||||
gameBoxHeight = controller.getGameBoxHeigth();
|
||||
gameBoxHeight = gameController.getGameBoxHeigth();
|
||||
}
|
||||
gameDecorator.addListener(new IsObserver() {
|
||||
@Override
|
||||
|
@ -113,14 +113,14 @@ public class FactoryDecorator implements IsObservable{
|
|||
tournamentDecorator.saveTournament();
|
||||
}
|
||||
});
|
||||
controller.loadContent();
|
||||
gameController.loadContent();
|
||||
}
|
||||
hBoxCenter.getChildren().add(vBox);
|
||||
if(treeView){
|
||||
if(i+1 < gameList.size())
|
||||
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){
|
||||
if(points1.length() > 0){
|
||||
game.setPoints1(Integer.parseInt(points1));
|
||||
} else {
|
||||
game.setPoints1(0);
|
||||
}
|
||||
if(points2.length() > 0) {
|
||||
game.setPoints2(Integer.parseInt(points2));
|
||||
} else {
|
||||
game.setPoints2(0);
|
||||
}
|
||||
informListener();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue