01: package net.ar.webonswing.petstore;
02:
03: import java.util.*;
04:
05: import javax.swing.*;
06:
07: import net.ar.webonswing.*;
08: import net.ar.webonswing.petstore.contributors.*;
09: import net.ar.webonswing.swing.layouts.*;
10:
11: public class Search extends ApplicationFrame {
12: protected List products;
13: private String keyword;
14:
15: public Search() {
16: WosFramework.assignContributor(this ,
17: SearchPersistenceContributor.class);
18: }
19:
20: public Search(List aProducts, String aKeyword) {
21: this ();
22:
23: products = aProducts;
24: keyword = aKeyword;
25: init();
26: }
27:
28: protected JComponent getBody() {
29: JPanel conditional = new JPanel();
30:
31: if (!products.isEmpty()) {
32: ProductsView productsView = new ProductsView(products);
33:
34: conditional.setName("products");
35: conditional.add(productsView);
36: } else
37: conditional.setName("noProducts");
38:
39: conditional.add(new JLabel(keyword)).setName("keyword");
40:
41: JPanel panel = new JPanel();
42: panel.add(conditional);
43: panel.setLayout(new PropagateTemplateLayoutByName(
44: ApplicationFrame.getCurrentSkin()
45: .getCurrentTemplateFor("Search.main"),
46: new TemplateFlowLayout(), true));
47:
48: return panel;
49: }
50:
51: public String getKeyword() {
52: return keyword;
53: }
54:
55: public void setKeyword(String aKeyword) {
56: this .keyword = aKeyword;
57: }
58:
59: public List getProducts() {
60: return products;
61: }
62:
63: public void setProducts(List aProducts) {
64: this.products = aProducts;
65: }
66: }
|