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

import javax.annotation.Nullable;

import de.ivu.elect.business.konfiguration.entity.CustomParameter;
import de.ivu.elect.jee.faces.Messages;
import de.ivu.elect.jee.presentation.Icons;
import de.ivu.elect.jee.presentation.dynamictable.ColumnType;
import de.ivu.elect.presentation.table.DefaultColumnEntry;

public class CustomParameterWertTypColumn<E extends CustomParameter< ? >> extends DefaultColumnEntry<E> {

  private static final long serialVersionUID = 1L;

  private final Icons icons;

  public CustomParameterWertTypColumn(Messages messages, Icons icons) {
    super("CustomParameter-WertTyp", messages, "custom.parameter.wert.typ", ColumnType.STRING, parameter -> "");

    this.icons = icons;
  }

  @Override
  public String getTooltip(E parameter) {
    return getMessage(parameter.getWertTyp());
  }

  @Override
  public boolean isIconPresent() {
    return true;
  }

  @Override
  public boolean isIconRendered(E parameter) {
    return true;
  }

  @Override
  @Nullable
  public String getIcon(E parameter) {
    return parameter.getWertTyp().getIcon(icons);
  }
}
