Source code: com/virtuosotechnologies/lib/basiccommand/builder/MenuBarGroupBuilderNode.java
1 /*
2 ================================================================================
3
4 FILE: MenuBarGroupBuilderNode.java
5
6 PROJECT:
7
8 Virtuoso Utilities
9
10 CONTENTS:
11
12 A special MenuGroupBuilderNode used for groups whose parent component
13 is the menu bar.
14
15 PROGRAMMERS:
16
17 Daniel Azuma (DA) <dazuma@kagi.com>
18
19 COPYRIGHT:
20
21 Copyright (C) 2003 Daniel Azuma (dazuma@kagi.com)
22
23 This program is free software; you can redistribute it and/or
24 modify it under the terms of the GNU General Public License as
25 published by the Free Software Foundation; either version 2
26 of the License, or (at your option) any later version.
27
28 This program is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 GNU General Public License for more details.
32
33 You should have received a copy of the GNU General Public
34 License along with this program; if not, write to
35 Free Software Foundation, Inc.
36 59 Temple Place, Suite 330
37 Boston, MA 02111-1307 USA
38
39 ================================================================================
40 */
41
42
43 package com.virtuosotechnologies.lib.basiccommand.builder;
44
45
46 import com.virtuosotechnologies.lib.command.CommandNode;
47 import com.virtuosotechnologies.lib.command.CommandNodeFlavor;
48 import com.virtuosotechnologies.lib.basiccommand.BasicCommandNode;
49
50
51 /**
52 * A special MenuGroupBuilderNode used for groups whose parent component
53 * is the menu bar. These nodes can only build MenuBuilders and other
54 * MenuBarGroupBuilders as children.
55 */
56 public class MenuBarGroupBuilderNode
57 extends AbstractGroupBuilderNode
58 {
59 /**
60 * Constructor
61 */
62 protected MenuBarGroupBuilderNode(
63 CommandNode commandNode,
64 AbstractBranchBuilderNode parent,
65 int index)
66 {
67 super(commandNode, parent, index);
68 }
69
70
71 /**
72 * Create a child node
73 */
74 protected AbstractBuilderNode createChildNode(
75 CommandNode cn,
76 int index)
77 {
78 AbstractBuilderNode child = null;
79 CommandNodeFlavor flavor = cn.getFlavor();
80 if (flavor.equalsOrExtends(BasicCommandNode.SEPARATOR_FLAVOR))
81 {
82 child = new MenuBarGlueBuilderNode(cn, this, index);
83 }
84 else if (flavor.equalsOrExtends(BasicCommandNode.GROUP_FLAVOR))
85 {
86 child = new MenuBarGroupBuilderNode(cn, this, index);
87 }
88 else if (flavor.equalsOrExtends(BasicCommandNode.RADIOCONTAINER_FLAVOR))
89 {
90 child = new MenuRadioMenuBuilderNode(cn, this, index);
91 }
92 else if (flavor.equalsOrExtends(BasicCommandNode.CONTAINER_FLAVOR))
93 {
94 child = new MenuBuilderNode(cn, this, index);
95 }
96 return child;
97 }
98 }