@Override
  public void initialize(
      Localizer localizer,
      TestExerExerciseData oldData,
      EditorHelper<TestExerExerciseData> editorHelper) {

    this.localizer = localizer;

    this.editorHelper = editorHelper;

    editorHelper.getTempManager().initialize();

    doLayout(oldData);
  }
  private void doLayout(TestExerExerciseData oldData) {

    this.setMargin(true);
    this.setSpacing(true);
    this.setWidth("100%");

    String oldQuestion;
    if (oldData != null) {
      oldQuestion = oldData.getQuestion();
    } else {
      oldQuestion = "";
    }

    String oldStartYear;
    if (oldData != null) {
      oldStartYear = Integer.toString(oldData.getStartYear());
    } else {
      oldStartYear = "1900";
    }

    String oldEndYear;
    if (oldData != null) {
      oldEndYear = Integer.toString(oldData.getEndYear());
    } else {
      oldEndYear = "2000";
    }

    String oldResolution;
    if (oldData != null) {
      oldResolution = Integer.toString(oldData.getResolution());
    } else {
      oldResolution = "1";
    }

    VerticalLayout controlsLayout = new VerticalLayout();
    controlsLayout.setWidth("400px");

    controlsLayout.addComponent(editorHelper.getInfoEditorView());

    controlsLayout.addComponent(
        editorHelper.getControlbar(
            new EditedExerciseGiver<TestExerExerciseData>() {

              @Override
              public TestExerExerciseData getCurrExerData(boolean forSaving) {
                return getCurrentExercise();
              }
            }));

    this.addComponent(controlsLayout);

    VerticalLayout editlayout = new VerticalLayout();

    Label questionTextCapt = new Label(localizer.getUIText(TestExerUiConstants.QUESTION));
    questionTextCapt.addStyleName(TestExerThemeConsts.TITLE_STYLE);

    editlayout.addComponent(questionTextCapt);

    questionText = new TextField(null, oldQuestion);

    editlayout.addComponent(questionText);

    eventStartYear = new TextField("Tapahtumien alkuvuosi", oldStartYear);
    editlayout.addComponent(eventStartYear);

    eventEndYear = new TextField("Tapahtumien loppuvuosi", oldEndYear);
    editlayout.addComponent(eventEndYear);

    eventResolution = new TextField("Tapahtumien tarkkuus", oldResolution);
    editlayout.addComponent(eventResolution);

    this.addComponent(editlayout);

    eventTable.setEditable(true);
    eventTable.addContainerProperty("Tapahtuma", String.class, null);
    eventTable.addContainerProperty("Vuosi", String.class, null);
    if (oldData != null) {
      ArrayList<String> eList = oldData.getEventList();
      ArrayList<Integer> aList = oldData.getAnswerList();

      for (int i = 0; i < eList.size(); i++) {
        String eName = eList.get(i);
        Integer aName = aList.get(i);

        if (eName == null) eName = "";
        if (aName == null) aName = 0;
        eventTable.addItem(new Object[] {eName, Integer.toString(aName)}, new Integer(i));
      }
      for (int i = eList.size(); i < maxEvents; i++) {
        eventTable.addItem(new Object[] {"", ""}, new Integer(i));
      }
    } else {
      for (int i = 0; i < maxEvents; i++) {
        eventTable.addItem(new Object[] {"", ""}, new Integer(i));
      }
    }

    this.addComponent(eventTable);
  }