01: package net.ar.webonswing.petstore;
02:
03: import javax.swing.*;
04:
05: import net.ar.webonswing.*;
06: import net.ar.webonswing.petstore.contributors.*;
07: import net.ar.webonswing.petstore.model.*;
08:
09: public class CategoryView extends ApplicationFrame {
10: protected Category category;
11:
12: public CategoryView() {
13: WosFramework.assignContributor(this ,
14: new HibernateObjectPersistenceContributor("category"));
15: }
16:
17: public CategoryView(Category aCategory) {
18: this ();
19:
20: setCategory(aCategory);
21: init();
22: }
23:
24: protected JComponent getBody() {
25: ProductsView productsView = new ProductsView(category
26: .getProducts());
27: productsView.setLayout(ApplicationFrame.getCurrentSkin()
28: .getCurrentPropagateTemplateFor("CategoryView.main"));
29:
30: productsView.add(new JLabel(category.getName()))
31: .setName("name");
32: productsView.add(new JLabel(category.getDescription()))
33: .setName("description");
34:
35: return productsView;
36: }
37:
38: public Category getCategory() {
39: return category;
40: }
41:
42: public void setCategory(Category aCategory) {
43: this.category = aCategory;
44: }
45: }
|