KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > common > DimensionValueNode


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