implemented the question edit
This commit is contained in:
parent
af87631ff1
commit
e3f033d1e5
@ -77,8 +77,7 @@ public class ViewController {
|
||||
|
||||
@FXML
|
||||
private void deleteQuestion(ActionEvent actionEvent) {
|
||||
if(!showConfirmationButton("Do you want to proceed with deletion of the question: \n" + currentQuestion.getQuestion()))
|
||||
{
|
||||
if (!showConfirmationButton("Do you want to proceed with deletion of the question: \n" + currentQuestion.getQuestion())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -90,26 +89,24 @@ public class ViewController {
|
||||
|
||||
@FXML
|
||||
private void editQuestion(ActionEvent actionEvent) throws SQLException {
|
||||
if(this.isInEditState){
|
||||
this.currentQuestion.setQuestion(this.questionField.getText());
|
||||
this.currentQuestion.setAnswer(this.answerField.getText());
|
||||
QuestionService.UpdateQuestion(this.currentQuestion);
|
||||
if (this.isInEditState) {
|
||||
this.currentQuestion.setQuestion(this.questionField.getText());
|
||||
this.currentQuestion.setAnswer(this.answerField.getText());
|
||||
QuestionService.UpdateQuestion(this.currentQuestion);
|
||||
|
||||
this.editButton.setText("Edit");
|
||||
questionListView.refresh();
|
||||
this.editButton.setText("Edit");
|
||||
questionListView.refresh();
|
||||
|
||||
this.isInEditState = false;
|
||||
this.setEditableAndSetDisabled(false);
|
||||
}
|
||||
else {
|
||||
this.setEditableAndSetDisabled(true);
|
||||
this.editButton.setText("Save");
|
||||
this.isInEditState = true;
|
||||
}
|
||||
this.isInEditState = false;
|
||||
this.setEditableAndSetDisabled(false);
|
||||
} else {
|
||||
this.setEditableAndSetDisabled(true);
|
||||
this.editButton.setText("Save");
|
||||
this.isInEditState = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void setEditableAndSetDisabled(boolean value)
|
||||
{
|
||||
private void setEditableAndSetDisabled(boolean value) {
|
||||
questionField.setEditable(value);
|
||||
answerField.setEditable(value);
|
||||
this.questionListView.setDisable(value);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user