package data.swing;

import data.*;

import util.swing.*;

/**
  * A {@link TableEntryDescriptor} that can be used with a {@link DataBasketTableModel} modelling
  * {@link DataBasketEntry DataBasketEntries} that describe operations on items in a {@link StoringStock}.
  *
  * <p>There will be exactly one column, headed &quot;Name&quot; and giving the key of the StockItem.</p>
  *
  * @author Steffen Zschaler
  * @version 2.0 23/08/1999
  * @since v2.0
  */
public class DefaultStoringStockDBETableEntryDescriptor extends AbstractTableEntryDescriptor {

  /**
    * @return 1.
    * @override Sometimes
    */
  public int getColumnCount() {
    return 1;
  }

  /**
    * @return &quot;Name&quot;.
    * @override Sometimes
    */
  public String getColumnName (int nIdx) {
    return "Name";
  }

  /**
    * @return <code>String.class</code>.
    * @override Sometimes
    */
  public Class getColumnClass (int nIdx) {
    return String.class;
  }

  /**
    * @return the name of the StockItem.
    * @override Sometimes
    */
  public Object getValueAt (Object oData, int nIdx) {
    return ((StockItem) ((DataBasketEntry) oData).getValue()).getName();
  }
}