1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.components;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.kuali.rice.krad.demo.uif.form.KradSampleAppForm;
22 import org.kuali.rice.krad.uif.component.Component;
23 import org.kuali.rice.krad.uif.container.Group;
24 import org.kuali.rice.krad.uif.container.TabGroup;
25 import org.kuali.rice.krad.uif.element.ContentElementBase;
26 import org.kuali.rice.krad.uif.field.FieldGroup;
27 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleRestriction;
28 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleRestriction;
29 import org.kuali.rice.krad.uif.widget.SyntaxHighlighter;
30
31
32
33
34
35
36
37 public class ComponentExhibit extends ContentElementBase {
38
39 private List<Group> demoGroups;
40 private List<String> demoSourceCode;
41 private List<String> additionalDemoSourceCode1 = new ArrayList<String>();
42 private List<String> additionalDemoSourceCode2 = new ArrayList<String>();
43 private SyntaxHighlighter sourceCodeViewer;
44 private SyntaxHighlighter additionalSourceCodeViewer1;
45 private SyntaxHighlighter additionalSourceCodeViewer2;
46 private FieldGroup docLinkFields;
47 private TabGroup tabGroup;
48
49
50
51
52
53
54 @Override
55 public void performInitialization(Object model) {
56
57 List<Component> tabItems = new ArrayList<Component>();
58 tabItems.addAll(tabGroup.getItems());
59 tabItems.addAll(demoGroups);
60 tabGroup.setItems(tabItems);
61
62
63 int currentIndice = 0;
64 if (model instanceof KradSampleAppForm) {
65 KradSampleAppForm kradSampleAppForm = (KradSampleAppForm) model;
66 if (kradSampleAppForm.getCurrentExampleIndex() != null) {
67 currentIndice = Integer.parseInt(kradSampleAppForm.getCurrentExampleIndex());
68 }
69 String id = demoGroups.get(currentIndice).getId();
70 tabGroup.setDefaultActiveTabId(id);
71 }
72
73
74 if(demoSourceCode != null && !demoSourceCode.isEmpty() && currentIndice < demoSourceCode.size()){
75 sourceCodeViewer.setSourceCode(demoSourceCode.get(currentIndice));
76 }
77
78 if(additionalDemoSourceCode1 != null && !additionalDemoSourceCode1.isEmpty() && currentIndice < additionalDemoSourceCode1.size()
79 && additionalDemoSourceCode1.get(currentIndice) != null){
80 additionalSourceCodeViewer1.setSourceCode(additionalDemoSourceCode1.get(currentIndice));
81 }
82
83 if(additionalDemoSourceCode2 != null && !additionalDemoSourceCode2.isEmpty() && currentIndice < additionalDemoSourceCode2.size()
84 && additionalDemoSourceCode2.get(currentIndice) != null){
85 additionalSourceCodeViewer2.setSourceCode(additionalDemoSourceCode2.get(currentIndice));
86 }
87 }
88
89
90
91
92
93
94 @ViewLifecycleRestriction
95 public List<Group> getDemoGroups() {
96 return demoGroups;
97 }
98
99
100
101
102
103
104 public void setDemoGroups(List<Group> demoGroups) {
105 this.demoGroups = demoGroups;
106 }
107
108
109
110
111
112
113 public List<String> getDemoSourceCode() {
114 return demoSourceCode;
115 }
116
117
118
119
120
121
122 public void setDemoSourceCode(List<String> demoSourceCode) {
123 this.demoSourceCode = demoSourceCode;
124 }
125
126
127
128
129
130
131 public SyntaxHighlighter getSourceCodeViewer() {
132 return sourceCodeViewer;
133 }
134
135
136
137
138
139
140 public void setSourceCodeViewer(SyntaxHighlighter sourceCodeViewer) {
141 this.sourceCodeViewer = sourceCodeViewer;
142 }
143
144
145
146
147
148
149 @ViewLifecycleRestriction
150 public FieldGroup getDocLinkFields() {
151 return docLinkFields;
152 }
153
154
155
156
157
158 public void setDocLinkFields(FieldGroup docLinkFields) {
159 this.docLinkFields = docLinkFields;
160 }
161
162
163
164
165
166
167 public TabGroup getTabGroup() {
168 return tabGroup;
169 }
170
171
172
173
174
175
176 public void setTabGroup(TabGroup tabGroup) {
177 this.tabGroup = tabGroup;
178 }
179
180 public List<String> getAdditionalDemoSourceCode1() {
181 return additionalDemoSourceCode1;
182 }
183
184 public void setAdditionalDemoSourceCode1(List<String> additionalDemoSourceCode1) {
185 this.additionalDemoSourceCode1 = additionalDemoSourceCode1;
186 }
187
188 public List<String> getAdditionalDemoSourceCode2() {
189 return additionalDemoSourceCode2;
190 }
191
192 public void setAdditionalDemoSourceCode2(List<String> additionalDemoSourceCode2) {
193 this.additionalDemoSourceCode2 = additionalDemoSourceCode2;
194 }
195
196 public SyntaxHighlighter getAdditionalSourceCodeViewer1() {
197 return additionalSourceCodeViewer1;
198 }
199
200 public void setAdditionalSourceCodeViewer1(SyntaxHighlighter additionalSourceCodeViewer1) {
201 this.additionalSourceCodeViewer1 = additionalSourceCodeViewer1;
202 }
203
204 public SyntaxHighlighter getAdditionalSourceCodeViewer2() {
205 return additionalSourceCodeViewer2;
206 }
207
208 public void setAdditionalSourceCodeViewer2(SyntaxHighlighter additionalSourceCodeViewer2) {
209 this.additionalSourceCodeViewer2 = additionalSourceCodeViewer2;
210 }
211 }