Search in sources :

Example 1 with FreeAnswerQuizHelper

use of org.stepik.core.courseFormat.stepHelpers.FreeAnswerQuizHelper in project intellij-plugins by StepicOrg.

the class StudyToolWindow method setText.

private void setText(@Nullable StepNode stepNode) {
    if (stepNode == null) {
        setEmptyText();
        rightPanel.setVisible(false);
        return;
    }
    browserWindow.showLoadAnimation();
    StepType stepType = stepNode.getType();
    if (stepType != VIDEO && stepType != CODE) {
        SwingUtilities.invokeLater(() -> rightPanel.setVisible(false));
    }
    boolean isTheory = stepType == VIDEO || stepType == TEXT;
    postView(stepNode, isTheory);
    StepHelper stepHelper = null;
    switch(stepType) {
        case UNKNOWN:
            stepHelper = new StepHelper(project, stepNode);
            break;
        case CODE:
            stepHelper = new CodeQuizHelper(project, stepNode);
            updateLanguageBox(stepNode);
            break;
        case TEXT:
            stepHelper = new TextTheoryHelper(project, stepNode);
            break;
        case VIDEO:
            stepHelper = new VideoTheoryHelper(project, stepNode);
            break;
        case CHOICE:
            stepHelper = new ChoiceQuizHelper(project, stepNode);
            break;
        case STRING:
            stepHelper = new StringQuizHelper(project, stepNode);
            break;
        case SORTING:
            stepHelper = new SortingQuizHelper(project, stepNode);
            break;
        case MATCHING:
            stepHelper = new MatchingQuizHelper(project, stepNode);
            break;
        case NUMBER:
            stepHelper = new NumberQuizHelper(project, stepNode);
            break;
        case DATASET:
            stepHelper = new DatasetQuizHelper(project, stepNode);
            break;
        case TABLE:
            stepHelper = new TableQuizHelper(project, stepNode);
            break;
        case FILL_BLANKS:
            stepHelper = new QuizHelper(project, stepNode);
            break;
        case MATH:
            stepHelper = new QuizHelper(project, stepNode);
            break;
        case FREE_ANSWER:
            stepHelper = new FreeAnswerQuizHelper(project, stepNode);
            break;
    }
    HashMap<String, Object> params = new HashMap<>();
    params.put("stepNode", stepHelper);
    params.put("darcula", LafManager.getInstance().getCurrentLookAndFeel() instanceof DarculaLookAndFeelInfo);
    browserWindow.loadContent("quiz/" + stepHelper.getType(), params);
}
Also used : CodeQuizHelper(org.stepik.core.courseFormat.stepHelpers.CodeQuizHelper) TableQuizHelper(org.stepik.core.courseFormat.stepHelpers.TableQuizHelper) HashMap(java.util.HashMap) StepType(org.stepik.core.courseFormat.StepType) DarculaLookAndFeelInfo(com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo) TextTheoryHelper(org.stepik.core.courseFormat.stepHelpers.TextTheoryHelper) StringQuizHelper(org.stepik.core.courseFormat.stepHelpers.StringQuizHelper) VideoTheoryHelper(org.stepik.core.courseFormat.stepHelpers.VideoTheoryHelper) SortingQuizHelper(org.stepik.core.courseFormat.stepHelpers.SortingQuizHelper) ChoiceQuizHelper(org.stepik.core.courseFormat.stepHelpers.ChoiceQuizHelper) StringQuizHelper(org.stepik.core.courseFormat.stepHelpers.StringQuizHelper) QuizHelper(org.stepik.core.courseFormat.stepHelpers.QuizHelper) DatasetQuizHelper(org.stepik.core.courseFormat.stepHelpers.DatasetQuizHelper) TableQuizHelper(org.stepik.core.courseFormat.stepHelpers.TableQuizHelper) MatchingQuizHelper(org.stepik.core.courseFormat.stepHelpers.MatchingQuizHelper) FreeAnswerQuizHelper(org.stepik.core.courseFormat.stepHelpers.FreeAnswerQuizHelper) SortingQuizHelper(org.stepik.core.courseFormat.stepHelpers.SortingQuizHelper) NumberQuizHelper(org.stepik.core.courseFormat.stepHelpers.NumberQuizHelper) CodeQuizHelper(org.stepik.core.courseFormat.stepHelpers.CodeQuizHelper) MatchingQuizHelper(org.stepik.core.courseFormat.stepHelpers.MatchingQuizHelper) NumberQuizHelper(org.stepik.core.courseFormat.stepHelpers.NumberQuizHelper) DatasetQuizHelper(org.stepik.core.courseFormat.stepHelpers.DatasetQuizHelper) StepHelper(org.stepik.core.courseFormat.stepHelpers.StepHelper) FreeAnswerQuizHelper(org.stepik.core.courseFormat.stepHelpers.FreeAnswerQuizHelper) ChoiceQuizHelper(org.stepik.core.courseFormat.stepHelpers.ChoiceQuizHelper)

Aggregations

DarculaLookAndFeelInfo (com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo)1 HashMap (java.util.HashMap)1 StepType (org.stepik.core.courseFormat.StepType)1 ChoiceQuizHelper (org.stepik.core.courseFormat.stepHelpers.ChoiceQuizHelper)1 CodeQuizHelper (org.stepik.core.courseFormat.stepHelpers.CodeQuizHelper)1 DatasetQuizHelper (org.stepik.core.courseFormat.stepHelpers.DatasetQuizHelper)1 FreeAnswerQuizHelper (org.stepik.core.courseFormat.stepHelpers.FreeAnswerQuizHelper)1 MatchingQuizHelper (org.stepik.core.courseFormat.stepHelpers.MatchingQuizHelper)1 NumberQuizHelper (org.stepik.core.courseFormat.stepHelpers.NumberQuizHelper)1 QuizHelper (org.stepik.core.courseFormat.stepHelpers.QuizHelper)1 SortingQuizHelper (org.stepik.core.courseFormat.stepHelpers.SortingQuizHelper)1 StepHelper (org.stepik.core.courseFormat.stepHelpers.StepHelper)1 StringQuizHelper (org.stepik.core.courseFormat.stepHelpers.StringQuizHelper)1 TableQuizHelper (org.stepik.core.courseFormat.stepHelpers.TableQuizHelper)1 TextTheoryHelper (org.stepik.core.courseFormat.stepHelpers.TextTheoryHelper)1 VideoTheoryHelper (org.stepik.core.courseFormat.stepHelpers.VideoTheoryHelper)1