
package de.ivu.elect.presentation.kandidatur;

import javax.annotation.Nullable;
import javax.inject.Inject;

import de.ivu.elect.presentation.kandidatur.form.ListenkandidaturViewFormBuilder;

public class ListenkandidaturCreateViewHelper extends AbstractListenkandidaturCreateViewHelper {

  private static final long serialVersionUID = 1L;

  @Inject
  protected transient ListenkandidaturViewFormBuilder listenkandidaturViewFormBuilder;

  public ListenkandidaturCreateViewHelper() {
    super();
  }

  public void preRenderView() {
    kandidaturCreateViewHelper.checkAutoCompleteOptionsExist(getSelectedWahl());
  }

  @Override
  @Nullable
  public String checkPreCondition() {
    if (isListeForGebietSelected()) {
      return null;
    }

    return cancel();
  }

  @Override
  public String getParentViewId() {
    return AbstractListenkandidaturCreateNoScopeView.PARENT_VIEW_ID;
  }

  @Override
  public String getViewId() {
    return AbstractListenkandidaturCreateNoScopeView.VIEW_ID;
  }

  @Override
  protected ListenkandidaturViewFormBuilder getViewFormBuilder() {
    return listenkandidaturViewFormBuilder;
  }
}
