1 /*
2 * Created on 09.mar.2003
3 *
4 * To change this generated comment go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
6 */
7 package net.sf.panoptes.model.component;
8
9 import net.sf.panoptes.model.component.registry.ComponentName;
10 import net.sf.panoptes.model.component.registry.ComponentRegistry;
11 import net.sf.panoptes.model.node.Node;
12
13 /***
14 * Abstract class that must be subclassed by Components.
15 *
16 * @see Component
17 * @author Dag Liodden
18 * @version 0.1
19 */
20 public abstract class Component extends Node {
21
22 private ComponentRegistry registry;
23 private ComponentName componentName = null;
24
25 public void setComponentRegistry(ComponentRegistry registry) {
26 this.registry = registry;
27 }
28
29 public ComponentRegistry getComponentRegistry() {
30 if (registry == null) throw new IllegalStateException("Component has not been registered and initialized by the component registry yet.");
31 return registry;
32 }
33
34 /***
35 * Called when the Component has had all it's attributes set and should be ready for
36 * initialization.
37 *
38 */
39 public abstract void init();
40
41 /* (non-Javadoc)
42 * @see net.sf.panoptes.model.node.Node#getChildren()
43 */
44 public Node[] getChildren() {
45 return new Component[0];
46 }
47
48 /* (non-Javadoc)
49 * @see net.sf.panoptes.model.node.Node#acceptsChildren()
50 */
51 public boolean acceptsChildren() {
52 return false;
53 }
54
55 /* (non-Javadoc)
56 * @see net.sf.panoptes.model.node.Node#getConfiguratorScripts()
57 */
58 public String[] getConfiguratorScripts() {
59 return new String[0];
60 }
61
62 /***
63 * Called by the <code>ComponentRegistry</code> when it registers the component.
64 * @param name
65 */
66 public void setComponentName(ComponentName name) {
67 this.componentName = name;
68 }
69
70 public ComponentName getComponentName() {
71 return componentName;
72 }
73 }
This page was automatically generated by Maven