Commit 8d09de53 authored by Thomas's avatar Thomas
Browse files

Merge fixes for Main branches in scope v2

parent 239befc8
package main.java.client.main.controller; package main.java.client.main.controller;
import java.io.IOException; import java.io.IOException;
import javafx.beans.value.ObservableValue;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import main.java.client.ClientApp;
import main.java.client.main.model.MainApplicationModel;
import main.java.common.dataModel.UserLight;
import javafx.fxml.FXML;
import javafx.scene.paint.Color;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
...@@ -23,17 +35,19 @@ import main.java.client.main.model.MainApplicationModel; ...@@ -23,17 +35,19 @@ import main.java.client.main.model.MainApplicationModel;
import main.java.common.dataModel.UserLight; import main.java.common.dataModel.UserLight;
public class FXCreateGame implements Initializable { public class FXCreateGame implements Initializable {
private MainApplicationModel model; private MainApplicationModel model;
private Stage stage; private Stage stage;
@FXML @FXML
protected ComboBox<String> spectatorsCombo = new ComboBox<>(); protected ComboBox<String> spectatorsCombo = new ComboBox<String>();
@FXML @FXML
private ComboBox<String> chatCombo; private ComboBox<String> chatCombo;
@FXML @FXML
protected ComboBox<String> colorCombo = new ComboBox<>(); protected ComboBox<String> colorCombo = new ComboBox<String>();
@FXML @FXML
private TextField createGameTextFieldLimitMove; private TextField createGameTextFieldLimitMove;
...@@ -44,16 +58,16 @@ public class FXCreateGame implements Initializable { ...@@ -44,16 +58,16 @@ public class FXCreateGame implements Initializable {
@FXML @FXML
private Text errorFieldsInteger; private Text errorFieldsInteger;
public FXCreateGame() {
model = ClientApp.mainCore.getFX().getModel(); public FXCreateGame(){
this.model = ClientApp.mainCore.getFX().getModel();
stage = new Stage(); stage = new Stage();
} }
public void setStage(Stage stage) { public void setStage(Stage stage){
this.stage = stage; this.stage = stage;
} }
@Override
public void initialize(URL fxmlFileLocation, ResourceBundle resources) { public void initialize(URL fxmlFileLocation, ResourceBundle resources) {
errorFields.setVisible(false); errorFields.setVisible(false);
...@@ -63,48 +77,72 @@ public class FXCreateGame implements Initializable { ...@@ -63,48 +77,72 @@ public class FXCreateGame implements Initializable {
errorFieldsInteger.setFill(Color.RED); errorFieldsInteger.setFill(Color.RED);
chatCombo.getItems().setAll("Oui", "Non"); chatCombo.getItems().setAll("Oui", "Non");
chatCombo.getSelectionModel().selectedItemProperty() chatCombo.getSelectionModel().selectedItemProperty().addListener(
.addListener((ChangeListener<String>) (selected, oldValue, newValue) -> System.out.println(newValue)); new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> selected, //
String oldValue, String newValue) {
System.out.println(newValue);
}
}
);
spectatorsCombo.getItems().setAll("Oui", "Non"); spectatorsCombo.getItems().setAll("Oui", "Non");
spectatorsCombo.getSelectionModel().selectedItemProperty() spectatorsCombo.getSelectionModel().selectedItemProperty().addListener(
.addListener((ChangeListener<String>) (selected, oldValue, newValue) -> System.out.println(newValue)); new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> selected, //
String oldValue, String newValue) {
System.out.println(newValue);
}
}
);
colorCombo.getItems().setAll("Blanc", "Noir"); colorCombo.getItems().setAll("Blanc", "Noir");
colorCombo.getSelectionModel().selectedItemProperty() colorCombo.getSelectionModel().selectedItemProperty().addListener(
.addListener((ChangeListener<String>) (selected, oldValue, newValue) -> System.out.println(newValue)); new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> selected, //
String oldValue, String newValue) {
System.out.println(newValue);
}
}
);
} }
@FXML @FXML
private void handleButtonClick(MouseEvent e) throws IOException { private void handleButtonClick(MouseEvent e) throws IOException {
String buttonSource = ((Button) e.getSource()).getId(); String buttonSource = ((Button) e.getSource()).getId();
switch (buttonSource) { switch(buttonSource){
case "createGameButtonValidate": case "createGameButtonValidate":
createGame(); createGame();
break; break;
case "createGameButtonClose": case "createGameButtonClose":
stage = (Stage) ((Node) e.getSource()).getScene().getWindow(); this.stage = (Stage)((Node)e.getSource()).getScene().getWindow();
FXHome fxHome = new FXHome(); FXHome fxHome = new FXHome();
fxHome.initialize("../fxml/home.fxml", stage); fxHome.initialize("../fxml/home.fxml", this.stage);
break; break;
default: default:
System.out.println("[" + buttonSource + "] A handler button was triggered, but no action was performed."); System.out.println("["+buttonSource+"] A handler button was triggered, but no action was performed.");
} }
} }
private void createGame() throws IOException { private void createGame() throws IOException {
UserLight userLight = model.getUserLight(); UserLight userLight = this.model.getUserLight();
try { try {
Boolean chat = chatCombo.getValue().equals("Oui") ? true : false; Boolean chat = this.chatCombo.getValue().equals("Oui") ? true : false;
Boolean spectators = spectatorsCombo.getValue().equals("Oui") ? true : false; Boolean spectators = this.spectatorsCombo.getValue().equals("Oui") ? true : false;
Boolean colorWhite = colorCombo.getValue().equals("Blanc") ? true : false; Boolean colorWhite = this.colorCombo.getValue().equals("Blanc") ? true : false;
int limitMove = Integer.parseInt(createGameTextFieldLimitMove.getText()); int limitMove = Integer.parseInt(this.createGameTextFieldLimitMove.getText());
BorderPane layout = FXMLLoader.load(new URL(main.java.client.main.controller.FXHome.class BorderPane layout = FXMLLoader.load(
.getResource("../fxml/createGame.fxml").toExternalForm())); new URL(main.java.client.main.controller.FXHome.class.getResource("../fxml/createGame.fxml").toExternalForm())
);
Scene scene = new Scene(layout, ClientApp.APPLICATION_WIDTH, ClientApp.APPLICATION_HEIGHT); Scene scene = new Scene(layout, ClientApp.APPLICATION_WIDTH, ClientApp.APPLICATION_HEIGHT);
scene.getStylesheets().add(ClientApp.CSS_FILE_PATH); scene.getStylesheets().add(ClientApp.CSS_FILE_PATH);
...@@ -114,8 +152,7 @@ public class FXCreateGame implements Initializable { ...@@ -114,8 +152,7 @@ public class FXCreateGame implements Initializable {
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
errorFieldsInteger.setVisible(true); errorFieldsInteger.setVisible(true);
} catch (Exception e) { } catch (Exception e) {
if (chatCombo.getValue() == null || spectatorsCombo.getValue() == null || colorCombo.getValue() == null if (this.chatCombo.getValue() == null || this.spectatorsCombo.getValue() == null || this.colorCombo.getValue() == null || this.createGameTextFieldLimitMove.getText().trim().isEmpty()){
|| createGameTextFieldLimitMove.getText().trim().isEmpty()) {
errorFields.setVisible(true); errorFields.setVisible(true);
} else { } else {
System.out.println(e); System.out.println(e);
......
package main.java.client.main.controller; package main.java.client.main.controller;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.layout.Border; import javafx.scene.layout.Border;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.control.DatePicker?> <?import javafx.scene.control.DatePicker?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="889.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.java.client.main.controller.FXProfileConsult"> <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="889.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.java.client.main.controller.FXModifyProfile">
<bottom> <bottom>
<Pane prefHeight="50.0" prefWidth="200.0" BorderPane.alignment="CENTER" /> <Pane prefHeight="50.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
</bottom> </bottom>
......
...@@ -38,17 +38,23 @@ ...@@ -38,17 +38,23 @@
</font> </font>
</Text> </Text>
<Text layoutX="40.0" layoutY="94.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nom" /> <Text layoutX="40.0" layoutY="94.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nom" />
<Text fx:id="displayProfileLastName" layoutX="120.0" layoutY="94.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nom" />
<Text layoutX="41.0" layoutY="171.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Age" /> <Text layoutX="41.0" layoutY="171.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Age" />
<Text fx:id="displayProfileAge" layoutX="121.0" layoutY="171.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Age" />
<Text layoutX="39.0" layoutY="58.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" /> <Text layoutX="39.0" layoutY="58.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" />
<Text fx:id="displayProfilePseudo" layoutX="119.0" layoutY="58.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" />
<Text layoutX="305.0" layoutY="52.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Avatar" /> <Text layoutX="305.0" layoutY="52.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Avatar" />
<Text layoutX="41.0" layoutY="133.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Prénom" /> <Text layoutX="41.0" layoutY="133.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Prénom" />
<Text fx:id="displayProfileFirstName" layoutX="121.0" layoutY="133.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Prénom" />
<ImageView fitHeight="150.0" fitWidth="125.0" layoutX="282.0" layoutY="145.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fitHeight="150.0" fitWidth="125.0" layoutX="282.0" layoutY="145.0" pickOnBounds="true" preserveRatio="true" />
<Button fx:id="viewProfileButtonEdit" layoutX="253.0" layoutY="295.0" mnemonicParsing="false" onMouseClicked="#handleButtonClick" text="Modifier" /> <Button fx:id="viewProfileButtonEdit" layoutX="253.0" layoutY="295.0" mnemonicParsing="false" onMouseClicked="#handleButtonClick" text="Modifier" />
<Button fx:id="viewProfileButtonExport" layoutX="331.0" layoutY="295.0" mnemonicParsing="false" onMouseClicked="#handleButtonClick" text="Exporter" /> <Button fx:id="viewProfileButtonExport" layoutX="331.0" layoutY="295.0" mnemonicParsing="false" onMouseClicked="#handleButtonClick" text="Exporter" />
<Button fx:id="viewProfileButtonClose" layoutX="404.0" layoutY="295.0" mnemonicParsing="false" onMouseClicked="#handleButtonClick" text="Fermer" /> <Button fx:id="viewProfileButtonClose" layoutX="404.0" layoutY="295.0" mnemonicParsing="false" onMouseClicked="#handleButtonClick" text="Fermer" />
<ImageView fitHeight="164.0" fitWidth="134.0" layoutX="305.0" layoutY="70.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fitHeight="164.0" fitWidth="134.0" layoutX="305.0" layoutY="70.0" pickOnBounds="true" preserveRatio="true" />
<Text layoutX="40.0" layoutY="209.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nb parties" /> <Text layoutX="40.0" layoutY="209.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nb parties" />
<Text fx:id="displayProfileNbGames" layoutX="120.0" layoutY="209.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nb parties" />
<Text layoutX="40.0" layoutY="247.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nb victoires" /> <Text layoutX="40.0" layoutY="247.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nb victoires" />
<Text fx:id="displayProfileNbVictories" layoutX="120.0" layoutY="247.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nb victoires" />
</children> </children>
</Pane> </Pane>
</center> </center>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment