Пример #1
0
  /**
   * Seeds the catalog with test products.
   *
   * @param catalog Catalog to seed
   */
  private static void seedCatalog(Catalog catalog, PropertyChangeListener productListener) {
    for (int i = 0; i < NUM_PRODUCTS; i++) {
      Product product = GeneralFactory.createProduct();
      product.addPropertyChangeListener(productListener);

      // define the product and add to the catalog
      product.setId(IDS[i]);
      product.setName(NAMES[i]);
      product.setDescription(DESCRIPTIONS[i]);
      product.setPrice(PRICES[i]);
      catalog.addProduct(product);
    }
  }