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 {@link CatalogItem CatalogItems}.
010 *
011 * <p>There will be exactly one column, headed "Name" and giving the key of the CatalogItem.</p>
012 *
013 * @author Steffen Zschaler
014 * @version 2.0 23/08/1999
015 * @since v2.0
016 */
017 public class DefaultCatalogItemDBETableEntryDescriptor extends AbstractTableEntryDescriptor {
018
019 /**
020 * ID for serialization.
021 */
022 private static final long serialVersionUID = 7105077176252465315L;
023
024 /**
025 * Create a new DefaultCatalogItemDBETableEntryDescriptor.
026 */
027 public DefaultCatalogItemDBETableEntryDescriptor() {
028 super();
029 }
030
031 /**
032 * @return 1.
033 * @override Sometimes
034 */
035 public int getColumnCount() {
036 return 1;
037 }
038
039 /**
040 * @return "Name".
041 * @override Sometimes
042 */
043 public String getColumnName(int nIdx) {
044 return "Name";
045 }
046
047 /**
048 * @return <code>String.class</code>.
049 * @override Sometimes
050 */
051 public Class<?> getColumnClass(int nIdx) {
052 return String.class;
053 }
054
055 /**
056 * @return the given CatalogItem's name.
057 * @override Sometimes
058 */
059 public Object getValueAt(Object oData, int nIdx) {
060 return ((DataBasketEntry)oData).getSecondaryKey();
061 }
062 }