KickJava   Java API By Example, From Geeks To Geeks.

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


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

4 package org.oddjob.designer.model;
5
6 /**
7  * A DesignElement which can also be an attribute. Subclasses of
8  * this type are for the most flexible types. The types these
9  * DesignElements represent can appear as attributes, as types
10  * (in lists, variables etc) and inline.
11  *
12  * @author Rob Gordon.
13  */

14 abstract public class DesignElementAttribute extends DesignElementType
15 implements DesignAttribute {
16     
17     /**
18      * The attribute for a design element will be set in two
19      * instances.
20      * 1) Where the DesignElement is being used as a property,
21      * then the attribute will contain what the attribute in the
22      * xml will contain.
23      * 2) When the design element is being used in-line and the
24      * DesignElement does not have a form (hasDetail() is false)
25      * Then the attribute will be set from a text field.
26      */

27     private String JavaDoc attribute;
28             
29     /*
30      * (non-Javadoc)
31      * @see org.oddjob.designer.model.DesignAttribute#attribute()
32      */

33     public String JavaDoc attribute() {
34         return attribute;
35     }
36     
37     /*
38      * (non-Javadoc)
39      * @see org.oddjob.designer.model.DesignAttribute#attribute(java.lang.String)
40      */

41     public void attribute(String JavaDoc value) {
42         if ("".equals(value)) {
43             attribute = null;
44         }
45         else {
46             attribute = value;
47         }
48         setChanged();
49         notifyObservers(DEObservable.attributeChanged(attribute));
50     }
51
52     /*
53      * (non-Javadoc)
54      * @see org.oddjob.designer.model.DesignElement#clear()
55      */

56     public void clear() {
57         attribute(null);
58         super.clear();
59     }
60 }
61
Popular Tags