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 StoringStockTableModel}.
009     *
010     * <p>There will be exactly one column headed &quot;Name&quot; and displaying the items' names.</p>
011     *
012     * @author Steffen Zschaler
013     * @version 2.0 23/08/1999
014     * @since v2.0
015     */
016    public class DefaultStockItemTED extends AbstractTableEntryDescriptor {
017    
018        /**
019             * ID for serialization.
020             */
021            private static final long serialVersionUID = -7455599382604773163L;
022    
023            /**
024         * @return 1.
025         * @override Sometimes
026         */
027        public int getColumnCount() {
028            return 1;
029        }
030    
031        /**
032         * @return &quot;Name&quot;.
033         * @override Sometimes
034         */
035        public String getColumnName(int nIdx) {
036            return "Name";
037        }
038    
039        /**
040         * @return <code>String.class</code>.
041         * @override Sometimes
042         */
043        public Class<?> getColumnClass(int nIdx) {
044            return String.class;
045        }
046    
047        /**
048         * @return the name of the StockItem.
049         * @override Sometimes
050         */
051        public Object getValueAt(Object oData, int nIdx) {
052            return ((StockItem)oData).getName();
053        }
054    }