001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.common.web.template;
009:
010: //base classes
011: import java.util.ArrayList;
012: import java.util.HashMap;
013:
014: //project specific classes
015:
016: //other classes
017:
018: public class MenuBranch extends MenuItem {
019:
020: private ArrayList nodes = null;
021:
022: private MenuBranch(String inLabel, String inOnClick,
023: HashMap inProperties) {
024: super (inLabel, inOnClick, inProperties);
025: this .nodes = new ArrayList();
026: }
027:
028: public final static MenuBranch newInstance(String inLabel) {
029:
030: MenuBranch outValue = null;
031:
032: outValue = new MenuBranch(inLabel, null, null);
033:
034: return outValue;
035: }
036:
037: public final static MenuBranch newInstance(String inLabel,
038: String inOnClick) {
039:
040: MenuBranch outValue = null;
041:
042: outValue = new MenuBranch(inLabel, inOnClick, null);
043:
044: return outValue;
045: }
046:
047: public final static MenuBranch newInstance(String inLabel,
048: HashMap inProperties) {
049:
050: MenuBranch outValue = null;
051:
052: outValue = new MenuBranch(inLabel, null, inProperties);
053:
054: return outValue;
055: }
056:
057: public final static MenuBranch newInstance(String inLabel,
058: String inOnClick, HashMap inProperties) {
059:
060: MenuBranch outValue = null;
061:
062: outValue = new MenuBranch(inLabel, inOnClick, inProperties);
063:
064: return outValue;
065: }
066:
067: public void add(MenuBranch inBranch) {
068: this .nodes.add(inBranch);
069: }
070:
071: public void add(MenuLeaf inLeaf) {
072: this .nodes.add(inLeaf);
073: }
074:
075: public int getNodeLength() {
076: return this .nodes.size();
077: }
078:
079: public boolean isLeaf(int inIndex) {
080: return (this .nodes.get(inIndex) instanceof MenuLeaf);
081: }
082:
083: public boolean isBranch(int inIndex) {
084: return (this .nodes.get(inIndex) instanceof MenuBranch);
085: }
086:
087: public MenuItem getNode(int inIndex) {
088: return (MenuItem) this .nodes.get(inIndex);
089: }
090:
091: //
092: //
093: //
094: //public boolean seekConceptTagLocation(ArrayList inLocation) {
095: //
096: // boolean outValue = false;
097: //
098: //
099: //
100: // return outValue;
101: //}
102:
103: //public MenuLeaf getNodeAsLeaf(int inIndex) {
104: // return (MenuLeaf)this.nodes.get(inIndex);
105: //}
106:
107: //public MenuBranch getNodeAsBranch(int inIndex) {
108: // return (MenuBranch)this.nodes.get(inIndex);
109: //}
110:
111: }
|