001: package simpleorm.simplewebapp.core;
002:
003: import java.util.ArrayList;
004: import java.util.Collections;
005: import java.util.List;
006:
007: /**
008: * Used with tree.tag to display trees.
009: */
010: public class WTree {
011: private ArrayList<WTreeNode> nodes = new ArrayList();
012:
013: public WTreeNode addNode(WTree.WTreeNode parent, String name,
014: String url) {
015: WTree.WTreeNode n = new WTree.WTreeNode();
016: n.index = nodes.size();
017: n.parent = parent;
018: n.name = name;
019: n.url = url;
020: nodes.add(n);
021: return n;
022: }
023:
024: public List<WTreeNode> getNodes() {
025: return Collections.unmodifiableList(nodes);
026: }
027:
028: public static class WTreeNode {
029: int index;
030: WTreeNode parent;
031: String name = "";
032: String url = "";
033: String title = ""; // ie hover text
034: String target = ""; // as in html <a target=
035: String icon = "";
036: String iconOpen = "";
037: boolean open = false; // whehter initially open
038:
039: public int getParentIndex() {
040: return parent != null ? parent.index : -1;
041: }
042:
043: /////////////// Generated //////////////////
044:
045: public int getIndex() {
046: return index;
047: }
048:
049: public void setIndex(int index) {
050: this .index = index;
051: }
052:
053: public WTreeNode getParent() {
054: return parent;
055: }
056:
057: public void setParent(WTreeNode parent) {
058: this .parent = parent;
059: }
060:
061: public String getName() {
062: return name;
063: }
064:
065: public void setName(String name) {
066: this .name = name;
067: }
068:
069: public String getUrl() {
070: return url;
071: }
072:
073: public void setUrl(String url) {
074: this .url = url;
075: }
076:
077: public String getTitle() {
078: return title;
079: }
080:
081: public void setTitle(String title) {
082: this .title = title;
083: }
084:
085: public String getTarget() {
086: return target;
087: }
088:
089: public void setTarget(String target) {
090: this .target = target;
091: }
092:
093: public String getIcon() {
094: return icon;
095: }
096:
097: public void setIcon(String icon) {
098: this .icon = icon;
099: }
100:
101: public String getIconOpen() {
102: return iconOpen;
103: }
104:
105: public void setIconOpen(String iconOpen) {
106: this .iconOpen = iconOpen;
107: }
108:
109: public boolean isOpen() {
110: return open;
111: }
112:
113: public void setOpen(boolean open) {
114: this.open = open;
115: }
116: }
117: }
|