/**
 * 
 */
package cz.neubauer.tomas.hazardanalysis.model.tablemodels;

import java.util.ArrayList;

import cz.neubauer.tomas.hazardanalysis.model.dangers.DangerVariant;
import cz.neubauer.tomas.hazardanalysis.model.stages.Phase;

/**
 * @author Tomáš Neubauer
 */
public class PhaseDangerVariantTableModel extends DangerVariantTableModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = -4777686666604746021L;

	private Phase phase;

	/**
	 * @param componentDangerVariantFrame
	 * @param variants
	 */
	public PhaseDangerVariantTableModel(Phase phase,
			ArrayList<DangerVariant> variants) {
		super(variants);
		this.phase = phase;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see rizika.gui.DangerVariantTableModel#getValueAt(int, int)
	 */
	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		DangerVariant currentVariant = getDangerVariants().get(rowIndex);
		switch (columnIndex) {
		case 0:
			return currentVariant.getDescription();
		case 1:
			return phase.getVariants().contains(currentVariant);
		default:
			return null;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see rizika.gui.DangerVariantTableModel#getColumnName(int)
	 */
	@Override
	public String getColumnName(int column) {
		switch (column) {
		case 0:
			return "Popis nebezpečí";
		case 1:
			return "";
		default:
			return null;
		}
	}

}
