Source Code Cross Referenced for ItemConfigBean.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » ui » bean » author » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » sakai » org.sakaiproject.tool.assessment.ui.bean.author 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemConfigBean.java $
003:         * $Id: ItemConfigBean.java 22608 2007-03-14 19:27:17Z lydial@stanford.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007:         *
008:         * Licensed under the Educational Community License, Version 1.0 (the"License");
009:         * you may not use this file except in compliance with the License.
010:         * You may obtain a copy of the License at
011:         *
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         *
014:         * Unless required by applicable law or agreed to in writing, software
015:         * distributed under the License is distributed on an "AS IS" BASIS,
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:         * See the License for the specific language governing permissions and
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.tool.assessment.ui.bean.author;
021:
022:        import java.io.Serializable;
023:        import java.util.ArrayList;
024:
025:        import javax.faces.model.SelectItem;
026:        import org.sakaiproject.util.ResourceLoader;
027:
028:        /**
029:         *
030:         * <p> </p>
031:         * <p>Description: Describes global item settings for authoring.
032:         * Describes what item types the will be supported.
033:         * To change, modify the itemConfig properties in the faces.config file.
034:         * Also developers could add an administrative configuration later.</p>
035:         *
036:         */
037:        public class ItemConfigBean implements  Serializable {
038:            /**
039:             * 
040:             */
041:            private static final long serialVersionUID = 5017545754149103817L;
042:
043:            private static final String msgResource = "org.sakaiproject.tool.assessment.bundle.AuthorMessages";
044:
045:            private boolean showFileUpload;
046:            private boolean showEssay;
047:            private boolean showAudio;
048:            private boolean showMatching;
049:            private boolean showTrueFalse;
050:            private boolean showMultipleChoiceSingleCorrect;
051:            private boolean showMultipleChoiceMultipleCorrect;
052:            private boolean showSurvey;
053:            private boolean showFillInTheBlank;
054:            private boolean showFillInNumeric;
055:            private boolean selectFromQuestionPool;
056:
057:            /**
058:             * Should we show file upload question?
059:             * @return if true
060:             */
061:            public boolean isShowFileUpload() {
062:                return showFileUpload;
063:            }
064:
065:            /**
066:             * Set whether file upload should be shown.
067:             * @param showFileUpload if this type should be shown
068:             */
069:            public void setShowFileUpload(boolean showFileUpload) {
070:                this .showFileUpload = showFileUpload;
071:            }
072:
073:            /**
074:             * Should we show short answer/essay question?
075:             * @return if true
076:             */
077:            public boolean isShowEssay() {
078:                return showEssay;
079:            }
080:
081:            /**
082:             * Set whether essay/short answer should be shown.
083:             * @param showEssay if this type should be shown
084:             */
085:            public void setShowEssay(boolean showEssay) {
086:                this .showEssay = showEssay;
087:            }
088:
089:            /**
090:             * Should we show audio upload question?
091:             * @return if true
092:             */
093:            public boolean isShowAudio() {
094:                return showAudio;
095:            }
096:
097:            /**
098:             * Set whether audio recording should be shown.
099:             * @param showAudio if this type should be shown
100:             */
101:            public void setShowAudio(boolean showAudio) {
102:                this .showAudio = showAudio;
103:            }
104:
105:            /**
106:             * Should we show matching question?
107:             * @return if true
108:             */
109:            public boolean isShowMatching() {
110:                return showMatching;
111:            }
112:
113:            /**
114:             * Set whether matching should be shown.
115:             * @param showMatching if this type should be shown
116:             */
117:            public void setShowMatching(boolean showMatching) {
118:                this .showMatching = showMatching;
119:            }
120:
121:            /**
122:             *
123:             * @return if true
124:             */
125:            public boolean isShowTrueFalse() {
126:                return showTrueFalse;
127:            }
128:
129:            /**
130:             * Set whether we show true/false question.
131:             * @param showTrueFalse if this type should be shown
132:             */
133:            public void setShowTrueFalse(boolean showTrueFalse) {
134:                this .showTrueFalse = showTrueFalse;
135:            }
136:
137:            /**
138:             * Should we show all multiple choice type question?
139:             * That means both multiple correct and single correct.
140:             * @return if true if this type should be shown
141:             */
142:            public boolean isShowAllMultipleChoice() {
143:                return showMultipleChoiceMultipleCorrect
144:                        && showMultipleChoiceSingleCorrect;
145:            }
146:
147:            /**
148:             * Should we show multiple choice single correct question?
149:             * @return if true
150:             */
151:            public boolean isShowMultipleChoiceSingleCorrect() {
152:                return showMultipleChoiceSingleCorrect;
153:            }
154:
155:            /**
156:             * Set whether multiple choice single correct should be shown.
157:             * @param showMultipleChoiceSingleCorrect if this type should be shown
158:             */
159:            public void setShowMultipleChoiceSingleCorrect(
160:                    boolean showMultipleChoiceSingleCorrect) {
161:                this .showMultipleChoiceSingleCorrect = showMultipleChoiceSingleCorrect;
162:            }
163:
164:            /**
165:             * Should we show multiple choice multiple correct question?
166:             * @return if true
167:             */
168:            public boolean isShowMultipleChoiceMultipleCorrect() {
169:                return showMultipleChoiceMultipleCorrect;
170:            }
171:
172:            /**
173:             * Set whether multiple choice multiple correct should be shown.
174:             * @param showMultipleChoiceMultipleCorrect if this type should be shown
175:             */
176:            public void setShowMultipleChoiceMultipleCorrect(
177:                    boolean showMultipleChoiceMultipleCorrect) {
178:                this .showMultipleChoiceMultipleCorrect = showMultipleChoiceMultipleCorrect;
179:            }
180:
181:            /**
182:             * Should we show fill in the blank question?
183:             * @return if true
184:             */
185:
186:            public boolean isShowFillInTheBlank() {
187:                return showFillInTheBlank;
188:            }
189:
190:            /**
191:             * Set whether fill in the blank should be shown.
192:             * @param showFillInTheBlank if this type should be shown
193:             */
194:            public void setShowFillInTheBlank(boolean showFillInTheBlank) {
195:                this .showFillInTheBlank = showFillInTheBlank;
196:            }
197:
198:            /**
199:             * Should we show survey question?
200:             * @return if true
201:             */
202:
203:            public boolean isShowFillInNumeric() {
204:                return showFillInNumeric;
205:            }
206:
207:            /**
208:             * Set whether fill in numeric should be shown.
209:             * @param showFillInNumeric if this type should be shown
210:             */
211:
212:            public void setShowFillInNumeric(boolean showFillInNumeric) {
213:                this .showFillInNumeric = showFillInNumeric;
214:            }
215:
216:            /**
217:             * Should we show survey question?
218:             * @return if true
219:             */
220:            public boolean isShowSurvey() {
221:                return showSurvey;
222:            }
223:
224:            /**
225:             * Set whether survey should be shown.
226:             * @param showSurvey if this type should be shown
227:             */
228:            public void setShowSurvey(boolean showSurvey) {
229:                this .showSurvey = showSurvey;
230:            }
231:
232:            /**
233:             * Derived property.  Get arraylist of item type SelectItems.
234:             * We are not lazy loading this so that we can change these dynamically.
235:             * Most are being injected from the faces-config, but whether we select from
236:             * question pools is always dynamic.
237:             *
238:             * @return ArrayList of model SelectItems
239:             */
240:
241:            public ArrayList getItemTypeSelectList() {
242:                ArrayList list = new ArrayList();
243:
244:                list.add(new SelectItem("",
245:                        getResourceDisplayName("select_qtype")));
246:
247:                if (isShowAllMultipleChoice())
248:                    list.add(new SelectItem("1",
249:                            getResourceDisplayName("multiple_choice_type")));
250:
251:                if (showSurvey)
252:                    list.add(new SelectItem("3",
253:                            getResourceDisplayName("multiple_choice_surv")));
254:
255:                if (showEssay)
256:                    list.add(new SelectItem("5",
257:                            getResourceDisplayName("short_answer_essay")));
258:
259:                if (showFillInTheBlank)
260:                    list.add(new SelectItem("8",
261:                            getResourceDisplayName("fill_in_the_blank")));
262:
263:                if (showFillInNumeric)
264:                    list.add(new SelectItem("11",
265:                            getResourceDisplayName("fill_in_numeric")));
266:                if (showMatching)
267:                    list.add(new SelectItem("9",
268:                            getResourceDisplayName("matching")));
269:
270:                if (showTrueFalse)
271:                    list.add(new SelectItem("4",
272:                            getResourceDisplayName("true_false")));
273:
274:                if (showAudio)
275:                    list.add(new SelectItem("7",
276:                            getResourceDisplayName("audio_recording")));
277:
278:                if (showFileUpload)
279:                    list.add(new SelectItem("6",
280:                            getResourceDisplayName("file_upload")));
281:
282:                if (selectFromQuestionPool)
283:                    list.add(new SelectItem("10",
284:                            getResourceDisplayName("import_from_q")));
285:
286:                return list;
287:            }
288:
289:            /*
290:            // test the item accessors and mutators and the selectItem list
291:            public static void main (String[] args)
292:            {
293:              ItemConfigBean bean = new ItemConfigBean();
294:              ArrayList list = bean.getItemTypeSelectList();
295:              for (int i = 0; i < list.size(); i++)
296:              {
297:                SelectItem sitem = (SelectItem)list.get(i);
298:              }
299:
300:              bean.setSelectFromQuestionPool(true);
301:              bean.setShowAudio(true);
302:              bean.setShowEssay(true);
303:              bean.setShowFileUpload(true);
304:              bean.setShowFillInTheBlank(true);
305:              bean.setShowFillInNumeric(true);
306:              bean.setShowMatching(true);
307:              bean.setShowMultipleChoiceMultipleCorrect(true);
308:              bean.setShowMultipleChoiceSingleCorrect(true);
309:              bean.setShowSurvey(true);
310:              bean.setShowTrueFalse(true);
311:              list = bean.getItemTypeSelectList();
312:              for (int i = 0; i < list.size(); i++)
313:              {
314:                SelectItem sitem = (SelectItem)list.get(i);
315:              }
316:              bean.setShowAudio(false);
317:              bean.setShowFileUpload(false);
318:              list = bean.getItemTypeSelectList();
319:              for (int i = 0; i < list.size(); i++)
320:              {
321:                SelectItem sitem = (SelectItem)list.get(i);
322:              }
323:            }
324:             */
325:
326:            /**
327:             * Can we select items from a question pool?
328:             * If we are in question pools we cannot select items from pool.
329:             * If we are not in question pools we can select items from pool.
330:             * @return if we can select from question pool.
331:             */
332:            public boolean isSelectFromQuestionPool() {
333:                return selectFromQuestionPool;
334:            }
335:
336:            /**
337:             * Set whether we can select items from a question pool.
338:             * If we are in question pools we cannot select items from pool.
339:             * If we are not in question pools we can select items from pool.
340:             * @return if we can select from question pool.
341:             */
342:
343:            public void setSelectFromQuestionPool(boolean selectFromQuestionPool) {
344:                this .selectFromQuestionPool = selectFromQuestionPool;
345:            }
346:
347:            /**
348:             * Utility for looking up item resources.
349:             * @param resName name to look up
350:             * @return the localized name.
351:             */
352:            private String getResourceDisplayName(String resName) {
353:                ResourceLoader res = new ResourceLoader(msgResource);
354:                return res.getString(resName);
355:            }
356:        }
w__w_w___.j__ava__2s_.___c_o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.