01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolDataModel.java $
03: * $Id: QuestionPoolDataModel.java 11400 2006-06-29 20:24:36Z lydial@stanford.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
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.assessment.ui.bean.questionpool;
21:
22: import javax.faces.model.DataModel;
23: import javax.faces.model.DataModelListener;
24:
25: import org.sakaiproject.tool.assessment.data.model.Tree;
26: import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade;
27:
28: /**
29: * This Data Model contains the tree.
30: *
31: * $Id: QuestionPoolDataModel.java 11400 2006-06-29 20:24:36Z lydial@stanford.edu $
32: */
33: public class QuestionPoolDataModel extends DataModel {
34: // for JSF
35: private Tree tree;
36: private DataModel model;
37:
38: /**
39: * Creates a new QuestionPoolDatModel object.
40: */
41: public QuestionPoolDataModel(Tree tree, DataModel model) {
42: this .model = model;
43: this .tree = tree;
44: //buildTree();
45: }
46:
47: public Object getRowData() {
48: try {
49: tree
50: .setCurrentId(((QuestionPoolFacade) (model
51: .getRowData())).getQuestionPoolId());
52: } catch (Exception e) {
53: e.printStackTrace();
54: throw new RuntimeException(e);
55: }
56: return model.getRowData();
57: }
58:
59: public boolean isRowAvailable() {
60: return model.isRowAvailable();
61: }
62:
63: public int getRowCount() {
64: return model.getRowCount();
65: }
66:
67: public int getRowIndex() {
68: return model.getRowIndex();
69: }
70:
71: public void setRowIndex(int rowIndex) {
72: model.setRowIndex(rowIndex);
73: }
74:
75: public Object getWrappedData() {
76: return model.getWrappedData();
77: }
78:
79: public void setWrappedData(Object data) {
80: model.setWrappedData(data);
81: }
82:
83: public void addDataModelListener(DataModelListener listener) {
84: model.addDataModelListener(listener);
85: }
86:
87: public DataModelListener[] getDataModelListeners() {
88: return model.getDataModelListeners();
89: }
90:
91: public void removeDataModelListener(DataModelListener listener) {
92: model.removeDataModelListener(listener);
93:
94: }
95:
96: }
|