Search in sources :

Example 6 with LibraryAnswer

use of com.cas.sim.tis.entity.LibraryAnswer in project TeachingInSimulation by ScOrPiOzzy.

the class ExamController method checkAnswer.

/**
 * @param o
 */
private void checkAnswer(ToggleButton button) {
    if (current == null) {
        return;
    }
    LibraryAnswer answer = current.getAnswer();
    if (answer == null) {
        return;
    }
    String answerStr = answer.getAnswer();
    if (StringUtils.isEmpty(answerStr)) {
        answer.setCorrected(AnswerState.ANSWER_STATE_UNDO.getType());
        if (button.getStyleClass().contains("undo")) {
            return;
        } else {
            button.getStyleClass().remove("done");
            button.getStyleClass().add("undo");
        }
    } else if (StringUtils.isEmpty(answerStr.replaceAll("\\|", ""))) {
        answer.setCorrected(AnswerState.ANSWER_STATE_UNDO.getType());
        if (button.getStyleClass().contains("undo")) {
            return;
        } else {
            button.getStyleClass().remove("done");
            button.getStyleClass().add("undo");
        }
    } else {
        answers.put((Integer) button.getUserData(), answer);
        if (button.getStyleClass().contains("done")) {
            return;
        } else {
            button.getStyleClass().add("done");
            button.getStyleClass().remove("undo");
        }
    }
}
Also used : LibraryAnswer(com.cas.sim.tis.entity.LibraryAnswer)

Aggregations

LibraryAnswer (com.cas.sim.tis.entity.LibraryAnswer)6 Question (com.cas.sim.tis.entity.Question)3 ToggleButton (javafx.scene.control.ToggleButton)2 LibraryAnswerAction (com.cas.sim.tis.action.LibraryAnswerAction)1 LibraryRecordAction (com.cas.sim.tis.action.LibraryRecordAction)1 LibraryPublish (com.cas.sim.tis.entity.LibraryPublish)1 LibraryRecord (com.cas.sim.tis.entity.LibraryRecord)1 LibraryRecordMapper (com.cas.sim.tis.mapper.LibraryRecordMapper)1 BlankOption (com.cas.sim.tis.view.control.imp.exam.BlankOption)1 ChoiceOption (com.cas.sim.tis.view.control.imp.exam.ChoiceOption)1 JudgmentOption (com.cas.sim.tis.view.control.imp.exam.JudgmentOption)1 SubjectiveOption (com.cas.sim.tis.view.control.imp.exam.SubjectiveOption)1 ArrayList (java.util.ArrayList)1 KeyFrame (javafx.animation.KeyFrame)1 Timeline (javafx.animation.Timeline)1 ActionEvent (javafx.event.ActionEvent)1 DataSourceTransactionManager (org.springframework.jdbc.datasource.DataSourceTransactionManager)1 TransactionStatus (org.springframework.transaction.TransactionStatus)1 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)1 Condition (tk.mybatis.mapper.entity.Condition)1