01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/sections/tags/sakai_2-4-1/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/StudentSectionDecorator.java $
03: * $Id: StudentSectionDecorator.java 20002 2006-12-22 19:52:45Z jholtzman@berkeley.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Regents of the University of California and The Regents of the University of Michigan
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.tool.section.decorator;
21:
22: import java.io.Serializable;
23: import java.util.List;
24:
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27: import org.sakaiproject.section.api.coursemanagement.CourseSection;
28: import org.sakaiproject.tool.section.jsf.JsfUtil;
29:
30: /**
31: * Decorates a CourseSection for use in the students' UI.
32: *
33: * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
34: *
35: */
36: public class StudentSectionDecorator extends SectionDecorator implements
37: Serializable {
38:
39: private static final long serialVersionUID = 1L;
40: private static final Log log = LogFactory
41: .getLog(StudentSectionDecorator.class);
42:
43: protected boolean full;
44: protected boolean joinable;
45: protected boolean switchable;
46: protected boolean member;
47:
48: public StudentSectionDecorator(CourseSection courseSection,
49: String categoryForDisplay, List<String> instructorNames,
50: int totalEnrollments, boolean member,
51: boolean memberOtherSection, boolean showNegativeSpots) {
52: super (courseSection, categoryForDisplay, instructorNames,
53: totalEnrollments, showNegativeSpots);
54: this .member = member;
55: if (!this .member && this .spotsAvailable.equals("0")) {
56: this .full = true;
57: }
58: if (!this .member && !this .full) {
59: this .switchable = memberOtherSection;
60: this .joinable = !memberOtherSection;
61: }
62: }
63:
64: public StudentSectionDecorator() {
65: // Needed for serialization
66: }
67:
68: public List getInstructorNames() {
69: return instructorNames;
70: }
71:
72: public boolean isFull() {
73: return full;
74: }
75:
76: public boolean isJoinable() {
77: return joinable;
78: }
79:
80: public boolean isMember() {
81: return member;
82: }
83:
84: public boolean isSwitchable() {
85: return switchable;
86: }
87: }
|