001: /**********************************************************************************
002: *
003: * $Id: PreferencesBean.java 20721 2007-01-26 21:15:26Z louis@media.berkeley.edu $
004: *
005: ***********************************************************************************
006: *
007: * Copyright (c) 2005 The Regents of the University of California, The MIT Corporation
008: *
009: * Licensed under the Educational Community License, Version 1.0 (the "License");
010: * you may not use this file except in compliance with the License.
011: * You may obtain a copy of the License at
012: *
013: * http://www.opensource.org/licenses/ecl1.php
014: *
015: * Unless required by applicable law or agreed to in writing, software
016: * distributed under the License is distributed on an "AS IS" BASIS,
017: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018: * See the License for the specific language governing permissions and
019: * limitations under the License.
020: *
021: **********************************************************************************/package org.sakaiproject.tool.gradebook.ui;
022:
023: import org.sakaiproject.tool.gradebook.Assignment;
024:
025: /**
026: * Session-scoped preferences for the sakai gradebook. These are currently
027: * not persistent across http sessions.
028: *
029: * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
030: */
031: public class PreferencesBean {
032:
033: public static final String SORT_BY_NAME = "studentSortName";
034: public static final String SORT_BY_UID = "studentDisplayId";
035:
036: private String assignmentSortColumn;
037: private boolean assignmentSortAscending;
038:
039: private String rosterTableSortColumn;
040: private boolean rosterTableSortAscending;
041:
042: private String assignmentDetailsTableSortColumn;
043: private boolean assignmentDetailsTableSortAscending;
044:
045: private String courseGradeDetailsTableSortColumn;
046: private boolean courseGradeDetailsTableSortAscending;
047:
048: private int defaultMaxDisplayedScoreRows;
049:
050: public PreferencesBean() {
051: loadPreferences();
052: }
053:
054: /**
055: * This could eventually be loaded from persistence or from the framework
056: */
057: protected void loadPreferences() {
058: assignmentSortAscending = true;
059: assignmentSortColumn = Assignment.SORT_BY_DATE;
060:
061: rosterTableSortAscending = true;
062: rosterTableSortColumn = SORT_BY_NAME;
063:
064: assignmentDetailsTableSortAscending = true;
065: assignmentDetailsTableSortColumn = SORT_BY_NAME;
066:
067: courseGradeDetailsTableSortAscending = true;
068: courseGradeDetailsTableSortColumn = SORT_BY_NAME;
069:
070: defaultMaxDisplayedScoreRows = 50;
071: }
072:
073: // Paging preferences
074: public int getDefaultMaxDisplayedScoreRows() {
075: return defaultMaxDisplayedScoreRows;
076: }
077:
078: // Assignment sorting (for overview, assignment details, and possibly roster)
079: public boolean isAssignmentSortAscending() {
080: return assignmentSortAscending;
081: }
082:
083: public void setAssignmentSortAscending(
084: boolean assignmentSortAscending) {
085: this .assignmentSortAscending = assignmentSortAscending;
086: }
087:
088: public String getAssignmentSortColumn() {
089: return assignmentSortColumn;
090: }
091:
092: public void setAssignmentSortColumn(String assignmentSortColumn) {
093: this .assignmentSortColumn = assignmentSortColumn;
094: }
095:
096: // Roster table sorting
097: public boolean isRosterTableSortAscending() {
098: return rosterTableSortAscending;
099: }
100:
101: public void setRosterTableSortAscending(
102: boolean rosterTableSortAscending) {
103: this .rosterTableSortAscending = rosterTableSortAscending;
104: }
105:
106: public String getRosterTableSortColumn() {
107: return rosterTableSortColumn;
108: }
109:
110: public void setRosterTableSortColumn(String rosterTableSortColumn) {
111: this .rosterTableSortColumn = rosterTableSortColumn;
112: }
113:
114: // Assignment details table sorting
115: public boolean isAssignmentDetailsTableSortAscending() {
116: return assignmentDetailsTableSortAscending;
117: }
118:
119: public void setAssignmentDetailsTableSortAscending(
120: boolean assignmentDetailsTableSortAscending) {
121: this .assignmentDetailsTableSortAscending = assignmentDetailsTableSortAscending;
122: }
123:
124: public String getAssignmentDetailsTableSortColumn() {
125: return assignmentDetailsTableSortColumn;
126: }
127:
128: public void setAssignmentDetailsTableSortColumn(
129: String assignmentDetailsTableSortColumn) {
130: this .assignmentDetailsTableSortColumn = assignmentDetailsTableSortColumn;
131: }
132:
133: // Course grade details table sorting
134: public boolean isCourseGradeDetailsTableSortAscending() {
135: return courseGradeDetailsTableSortAscending;
136: }
137:
138: public void setCourseGradeDetailsTableSortAscending(
139: boolean courseGradeDetailsTableSortAscending) {
140: this .courseGradeDetailsTableSortAscending = courseGradeDetailsTableSortAscending;
141: }
142:
143: public String getCourseGradeDetailsTableSortColumn() {
144: return courseGradeDetailsTableSortColumn;
145: }
146:
147: public void setCourseGradeDetailsTableSortColumn(
148: String courseGradeDetailsTableSortColumn) {
149: this.courseGradeDetailsTableSortColumn = courseGradeDetailsTableSortColumn;
150: }
151: }
|