1 package org.kuali.student.lum.lu.ui.dependency.client.views;
2
3
4 import java.util.ArrayList;
5 import java.util.Arrays;
6 import java.util.HashMap;
7 import java.util.HashSet;
8 import java.util.List;
9 import java.util.Map;
10 import java.util.Set;
11
12 import org.kuali.student.common.assembly.data.LookupMetadata;
13 import org.kuali.student.common.assembly.data.Metadata;
14 import org.kuali.student.common.assembly.data.ModelDefinition;
15 import org.kuali.student.common.search.dto.SearchParam;
16 import org.kuali.student.common.search.dto.SearchRequest;
17 import org.kuali.student.common.search.dto.SearchResult;
18 import org.kuali.student.common.search.dto.SearchResultCell;
19 import org.kuali.student.common.search.dto.SearchResultRow;
20 import org.kuali.student.common.ui.client.application.KSAsyncCallback;
21 import org.kuali.student.common.ui.client.mvc.Callback;
22 import org.kuali.student.common.ui.client.mvc.Controller;
23 import org.kuali.student.common.ui.client.mvc.DataModelDefinition;
24 import org.kuali.student.common.ui.client.mvc.ViewComposite;
25 import org.kuali.student.common.ui.client.service.MetadataRpcService;
26 import org.kuali.student.common.ui.client.service.MetadataRpcServiceAsync;
27 import org.kuali.student.common.ui.client.service.SearchRpcService;
28 import org.kuali.student.common.ui.client.service.SearchRpcServiceAsync;
29 import org.kuali.student.common.ui.client.util.UtilConstants;
30 import org.kuali.student.common.ui.client.widgets.HasWatermark;
31 import org.kuali.student.common.ui.client.widgets.KSButton;
32 import org.kuali.student.common.ui.client.widgets.KSLabel;
33 import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
34 import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel;
35 import org.kuali.student.common.ui.client.widgets.field.layout.layouts.VerticalFieldLayout;
36 import org.kuali.student.common.ui.client.widgets.filter.FilterEvent;
37 import org.kuali.student.common.ui.client.widgets.filter.FilterEventHandler;
38 import org.kuali.student.common.ui.client.widgets.filter.FilterResetEventHandler;
39 import org.kuali.student.common.ui.client.widgets.filter.KSFilterOptions;
40 import org.kuali.student.common.ui.client.widgets.headers.KSDocumentHeader;
41 import org.kuali.student.common.ui.client.widgets.layout.HorizontalBlockFlowPanel;
42 import org.kuali.student.common.ui.client.widgets.layout.VerticalFlowPanel;
43 import org.kuali.student.common.ui.client.widgets.progress.BlockingTask;
44 import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator;
45 import org.kuali.student.common.ui.client.widgets.search.CollapsablePanel;
46 import org.kuali.student.common.ui.client.widgets.search.KSPicker;
47 import org.kuali.student.common.ui.client.widgets.suggestbox.KSSuggestBox;
48 import org.kuali.student.common.ui.client.widgets.suggestbox.IdableSuggestOracle.IdableSuggestion;
49 import org.kuali.student.core.statement.dto.ReqCompFieldInfo;
50 import org.kuali.student.core.statement.dto.ReqComponentInfo;
51 import org.kuali.student.core.statement.dto.StatementTreeViewInfo;
52 import org.kuali.student.core.statement.ui.client.widgets.rules.RulePreviewWidget;
53 import org.kuali.student.core.statement.ui.client.widgets.rules.RulesUtil;
54 import org.kuali.student.lum.common.client.lu.LUUIConstants;
55 import org.kuali.student.lum.common.client.widgets.AppLocations;
56 import org.kuali.student.lum.common.client.widgets.CluSetDetailsWidget;
57 import org.kuali.student.lum.common.client.widgets.CluSetRetriever;
58 import org.kuali.student.lum.common.client.widgets.CluSetRetrieverImpl;
59 import org.kuali.student.lum.lu.ui.dependency.client.controllers.DependencyAnalysisController;
60 import org.kuali.student.lum.lu.ui.dependency.client.controllers.DependencyAnalysisController.DependencyViews;
61 import org.kuali.student.lum.lu.ui.dependency.client.service.DependencyAnalysisRpcService;
62 import org.kuali.student.lum.lu.ui.dependency.client.service.DependencyAnalysisRpcServiceAsync;
63 import org.kuali.student.lum.lu.ui.dependency.client.widgets.DependencyResultPanel;
64 import org.kuali.student.lum.lu.ui.dependency.client.widgets.DependencyResultPanel.DependencyTypeSection;
65 import org.kuali.student.lum.lu.ui.tools.client.configuration.ClusetView.Picker;
66 import org.kuali.student.lum.program.dto.ProgramRequirementInfo;
67
68 import com.google.gwt.core.client.GWT;
69 import com.google.gwt.event.dom.client.ClickEvent;
70 import com.google.gwt.event.dom.client.ClickHandler;
71 import com.google.gwt.user.client.Window;
72 import com.google.gwt.user.client.ui.Anchor;
73 import com.google.gwt.user.client.ui.FlowPanel;
74 import com.google.gwt.user.client.ui.HTMLPanel;
75 import com.google.gwt.user.client.ui.HorizontalPanel;
76 import com.google.gwt.user.client.ui.Widget;
77
78 public class DependencyAnalysisView extends ViewComposite{
79
80 private static CluSetRetriever cluSetRetriever = new CluSetRetrieverImpl();
81
82 protected final BlockingTask initializingTask = new BlockingTask("Loading");
83
84 protected DependencyAnalysisRpcServiceAsync depRpcServiceAsync = GWT.create(DependencyAnalysisRpcService.class);
85 protected MetadataRpcServiceAsync metadataServiceAsync = GWT.create(MetadataRpcService.class);
86 protected SearchRpcServiceAsync searchServiceAsync = GWT.create(SearchRpcService.class);
87
88 private ModelDefinition searchDefinition;
89 private VerticalFieldLayout container = new VerticalFieldLayout();
90 protected boolean initialized = false;
91
92 protected String selectedCourseId;
93 protected String selectedCourseCd;
94 protected String selectedCourseName;
95
96 protected DependencyResultPanel depResultPanel;
97 protected KSFilterOptions dependencyFilter;
98 protected HorizontalBlockFlowPanel resultContainer = new HorizontalBlockFlowPanel();
99
100 private final BlockingTask loadDataTask = new BlockingTask("Retrieving Data");
101
102 private KSDocumentHeader header;
103
104 public DependencyAnalysisView(Controller controller) {
105 super(controller, "Dependency Analysis", DependencyViews.MAIN);
106 this.initWidget(container);
107 this.addStyleName("blockLayout");
108 this.addStyleName("ks-dependency-container");
109 }
110
111 @Override
112 public void beforeShow(final Callback<Boolean> onReadyCallback) {
113 if (!initialized) {
114 KSBlockingProgressIndicator.addTask(initializingTask);
115
116
117 metadataServiceAsync.getMetadata("dependency", null, null, new KSAsyncCallback<Metadata>(){
118
119 @Override
120 public void handleFailure(Throwable caught) {
121 KSBlockingProgressIndicator.removeTask(initializingTask);
122 throw new RuntimeException("Failed to load search definitions.", caught);
123 }
124
125 @Override
126 public void onSuccess(Metadata result) {
127 searchDefinition = new DataModelDefinition(result);
128 init();
129 onReadyCallback.exec(true);
130 initialized = true;
131 KSBlockingProgressIndicator.removeTask(initializingTask);
132 }
133 });
134 } else {
135 onReadyCallback.exec(true);
136 }
137 }
138
139 protected void init(){
140 this.header = new KSDocumentHeader();
141
142 header.setTitle("Dependency Analysis");
143
144
145 Metadata metaData = searchDefinition.getMetadata("courseId");
146 final KSPicker triggerPicker = new Picker(metaData.getInitialLookup(), metaData.getAdditionalLookups());
147 ((HasWatermark)triggerPicker.getInputWidget()).setWatermarkText("Enter course code");
148
149
150 KSButton goButton = new KSButton("Go", ButtonStyle.PRIMARY_SMALL);
151 goButton.addClickHandler(new ClickHandler(){
152
153 @Override
154 public void onClick(ClickEvent event) {
155 selectedCourseId = triggerPicker.getValue().toString();
156 KSSuggestBox suggestBox = (KSSuggestBox)triggerPicker.getInputWidget();
157 IdableSuggestion selectedSuggestion = suggestBox.getCurrentSuggestion();
158
159
160 if(selectedSuggestion != null && selectedSuggestion.getReplacementString().equalsIgnoreCase(suggestBox.getText())){
161 selectedCourseName = selectedSuggestion.getAttrMap().get("lu.resultColumn.luOptionalLongName");
162 if (!selectedCourseId.equals(UtilConstants.IMPOSSIBLE_CHARACTERS)){
163 KSBlockingProgressIndicator.addTask(loadDataTask);
164 selectedCourseCd = triggerPicker.getDisplayValue();
165 if (depResultPanel != null){
166 resultContainer.remove(depResultPanel);
167 }
168 depResultPanel = new DependencyResultPanel();
169 depResultPanel.setHeaderTitle(selectedCourseCd + " - " + selectedCourseName);
170 resultContainer.add(depResultPanel);
171 resultContainer.setVisible(true);
172 updateDependencyResults();
173
174 ((DependencyAnalysisController) DependencyAnalysisView.this.getController()).showExport(isExportButtonActive());
175 header.showPrint(true);
176 header.setPrintContent(depResultPanel);
177 }
178
179 }
180 }
181
182 });
183
184
185
186 HorizontalPanel pickerPanel = new HorizontalPanel();
187 pickerPanel.add(triggerPicker);
188 pickerPanel.add(goButton);
189
190 FlowPanel searchPanel = new FlowPanel();
191 searchPanel.addStyleName("ks-dependency-search");
192 searchPanel.add(new KSLabel("Search for item to view its dependencies"));
193 searchPanel.add(pickerPanel);
194
195
196 container.setTitleWidget(header);
197 container.addStyleName("blockLayout");
198 container.addWidget(searchPanel);
199
200 List<LookupMetadata> lookups = new ArrayList<LookupMetadata>();
201 metaData = searchDefinition.getMetadata("filter");
202 lookups.add(metaData.getInitialLookup());
203
204 dependencyFilter = new KSFilterOptions(metaData.getAdditionalLookups());
205 dependencyFilter.addFilterEventHandler(new FilterEventHandler(){
206
207 @Override
208 public void onDeselect(FilterEvent e) {
209 depResultPanel.hide(e.getFilterKey(), e.getFilterValue());
210 }
211
212 @Override
213 public void onSelect(FilterEvent e) {
214 if (e.isInitialSelect()){
215 depResultPanel.hideAll();
216 }
217 depResultPanel.show(e.getFilterKey(), e.getFilterValue());
218 }
219
220 });
221
222 dependencyFilter.addFilterResetEventHandler(new FilterResetEventHandler(){
223
224 @Override
225 public void onReset() {
226 depResultPanel.showAll();
227 }
228 });
229
230 resultContainer.add(dependencyFilter);
231 resultContainer.setVisible(false);
232
233 container.addWidget(resultContainer);
234 }
235
236
237
238
239
240 protected void updateDependencyResults(){
241
242 depResultPanel.addSection(LUUIConstants.DEP_SECTION_COURSE,"Course Dependencies");
243 depResultPanel.addSection(LUUIConstants.DEP_SECTION_PROGRAM,"Program Dependencies");
244 depResultPanel.addSection(LUUIConstants.DEP_SECTION_COURSE_SET, "Course Set Inclusions");
245
246 dependencyFilter.reset();
247
248
249 SearchRequest searchRequest = new SearchRequest();
250 searchRequest.setSearchKey("lu.search.dependencyAnalysis");
251
252 SearchParam searchParam = new SearchParam();
253 searchParam.setKey("lu.queryParam.luOptionalCluId");
254 searchParam.setValue(selectedCourseId);
255 searchRequest.getParams().add(searchParam);
256
257 searchServiceAsync.search(searchRequest, new KSAsyncCallback<SearchResult>(){
258
259 @Override
260 public void onSuccess(SearchResult searchResults) {
261 for (SearchResultRow searchResultRow : searchResults.getRows ()) {
262
263
264 String cluCode = "";
265 String cluName = "";
266 String cluType = "";
267 String dependencyType = "";
268 String dependencyTypeName = "";
269 String reqComponentIds = "";
270 String reqRootId = "";
271 String cluId = "";
272 String curriculumOversightNames = "";
273 String dependencySectionKey = "";
274 Boolean diffAdminOrg = false;
275 String parentCluId = "";
276
277 for (SearchResultCell searchResultCell : searchResultRow.getCells ()){
278 if (searchResultCell.getKey().equals ("lu.resultColumn.luOptionalCode")) {
279 cluCode = searchResultCell.getValue();
280 } if (searchResultCell.getKey().equals ("lu.resultColumn.cluId")) {
281 cluId = searchResultCell.getValue();
282 } else if (searchResultCell.getKey().equals("lu.resultColumn.luOptionalLongName")){
283 cluName = searchResultCell.getValue();
284 } else if (searchResultCell.getKey().equals("lu.resultColumn.cluType")){
285 cluType = searchResultCell.getValue();
286 if (cluType.equals(LUUIConstants.CLU_TYPE_CREDIT_COURSE)){
287 dependencySectionKey = LUUIConstants.DEP_SECTION_COURSE;
288 } else if (cluType != null){
289 dependencySectionKey = LUUIConstants.DEP_SECTION_PROGRAM;
290 }
291 } else if (searchResultCell.getKey().equals("lu.resultColumn.luOptionalDependencyType")){
292 dependencyType = searchResultCell.getValue();
293 if (dependencyType.equals("cluSet")){
294 dependencySectionKey = LUUIConstants.DEP_SECTION_COURSE_SET;
295 } else if (LUUIConstants.DEP_TYPE_JOINT.equals(dependencyType) ||
296 LUUIConstants.DEP_TYPE_CROSS_LISTED.equals(dependencyType)){
297 dependencySectionKey = LUUIConstants.DEP_SECTION_COURSE;;
298 }
299 } else if (searchResultCell.getKey().equals("lu.resultColumn.luOptionalDependencyTypeName")){
300 dependencyTypeName = searchResultCell.getValue();
301 } else if (searchResultCell.getKey().equals("lu.resultColumn.luOptionalDependencyRequirementComponentIds")){
302 reqComponentIds = searchResultCell.getValue();
303 } else if (searchResultCell.getKey().equals("lu.resultColumn.luOptionalDependencyRootId")){
304 reqRootId = searchResultCell.getValue();
305 } else if (searchResultCell.getKey().equals("lu.resultColumn.luOptionalOversightCommitteeNames")){
306 curriculumOversightNames = searchResultCell.getValue();
307 } else if (searchResultCell.getKey().equals("lu.resultColumn.luOptionalDependencyRequirementDifferentAdminOrg")){
308 diffAdminOrg = ("true").equals(searchResultCell.getValue());
309 } else if (searchResultCell.getKey().equals("lu.resultColumn.parentCluId")){
310 parentCluId = searchResultCell.getValue();
311 }
312
313
314 }
315
316
317 DependencyTypeSection typeSection = depResultPanel.getDependencyTypeSection(dependencySectionKey, dependencyType);
318 if (typeSection == null){
319 typeSection = depResultPanel.addDependencyTypeSection(dependencySectionKey, dependencyType, getDependencyTypeLabel(dependencySectionKey, dependencyType, dependencyTypeName));
320 }
321
322
323 VerticalFieldLayout depDetails = null;
324 if (hasDependencyDetails(dependencyType)){
325 depDetails = getDependencyDetails(dependencySectionKey, dependencyType, cluCode, reqRootId, reqComponentIds);
326 KSLabel curricOversightLabel = new KSLabel("Curriculum Oversight: " + curriculumOversightNames);
327 curricOversightLabel.addStyleName("ks-dependency-oversight");
328 depDetails.addWidget(curricOversightLabel);
329 }
330
331
332 typeSection.addDependencyItem(getDependencyLabel(dependencySectionKey, dependencyType, cluId, cluCode, cluName, cluType, diffAdminOrg, parentCluId), depDetails);
333 }
334
335 depResultPanel.finishLoad();
336 KSBlockingProgressIndicator.removeTask(loadDataTask);
337 }
338
339 });
340 }
341
342
343 private VerticalFieldLayout getDependencyDetails(String dependencySectionKey, String dependencyType, final String cluCode, final String rootId, String reqComponentIds){
344 VerticalFieldLayout depDetails = new VerticalFieldLayout();
345 depDetails.addStyleName("KS-Dependency-Details");
346 if (reqComponentIds != null && !reqComponentIds.isEmpty()){
347 List<String> reqComponentIdList = Arrays.asList(reqComponentIds.split(","));
348
349 final VerticalFlowPanel simpleRequirement = new VerticalFlowPanel();
350 simpleRequirement.addStyleName("KS-Dependency-Simple-Rule");
351
352
353 if (LUUIConstants.DEP_SECTION_PROGRAM.equals(dependencySectionKey)){
354 final KSButton complexReqLabel = new KSButton("Display complex requirement", ButtonStyle.DEFAULT_ANCHOR);
355 final KSButton simpleReqLabel = new KSButton("Display simple requirement", ButtonStyle.DEFAULT_ANCHOR);
356
357
358 final FlowPanel complexContent = new FlowPanel();
359 final CollapsablePanel complexRequirement = new CollapsablePanel("", complexContent, false, false);
360
361 complexContent.addStyleName("KS-Dependency-Complex-Rule");
362 depDetails.addWidget(simpleRequirement);
363 depDetails.addWidget(complexRequirement);
364 depDetails.addWidget(complexReqLabel);
365 depDetails.addWidget(simpleReqLabel);
366
367 simpleReqLabel.setVisible(false);
368
369
370
371 complexReqLabel.addClickHandler(new ClickHandler(){
372 public void onClick(ClickEvent event) {
373 simpleReqLabel.setVisible(true);
374 simpleRequirement.setVisible(false);
375 complexReqLabel.setVisible(false);
376
377 if (complexContent.getWidgetCount() <= 0){
378 KSBlockingProgressIndicator.addTask(loadDataTask);
379
380 depRpcServiceAsync.getProgramRequirement(rootId, new KSAsyncCallback<ProgramRequirementInfo>(){
381 public void onSuccess(ProgramRequirementInfo progReqInfo) {
382 int minCredits = (progReqInfo.getMinCredits() == null ? 0 : progReqInfo.getMinCredits());
383 int maxCredits = (progReqInfo.getMaxCredits() == null ? 0 : progReqInfo.getMaxCredits());
384 String plainDesc = (progReqInfo.getDescr() == null ? "" : progReqInfo.getDescr().getPlain());
385 final RulePreviewWidget rulePreviewWidget = new RulePreviewWidget(1, progReqInfo.getShortTitle(),
386 getTotalCreditsString(minCredits, maxCredits),
387 plainDesc, progReqInfo.getStatement(),
388 true, getCluSetWidgetList(progReqInfo.getStatement()));
389 complexContent.add(rulePreviewWidget);
390 KSBlockingProgressIndicator.removeTask(loadDataTask);
391 complexRequirement.open();
392 }
393 });
394 } else {
395 complexRequirement.open();
396 }
397 }
398 });
399
400
401 simpleReqLabel.addClickHandler(new ClickHandler(){
402 public void onClick(ClickEvent event) {
403 complexReqLabel.setVisible(true);
404 complexRequirement.close();
405 simpleRequirement.setVisible(true);
406 simpleReqLabel.setVisible(false);
407 }
408 });
409 } else {
410 depDetails.addWidget(simpleRequirement);
411 }
412
413 depRpcServiceAsync.getRequirementComponentNL(reqComponentIdList, new KSAsyncCallback<List<String>>(){
414 public void onSuccess(List<String> results) {
415 for (String reqCompNL:results){
416 int codeIdx = reqCompNL.indexOf(selectedCourseCd);
417 SpanPanel requirement = new SpanPanel();
418 requirement.setHTML(reqCompNL.substring(0,codeIdx) +
419 " <b>" + selectedCourseCd + "</b>" + reqCompNL.substring(codeIdx + selectedCourseCd.length()));
420 simpleRequirement.add(requirement);
421 }
422 }
423 });
424 }
425
426 return depDetails;
427 }
428
429
430 private SpanPanel getDependencyTypeLabel(String dependencySectionKey, String dependencyType, String dependencyTypeName) {
431 SpanPanel header = new SpanPanel();
432 if (dependencyType.equals("joint") || dependencyType.equals("crossListed")){
433 header.setHTML("<b>" + selectedCourseCd + "</b> is <b>" + dependencyTypeName + "</b> with the following ");
434 } else if (dependencySectionKey.equals("course sets")){
435 header.setHTML("<b>" + selectedCourseCd + "</b> belongs to the following course sets");
436 } else {
437 header.setHTML("<b>" + selectedCourseCd + "</b> is a/an <b>" + dependencyTypeName + "</b> for the following " + dependencySectionKey);
438 }
439 header.setStyleName("KS-DependencyType-Label");
440 return header;
441 }
442
443
444
445
446
447 private SpanPanel getDependencyLabel(final String dependencySectionKey, String dependencyType, final String cluId, String cluCode, String cluName, final String cluType, boolean diffAdminOrg, final String parentCluId){
448
449
450 Anchor viewLinkAnchor = null;
451 final String viewLinkUrl;
452 if (LUUIConstants.CLU_TYPE_CREDIT_COURSE.equals(cluType) &&
453 !LUUIConstants.DEP_TYPE_CROSS_LISTED.equals(dependencyType)){
454 viewLinkAnchor = new Anchor("View Course");
455 viewLinkUrl = AppLocations.Locations.VIEW_COURSE.toString();
456 } else if ("kuali.lu.type.MajorDiscipline".equals(cluType) || "kuali.lu.type.Variation".equals(cluType)){
457 viewLinkAnchor = new Anchor("View Program ");
458 viewLinkUrl = AppLocations.Locations.VIEW_PROGRAM.toString();
459 } else if ("kuali.lu.type.CoreProgram".equals(cluType)){
460 viewLinkAnchor = new Anchor("View Program ");
461 viewLinkUrl = AppLocations.Locations.VIEW_CORE_PROGRAM.toString();
462 } else if (cluType.startsWith("kuali.lu.type.credential")){
463 viewLinkAnchor = new Anchor("View Program ");
464 viewLinkUrl = AppLocations.Locations.VIEW_BACC_PROGRAM.toString();
465 } else if (LUUIConstants.DEP_TYPE_COURSE_SET.equals(dependencyType)){
466 viewLinkAnchor = new Anchor("View Course Set");
467 viewLinkUrl = AppLocations.Locations.VIEW_CLU_SET.toString();
468 } else {
469 viewLinkUrl = null;
470 }
471
472
473 if (viewLinkAnchor != null){
474 viewLinkAnchor.addStyleName("KS-Dependency-View-Link");
475 viewLinkAnchor.addClickHandler(new ClickHandler(){
476
477 @Override
478 public void onClick(ClickEvent event) {
479 String url = "http://" + Window.Location.getHost() + Window.Location.getPath() +
480 "?view=" + viewLinkUrl;
481 if("kuali.lu.type.Variation".equals(cluType)){
482 url += "&docId=" + parentCluId + "&variationId=" + cluId;
483 }else {
484 url += "&docId=" + cluId;
485 }
486 String features = "height=600,width=960,dependent=0,directories=1," +
487 "fullscreen=1,location=1,menubar=1,resizable=1,scrollbars=1,status=1,toolbar=1";
488 Window.open(url, HTMLPanel.createUniqueId(), features);
489 }
490 });
491 }
492
493
494 String orgHighlight = (diffAdminOrg ? " <span class=\"ks-dependency-highlight\">Different Org</span> ":"");
495
496
497 String headerLabel = "";
498 if (LUUIConstants.DEP_TYPE_CROSS_LISTED.equals(dependencyType)){
499 headerLabel = cluCode + " - " + selectedCourseName + orgHighlight;
500 } else if (LUUIConstants.DEP_TYPE_COURSE_SET.equals(dependencyType)){
501 headerLabel = cluName;
502 } else {
503 headerLabel = cluCode + " - " + cluName + orgHighlight;
504 }
505
506
507 SpanPanel header = new SpanPanel();
508 header.setStyleName("KS-DependencyType-Label");
509 header.setHTML(headerLabel);
510 if (viewLinkAnchor != null){
511 header.add(viewLinkAnchor);
512 }
513
514 return header;
515 }
516
517 protected boolean hasDependencyDetails(String dependencyType){
518
519
520 return !(LUUIConstants.DEP_TYPE_JOINT.equals(dependencyType) ||
521 LUUIConstants.DEP_TYPE_CROSS_LISTED.equals(dependencyType) ||
522 LUUIConstants.DEP_TYPE_COURSE_SET.equals(dependencyType));
523 }
524
525 private String getTotalCreditsString(int min, int max) {
526 return "Expected Total Credits:" + min + "-" + max;
527 }
528
529
530 protected Map<String, Widget> getCluSetWidgetList(StatementTreeViewInfo rule) {
531 Map<String, Widget> widgetList = new HashMap<String, Widget>();
532 Set<String> cluSetIds = new HashSet<String>();
533 findCluSetIds(rule, cluSetIds);
534 for (String clusetId : cluSetIds) {
535 widgetList.put(clusetId, new CluSetDetailsWidget(clusetId, cluSetRetriever));
536 }
537
538 return widgetList;
539 }
540
541
542 private void findCluSetIds(StatementTreeViewInfo rule, Set<String> list) {
543
544 List<StatementTreeViewInfo> statements = rule.getStatements();
545 List<ReqComponentInfo> reqComponentInfos = rule.getReqComponents();
546
547 if ((statements != null) && (statements.size() > 0)) {
548
549 for (StatementTreeViewInfo statement : statements) {
550 findCluSetIds(statement, list);
551 }
552 } else if ((reqComponentInfos != null) && (reqComponentInfos.size() > 0)) {
553
554 for (ReqComponentInfo reqComponent : reqComponentInfos) {
555 List<ReqCompFieldInfo> fieldInfos = reqComponent.getReqCompFields();
556 for (ReqCompFieldInfo fieldInfo : fieldInfos) {
557 if (RulesUtil.isCluSetWidget(fieldInfo.getType())) {
558 list.add(fieldInfo.getValue());
559 }
560 }
561 }
562 }
563 }
564
565 public KSDocumentHeader getHeader() {
566 return header;
567 }
568
569 @Override
570 public boolean isExportButtonActive() {
571 return true;
572 }
573
574 public DependencyResultPanel getDepResultPanel() {
575 return depResultPanel;
576 }
577
578 }