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

import de.ivu.elect.jee.exchange.AbstractViolation;
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.AbstractColumnEntry;

public class ViolationLevelColumn extends AbstractColumnEntry<AbstractViolation> {

  private static final long serialVersionUID = 1L;

  private final Icons icons;

  public ViolationLevelColumn(Messages messages, Icons icons) {
    super(messages);

    this.icons = icons;
  }

  @Override
  public ColumnType getType() {
    return ColumnType.ENUM;
  }

  @Override
  public String getHeader() {
    return getMessage("datei.import.import.violations.attribut.level");
  }

  @Override
  public Object getValue(AbstractViolation entity) {
    return getMessage(entity.getViolationLevel());
  }

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

  @Override
  public boolean isIconRendered(AbstractViolation entity) {
    return true;
  }

  @Override
  public String getIcon(AbstractViolation entity) {
    return entity.getViolationLevel().getIcon(icons);
  }
}
