View Javadoc
1   package org.kuali.student.ap.planner.form;
2   
3   import org.kuali.student.ap.coursesearch.dataobject.CourseDetailsPopoverWrapper;
4   import org.kuali.student.ap.coursesearch.service.impl.CourseDetailsInquiryHelperImpl2;
5   import org.kuali.student.ap.planner.PlannerTerm;
6   
7   import java.util.ArrayList;
8   import java.util.List;
9   
10  /**
11   * Extends the default planner form to tie in course summary details from course
12   * search in support of the course summary dialog.
13   * 
14   * @author Mark Fyffe <mwfyffe@iu.edu>
15   * @version 0.7.6
16   */
17  public class PlannerFormImpl extends DefaultPlannerForm {
18  
19  	private static final long serialVersionUID = -3275492339094049260L;
20  
21  	private transient CourseDetailsPopoverWrapper courseSummaryDetails;
22  
23      private boolean loadCalendar;
24  
25      public PlannerFormImpl(){
26          this.setFocusTermIndex(-1);
27      }
28  
29  	@Override
30  	public void setLearningPlanId(String learningPlanId) {
31  		super.setLearningPlanId(learningPlanId);
32  		this.courseSummaryDetails = null;
33  	}
34  
35  	@Override
36  	public void setPlanItemId(String planItemId) {
37  		super.setPlanItemId(planItemId);
38  		this.courseSummaryDetails = null;
39  	}
40  
41  	@Override
42  	public void setCourseId(String courseId) {
43  		super.setCourseId(courseId);
44  		this.courseSummaryDetails = null;
45  	}
46  
47  	public CourseDetailsPopoverWrapper getCourseSummaryDetails() {
48  		if (courseSummaryDetails == null && getCourseId() != null)
49  			courseSummaryDetails = new CourseDetailsInquiryHelperImpl2()
50  					.retrieveCoursePopoverDetails(getCourseId());
51  
52  		return courseSummaryDetails;
53  	}
54  
55      public boolean isLoadCalendar() {
56          return loadCalendar;
57      }
58  
59      public void setLoadCalendar(boolean loadCalendar) {
60          this.loadCalendar = loadCalendar;
61      }
62  
63  
64      @Override
65      public List<PlannerTerm> getTerms() {
66          if(isLoadCalendar()){
67              return super.getTerms();
68          }
69          return new ArrayList<PlannerTerm>();
70      }
71  }