Ejemplo n.º 1
0
 /**
  * If add symbol is clicked, <br>
  * a ToolCreationDialog will be created, if there are no (more) Macros which can be used for the
  * Exercise <br>
  * or a SubMenu like chooser of the tools which can be used for the Exercise will be shown.
  */
 void handleAddClick() {
   if (app.getKernel().getMacroNumber() == 0
       || app.getKernel().getMacroNumber() <= exercise.getParts().size()) {
     newTool();
   } else {
     userAddModes.setVisible(true);
   }
 }
Ejemplo n.º 2
0
  private void check() {
    exercise.checkExercise();

    int k = 1;
    int i = 0; // keep track of the row we're in
    checkAssignmentsTable.setWidget(i, k++, new Label(app.getMenu("Tool")));
    checkAssignmentsTable.setWidget(i, k++, new Label(app.getPlain("Result")));
    checkAssignmentsTable.setWidget(i, k++, new Label(app.getPlain("HintForResult")));
    checkAssignmentsTable.setWidget(i, k++, new Label(app.getPlain("Fraction")));
    i++;

    ArrayList<Assignment> parts = exercise.getParts();
    for (int j = 0; j < parts.size(); j++, i++) {
      final Assignment assignment = parts.get(j);
      Image icon = new Image();
      icon.setUrl(getIconFile(assignment.getIconFileName()));
      k = 0;
      checkAssignmentsTable.setWidget(i, k++, icon);
      checkAssignmentsTable.setWidget(i, k++, new Label(assignment.getToolName()));
      checkAssignmentsTable.setWidget(i, k++, new Label(assignment.getResult().name()));
      checkAssignmentsTable.setWidget(i, k++, new Label(assignment.getHint()));
      checkAssignmentsTable.setWidget(
          i,
          k++,
          new Label(
              app.getKernel()
                  .format(assignment.getFraction() * 100, StringTemplate.defaultTemplate)));
    }

    checkAssignmentsTable.setWidget(i, k = 0, new Label(app.getPlain("FractionTotal")));
    checkAssignmentsTable.setWidget(
        i,
        k++,
        new Label(
            app.getKernel().format(exercise.getFraction() * 100, StringTemplate.defaultTemplate)));
  }
Ejemplo n.º 3
0
 private void createAssignmentsTable() {
   for (Assignment assignment : exercise.getParts()) {
     appendAssignmentRow(assignment);
   }
 }