001: /*
002: * Copyright 2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package javax.faces.model;
017:
018: import java.io.Serializable;
019:
020: /**
021: * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
022: *
023: * @author Thomas Spiegl (latest modification by $Author: mbr $)
024: * @version $Revision: 512227 $ $Date: 2007-02-27 13:25:16 +0100 (Di, 27 Feb 2007) $
025: */
026: public class SelectItem implements Serializable {
027: private static final long serialVersionUID = 8841094741464512226L;
028: // FIELDS
029: private Object _value;
030: private String _label;
031: private String _description;
032: private boolean _disabled;
033: private boolean escape;
034:
035: // CONSTRUCTORS
036: public SelectItem() {
037: }
038:
039: public SelectItem(Object value) {
040: _value = value;
041: _label = value == null ? null : value.toString();
042: _description = null;
043: _disabled = false;
044: }
045:
046: public SelectItem(Object value, String label) {
047: _value = value;
048: _label = label;
049: _description = null;
050: _disabled = false;
051: }
052:
053: public SelectItem(Object value, String label, String description) {
054: _value = value;
055: _label = label;
056: _description = description;
057: _disabled = false;
058: }
059:
060: public SelectItem(Object value, String label, String description,
061: boolean disabled) {
062: _value = value;
063: _label = label;
064: _description = description;
065: _disabled = disabled;
066: }
067:
068: public SelectItem(Object value, String label, String description,
069: boolean disabled, boolean escape) {
070: _value = value;
071: _label = label;
072: _description = description;
073: _disabled = disabled;
074: this .escape = escape;
075: }
076:
077: // METHODS
078: public String getDescription() {
079: return _description;
080: }
081:
082: public void setDescription(String description) {
083: _description = description;
084: }
085:
086: public boolean isDisabled() {
087: return _disabled;
088: }
089:
090: public void setDisabled(boolean disabled) {
091: _disabled = disabled;
092: }
093:
094: public String getLabel() {
095: return _label;
096: }
097:
098: public void setLabel(String label) {
099: if (label == null)
100: throw new NullPointerException("label");
101: _label = label;
102: }
103:
104: public Object getValue() {
105: return _value;
106: }
107:
108: public void setValue(Object value) {
109: _value = value;
110: }
111:
112: public boolean isEscape() {
113: return escape;
114: }
115:
116: public void setEscape(boolean escape) {
117: this.escape = escape;
118: }
119:
120: }
|