001 package data.swing; 002 003 import javax.swing.table.*; 004 import javax.swing.*; 005 006 import java.util.Comparator; 007 008 import data.*; 009 010 import util.swing.*; 011 012 /** 013 * A {@link JTable} for displaying and editing the contents of a {@link Catalog}. 014 * 015 * @author Steffen Zschaler 016 * @version 2.0 23/08/1999 017 * @since v2.0 018 */ 019 public class JCatalogTable extends JAbstractTable { 020 021 /** 022 * Create a new JCatalogTable. 023 * 024 * @param c the Catalog to be displayed. 025 * @param db the DataBasket to be used to determine visibility. 026 * @param cmp a Comparator defining the sort order. If <code>null</code>, the CatalogItems are ordered in 027 * their natural order. 028 * @param ted a TableEntryDescriptor that can split CatalogItems into a table's cells. 029 */ 030 public JCatalogTable(Catalog c, DataBasket db, Comparator cmp, TableEntryDescriptor ted) { 031 super(new CatalogTableModel(c, db, cmp, ted)); 032 033 if (c instanceof Currency) { 034 setDefaultRenderer(NumberValue.class, new CurrencyRenderer((Currency)c)); 035 } 036 } 037 }