implemented the question edit
This commit is contained in:
parent
af87631ff1
commit
e3f033d1e5
@ -77,8 +77,7 @@ public class ViewController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void deleteQuestion(ActionEvent actionEvent) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ public class ViewController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void editQuestion(ActionEvent actionEvent) throws SQLException {
|
private void editQuestion(ActionEvent actionEvent) throws SQLException {
|
||||||
if(this.isInEditState){
|
if (this.isInEditState) {
|
||||||
this.currentQuestion.setQuestion(this.questionField.getText());
|
this.currentQuestion.setQuestion(this.questionField.getText());
|
||||||
this.currentQuestion.setAnswer(this.answerField.getText());
|
this.currentQuestion.setAnswer(this.answerField.getText());
|
||||||
QuestionService.UpdateQuestion(this.currentQuestion);
|
QuestionService.UpdateQuestion(this.currentQuestion);
|
||||||
@ -100,16 +99,14 @@ public class ViewController {
|
|||||||
|
|
||||||
this.isInEditState = false;
|
this.isInEditState = false;
|
||||||
this.setEditableAndSetDisabled(false);
|
this.setEditableAndSetDisabled(false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.setEditableAndSetDisabled(true);
|
this.setEditableAndSetDisabled(true);
|
||||||
this.editButton.setText("Save");
|
this.editButton.setText("Save");
|
||||||
this.isInEditState = true;
|
this.isInEditState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setEditableAndSetDisabled(boolean value)
|
private void setEditableAndSetDisabled(boolean value) {
|
||||||
{
|
|
||||||
questionField.setEditable(value);
|
questionField.setEditable(value);
|
||||||
answerField.setEditable(value);
|
answerField.setEditable(value);
|
||||||
this.questionListView.setDisable(value);
|
this.questionListView.setDisable(value);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user