001: /*
002: * Created on 05.11.2004
003: */
004: package de.jwic.controls;
005:
006: import java.util.ArrayList;
007: import java.util.List;
008:
009: import javax.swing.tree.TreeNode;
010:
011: /**
012: * TreeEntry encapsulate a TreeNode for rendering.
013: *
014: * $Id: TreeEntry.java,v 1.2 2006/08/14 10:56:37 lordsam Exp $
015: * @version $Revision: 1.2 $
016: * @author JBornemann
017: */
018: public class TreeEntry {
019:
020: protected TreeEntry parent = null;
021: protected TreeNode node = null;
022: protected String nodeID = null;
023: protected int level = 0;
024: protected int curr = 0;
025: protected boolean selected = false;
026: protected boolean expanded = false;
027: protected boolean last = false;
028:
029: /**
030: * @return Returns the parent.
031: */
032: public TreeEntry getParent() {
033: return parent;
034: }
035:
036: /**
037: * @param parent The parent to set.
038: */
039: public void setParent(TreeEntry parent) {
040: this .parent = parent;
041: }
042:
043: /**
044: * Returns the TreeEntry parents of this.
045: * List is empty if no parent exists.
046: * @return
047: */
048: public List getPath() {
049: ArrayList path = new ArrayList();
050: TreeEntry entry = getParent();
051: while (entry != null) {
052: path.add(0, entry);
053: entry = entry.getParent();
054: }
055: return path;
056: }
057:
058: /**
059: * @return Returns the expanded.
060: */
061: public boolean isExpanded() {
062: return expanded;
063: }
064:
065: /**
066: * @param expanded The expanded to set.
067: */
068: public void setExpanded(boolean expanded) {
069: this .expanded = expanded;
070: }
071:
072: /**
073: * Returns the int level: no parent is 0, one parent is 1 a.s.o.
074: * @return Returns the level.
075: */
076: public int getLevel() {
077: return level;
078: }
079:
080: /**
081: * Sets the level: no parent is 0, one parent is 1 a.s.o.
082: * @param level The level to set.
083: */
084: public void setLevel(int level) {
085: this .level = level;
086: }
087:
088: /**
089: * @return Returns the TreeNode.
090: */
091: public TreeNode getNode() {
092: return node;
093: }
094:
095: /**
096: * @param node The TreeNode to set.
097: */
098: public void setNode(TreeNode node) {
099: this .node = node;
100: }
101:
102: /**
103: * @return Returns the nodeID.
104: */
105: public String getNodeID() {
106: return nodeID;
107: }
108:
109: /**
110: * @param nodeID The nodeID to set.
111: */
112: public void setNodeID(String nodeID) {
113: this .nodeID = nodeID;
114: }
115:
116: /**
117: * @return Returns the selected.
118: */
119: public boolean isSelected() {
120: return selected;
121: }
122:
123: /**
124: * @param selected The selected to set.
125: */
126: public void setSelected(boolean selected) {
127: this .selected = selected;
128: }
129:
130: /**
131: * Returns if this is the last of its parent.
132: * @return boolean.
133: */
134: public boolean isLast() {
135: return last;
136: }
137:
138: /**
139: * @param last The last to set.
140: */
141: public void setLast(boolean last) {
142: this.last = last;
143: }
144: }
|