package data.swing; import data.*; import util.swing.*; /** * A {@link TableEntryDescriptor} that can be used with a {@link CatalogTableModel}. * * <p>There will be two columns headed "Name" and "Value". The first will display the * CatalogItems' names, the second their values.</p> * * @author Steffen Zschaler * @version 2.0 23/08/1999 * @since v2.0 */ public class DefaultCatalogItemTED extends AbstractTableEntryDescriptor { /** * Create a new DefaultCatalogItemTED. */ public DefaultCatalogItemTED() { super(); } /** * @return 2. * @override Sometimes */ public int getColumnCount() { return 2; } /** * @return "Name" for the first, "Value" for the second column. * @override Sometimes */ public String getColumnName (int nIdx) { String[] asNames = {"Name", "Value"}; return asNames[nIdx]; } /** * @return <code>String.class</code> for the first, <code>{@link Value}.class</code> for the second column. * @override Sometimes */ public Class getColumnClass (int nIdx) { Class[] acClasses = {String.class, Value.class}; return acClasses[nIdx]; } /** * @return the CatalogItem's name for the first, its value for the second column. * @override Sometimes */ public Object getValueAt (Object oData, int nIdx) { if (nIdx == 0) { return ((CatalogItem) oData).getName(); } else { return ((CatalogItem) oData).getValue(); } } }