
package de.ivu.elect.presentation.ergebnis.table;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.ergebnis.entity.DHondtQuotient;
import de.ivu.elect.jee.presentation.dynamictable.AbstractColumnBuilder;
import de.ivu.elect.jee.presentation.dynamictable.ColumnEntry;
import de.ivu.elect.presentation.gebietsbaum.GebietNummerFormatter;

public abstract class AbstractDHondtQuotientColumnBuilder<T extends DHondtQuotient> extends AbstractColumnBuilder<T> {

  private static final long serialVersionUID = 1L;

  @Inject
  protected transient GebietNummerFormatter gebietNummerFormatter;

  private AbstractDHondtQuotientColumn<DHondtQuotient> dHondtQuotientQuotientenwertRangColumn;

  private AbstractDHondtQuotientColumn<DHondtQuotient> dHondtQuotientSitzgewinnColumn;

  private AbstractDHondtQuotientColumn<DHondtQuotient> dHondtQuotientZaehlerColumn;

  private AbstractDHondtQuotientColumn<DHondtQuotient> dHondtQuotientNennerColumn;

  private AbstractDHondtQuotientColumn<DHondtQuotient> dHondtQuotientQuotientenwertColumn;

  private AbstractDHondtQuotientColumn<DHondtQuotient> teilnehmerAmLosverfahrenColumn;

  public AbstractDHondtQuotientColumnBuilder() {
    super();
  }

  @Override
  protected void initColumns() {
    dHondtQuotientZaehlerColumn = AbstractDHondtQuotientColumn.createDHondtQuotientZaehlerColumn(getMessages());
    dHondtQuotientNennerColumn = AbstractDHondtQuotientColumn.createDHondtQuotientNennerColumn(getMessages());
    dHondtQuotientQuotientenwertColumn = new DHondtQuotientQuotientenwertColumn(getMessages());
    dHondtQuotientQuotientenwertRangColumn = AbstractDHondtQuotientColumn.createDHondtQuotientRangColumn(getMessages());

    dHondtQuotientSitzgewinnColumn = AbstractDHondtQuotientColumn.createDHondtQuotientSitzgewinnColumn(getMessages());

    teilnehmerAmLosverfahrenColumn = AbstractDHondtQuotientColumn.createDHondtQuotientTeilnehmerAmLosverfahrenColumn(getMessages());
  }

  @Override
  protected List<ColumnEntry< ? super T>> getColumnEntriesSorted() {
    List<ColumnEntry< ? super T>> result = new ArrayList<>();

    result.add(dHondtQuotientZaehlerColumn);
    result.add(dHondtQuotientNennerColumn);
    result.add(dHondtQuotientQuotientenwertColumn);
    result.add(dHondtQuotientQuotientenwertRangColumn);

    result.add(dHondtQuotientSitzgewinnColumn);

    addTeilnehmerColumnEntriesSorted(result);

    result.add(teilnehmerAmLosverfahrenColumn);

    return result;
  }

  protected abstract void addTeilnehmerColumnEntriesSorted(List<ColumnEntry< ? super T>> result);
}
