Commit d9c848a5 authored by Peining Li's avatar Peining Li
Browse files

Merge branch 'ihm-main/clean_code' into 'ihm-main/develop'

Ihm main/clean code

See merge request !124
parents e04851bc 61b63f46
......@@ -27,10 +27,11 @@ import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.stage.Stage;
/**
* Object: display all info of player profile.
* Display user's own profile (writable)
* Display others profiles (read-only)
* Displays all info of player profile.
* Displays user's own profile (writable).
* Displays others profiles (read-only).
*
* @author Lipeining
*/
......@@ -66,6 +67,7 @@ public class PlayerProfileController extends AbstractController{
private void back(ActionEvent event) throws IOException{
getIhmmain().toMenu();
}
@FXML
private void toPlayerList(ActionEvent event) throws IOException{
getIhmmain().toPlayerList();
......@@ -78,6 +80,7 @@ public class PlayerProfileController extends AbstractController{
text = description.getText();
description.setText(text);
}
@FXML
private void closeEdit(KeyEvent event) throws IOException{
KeyCode code = event.getCode();
......@@ -85,34 +88,40 @@ public class PlayerProfileController extends AbstractController{
description.setEditable(false);
}
}
@FXML
private void editPlayerName(ActionEvent event) throws IOException{
attribut="PlayerName";
popup(attribut);
}
@FXML
private void editFirstName(ActionEvent event) throws IOException{
attribut="FirstName";
popup(attribut);
}
@FXML
private void editLastName(ActionEvent event) throws IOException{
attribut="LastName";
popup(attribut);
}
@FXML
private void editBirthday(ActionEvent event) throws IOException{
attribut="Birthday";
popup(attribut);
}
@FXML
private void editPassword(ActionEvent event) throws IOException{
attribut="Password";
popup(attribut);
}
/**
* Generate a pop-up
* @param attribut:name of info that user would like to modify
* Generates a pop-up.
* @param attribut : name of info that user would like to modify
* @throws IOException
*/
private void popup(String attribut) throws IOException{
......@@ -132,7 +141,7 @@ public class PlayerProfileController extends AbstractController{
popup.show();
}
/**
* This function is for receiving the profile of other player asked by user
* This method is for receiving the profile of other player asked by user.
* @param player: profile sent by Data for us to display
* @throws IOException
*/
......@@ -142,8 +151,9 @@ public class PlayerProfileController extends AbstractController{
other = player;
}
}
/**
* This function is for waiting the profile
* This method is for waiting the profile.
* As soon as receive the profile sent by Data, skip the loading and refresh the page.
* @throws IOException
*/
......@@ -201,6 +211,7 @@ public class PlayerProfileController extends AbstractController{
new Thread(wait).start();
}
}
public void getAvatar(){
byte[] thumbnail = getFacade().iDataIHMMain.getMyPublicUserProfile().getLightPublicUser().getAvatarThumbnail();
//System.out.println(thumbnail);
......@@ -209,8 +220,9 @@ public class PlayerProfileController extends AbstractController{
}
@Override
/**
* Initialize all the info of profile
* Initializes all the info of profile.
*/
@Override
public void refresh(){
if (!isOther){
try{
......
......@@ -11,9 +11,9 @@ import javafx.scene.Node;
import javafx.scene.control.TextArea;
/**
* Object: Generate a pop-up to enter and to send new info to update player profile
* According to the label transformed by interface player profile, this controller will call
* the update function corresponding created by Data.
* Generates a pop-up to enter and to send new info to update player profile.
* According to the label transformed by interface player profile,
* this controller will call the update function corresponding created by Data.
*
* @author lipeining
*/
......
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