001 package data.swing;
002
003 import data.*;
004
005 import util.swing.*;
006
007 import javax.swing.*;
008 import java.util.*;
009
010 /**
011 * A {@link JTable} for displaying and editing the contents of a {@link CountingStock}.
012 *
013 * @author Steffen Zschaler
014 * @version 2.0 23/08/1999
015 * @since v2.0
016 */
017 public class JCountingStockTable extends JAbstractTable {
018
019 /**
020 * ID for serialization.
021 */
022 private static final long serialVersionUID = 1738508295457002566L;
023
024 /**
025 * Create a new JCountingStockTable.
026 *
027 * @param cs the CountingStock to be displayed.
028 * @param db the DataBasket to be used to determine visibility.
029 * @param cmp a Comparator defining the sort order. If <code>null</code>, the records are ordered by their
030 * keys.
031 * @param fShowZeros if false, rows containing '0' in the value column will be omitted from the table.
032 * @param ted a TableEntryDescriptor that can split
033 * {@link CountingStockTableModel.Record CountingStockTableModel records} into a table's cells.
034 */
035 public JCountingStockTable(CountingStock cs, DataBasket db, Comparator<CatalogItem> cmp, boolean fShowZeros,
036 TableEntryDescriptor ted) {
037 super(new CountingStockTableModel(cs, db, cmp, fShowZeros, ted));
038
039 if (cs instanceof MoneyBag) {
040 setDefaultRenderer(NumberValue.class, new CurrencyRenderer((data.Currency)cs.getCatalog(db)));
041 }
042 }
043 }