SOURCECODE

How to... use a DataBasketCondition


Description:
DataBasketConditions are important to display the contents of a DataBasket in a FormSheet (JTable jt = new JDataBasketTable(DataBasket db, DataBasketCondition dbc, DataBasketEntryGrouper dbeg, Comparator cmp, TableEntryDescriptor ted) ). They could also be used to summ the contentīs values (public Value sumBasket(DataBasketCondition dbc, BasketEntryValue bev, Value vInit) ).
(See also: HowTo..create a DataBasketEntryGrouper )
The already implemented DataBasketConditionImpl provides all what is needed.

ToDo's:
  1. Use the Constructor to create a DataBasketCondition.
  2. Use static fields (ALL_CATALOG_ITEMS, ALL_STOCK_ITEMS, ALL_ENTRIES).
  3. Use static methods to get needed instance of DataBasketCondition
    (
    1. allCatalogItemsWithDest(Catalog cDest);
    2. allCatalogItemsWithSource(Catalog cSource);
    3. allStockItemsWithDest(Stock stDest);
    4. allStockItemsWithSource(Stock stSource);
    5. specificCatalogItem(CatalogItem ci);
    6. specificStockItem(StockItem si);

    )


Uses:
DataBasketCondition  DataBasketConditionImpl  



SourceCode

   import data.DataBasketCondition;
   import data.DataBasketConditionImpl;
   import data.DataBasketEntrySource;
   import data.DataBasketEntryDestination;

         //...

          1
         DataBasketCondition dbc;
         dbc = new DataBasketConditionImpl(
                                 (String) sMainKey,
                              // filters Entrys of a certain kind
                              // (DataBasketKeys.CATALOG_ITEM_MAIN_KEY, DataBasketKeys.STOCK_ITEM_MAIN_KEY)
                                 (String) sSecondaryKey,
                              // filters Entrys with given name ((StockItem) si).getName()
                                 (DataBasketEntrySource) dbesSource,
                              // filters Entrys from given source (Catalog or Stock)
                                 (DataBasketEntryDestination) dbedDest,
                              // filters Entrys from given destination (Catalog or Stock)
                                 (Object) oValue);
                              // filters only given object (if it is null, all DataBasketEntrys will be checked)

          2
         // creates a DCB to filter DataBasketEntrys of CatalogItems
         dbc = DataBasketConditionImpl.ALL_CATALOG_ITEMS;

          3
         // creates a DBC to filter DataBasketEntrys of the Video-Catalog
         dbc = DataBasketConditionImpl.allCatalogItemsWithSource(videoCatalog);