View Javadoc

1   package org.kuali.student.common.ui.client.util;
2   
3   import java.io.Serializable;
4   import java.util.List;
5   
6   public class ExportElement implements Serializable {
7   
8       private static final long serialVersionUID = 1L;
9       private String fieldLabel;
10      private boolean isMandatory;
11      private int printType = -1;
12  
13      private String fieldValue;
14      private String fieldValue2;
15      private String viewName;
16      
17      //Print type constants.
18      public static int DEFAULT = 0;
19      public static int BOLD = 1;
20      public static int LIST_SUBREPORT = 2;
21      public static int SUBREPORT = 3;
22      public static int LIST = 4;
23      public static int ITALIC = 5;
24      public static int PROPOSAL = 6;
25      public static int PARAGRAPH = 7;
26  
27      public ExportElement() {
28          super();
29      }
30  
31      public ExportElement(String viewName, String sectionName) {
32          super();
33          this.viewName = viewName;
34          this.sectionName = sectionName;
35      }
36  
37      private String sectionName;
38      private List<ExportElement> subset;
39  
40      public String getViewName() {
41          return viewName;
42      }
43  
44      public void setViewName(String viewName) {
45          this.viewName = viewName;
46      }
47  
48      public String getSectionName() {
49          return sectionName;
50      }
51  
52      public void setSectionName(String sectionName) {
53          this.sectionName = sectionName;
54      }
55  
56      public String getFieldLabel() {
57          return fieldLabel;
58      }
59  
60      public void setFieldLabel(String fieldLabel) {
61          this.fieldLabel = fieldLabel;
62      }
63  
64      public String getFieldValue() {
65          return this.fieldValue;
66      }
67  
68      public void setFieldValue(String fieldValue) {
69          this.fieldValue = fieldValue;
70      }
71  
72  	public boolean isSub() {
73          return subset != null;
74      }
75      
76      public void setPrintType(int printType) {
77          this.printType = printType;
78      }
79  
80      public int getPrintType() {
81          if (this.printType != -1) {
82              if (this.printType == LIST && this.getSubset() != null){
83                  return LIST_SUBREPORT;
84              }
85              return this.printType;
86          } else if (this.getSubset() != null && this.getValue().equals( "" )) {
87              return SUBREPORT;
88          }
89          return DEFAULT;
90      }
91  
92      public List<ExportElement> getSubset() {
93          return subset;
94      }
95  
96      public void setSubset(List<ExportElement> subset) {
97          if (subset != null && subset.size() > 0) {
98              this.subset = subset;
99          }
100     }
101 
102     public boolean isMandatory() {
103         return isMandatory;
104     }
105 
106     public void setMandatory(boolean isMandatory) {
107         this.isMandatory = isMandatory;
108     }
109 
110     public String getFieldValue2() {
111         return fieldValue2;
112     }
113 
114     public void setFieldValue2(String fieldValue2) {
115         this.fieldValue2 = fieldValue2;
116     }
117 
118     public String getKey() {
119         if (this.getFieldLabel() != null) {
120             return this.getFieldLabel();
121         }
122         return "";
123     }
124 
125     public String getValue() {
126         if (this.getFieldValue() != null) {
127             return getFieldValue();
128         }
129         return "";
130     }
131 
132     public String getProposalValue() {
133         if (this.getFieldValue() != null) {
134             return getFieldValue();
135         }
136         return "";
137     }
138 
139     public String getOriginalValue() {
140         if (this.getFieldValue2() != null) {
141             return this.getFieldValue2();
142         }
143         return "";
144     }
145 
146     public boolean isDataEmpty() {
147         if ((this.fieldLabel == null) && (this.fieldValue == null) && (this.fieldValue2 == null)) {
148             return true;
149         }
150         return false;
151     }
152 
153     public boolean isEmpty() {
154         if ((this.fieldLabel == null) && (this.fieldValue == null) && (this.fieldValue2 == null) && (this.subset == null)) {
155             return true;
156         }
157         return false;
158     }
159 
160     public String toString() {
161         return this.sectionName + " - " + this.viewName + " - " + this.getFieldLabel() + " - " + this.getFieldValue() + " - " + this.getFieldValue2();
162     }
163 
164 }