1 package net.sf.panoptes.model.component;
2
3 import java.util.Vector;
4
5 import net.sf.panoptes.model.node.Node;
6 import net.sf.panoptes.model.node.NodeDescriptor;
7
8 import org.eclipse.swt.graphics.Image;
9
10
11 /***
12 * Simple class for use in the treemodel when logical grouping is to be done. This
13 * class does not represent anything else than a group and does not have any other
14 * meaning. Is typically used when the user wants to group MBeans from different domains.
15 *
16 * @author Dag Liodden
17 */
18 public class ComponentGroup extends Component {
19
20 private Image icon = null;
21 private boolean acceptsChildren = true;
22
23 private NodeDescriptor configDescriptor = null;
24
25 /***
26 * Children of this group
27 */
28 private Vector children;
29
30 /***
31 * Name of the group
32 */
33 private String name;
34
35 /***
36 * Group description
37 */
38 private String description;
39
40 /***
41 *
42 */
43 public ComponentGroup(String name, String description) {
44 children = new Vector();
45 this.name = name;
46 this.description = description;
47 }
48
49 public void init() {
50
51 }
52
53 public void addChild(Node child) {
54 children.add(child);
55 }
56
57 /* (non-Javadoc)
58 * @see com.glt.troodon.console.Node#getConfigDescriptor()
59 */
60 public NodeDescriptor getConfigDescriptor() {
61 if (configDescriptor != null) return configDescriptor;
62 else return new NodeDescriptor(name, description);
63
64 }
65
66 /* (non-Javadoc)
67 * @see com.glt.troodon.console.Node#getChildren()
68 */
69 public Node[] getChildren() {
70 return (Node[]) children.toArray(new Node[children.size()]);
71
72 }
73
74 /* (non-Javadoc)
75 * @see com.glt.troodon.console.Node#getIconName()
76 */
77 public Image getIcon() {
78 if (icon != null) return icon;
79 else return Node.ICON_FOLDER;
80
81 }
82
83 /* (non-Javadoc)
84 * @see net.sf.panoptes.view.configurator.Node#acceptsChildren()
85 */
86 public boolean acceptsChildren() {
87 return acceptsChildren;
88 }
89
90 /***
91 * Sets the icon.
92 * @param iconName The icon to set
93 */
94 public void setIcon(Image icon) {
95 this.icon = icon;
96 }
97
98 /***
99 * Sets acceptsChildren. If you don't want this group to accept arbitrary children, set it to true.
100 * @param acceptsChildren The acceptsChildren to set
101 */
102 public void setAcceptsChildren(boolean acceptsChildren) {
103 this.acceptsChildren = acceptsChildren;
104 }
105
106 /***
107 * Sets the configDescriptor.
108 * @param configDescriptor The configDescriptor to set
109 */
110 public void setConfigDescriptor(NodeDescriptor configDescriptor) {
111 this.configDescriptor = configDescriptor;
112 }
113
114 /* (non-Javadoc)
115 * @see net.sf.panoptes.model.node.Node#getConfiguratorScripts()
116 */
117 public String[] getConfiguratorScripts() {
118 // TODO Auto-generated method stub
119 return null;
120 }
121
122 }
This page was automatically generated by Maven