1 | |
package org.kuali.student.lum.program.client; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.HashMap; |
5 | |
import java.util.List; |
6 | |
import java.util.Map; |
7 | |
|
8 | |
import org.kuali.student.common.assembly.data.Data; |
9 | |
import org.kuali.student.common.assembly.data.Metadata; |
10 | |
import org.kuali.student.common.dto.DtoConstants; |
11 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
12 | |
import org.kuali.student.common.ui.client.application.Application; |
13 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
14 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController; |
15 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
16 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
17 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
18 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
19 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
20 | |
import org.kuali.student.common.ui.client.mvc.ModelProvider; |
21 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
22 | |
import org.kuali.student.common.ui.client.mvc.View; |
23 | |
import org.kuali.student.common.ui.client.mvc.dto.ReferenceModel; |
24 | |
import org.kuali.student.common.ui.client.mvc.history.HistoryManager; |
25 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
26 | |
import org.kuali.student.common.ui.client.util.ExportElement; |
27 | |
import org.kuali.student.common.ui.client.util.ExportUtils; |
28 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
29 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract; |
30 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations; |
31 | |
import org.kuali.student.common.ui.client.widgets.dialog.ButtonMessageDialog; |
32 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonGroup; |
33 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.YesNoCancelGroup; |
34 | |
import org.kuali.student.common.ui.shared.IdAttributes; |
35 | |
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
36 | |
import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool; |
37 | |
import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper; |
38 | |
import org.kuali.student.lum.common.client.widgets.AppLocations; |
39 | |
import org.kuali.student.lum.program.client.events.ModelLoadedEvent; |
40 | |
import org.kuali.student.lum.program.client.events.UpdateEvent; |
41 | |
import org.kuali.student.lum.program.client.rpc.AbstractCallback; |
42 | |
import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcService; |
43 | |
import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcServiceAsync; |
44 | |
import org.kuali.student.lum.program.client.widgets.ProgramSideBar; |
45 | |
|
46 | |
import com.google.gwt.core.client.GWT; |
47 | |
import com.google.gwt.event.dom.client.ClickEvent; |
48 | |
import com.google.gwt.event.dom.client.ClickHandler; |
49 | |
import com.google.gwt.event.shared.HandlerManager; |
50 | |
import com.google.gwt.user.client.ui.Label; |
51 | |
import com.google.gwt.user.client.ui.Widget; |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | 0 | public abstract class ProgramController extends MenuSectionController { |
57 | |
|
58 | |
protected MajorDisciplineRpcServiceAsync programRemoteService; |
59 | |
|
60 | 0 | protected boolean initialized = false; |
61 | |
|
62 | |
protected DataModel programModel; |
63 | |
|
64 | |
protected AbstractProgramConfigurer configurer; |
65 | |
|
66 | |
protected HandlerManager eventBus; |
67 | |
|
68 | 0 | protected Label statusLabel = new Label(); |
69 | |
|
70 | |
protected ProgramSideBar sideBar; |
71 | |
|
72 | 0 | private boolean needToLoadOldModel = false; |
73 | |
|
74 | |
protected ProgramStatus lastLoadedStatus; |
75 | |
|
76 | 0 | protected boolean reloadMetadata = false; |
77 | |
|
78 | 0 | protected boolean processBeforeShow = true; |
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
public ProgramController(String name, DataModel programModel, ViewContext viewContext, HandlerManager eventBus) { |
86 | 0 | super(); |
87 | 0 | programRemoteService = createProgramRemoteService(); |
88 | 0 | this.eventBus = eventBus; |
89 | 0 | this.programModel = programModel; |
90 | 0 | setViewContext(viewContext); |
91 | 0 | initializeModel(); |
92 | 0 | } |
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
protected MajorDisciplineRpcServiceAsync createProgramRemoteService() { |
99 | 0 | return GWT.create(MajorDisciplineRpcService.class); |
100 | |
} |
101 | |
|
102 | |
@Override |
103 | |
public void beforeViewChange(Enum<?> viewChangingTo, final Callback<Boolean> okToChange) { |
104 | 0 | if (processBeforeShow) { |
105 | 0 | super.beforeViewChange(viewChangingTo, new Callback<Boolean>() { |
106 | |
|
107 | |
@Override |
108 | |
public void exec(Boolean result) { |
109 | 0 | if (result) { |
110 | 0 | if (getCurrentView() instanceof SectionView && ((SectionView) getCurrentView()).isDirty()) { |
111 | 0 | ButtonGroup<ButtonEnumerations.YesNoCancelEnum> buttonGroup = new YesNoCancelGroup(); |
112 | 0 | final ButtonMessageDialog<ButtonEnumerations.YesNoCancelEnum> dialog = new ButtonMessageDialog<ButtonEnumerations.YesNoCancelEnum>("Warning", "You may have unsaved changes. Save changes?", buttonGroup); |
113 | 0 | buttonGroup.addCallback(new Callback<ButtonEnumerations.YesNoCancelEnum>() { |
114 | |
|
115 | |
@Override |
116 | |
public void exec(ButtonEnumerations.YesNoCancelEnum result) { |
117 | 0 | switch (result) { |
118 | |
case YES: |
119 | 0 | dialog.hide(); |
120 | 0 | fireUpdateEvent(okToChange); |
121 | 0 | break; |
122 | |
case NO: |
123 | 0 | dialog.hide(); |
124 | 0 | resetModel(); |
125 | 0 | needToLoadOldModel = true; |
126 | 0 | resetFieldInteractionFlag(); |
127 | 0 | okToChange.exec(true); |
128 | 0 | break; |
129 | |
case CANCEL: |
130 | 0 | okToChange.exec(false); |
131 | 0 | dialog.hide(); |
132 | |
|
133 | 0 | HistoryManager.logHistoryChange(); |
134 | |
break; |
135 | |
} |
136 | 0 | } |
137 | |
}); |
138 | 0 | dialog.addCloseLinkClickHandler(new ClickHandler() { |
139 | |
|
140 | |
@Override |
141 | |
public void onClick(ClickEvent event) { |
142 | 0 | okToChange.exec(false); |
143 | 0 | dialog.hide(); |
144 | |
|
145 | 0 | HistoryManager.logHistoryChange(); |
146 | 0 | } |
147 | |
}); |
148 | 0 | dialog.show(); |
149 | 0 | } else { |
150 | 0 | okToChange.exec(true); |
151 | |
} |
152 | |
} else { |
153 | 0 | okToChange.exec(false); |
154 | |
} |
155 | 0 | } |
156 | |
}); |
157 | |
} else { |
158 | 0 | processBeforeShow = true; |
159 | |
} |
160 | 0 | } |
161 | |
|
162 | |
protected void fireUpdateEvent(final Callback<Boolean> okToChange) { |
163 | 0 | eventBus.fireEvent(new UpdateEvent(okToChange)); |
164 | 0 | } |
165 | |
|
166 | |
protected void resetModel() { |
167 | 0 | programModel.resetRoot(); |
168 | 0 | } |
169 | |
|
170 | |
protected void resetFieldInteractionFlag() { |
171 | 0 | View currentView = getCurrentView(); |
172 | 0 | if (currentView instanceof Section) { |
173 | 0 | ((Section) currentView).resetFieldInteractionFlags(); |
174 | |
} |
175 | 0 | } |
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
private void initializeModel() { |
181 | 0 | setDefaultModelId(ProgramConstants.PROGRAM_MODEL_ID); |
182 | 0 | registerModel(ProgramConstants.PROGRAM_MODEL_ID, new ModelProvider<DataModel>() { |
183 | |
@Override |
184 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
185 | 0 | if (programModel.getRoot() == null || programModel.getRoot().size() == 0) { |
186 | 0 | loadModel(callback); |
187 | |
} else { |
188 | 0 | callback.onModelReady(programModel); |
189 | |
} |
190 | 0 | } |
191 | |
}); |
192 | 0 | } |
193 | |
|
194 | |
|
195 | |
@Override |
196 | |
public void requestModel(Class modelType, ModelRequestCallback callback) { |
197 | 0 | if (modelType == ReferenceModel.class) { |
198 | 0 | ReferenceModel referenceModel = new ReferenceModel(); |
199 | 0 | referenceModel.setReferenceId(ProgramUtils.getProgramId(programModel)); |
200 | 0 | referenceModel.setReferenceTypeKey(ProgramConstants.MAJOR_REFERENCE_TYPE_ID); |
201 | 0 | referenceModel.setReferenceType(ProgramConstants.MAJOR_LU_TYPE_ID); |
202 | 0 | Map<String, String> attributes = new HashMap<String, String>(); |
203 | 0 | attributes.put("name", getStringProperty("name")); |
204 | 0 | referenceModel.setReferenceAttributes(attributes); |
205 | 0 | callback.onModelReady(referenceModel); |
206 | 0 | } else { |
207 | 0 | super.requestModel(modelType, callback); |
208 | |
} |
209 | 0 | } |
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | |
protected void loadModel(final ModelRequestCallback<DataModel> callback) { |
218 | 0 | programRemoteService.getData(getViewContext().getId(), new AbstractCallback<Data>(getLabel(ProgramMsgConstants.COMMON_RETRIEVINGDATA)) { |
219 | |
|
220 | |
@Override |
221 | |
public void onFailure(Throwable caught) { |
222 | 0 | super.onFailure(caught); |
223 | 0 | callback.onRequestFail(caught); |
224 | 0 | } |
225 | |
|
226 | |
@Override |
227 | |
public void onSuccess(Data result) { |
228 | 0 | super.onSuccess(result); |
229 | 0 | programModel.setRoot(result); |
230 | 0 | setHeaderTitle(); |
231 | 0 | callback.onModelReady(programModel); |
232 | 0 | } |
233 | |
}); |
234 | 0 | } |
235 | |
|
236 | |
private void setModelData() { |
237 | 0 | setHeaderTitle(); |
238 | 0 | setStatus(); |
239 | 0 | configurer.applyPermissions(); |
240 | |
|
241 | 0 | if (needToLoadOldModel) { |
242 | 0 | needToLoadOldModel = false; |
243 | |
} else { |
244 | 0 | String id = ProgramUtils.getProgramId(programModel); |
245 | 0 | if (null != id) { |
246 | |
|
247 | 0 | ViewContext docContext = new ViewContext(); |
248 | 0 | docContext.setId(id); |
249 | 0 | docContext.setIdType(IdType.OBJECT_ID); |
250 | 0 | String pgmType = getStringProperty(ProgramConstants.TYPE); |
251 | 0 | docContext.setAttribute(ProgramConstants.TYPE, pgmType + '/' + ProgramSections.PROGRAM_DETAILS_VIEW); |
252 | 0 | RecentlyViewedHelper.addDocument(getProgramName(), |
253 | |
HistoryManager.appendContext(getProgramViewLocation(pgmType), docContext)); |
254 | |
} |
255 | 0 | eventBus.fireEvent(new ModelLoadedEvent(programModel)); |
256 | 0 | onModelLoadedEvent(); |
257 | |
} |
258 | 0 | } |
259 | |
|
260 | |
private String getProgramViewLocation(String pgmType) { |
261 | 0 | if (ProgramClientConstants.MAJOR_PROGRAM.equals(pgmType)) { |
262 | 0 | return AppLocations.Locations.VIEW_PROGRAM.getLocation(); |
263 | 0 | } else if (ProgramClientConstants.CORE_PROGRAM.equals(pgmType)) { |
264 | 0 | return AppLocations.Locations.VIEW_CORE_PROGRAM.getLocation(); |
265 | 0 | } else if (ProgramClientConstants.CREDENTIAL_PROGRAM_TYPES.contains(pgmType)) { |
266 | 0 | return AppLocations.Locations.VIEW_BACC_PROGRAM.getLocation(); |
267 | |
} |
268 | 0 | return null; |
269 | |
} |
270 | |
|
271 | |
protected void setStatus() { |
272 | 0 | statusLabel.setText(getLabel(ProgramMsgConstants.COMMON_STATUS,getStringProperty(ProgramConstants.STATE))); |
273 | 0 | } |
274 | |
|
275 | |
public String getProgramName() { |
276 | 0 | String name = getStringProperty(ProgramConstants.LONG_TITLE); |
277 | 0 | if (name == null) { |
278 | 0 | name = getLabel(ProgramMsgConstants.COMMON_NEWPROGRAM); |
279 | |
} |
280 | 0 | return name; |
281 | |
} |
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
@Override |
289 | |
public void beforeShow(final Callback<Boolean> onReadyCallback) { |
290 | 0 | if (programModel.getRoot() == null) { |
291 | 0 | loadModel(new ModelRequestCallback<DataModel>() { |
292 | |
@Override |
293 | |
public void onModelReady(DataModel model) { |
294 | 0 | if (loadMetadataCondition()) { |
295 | 0 | loadMetadata(onReadyCallback); |
296 | |
} else { |
297 | |
|
298 | 0 | onReadyCallback.exec(true); |
299 | |
} |
300 | 0 | } |
301 | |
|
302 | |
@Override |
303 | |
public void onRequestFail(Throwable cause) { |
304 | 0 | GWT.log(cause.getMessage()); |
305 | 0 | } |
306 | |
}); |
307 | |
} else { |
308 | 0 | afterMetadataLoaded(onReadyCallback); |
309 | |
} |
310 | 0 | } |
311 | |
|
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
protected boolean loadMetadataCondition() { |
318 | 0 | return lastLoadedStatus == null || ProgramStatus.of(programModel) != lastLoadedStatus; |
319 | |
} |
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | |
|
325 | |
|
326 | |
protected void loadMetadata(final Callback<Boolean> onReadyCallback) { |
327 | 0 | Map<String, String> idAttributes = new HashMap<String, String>(); |
328 | 0 | ViewContext viewContext = getViewContext(); |
329 | 0 | IdType idType = viewContext.getIdType(); |
330 | 0 | String viewContextId = null; |
331 | 0 | if (idType != null) { |
332 | 0 | idAttributes.put(IdAttributes.ID_TYPE, idType.toString()); |
333 | 0 | viewContextId = viewContext.getId(); |
334 | 0 | if (idType == IdType.COPY_OF_OBJECT_ID) { |
335 | |
|
336 | 0 | viewContextId = null; |
337 | |
} |
338 | |
} |
339 | 0 | if (programModel.getRoot() != null) { |
340 | 0 | ProgramStatus programStatus = ProgramStatus.of(programModel); |
341 | 0 | idAttributes.put(DtoConstants.DTO_STATE, programStatus.getValue()); |
342 | 0 | if (programStatus.getNextStatus() != null) { |
343 | 0 | idAttributes.put(DtoConstants.DTO_NEXT_STATE, programStatus.getNextStatus().getValue()); |
344 | |
} |
345 | |
} |
346 | 0 | programRemoteService.getMetadata(viewContextId, idAttributes, new AbstractCallback<Metadata>() { |
347 | |
|
348 | |
@Override |
349 | |
public void onSuccess(Metadata result) { |
350 | 0 | super.onSuccess(result); |
351 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
352 | 0 | programModel.setDefinition(def); |
353 | 0 | lastLoadedStatus = ProgramStatus.of(programModel); |
354 | 0 | afterMetadataLoaded(onReadyCallback); |
355 | 0 | } |
356 | |
|
357 | |
@Override |
358 | |
public void onFailure(Throwable caught) { |
359 | 0 | super.onFailure(caught); |
360 | 0 | onReadyCallback.exec(false); |
361 | 0 | } |
362 | |
}); |
363 | 0 | } |
364 | |
|
365 | |
protected void configureView() { |
366 | 0 | addStyleName("programController"); |
367 | 0 | configurer.setModelDefinition(programModel.getDefinition()); |
368 | 0 | configurer.configure(this); |
369 | 0 | addContentWidget(statusLabel); |
370 | 0 | setSideBarWidget(sideBar); |
371 | 0 | } |
372 | |
|
373 | |
@Override |
374 | |
public void setViewContext(ViewContext viewContext) { |
375 | 0 | super.setViewContext(viewContext); |
376 | 0 | if (viewContext.getId() != null && !viewContext.getId().isEmpty()) { |
377 | 0 | viewContext.setPermissionType(PermissionType.OPEN); |
378 | |
} else { |
379 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
380 | |
} |
381 | 0 | } |
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
protected void afterMetadataLoaded(Callback<Boolean> onReadyCallback) { |
389 | 0 | if (!reloadMetadata) { |
390 | 0 | configureView(); |
391 | 0 | onReadyCallback.exec(true); |
392 | 0 | reloadMetadata = true; |
393 | |
} else { |
394 | 0 | onReadyCallback.exec(true); |
395 | 0 | ProgramUtils.syncMetadata(configurer, programModel.getDefinition()); |
396 | |
} |
397 | 0 | if (programModel.getRoot() != null) { |
398 | 0 | setModelData(); |
399 | |
} |
400 | 0 | } |
401 | |
|
402 | |
protected void setHeaderTitle() { |
403 | 0 | String title = getProgramName(); |
404 | 0 | this.setContentTitle(title); |
405 | 0 | this.setName(title); |
406 | 0 | } |
407 | |
|
408 | |
protected Widget createCommentPanel() { |
409 | 0 | final CommentTool commentTool = new CommentTool(ProgramSections.COMMENTS, "Comments", "kuali.comment.type.generalRemarks", "Program Comments"); |
410 | 0 | commentTool.setController(this); |
411 | 0 | KSButton commentsButton = new KSButton(getLabel(ProgramMsgConstants.COMMENTS_BUTTON), KSButtonAbstract.ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() { |
412 | |
|
413 | |
@Override |
414 | |
public void onClick(ClickEvent event) { |
415 | 0 | commentTool.show(); |
416 | 0 | } |
417 | |
}); |
418 | 0 | return commentsButton; |
419 | |
} |
420 | |
|
421 | |
protected void doSave() { |
422 | 0 | } |
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
|
438 | |
|
439 | |
|
440 | |
|
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
|
448 | |
protected void updateState(String state, final Callback<Boolean> okCallback) { |
449 | |
|
450 | 0 | programRemoteService.updateState(programModel.getRoot(), state, new AbstractCallback<DataSaveResult>(getLabel(ProgramMsgConstants.COMMON_SAVINGDATA)) { |
451 | |
@Override |
452 | |
public void onSuccess(DataSaveResult result) { |
453 | 0 | if(result.getValidationResults()==null || result.getValidationResults().isEmpty()){ |
454 | 0 | super.onSuccess(result); |
455 | 0 | okCallback.exec(true); |
456 | 0 | refreshModelAndView(result); |
457 | |
}else{ |
458 | |
|
459 | 0 | super.onSuccess(result); |
460 | |
|
461 | 0 | isValid(result.getValidationResults(), false, true); |
462 | 0 | ProgramUtils.handleValidationErrorsForSpecializations(result.getValidationResults(), programModel); |
463 | |
|
464 | 0 | okCallback.exec(false); |
465 | |
} |
466 | 0 | } |
467 | |
|
468 | |
}); |
469 | |
|
470 | 0 | } |
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
public void refreshModelAndView(DataSaveResult result){ |
477 | 0 | if (result != null) { |
478 | 0 | programModel.setRoot(result.getValue()); |
479 | |
} |
480 | 0 | setHeaderTitle(); |
481 | 0 | setStatus(); |
482 | 0 | } |
483 | |
|
484 | |
public DataModel getProgramModel() { |
485 | 0 | return programModel; |
486 | |
} |
487 | |
|
488 | |
public void onModelLoadedEvent() { |
489 | 0 | } |
490 | |
|
491 | |
protected String getStringProperty(String key) { |
492 | 0 | return programModel.get(key); |
493 | |
} |
494 | |
|
495 | |
protected Data getDataProperty(String key) { |
496 | 0 | return programModel.get(key); |
497 | |
} |
498 | |
|
499 | |
public boolean isExportButtonActive() { |
500 | 0 | if (this.getCurrentViewEnum() != null) { |
501 | 0 | if (this.getCurrentViewEnum().equals(ProgramSections.SUMMARY) |
502 | |
|| this.getCurrentViewEnum().equals(ProgramSections.VIEW_ALL)) { |
503 | 0 | return true; |
504 | |
} else { |
505 | 0 | return false; |
506 | |
} |
507 | |
|
508 | |
} else { |
509 | 0 | return false; |
510 | |
} |
511 | |
} |
512 | |
|
513 | |
|
514 | |
|
515 | |
|
516 | |
|
517 | |
@Override |
518 | |
public String getExportTemplateName() { |
519 | 0 | if (this.getCurrentViewEnum().equals(ProgramSections.VIEW_ALL)){ |
520 | 0 | return "base.template"; |
521 | |
} |
522 | 0 | return "proposal.template"; |
523 | |
} |
524 | |
|
525 | |
@Override |
526 | |
public List<ExportElement> getExportElementsFromView() { |
527 | |
|
528 | 0 | String viewName = null; |
529 | 0 | String sectionTitle = null; |
530 | 0 | View currentView = this.getCurrentView(); |
531 | 0 | if (currentView != null) { |
532 | |
|
533 | 0 | List<ExportElement> exportElements = new ArrayList<ExportElement>(); |
534 | 0 | ExportElement heading = new ExportElement(); |
535 | 0 | heading.setFieldLabel(""); |
536 | 0 | heading.setFieldValue(currentView.getName()); |
537 | 0 | exportElements.add(heading); |
538 | |
|
539 | 0 | if (currentView instanceof Section) { |
540 | 0 | Section currentSection = (Section) currentView; |
541 | 0 | List<Section> nestedSections = currentSection.getSections(); |
542 | 0 | for (int i = 0; i < nestedSections.size(); i++) { |
543 | 0 | ExportElement sectionExportItem = new ExportElement(); |
544 | 0 | ArrayList<ExportElement> subList = null; |
545 | 0 | Section nestedSection = nestedSections.get(i); |
546 | 0 | if (nestedSection != null && nestedSection instanceof SectionView) { |
547 | 0 | SectionView nestedSectionView = (SectionView) nestedSection; |
548 | 0 | viewName = nestedSectionView.getName(); |
549 | 0 | sectionTitle = nestedSectionView.getTitle(); |
550 | 0 | sectionExportItem.setSectionName(sectionTitle + " " + i + " - " + viewName); |
551 | 0 | sectionExportItem.setViewName(sectionTitle + " " + i + " - " + viewName); |
552 | 0 | subList = ExportUtils.getExportElementsFromView(nestedSectionView, subList, viewName, sectionTitle); |
553 | 0 | if (subList != null && subList.size()> 0) { |
554 | 0 | sectionExportItem.setSubset(subList); |
555 | 0 | exportElements.add(sectionExportItem); |
556 | |
} |
557 | |
} |
558 | |
} |
559 | |
} |
560 | 0 | return exportElements; |
561 | |
|
562 | |
} else { |
563 | |
|
564 | |
} |
565 | 0 | return null; |
566 | |
|
567 | |
} |
568 | |
|
569 | |
protected String getLabel(String messageKey) { |
570 | 0 | return Application.getApplicationContext().getUILabel(ProgramMsgConstants.PROGRAM_MSG_GROUP, messageKey); |
571 | |
} |
572 | |
|
573 | |
protected String getLabel(String messageKey, String parameter) { |
574 | 0 | Map<String, Object> parameters = new HashMap<String, Object>(); |
575 | 0 | parameters.put("0", parameter); |
576 | 0 | return Application.getApplicationContext().getUILabel(ProgramMsgConstants.PROGRAM_MSG_GROUP, messageKey, parameters); |
577 | |
} |
578 | |
|
579 | |
} |