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 {@link CatalogItem CatalogItems}.
  *
  * <p>There will be exactly one column, headed &quot;Name&quot; and giving the key of the CatalogItem.</p>
  *
  * @author Steffen Zschaler
  * @version 2.0 23/08/1999
  * @since v2.0
  */
public class DefaultCatalogItemDBETableEntryDescriptor extends AbstractTableEntryDescriptor {

  /**
    * Create a new DefaultCatalogItemDBETableEntryDescriptor.
    */
  public DefaultCatalogItemDBETableEntryDescriptor() {
    super();
  }

  /**
    * @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 given CatalogItem's name.
    * @override Sometimes
    */
  public Object getValueAt (Object oData, int nIdx) {
    return ((DataBasketEntry) oData).getSecondaryKey();
  }
}