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

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

import javax.inject.Named;

import de.ivu.elect.business.wahl.entity.Wahlart;
import de.ivu.elect.jee.presentation.dynamictable.AbstractColumnBuilder;
import de.ivu.elect.jee.presentation.dynamictable.ColumnEntry;
import de.ivu.elect.presentation.table.ColorColumnEntryWrapper;

@Named(WahlartColumnBuilder.COMPONENT_NAME)
public class WahlartColumnBuilder extends AbstractColumnBuilder<Wahlart> {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "wahlartColumnBuilder";

  private AbstractWahlartColumn<Wahlart> wahlartNameColumn;

  private AbstractWahlartColumn<Wahlart> wahlartTitelColumn;

  private ColorColumnEntryWrapper<Wahlart> wahlartFarbeColumn;

  private AbstractWahlartColumn<Wahlart> wahlartCommonWahlartColumn;

  public WahlartColumnBuilder() {
    super();
  }

  @Override
  protected void initColumns() {
    wahlartNameColumn = AbstractWahlartColumn.createWahlartNameColumn(getMessages());
    wahlartTitelColumn = AbstractWahlartColumn.createWahlartTitelColumn(getMessages());
    wahlartFarbeColumn = ColorColumnEntryWrapper.wrap(AbstractWahlartColumn.createWahlartFarbeColumn(getMessages()));
    wahlartCommonWahlartColumn = AbstractWahlartColumn.createWahlartCommonWahlartColumn(getMessages());
  }

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

    result.add(wahlartFarbeColumn);
    result.add(wahlartNameColumn);
    result.add(wahlartTitelColumn);
    result.add(wahlartCommonWahlartColumn);

    return result;
  }
}
