Пример #1
0
  private void addAssignmentRow(final Assignment assignment, int insertrow) {
    int j = 0;
    int row =
        (insertrow <= assignmentsTable.getRowCount())
            ? assignmentsTable.insertRow(insertrow)
            : insertrow;

    Image delIcon = getDeleteIcon(assignment);
    // assignment
    assignmentsTable.setWidget(row, j++, delIcon);

    Image icon = new Image();
    icon.setUrl(getIconFile(assignment.getIconFileName()));
    assignmentsTable.setWidget(row, j++, icon);
    assignmentsTable.setWidget(row, j++, new Label(assignment.getToolName()));

    final TextBox textForSolvedAssignment = getHintTextBox(assignment, Result.CORRECT);

    assignmentsTable.setWidget(row, j++, textForSolvedAssignment);

    final ListBox fractions = getFractionsLB(assignment, Result.CORRECT);
    assignmentsTable.setWidget(row, j++, fractions);

    Image editIcon = new Image(GuiResources.INSTANCE.menu_icon_edit());
    editIcon.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            handleEditClick(assignment);
          }
        });
    assignmentsTable.setWidget(row, j++, editIcon);
  }
Пример #2
0
 /**
  * Handles the remove of an Assignment from the Exercise
  *
  * @param event the original event to determine which row should be removed from Table
  * @param assignment the assignment to remove from the Exercise
  */
 void handleAssignmentDeleteClick(ClickEvent event, Assignment assignment) {
   ListItem item =
       userAddModes.addItem(
           app.getKernel().getMacroID(assignment.getTool())
               + EuclidianConstants.MACRO_MODE_ID_OFFSET);
   addDomHandlers(item);
   exercise.remove(assignment);
   assignmentsTable.removeRow(assignmentsTable.getCellForEvent(event).getRowIndex());
 }
Пример #3
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)));
  }