/**
  * Adds a user defined tool to the exercise as well as the view
  *
  * @param macro the user defined tool which should be added to the exercise as well as the view
  */
 void addAssignment(Macro macro) {
   if (!exercise.usesMacro(macro)) {
     Assignment a = exercise.addAssignment(macro);
     appendAssignmentRow(a);
   }
   userAddModes.setVisible(false);
 }
  private void createGUI() {

    getCaption().setText(app.getMenu("Exercise.CreateNew"));

    setWidget(mainWidget = new VerticalPanel());
    addDomHandlers(mainWidget);
    assignmentsTable = new FlexTable();
    FlexCellFormatter cellFormatter = assignmentsTable.getFlexCellFormatter();
    cellFormatter.setColSpan(0, 1, 2);

    assignmentsTable.setWidget(0, 1, new Label(app.getPlain("Tool")));
    assignmentsTable.setWidget(0, 2, new Label(app.getPlain("HintForCorrect")));
    assignmentsTable.setWidget(0, 3, new Label(app.getPlain("Fraction")));

    createAssignmentsTable();
    checkAssignmentsTable = new FlexTable();
    checkAssignmentsTable.setVisible(false);

    mainWidget.add(assignmentsTable);
    mainWidget.add(checkAssignmentsTable);

    addList = new UnorderedList();
    addDomHandlers(addList);
    // addIcon = new ListItem();
    Image addIcon = new Image(GuiResources.INSTANCE.menu_icon_file_new());
    ListItem addListItem = new ListItem();
    addListItem.addStyleName("toolbar_item");
    addListItem.add(addIcon);
    addList.add(addListItem);

    userAddModes = new ToolbarSubemuW(app, 1);
    userAddModes.addStyleName("toolbar_item");
    userAddModes.setVisible(false);
    for (int i = 0; i < app.getKernel().getMacroNumber(); i++) {
      if (!exercise.usesMacro(i)) {
        ListItem item = userAddModes.addItem(i + EuclidianConstants.MACRO_MODE_ID_OFFSET);
        addDomHandlers(item);
      }
    }
    addList.add(userAddModes);
    mainWidget.add(addList);

    mainWidget.add(bottomWidget = new FlowPanel());
    bottomWidget.setStyleName("DialogButtonPanel");

    btApply = new Button(app.getPlain("OK"));
    btApply.addClickHandler(this);
    btApply.getElement().getStyle().setMargin(3, Style.Unit.PX);

    addCancelButton();

    btTest = new Button(app.getPlain("Test"));
    btTest.addClickHandler(this);
    btTest.getElement().getStyle().setMargin(3, Style.Unit.PX);

    bottomWidget.add(btTest);
    bottomWidget.add(btApply);
    // bottomWidget.add(btCancel);

  }