Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a7ca1ac3e |
@@ -19,14 +19,6 @@ public class Game implements Serializable {
|
|||||||
this.previousGame2 = previousGame2;
|
this.previousGame2 = previousGame2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Place getLocation() {
|
|
||||||
return place;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocation(Place place) {
|
|
||||||
this.place = place;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPoints1() {
|
public int getPoints1() {
|
||||||
return points1;
|
return points1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class TournamentDecorator implements IsObservable{
|
public class TournamentDecorator implements IsObservable{
|
||||||
private Tournament tournament;
|
private Tournament tournament;
|
||||||
@@ -176,11 +175,6 @@ public class TournamentDecorator implements IsObservable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeApplication() throws InterruptedException {
|
|
||||||
executorService.shutdown();
|
|
||||||
executorService.awaitTermination(2000, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class saveTask implements Runnable {
|
private class saveTask implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,31 +5,28 @@ import ch.zhaw.projekt2.turnierverwaltung.FactoryDecorator;
|
|||||||
import ch.zhaw.projekt2.turnierverwaltung.FileIO;
|
import ch.zhaw.projekt2.turnierverwaltung.FileIO;
|
||||||
import ch.zhaw.projekt2.turnierverwaltung.TournamentDecorator;
|
import ch.zhaw.projekt2.turnierverwaltung.TournamentDecorator;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
public class MainWindow extends Application {
|
public class MainWindow extends Application {
|
||||||
private FileIO fileIO = new FileIO(System.getProperty("user.dir") + System.getProperty("file.separator") + "tournierverwaltung_angrynerds");
|
private FileIO fileIO = new FileIO(System.getProperty("user.dir") + System.getProperty("file.separator") + "tournierverwaltung_angrynerds");
|
||||||
private FactoryDecorator factoryDecorator;
|
private FactoryDecorator factoryDecorator;
|
||||||
private TournamentDecorator tournamentDecorator = new TournamentDecorator(fileIO);
|
private TournamentDecorator tournamentDecorator = new TournamentDecorator(fileIO);
|
||||||
private Factory factory = new Factory(fileIO, tournamentDecorator);
|
private Factory factory = new Factory(fileIO, tournamentDecorator); //TODO make it private!
|
||||||
private static final Logger logger = Logger.getLogger(FileIO.class.getCanonicalName());
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
|
||||||
BorderPane pane = factory.loadMainWindow();
|
BorderPane pane = factory.loadMainWindow();
|
||||||
factoryDecorator = new FactoryDecorator(fileIO, factory, pane);
|
factoryDecorator = new FactoryDecorator(fileIO, factory, pane);
|
||||||
factory.loadAllViews(factoryDecorator, pane);
|
factory.loadAllViews(factoryDecorator, pane);
|
||||||
tournamentDecorator.setFactoryDecorator(factoryDecorator);
|
tournamentDecorator.setFactoryDecorator(factoryDecorator);
|
||||||
factoryDecorator.openTournamentList();
|
factoryDecorator.openTournamentList();
|
||||||
|
|
||||||
|
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
primaryStage.setMaximized(true);
|
primaryStage.setMaximized(true);
|
||||||
@@ -38,13 +35,5 @@ public class MainWindow extends Application {
|
|||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
try {
|
|
||||||
super.stop();
|
|
||||||
tournamentDecorator.closeApplication();
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.warning("Exception while closing application");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package ch.zhaw.projekt2.turnierverwaltung.main;
|
package ch.zhaw.projekt2.turnierverwaltung.main;
|
||||||
|
|
||||||
import ch.zhaw.projekt2.turnierverwaltung.FXController;
|
import ch.zhaw.projekt2.turnierverwaltung.FXController;
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@ public class MainWindowController extends FXController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void closeApplication(ActionEvent event) {
|
void closeApplication(ActionEvent event) {
|
||||||
Platform.exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ public class GameController extends FXController{
|
|||||||
public void setup(TournamentDecorator tournamentDecorator, FileIO fileIO, FactoryDecorator factoryDecorator, Pane pane, GameDecorator gameDecorator) {
|
public void setup(TournamentDecorator tournamentDecorator, FileIO fileIO, FactoryDecorator factoryDecorator, Pane pane, GameDecorator gameDecorator) {
|
||||||
setTournamentDecorator(tournamentDecorator);
|
setTournamentDecorator(tournamentDecorator);
|
||||||
this.gameDecorator = gameDecorator;
|
this.gameDecorator = gameDecorator;
|
||||||
placesChoiceBox.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends Place> observable, Place oldValue, Place newValue) -> saveGamePlace(newValue));
|
placesChoiceBox.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends Place> observable, Place oldValue, Place newValue) -> saveGamePlace(newValue == null ? oldValue : newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user