1 package org.kuali.student.enrollment.class2.courseoffering.form;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.kuali.rice.krad.uif.view.View;
5 import org.kuali.rice.krad.web.form.MaintenanceForm;
6 import org.kuali.student.enrollment.class2.courseoffering.dto.ActivityOfferingWrapper;
7 import org.kuali.student.r2.common.util.constants.CourseOfferingSetServiceConstants;
8
9
10
11
12
13
14
15
16 public class ActivityOfferingForm extends MaintenanceForm {
17
18 public static final String MAIN_PAGE = "ActivityOfferingEdit-MainPage";
19 public static final String SCHEDULE_PAGE = "ActivityOfferingEdit-SchedulePage";
20
21 private String deliveryLogisiticsAddButtonText;
22 private boolean scheduleEditInProgress;
23
24 public ActivityOfferingForm(){
25 }
26
27 public boolean isSchedulePage(){
28 View view = getPostedView();
29 if (view == null){
30 view = getView();
31 }
32 return StringUtils.equals(view.getCurrentPageId(),SCHEDULE_PAGE);
33 }
34
35 public boolean isMainPage(){
36 View view = getPostedView();
37 if (view == null){
38 view = getView();
39 }
40 return StringUtils.equals(view.getCurrentPageId(),MAIN_PAGE);
41 }
42
43 public String getDeliveryLogisiticsAddButtonText() {
44 if (isMainPage()){
45 return "Add";
46 } else{
47 return deliveryLogisiticsAddButtonText;
48 }
49 }
50
51 public void setDeliveryLogisiticsAddButtonText(String deliveryLogisiticsAddButtonText) {
52 this.deliveryLogisiticsAddButtonText = deliveryLogisiticsAddButtonText;
53 }
54
55 public boolean isScheduleEditInProgress() {
56 if (isMainPage()){
57 return false;
58 } else{
59 return scheduleEditInProgress;
60 }
61 }
62
63 public void setScheduleEditInProgress(boolean scheduleEditInProgress) {
64 this.scheduleEditInProgress = scheduleEditInProgress;
65 }
66
67 public boolean isScheduleCompleted(){
68 ActivityOfferingWrapper wrapper = (ActivityOfferingWrapper)getDocument().getNewMaintainableObject().getDataObject();
69 if (wrapper.getSocInfo() != null){
70 if (StringUtils.equals(CourseOfferingSetServiceConstants.SOC_SCHEDULING_STATE_COMPLETED,wrapper.getSocInfo().getSchedulingStateKey())){
71 return true;
72 }
73 }
74 return false;
75 }
76
77 }