Commit 18ce71b3 authored by Peining's avatar Peining
Browse files

Add alert for null string when updating profile.

parent fb7d677c
......@@ -20,6 +20,7 @@ import javafx.scene.control.TextArea;
public class PopupController extends AbstractController{
public String label;
private boolean textnull = true;
@FXML
private TextArea field;
@FXML
......@@ -30,7 +31,12 @@ public class PopupController extends AbstractController{
private void update(ActionEvent event) throws IOException, DataException{
String text;
text = field.getText();
switch(label){
if (text.isEmpty()){
field.setText("Can not send empty string");
}
else{
textnull = false;
switch(label){
case "PlayerName":
getFacade().iDataIHMMain.updatePlayername(text);
break;
......@@ -48,14 +54,16 @@ public class PopupController extends AbstractController{
getFacade().iDataIHMMain.updatePassword(text);
break;
default:
Logger.getLogger(
PopupController.class.getName()).log(
Logger.getLogger( PopupController.class.getName()).log(
Level.INFO,
"[PlayerProfile] - error update profile, attribut not found."
);
}
}
if(textnull == false){
getIhmmain().controllerMap.get(SceneName.PLAYER_PROFILE.toString()).refresh();
((Node) (event.getSource())).getScene().getWindow().hide();
}
getIhmmain().controllerMap.get(SceneName.PLAYER_PROFILE.toString()).refresh();
((Node) (event.getSource())).getScene().getWindow().hide();
}
/**
*
......
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