KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > designer > model > ElementField


1 /*
2  * (c) Rob Gordon 2005.
3  */

4 package org.oddjob.designer.model;
5
6 import org.oddjob.designer.arooa.DesignIH;
7
8 /**
9  * Groups a DesignElement and it's title.
10  */

11 public class ElementField implements DesignDefinition {
12
13     private final String JavaDoc title;
14     private final DesignAttribute designElement;
15     
16     public ElementField(String JavaDoc title, DesignAttribute el) {
17         if (title == null) {
18             throw new NullPointerException JavaDoc("Null title not allowed!");
19         }
20         if (el == null) {
21             throw new NullPointerException JavaDoc("Null DesignElement not allowed!");
22         }
23         this.title = title;
24         this.designElement = el;
25     }
26
27     public String JavaDoc getTitle() {
28         return title;
29     }
30     
31     public DesignAttribute getDesignElement() {
32         return designElement;
33     }
34
35     /**
36      * Does this contain any data of any sort. Used in selection dialogs to
37      * see if a group containing this element should be selected.
38      */

39     public boolean isPopulated() {
40         if (designElement.attribute() != null) {
41             return true;
42         }
43         DesignIH dih = DesignIH.getHelper(designElement.getClass());
44         if (dih.hasDetailData(designElement)) {
45             return true;
46         }
47         return false;
48     }
49     
50     /* (non-Javadoc)
51      * @see org.oddjob.designer.model.DesignDefinition#accept(org.oddjob.designer.model.DesignProcessor)
52      */

53     public void accept(DesignProcessor processor) {
54         processor.onElementField(this);
55     }
56 }
57
Popular Tags