Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alexandre Ducarne
ai12-othello
Commits
3317cc7a
Commit
3317cc7a
authored
Nov 27, 2019
by
Thomas Lecluse
Browse files
Merge branch 'feature/main/cleanV2' into 'int/v2'
Feature/main/clean v2 See merge request
!37
parents
239befc8
8d09de53
Changes
5
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
3317cc7a
...
@@ -63,14 +63,14 @@
...
@@ -63,14 +63,14 @@
<mainClass>
main.java.Main
</mainClass>
<mainClass>
main.java.Main
</mainClass>
</configuration>
</configuration>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>
org.openjfx
</groupId>
<groupId>
org.openjfx
</groupId>
<artifactId>
javafx-maven-plugin
</artifactId>
<artifactId>
javafx-maven-plugin
</artifactId>
<version>
0.0.3
</version>
<version>
0.0.3
</version>
<configuration>
<configuration>
<mainClass>
main.java.Main
</mainClass>
<mainClass>
main.java.Main
</mainClass>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
<resources>
<resources>
<resource>
<resource>
...
...
src/main/java/client/main/controller/FXCreateGame.java
View file @
3317cc7a
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,105 +35,130 @@ import main.java.client.main.model.MainApplicationModel;
...
@@ -23,105 +35,130 @@ 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
Stage
stage
;
private
MainApplicationModel
model
;
private
Stage
stage
;
@FXML
protected
ComboBox
<
String
>
spectatorsCombo
=
new
ComboBox
<>();
@FXML
@FXML
protected
ComboBox
<
String
>
spectatorsCombo
=
new
ComboBox
<
String
>();
private
ComboBox
<
String
>
chatCombo
;
@FXML
@FXML
private
ComboBox
<
String
>
chatCombo
;
protected
ComboBox
<
String
>
colorCombo
=
new
ComboBox
<>();
@FXML
@FXML
protected
ComboBox
<
String
>
colorCombo
=
new
ComboBox
<
String
>();
private
TextField
createGameTextFieldLimitMove
;
@FXML
@FXML
private
TextField
createGameTextFieldLimitMove
;
private
Text
errorFields
;
@FXML
@FXML
private
Text
errorFields
;
private
Text
errorFieldsInteger
;
@FXML
public
FXCreateGame
()
{
private
Text
errorFieldsInteger
;
model
=
ClientApp
.
mainCore
.
getFX
().
getModel
();
stage
=
new
Stage
();
}
public
FXCreateGame
(){
this
.
model
=
ClientApp
.
mainCore
.
getFX
().
getModel
();
public
void
setStage
(
Stage
stage
)
{
stage
=
new
Stage
();
this
.
stage
=
stage
;
}
}
public
void
setStage
(
Stage
stage
){
@Override
this
.
stage
=
stage
;
public
void
initialize
(
URL
fxmlFileLocation
,
ResourceBundle
resources
)
{
}
errorFields
.
setVisible
(
false
);
public
void
initialize
(
URL
fxmlFileLocation
,
ResourceBundle
resources
)
{
errorFields
.
setFill
(
Color
.
RED
);
errorFields
.
setVisible
(
false
);
errorFieldsInteger
.
setVisible
(
false
);
errorFields
.
setFill
(
Color
.
RED
);
errorFieldsInteger
.
setFill
(
Color
.
RED
);
errorFieldsInteger
.
setVisible
(
false
);
chatCombo
.
getItems
().
setAll
(
"Oui"
,
"Non"
);
errorFieldsInteger
.
setFill
(
Color
.
RED
);
chatCombo
.
getSelectionModel
().
selectedItemProperty
()
.
addListener
((
ChangeListener
<
String
>)
(
selected
,
oldValue
,
newValue
)
->
System
.
out
.
println
(
newValue
));
chatCombo
.
getItems
().
setAll
(
"Oui"
,
"Non"
);
chatCombo
.
getSelectionModel
().
selectedItemProperty
().
addListener
(
spectatorsCombo
.
getItems
().
setAll
(
"Oui"
,
"Non"
);
new
ChangeListener
<
String
>()
{
spectatorsCombo
.
getSelectionModel
().
selectedItemProperty
()
@Override
.
addListener
((
ChangeListener
<
String
>)
(
selected
,
oldValue
,
newValue
)
->
System
.
out
.
println
(
newValue
));
public
void
changed
(
ObservableValue
<?
extends
String
>
selected
,
//
String
oldValue
,
String
newValue
)
{
colorCombo
.
getItems
().
setAll
(
"Blanc"
,
"Noir"
);
System
.
out
.
println
(
newValue
);
colorCombo
.
getSelectionModel
().
selectedItemProperty
()
}
.
addListener
((
ChangeListener
<
String
>)
(
selected
,
oldValue
,
newValue
)
->
System
.
out
.
println
(
newValue
));
}
);
}
spectatorsCombo
.
getItems
().
setAll
(
"Oui"
,
"Non"
);
@FXML
spectatorsCombo
.
getSelectionModel
().
selectedItemProperty
().
addListener
(
private
void
handleButtonClick
(
MouseEvent
e
)
throws
IOException
{
new
ChangeListener
<
String
>()
{
String
buttonSource
=
((
Button
)
e
.
getSource
()).
getId
();
@Override
switch
(
buttonSource
)
{
public
void
changed
(
ObservableValue
<?
extends
String
>
selected
,
//
case
"createGameButtonValidate"
:
String
oldValue
,
String
newValue
)
{
createGame
();
System
.
out
.
println
(
newValue
);
break
;
}
case
"createGameButtonClose"
:
}
stage
=
(
Stage
)
((
Node
)
e
.
getSource
()).
getScene
().
getWindow
();
);
FXHome
fxHome
=
new
FXHome
();
fxHome
.
initialize
(
"../fxml/home.fxml"
,
stage
);
colorCombo
.
getItems
().
setAll
(
"Blanc"
,
"Noir"
);
break
;
colorCombo
.
getSelectionModel
().
selectedItemProperty
().
addListener
(
default
:
new
ChangeListener
<
String
>()
{
System
.
out
.
println
(
"["
+
buttonSource
+
"] A handler button was triggered, but no action was performed."
);
@Override
}
public
void
changed
(
ObservableValue
<?
extends
String
>
selected
,
//
}
String
oldValue
,
String
newValue
)
{
System
.
out
.
println
(
newValue
);
private
void
createGame
()
throws
IOException
{
}
}
UserLight
userLight
=
model
.
getUserLight
();
);
try
{
}
Boolean
chat
=
chatCombo
.
getValue
().
equals
(
"Oui"
)
?
true
:
false
;
Boolean
spectators
=
spectatorsCombo
.
getValue
().
equals
(
"Oui"
)
?
true
:
false
;
@FXML
Boolean
colorWhite
=
colorCombo
.
getValue
().
equals
(
"Blanc"
)
?
true
:
false
;
private
void
handleButtonClick
(
MouseEvent
e
)
throws
IOException
{
int
limitMove
=
Integer
.
parseInt
(
createGameTextFieldLimitMove
.
getText
());
String
buttonSource
=
((
Button
)
e
.
getSource
()).
getId
();
switch
(
buttonSource
){
BorderPane
layout
=
FXMLLoader
.
load
(
new
URL
(
main
.
java
.
client
.
main
.
controller
.
FXHome
.
class
case
"createGameButtonValidate"
:
.
getResource
(
"../fxml/createGame.fxml"
).
toExternalForm
()));
createGame
();
break
;
Scene
scene
=
new
Scene
(
layout
,
ClientApp
.
APPLICATION_WIDTH
,
ClientApp
.
APPLICATION_HEIGHT
);
case
"createGameButtonClose"
:
scene
.
getStylesheets
().
add
(
ClientApp
.
CSS_FILE_PATH
);
this
.
stage
=
(
Stage
)((
Node
)
e
.
getSource
()).
getScene
().
getWindow
();
FXHome
fxHome
=
new
FXHome
();
System
.
out
.
println
(
chat
+
" "
+
spectators
+
" "
+
colorWhite
+
" "
+
limitMove
);
fxHome
.
initialize
(
"../fxml/home.fxml"
,
this
.
stage
);
ClientApp
.
mainCore
.
getMainToData
().
newGame
(
userLight
,
spectators
,
chat
,
colorWhite
,
limitMove
,
stage
);
break
;
}
catch
(
NumberFormatException
e
)
{
default
:
errorFieldsInteger
.
setVisible
(
true
);
System
.
out
.
println
(
"["
+
buttonSource
+
"] A handler button was triggered, but no action was performed."
);
}
catch
(
Exception
e
)
{
}
if
(
chatCombo
.
getValue
()
==
null
||
spectatorsCombo
.
getValue
()
==
null
||
colorCombo
.
getValue
()
==
null
}
||
createGameTextFieldLimitMove
.
getText
().
trim
().
isEmpty
())
{
errorFields
.
setVisible
(
true
);
}
else
{
private
void
createGame
()
throws
IOException
{
System
.
out
.
println
(
e
);
}
UserLight
userLight
=
this
.
model
.
getUserLight
();
}
try
{
}
Boolean
chat
=
this
.
chatCombo
.
getValue
().
equals
(
"Oui"
)
?
true
:
false
;
Boolean
spectators
=
this
.
spectatorsCombo
.
getValue
().
equals
(
"Oui"
)
?
true
:
false
;
Boolean
colorWhite
=
this
.
colorCombo
.
getValue
().
equals
(
"Blanc"
)
?
true
:
false
;
int
limitMove
=
Integer
.
parseInt
(
this
.
createGameTextFieldLimitMove
.
getText
());
BorderPane
layout
=
FXMLLoader
.
load
(
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
.
getStylesheets
().
add
(
ClientApp
.
CSS_FILE_PATH
);
System
.
out
.
println
(
chat
+
" "
+
spectators
+
" "
+
colorWhite
+
" "
+
limitMove
);
ClientApp
.
mainCore
.
getMainToData
().
newGame
(
userLight
,
spectators
,
chat
,
colorWhite
,
limitMove
,
stage
);
}
catch
(
NumberFormatException
e
)
{
errorFieldsInteger
.
setVisible
(
true
);
}
catch
(
Exception
e
)
{
if
(
this
.
chatCombo
.
getValue
()
==
null
||
this
.
spectatorsCombo
.
getValue
()
==
null
||
this
.
colorCombo
.
getValue
()
==
null
||
this
.
createGameTextFieldLimitMove
.
getText
().
trim
().
isEmpty
()){
errorFields
.
setVisible
(
true
);
}
else
{
System
.
out
.
println
(
e
);
}
}
}
}
}
src/main/java/client/main/controller/FXHome.java
View file @
3317cc7a
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
;
...
...
src/main/java/client/main/fxml/modifyProfile.fxml
View file @
3317cc7a
...
@@ -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.FXProfile
Consult
"
>
<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.FX
Modify
Profile"
>
<bottom>
<bottom>
<Pane
prefHeight=
"50.0"
prefWidth=
"200.0"
BorderPane.alignment=
"CENTER"
/>
<Pane
prefHeight=
"50.0"
prefWidth=
"200.0"
BorderPane.alignment=
"CENTER"
/>
</bottom>
</bottom>
...
...
src/main/java/client/main/fxml/viewProfile.fxml
View file @
3317cc7a
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment