001: // WARNING: This file was automatically generated. Do not edit it directly,
002: // or you will lose your changes.
003:
004: /*
005: * Licensed to the Apache Software Foundation (ASF) under one
006: * or more contributor license agreements. See the NOTICE file
007: * distributed with this work for additional information
008: * regarding copyright ownership. The ASF licenses this file
009: * to you under the Apache License, Version 2.0 (the
010: * "License"); you may not use this file except in compliance
011: * with the License. You may obtain a copy of the License at
012: *
013: * http://www.apache.org/licenses/LICENSE-2.0
014: *
015: * Unless required by applicable law or agreed to in writing,
016: * software distributed under the License is distributed on an
017: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018: * KIND, either express or implied. See the License for the
019: * specific language governing permissions and limitations
020: * under the License.
021: */
022: package javax.faces.component;
023:
024: import javax.el.ValueExpression;
025: import javax.faces.context.FacesContext;
026: import javax.faces.el.ValueBinding;
027:
028: /**
029: *
030: * <h4>Events:</h4>
031: * <table border="1" width="100%" cellpadding="3" summary="">
032: * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
033: * <th align="left">Type</th>
034: * <th align="left">Phases</th>
035: * <th align="left">Description</th>
036: * </tr>
037: * <tr class="TableRowColor">
038: * <td valign="top"><code>javax.faces.event.ValueChangeEvent</code></td>
039: * <td valign="top" nowrap></td>
040: * <td valign="top">The valueChange event is delivered when the value
041: attribute is changed.</td>
042: * </tr>
043: * </table>
044: */
045: public class UISelectBoolean extends UIInput {
046:
047: static public final String COMPONENT_FAMILY = "javax.faces.SelectBoolean";
048: static public final String COMPONENT_TYPE = "javax.faces.SelectBoolean";
049:
050: /**
051: * Construct an instance of the UISelectBoolean.
052: */
053: public UISelectBoolean() {
054: setRendererType("javax.faces.Checkbox");
055: }
056:
057: public void setSelected(boolean selected) {
058: setValue(Boolean.valueOf(selected));
059: }
060:
061: public boolean isSelected() {
062: Boolean value = (Boolean) getSubmittedValue();
063: if (value == null)
064: value = (Boolean) getValue();
065:
066: return value != null ? value.booleanValue() : false;
067: }
068:
069: /**
070: * @deprecated Use getValueExpression instead
071: */
072: public ValueBinding getValueBinding(String name) {
073: if (name == null)
074: throw new NullPointerException("name");
075: if (name.equals("selected")) {
076: return super .getValueBinding("value");
077: } else {
078: return super .getValueBinding(name);
079: }
080: }
081:
082: /**
083: * @deprecated Use setValueExpression instead
084: */
085: public void setValueBinding(String name, ValueBinding binding) {
086: if (name == null)
087: throw new NullPointerException("name");
088: if (name.equals("selected")) {
089: super .setValueBinding("value", binding);
090: } else {
091: super .setValueBinding(name, binding);
092: }
093: }
094:
095: public ValueExpression getValueExpression(String name) {
096: if (name == null)
097: throw new NullPointerException("name");
098: if (name.equals("selected")) {
099: return super .getValueExpression("value");
100: } else {
101: return super .getValueExpression(name);
102: }
103: }
104:
105: public void setValueExpression(String name, ValueExpression binding) {
106: if (name == null)
107: throw new NullPointerException("name");
108: if (name.equals("selected")) {
109: super .setValueExpression("value", binding);
110: } else {
111: super .setValueExpression(name, binding);
112: }
113: }
114:
115: @Override
116: public String getFamily() {
117: return COMPONENT_FAMILY;
118: }
119: }
|