001 package data.swing;
002
003 import data.*;
004
005 import util.swing.*;
006
007 /**
008 * A {@link TableEntryDescriptor} that can be used with a {@link DataBasketTableModel} modelling
009 * {@link DataBasketEntry DataBasketEntries} that describe operations on items in a {@link StoringStock}.
010 *
011 * <p>There will be exactly one column, headed "Name" and giving the key of the StockItem.</p>
012 *
013 * @author Steffen Zschaler
014 * @version 2.0 23/08/1999
015 * @since v2.0
016 */
017 public class DefaultStoringStockDBETableEntryDescriptor extends AbstractTableEntryDescriptor {
018
019 /**
020 * @return 1.
021 * @override Sometimes
022 */
023 public int getColumnCount() {
024 return 1;
025 }
026
027 /**
028 * @return "Name".
029 * @override Sometimes
030 */
031 public String getColumnName(int nIdx) {
032 return "Name";
033 }
034
035 /**
036 * @return <code>String.class</code>.
037 * @override Sometimes
038 */
039 public Class getColumnClass(int nIdx) {
040 return String.class;
041 }
042
043 /**
044 * @return the name of the StockItem.
045 * @override Sometimes
046 */
047 public Object getValueAt(Object oData, int nIdx) {
048 return ((StockItem)((DataBasketEntry)oData).getValue()).getName();
049 }
050 }