001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License version 2
011: * as published by the Free Software Foundation.
012: *
013: * Resin Open Source is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
016: * of NON-INFRINGEMENT. See the GNU General Public License for more
017: * details.
018: *
019: * You should have received a copy of the GNU General Public License
020: * along with Resin Open Source; if not, write to the
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package javax.faces.model;
030:
031: public class SelectItem implements java.io.Serializable {
032: private String description;
033: private boolean disabled;
034: private boolean escape;
035: private String label;
036: private Object value;
037:
038: public SelectItem() {
039: }
040:
041: public SelectItem(Object value) {
042: setValue(value);
043: if (value != null)
044: setLabel(value.toString());
045: setEscape(true);
046: }
047:
048: public SelectItem(Object value, String label) {
049: setValue(value);
050: setLabel(label);
051: setEscape(true);
052: }
053:
054: public SelectItem(Object value, String label, String description) {
055: setValue(value);
056: setLabel(label);
057: setDescription(description);
058: setEscape(true);
059: }
060:
061: public SelectItem(Object value, String label, String description,
062: boolean disabled) {
063: setValue(value);
064: setLabel(label);
065: setDescription(description);
066: setDisabled(disabled);
067: setEscape(true);
068: }
069:
070: public SelectItem(Object value, String label, String description,
071: boolean disabled, boolean escape) {
072: setValue(value);
073: setLabel(label);
074: setDescription(description);
075: setDisabled(disabled);
076: setEscape(escape);
077: }
078:
079: public String getDescription() {
080: return this .description;
081: }
082:
083: public void setDescription(String description) {
084: this .description = description;
085: }
086:
087: public boolean isDisabled() {
088: return this .disabled;
089: }
090:
091: public void setDisabled(boolean disabled) {
092: this .disabled = disabled;
093: }
094:
095: public boolean isEscape() {
096: return this .escape;
097: }
098:
099: public void setEscape(boolean escape) {
100: this .escape = escape;
101: }
102:
103: public String getLabel() {
104: return this .label;
105: }
106:
107: public void setLabel(String label) {
108: this .label = label;
109: }
110:
111: public Object getValue() {
112: return this .value;
113: }
114:
115: public void setValue(Object value) {
116: this .value = value;
117: }
118:
119: public String toString() {
120: if (this .label != null)
121: return "SelectItem[" + this .label + "]";
122: else
123: return "SelectItem[]";
124: }
125: }
|