KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > gulden > framework > amoda > generic > core > GenericApplicationMemberAbstract


1 /*
2  * Project: AMODA - Abstract Modeled Application
3  * Class: de.gulden.framework.amoda.generic.core.GenericApplicationMemberAbstract
4  * Version: snapshot-beautyj-1.1
5  *
6  * Date: 2004-09-29
7  *
8  * This is a snapshot version of the AMODA 0.2 development branch,
9  * it is not released as a seperate version.
10  * For AMODA, see http://amoda.berlios.de/.
11  *
12  * This is licensed under the GNU Lesser General Public License (LGPL)
13  * and comes with NO WARRANTY.
14  *
15  * Author: Jens Gulden
16  * Email: amoda@jensgulden.de
17  */

18
19 package de.gulden.framework.amoda.generic.core;
20
21 import de.gulden.framework.amoda.generic.metadata.*;
22 import de.gulden.framework.amoda.generic.option.*;
23 import de.gulden.framework.amoda.model.behaviour.*;
24 import de.gulden.framework.amoda.model.core.*;
25 import de.gulden.framework.amoda.model.core.ApplicationMember;
26 import de.gulden.framework.amoda.model.data.*;
27 import de.gulden.framework.amoda.model.metadata.*;
28 import de.gulden.framework.amoda.model.option.*;
29 import de.gulden.util.xml.serializer.XMLSerializable;
30 import java.lang.*;
31 import java.util.*;
32 import javax.swing.*;
33
34 /**
35  * Class GenericApplicationMemberAbstract.
36  *
37  * @author Jens Gulden
38  * @version snapshot-beautyj-1.1
39  */

40 public abstract class GenericApplicationMemberAbstract implements ApplicationMember, XMLSerializable {
41
42     // ------------------------------------------------------------------------
43
// --- fields ---
44
// ------------------------------------------------------------------------
45

46     public static String JavaDoc AUTO_ID_PREFIX = "id_";
47
48     protected static int autoInitId = 0;
49
50     public String JavaDoc id = AUTO_ID_PREFIX+(++autoInitId);
51
52     public String JavaDoc name;
53
54     public Metadata metadata;
55
56     public Options options;
57
58     protected CompositeGroup parent;
59
60
61     // ------------------------------------------------------------------------
62
// --- constructor ---
63
// ------------------------------------------------------------------------
64

65     public GenericApplicationMemberAbstract() {
66         // create initial blank values
67
setMetadata(new de.gulden.framework.amoda.generic.metadata.GenericMetadata());
68         if (!(this instanceof GenericOptions)) { // avoid endless recursion, options never have options anyway
69
setOptions(new de.gulden.framework.amoda.generic.option.GenericOptions()); // default empty container, will be replaced later by other object
70
}
71     }
72
73
74     // ------------------------------------------------------------------------
75
// --- methods ---
76
// ------------------------------------------------------------------------
77

78     public State getState() {
79         return null; // null on default, may be overwritten
80
}
81
82     public String JavaDoc getId() {
83         return id;
84     }
85
86     public void setId(String JavaDoc _id) {
87         id = _id;
88     }
89
90     public Metadata getMetadata() {
91         return metadata;
92     }
93
94     public void setMetadata(Metadata _metadata) {
95         metadata = _metadata;
96     }
97
98     public Options getOptions() {
99         return options;
100     }
101
102     public void setOptions(Options _options) {
103         de.gulden.framework.amoda.model.core.Feature parent;
104         if (this instanceof de.gulden.framework.amoda.model.core.Feature) {
105             parent=(de.gulden.framework.amoda.model.core.Feature)this;
106         } else {
107             parent=(de.gulden.framework.amoda.model.core.Feature)this.getParent();
108         }
109         ((GenericOptions)_options).setParent(parent);
110         ((GenericOptions)_options).setParentMember(this);
111         setOptionsDirectly(_options);
112     }
113
114     public Application getApplication() {
115         return ((GenericApplicationMemberAbstract)getParent()).getApplication();
116     }
117
118     public String JavaDoc getName() {
119         // this is an identical replacement of getId(), variable name is actually unused (dummy for XML deserializer)
120
return getId();
121     }
122
123     public void setName(String JavaDoc _name) {
124         // this is an identical replacement of getId(), variable name is actually unused (dummy for XML deserializer)
125
setId(_name);
126     }
127
128     public void setOptionsDirectly(Options options) {
129         this.options = options;
130     }
131
132     public CompositeGroup getParent() {
133         return parent;
134     }
135
136     public void setParent(CompositeGroup _parent) {
137         parent = _parent;
138     }
139
140     public String JavaDoc getQualifiedId() {
141         GenericApplicationMemberAbstract parent=(GenericApplicationMemberAbstract)getParent();
142         if (parent!=null) {
143             return parent.getQualifiedId()+"."+this.getId();
144         } else {
145             return this.getId();
146         }
147     }
148
149     public String JavaDoc findTitle() {
150         return de.gulden.framework.amoda.generic.metadata.GenericMetadata.findTitle(this);
151     }
152
153     public ImageIcon findIcon() {
154         return de.gulden.framework.amoda.generic.metadata.GenericMetadata.findIcon(this);
155     }
156
157 } // end GenericApplicationMemberAbstract
158
Popular Tags