01: package com.calipso.reportgenerator.common;
02:
03: import java.util.*;
04: import java.io.Serializable;
05:
06: public class DimensionValueNode implements Serializable {
07:
08: private Object value;
09: private Map subNodes;
10: private Collection subNodesList;
11: private int dimensionCount;
12: private int dimensionIndex;
13: private boolean collapsed;
14: private DimensionValueNode parentNode;
15: private Map allSubNodes;
16:
17: public DimensionValueNode(Object value) {
18: this .value = value;
19: this .dimensionCount = -1;
20: this .dimensionIndex = -1;
21: collapsed = false;
22: }
23:
24: public DimensionValueNode(Object value,
25: DimensionValueNode parentNode) {
26: this (value);
27: this .parentNode = parentNode;
28: }
29:
30: public void setValue(Object value) {
31: this .value = value;
32: }
33:
34: public Object getValue() {
35: return value;
36: }
37:
38: public int getDimensionCount() {
39: return dimensionCount;
40: }
41:
42: public void setDimensionCount(int dimensionCount) {
43: this .dimensionCount = dimensionCount;
44: }
45:
46: public Map getSubNodes() {
47: if (subNodes == null) {
48: subNodes = new HashMap();
49: }
50: return subNodes;
51: }
52:
53: public Iterator iterator() {
54: if (getCollapsed()) {
55: return new ArrayList().iterator();
56: }
57: return getSubNodesList().iterator();
58: }
59:
60: public Collection getSubNodesList() {
61: if (subNodesList == null) {
62: subNodesList = new Vector();
63: }
64: return subNodesList;
65: }
66:
67: public int getDimesionIndex() {
68: return dimensionIndex;
69: }
70:
71: public void setDimensionIndex(int dimensionIndex) {
72: this .dimensionIndex = dimensionIndex;
73: }
74:
75: public void addSubNode(DimensionValueNode node) {
76: getSubNodes().put(node.getValue(), node);
77: getSubNodesList().add(node);
78: }
79:
80: public boolean getCollapsed() {
81: return collapsed;
82: }
83:
84: public void changeDimensionValueNodeState() {
85: collapsed = !collapsed;
86: }
87:
88: public DimensionValueNode getParentNode() {
89: return parentNode;
90: }
91:
92: public Map getAllSubNodes() {
93: if (allSubNodes == null) {
94: allSubNodes = new HashMap();
95: }
96: return allSubNodes;
97: }
98: }
|