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 * ID for serialization.
021 */
022 private static final long serialVersionUID = -2849396345932833457L;
023
024 /**
025 * @return 1.
026 * @override Sometimes
027 */
028 public int getColumnCount() {
029 return 1;
030 }
031
032 /**
033 * @return "Name".
034 * @override Sometimes
035 */
036 public String getColumnName(int nIdx) {
037 return "Name";
038 }
039
040 /**
041 * @return <code>String.class</code>.
042 * @override Sometimes
043 */
044 public Class<?> getColumnClass(int nIdx) {
045 return String.class;
046 }
047
048 /**
049 * @return the name of the StockItem.
050 * @override Sometimes
051 */
052 public Object getValueAt(Object oData, int nIdx) {
053 return ((StockItem)((DataBasketEntry)oData).getValue()).getName();
054 }
055 }