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

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

import javax.inject.Inject;
import javax.inject.Named;

import de.ivu.elect.business.geodata.entity.GeodataOrt;
import de.ivu.elect.business.geodata.entity.GeodataOrtMeta;
import de.ivu.elect.jee.presentation.dynamictable.AbstractColumnBuilder;
import de.ivu.elect.jee.presentation.dynamictable.ColumnEntry;

@Named(GeodataOrtColumnBuilder.COMPONENT_NAME)
public class GeodataOrtColumnBuilder extends AbstractColumnBuilder<GeodataOrt> {

  public static final String COMPONENT_NAME = "geodataOrtColumnBuilder";

  private static final long serialVersionUID = 1L;

  @Inject
  private GeodataOrtMeta geodataOrtMeta;

  private AbstractGeodataOrtColumn<GeodataOrt> geodataOrtOrtsnameColumn;

  private AbstractGeodataOrtColumn<GeodataOrt> geodataOrtOrtsteilnameColumn;

  private GeodataOrtGeodataPlzColumn<GeodataOrt> geodataOrtGeodataPlzColumn;

  public GeodataOrtColumnBuilder() {
    super();
  }

  @Override
  protected void initColumns() {
    geodataOrtOrtsnameColumn =  AbstractGeodataOrtColumn.createGeodataOrtOrtsnameColumn(getMessages());
    geodataOrtOrtsteilnameColumn =  AbstractGeodataOrtColumn.createGeodataOrtOrtsteilnameColumn(getMessages());
    geodataOrtGeodataPlzColumn = new GeodataOrtGeodataPlzColumn<>(getMessages(), geodataOrtMeta);
  }

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

    result.add(geodataOrtOrtsnameColumn);
    result.add(geodataOrtOrtsteilnameColumn);
    result.add(geodataOrtGeodataPlzColumn);

    return result;
  }
}
