All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.faces.model.SelectItem Maven / Gradle / Ivy

Go to download

This is the master POM file for Oracle's Implementation of the JSF 2.1 Specification.

There is a newer version: 2.1
Show newest version
/*
 * $Id: SelectItem.java,v 1.16 2007/01/29 22:17:39 rlubke Exp $
 */

/*
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the License). You may not use this file except in
 * compliance with the License.
 * 
 * You can obtain a copy of the License at
 * https://javaserverfaces.dev.java.net/CDDL.html or
 * legal/CDDLv1.0.txt. 
 * See the License for the specific language governing
 * permission and limitations under the License.
 * 
 * When distributing Covered Code, include this CDDL
 * Header Notice in each file and include the License file
 * at legal/CDDLv1.0.txt.    
 * If applicable, add the following below the CDDL Header,
 * with the fields enclosed by brackets [] replaced by
 * your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 * 
 * [Name of File] [ver.__] [Date]
 * 
 * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
 */

package javax.faces.model;


import java.io.Serializable;
import javax.faces.component.UISelectMany;
import javax.faces.component.UISelectOne;


/**
 * 

SelectItem represents a single item in the * list of supported items associated with a {@link UISelectMany} * or {@link UISelectOne} component.

*/ public class SelectItem implements Serializable { private static final long serialVersionUID = 876782311414654999L; // ------------------------------------------------------------ Constructors /** *

Construct a SelectItem with no initialized property * values.

*/ public SelectItem() { super(); } /** *

Construct a SelectItem with the specified value. The * label property will be set to the value (converted to a * String, if necessary), the description property will be * set to null, the disabled property will be set to * false, and the escape property will be set to ( true.

* * @param value Value to be delivered to the model if this * item is selected by the user */ public SelectItem(Object value) { this(value, value == null ? null : value.toString(), null, false, true); } /** *

Construct a SelectItem with the specified value and * label. The description property will be set to * null, the disabled property will be * set to false, and the escape property will * be set to true.

* * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response */ public SelectItem(Object value, String label) { this(value, label, null, false, true); } /** *

Construct a SelectItem instance with the specified * value, label and description. This disabled property * will be set to false, and the escape * property will be set to true.

* * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools */ public SelectItem(Object value, String label, String description) { this(value, label, description, false, true); } /** *

Construct a SelectItem instance with the specified * property values. The escape property will be set * to true.

* * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled */ public SelectItem(Object value, String label, String description, boolean disabled) { this(value, label, description, disabled, true); } /** *

Construct a SelectItem instance with the specified * property values.

* * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); } // ------------------------------------------------------ Instance Variables private String description = null; private boolean disabled = false; private String label = null; @SuppressWarnings({"NonSerializableFieldInSerializableClass"}) private Object value = null; // -------------------------------------------------------------- Properties /** *

Return a description of this item, for use in development tools. */ public String getDescription() { return (this.description); } /** *

Set the description of this item, for use in development tools.

* * @param description The new description */ public void setDescription(String description) { this.description = description; } /** *

Return the disabled flag for this item, which should modify the * rendered output to make this item unavailable for selection by the user * if set to true.

*/ public boolean isDisabled() { return (this.disabled); } /** *

Set the disabled flag for this item, which should modify the * rendered output to make this item unavailable for selection by the user * if set to true.

* * @param disabled The new disabled flag */ public void setDisabled(boolean disabled) { this.disabled = disabled; } /** *

Return the label of this item, to be rendered visibly for the user. */ public String getLabel() { return (this.label); } /** *

Set the label of this item, to be rendered visibly for the user. * * @param label The new label */ public void setLabel(String label) { this.label = label; } /** *

Return the value of this item, to be delivered to the model * if this item is selected by the user. */ public Object getValue() { return (this.value); } /** *

Set the value of this item, to be delivered to the model * if this item is selected by this user. * * @param value The new value * */ public void setValue(Object value) { this.value = value; } /** * Holds value of property escape. */ private boolean escape; /** * Getter for property escape. * @return Value of property escape. */ public boolean isEscape() { return this.escape; } /** * Setter for property escape. * @param escape New value of property escape. */ public void setEscape(boolean escape) { this.escape = escape; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy