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

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

import de.ivu.elect.business.konfiguration.entity.CustomParameter;
import de.ivu.elect.jee.presentation.dynamictable.AbstractColumnBuilder;
import de.ivu.elect.jee.presentation.dynamictable.ColumnEntry;

public abstract class AbstractCustomParameterColumnBuilder<E extends CustomParameter< ? >> extends AbstractColumnBuilder<E> {

  private static final long serialVersionUID = 1L;

  private CustomParameterKategorieColumn<E> customParameterKategorieColumn;

  private CustomParameterKeyColumn<E> customParameterKeyColumn;

  private CustomParameterWertColumn<E> customParameterWertColumn;

  private CustomParameterWertTypColumn<E> customParameterWertTypColumn;

  private CustomParameterWertValidColumn<E> customParameterWertValidColumn;

  public AbstractCustomParameterColumnBuilder() {
    super();
  }

  @Override
  protected void initColumns() {
    customParameterKategorieColumn = new CustomParameterKategorieColumn<>(getMessages());
    customParameterKeyColumn = new CustomParameterKeyColumn<>(getMessages());
    customParameterWertColumn = new CustomParameterWertColumn<>(getMessages(), getUserLocale());
    customParameterWertTypColumn = new CustomParameterWertTypColumn<>(getMessages(), getIcons());
    customParameterWertValidColumn = new CustomParameterWertValidColumn<>(getMessages(), getIcons());
  }

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

    result.add(customParameterKategorieColumn);
    result.add(customParameterKeyColumn);
    result.add(customParameterWertTypColumn);
    result.add(customParameterWertColumn);
    result.add(customParameterWertValidColumn);

    return result;
  }
}
