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  
26      public ExportElement() {
27          super();
28      }
29  
30      public ExportElement(String viewName, String sectionName) {
31          super();
32          this.viewName = viewName;
33          this.sectionName = sectionName;
34      }
35  
36      private String sectionName;
37      private List<ExportElement> subset;
38  
39      public String getViewName() {
40          return viewName;
41      }
42  
43      public void setViewName(String viewName) {
44          this.viewName = viewName;
45      }
46  
47      public String getSectionName() {
48          return sectionName;
49      }
50  
51      public void setSectionName(String sectionName) {
52          this.sectionName = sectionName;
53      }
54  
55      public String getFieldLabel() {
56          return fieldLabel;
57      }
58  
59      public void setFieldLabel(String fieldLabel) {
60          this.fieldLabel = fieldLabel;
61      }
62  
63      public String getFieldValue() {
64          return this.fieldValue;
65      }
66  
67      public void setFieldValue(String fieldValue) {
68          this.fieldValue = fieldValue;
69      }
70  
71  	public boolean isSub() {
72          return subset != null;
73      }
74      
75      public void setPrintType(int printType) {
76          this.printType = printType;
77      }
78  
79      public int getPrintType() {
80          if (this.printType != -1) {
81              if (this.printType == LIST && this.getSubset() != null){
82                  return LIST_SUBREPORT;
83              }
84              return this.printType;
85          } else if (this.getSubset() != null && this.getValue().equals( "" )) {
86              return SUBREPORT;
87          }
88          return DEFAULT;
89      }
90  
91      public List<ExportElement> getSubset() {
92          return subset;
93      }
94  
95      public void setSubset(List<ExportElement> subset) {
96          if (subset != null && subset.size() > 0) {
97              this.subset = subset;
98          }
99      }
100 
101     public boolean isMandatory() {
102         return isMandatory;
103     }
104 
105     public void setMandatory(boolean isMandatory) {
106         this.isMandatory = isMandatory;
107     }
108 
109     public String getFieldValue2() {
110         return fieldValue2;
111     }
112 
113     public void setFieldValue2(String fieldValue2) {
114         this.fieldValue2 = fieldValue2;
115     }
116 
117     public String getKey() {
118         if (this.getFieldLabel() != null) {
119             return this.getFieldLabel();
120         }
121         return "";
122     }
123 
124     public String getValue() {
125         if (this.getFieldValue() != null) {
126             return getFieldValue();
127         }
128         return "";
129     }
130 
131     public String getProposalValue() {
132         if (this.getFieldValue() != null) {
133             return getFieldValue();
134         }
135         return "";
136     }
137 
138     public String getOriginalValue() {
139         if (this.getFieldValue2() != null) {
140             return this.getFieldValue2();
141         }
142         return "";
143     }
144 
145     public boolean isDataEmpty() {
146         if ((this.fieldLabel == null) && (this.fieldValue == null) && (this.fieldValue2 == null)) {
147             return true;
148         }
149         return false;
150     }
151 
152     public boolean isEmpty() {
153         if ((this.fieldLabel == null) && (this.fieldValue == null) && (this.fieldValue2 == null) && (this.subset == null)) {
154             return true;
155         }
156         return false;
157     }
158 
159     public String toString() {
160         return this.sectionName + " - " + this.viewName + " - " + this.getFieldLabel() + " - " + this.getFieldValue() + " - " + this.getFieldValue2();
161     }
162 
163 }