001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/jsf/example/src/java/example/TestBean.java $
003: * $Id: TestBean.java 10835 2006-06-17 03:25:03Z lance@indiana.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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 example;
021:
022: import java.io.InputStream;
023: import java.util.ArrayList;
024: import java.util.List;
025:
026: import javax.faces.event.ActionEvent;
027:
028: import org.theospi.jsf.impl.DefaultXmlTagFactory;
029: import org.theospi.jsf.impl.DefaultXmlTagHandler;
030: import org.theospi.jsf.intf.XmlTagFactory;
031:
032: import example.xml.TestXmlTagFactory;
033:
034: public class TestBean {
035:
036: private String label = "Select Content";
037: private boolean disabled = true;
038: private boolean rendered = false;
039: private String currentStep = "1";
040: private List subBeans = new ArrayList();
041: private XmlTagFactory factory = null;
042:
043: public TestBean() {
044: for (int i = 0; i < 10; i++) {
045: subBeans.add(new TestSubBean());
046: }
047: }
048:
049: public String getCurrentStep() {
050: return currentStep;
051: }
052:
053: public void setCurrentStep(String currentStep) {
054: this .currentStep = currentStep;
055: }
056:
057: public boolean isDisabled() {
058: return disabled;
059: }
060:
061: public void setDisabled(boolean disabled) {
062: this .disabled = disabled;
063: }
064:
065: public String getLabel() {
066: return label;
067: }
068:
069: public void setLabel(String label) {
070: this .label = label;
071: }
072:
073: public boolean isRendered() {
074: return rendered;
075: }
076:
077: public void setRendered(boolean rendered) {
078: this .rendered = rendered;
079: }
080:
081: public void processTestButton(ActionEvent event) {
082: getSubBeans().add(new TestSubBean());
083: }
084:
085: public List getSubBeans() {
086: return subBeans;
087: }
088:
089: public void setSubBeans(List subBeans) {
090: this .subBeans = subBeans;
091: }
092:
093: public XmlTagFactory getFactory() {
094: if (factory == null) {
095: factory = new TestXmlTagFactory();
096: ((DefaultXmlTagFactory) factory)
097: .setDefaultHandler(new DefaultXmlTagHandler(factory));
098: }
099: return factory;
100: }
101:
102: public InputStream getSampleXmlFile() {
103: return this .getClass().getResourceAsStream(
104: "/xmlDocTagSample.xhtml");
105: }
106:
107: }
|