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

com.sun.webui.jsf.component.Selector Maven / Gradle / Ivy

There is a newer version: 4.4.0.1
Show newest version
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2007-2018 Oracle and/or its affiliates. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License.  You can
 * obtain a copy of the License at
 * https://oss.oracle.com/licenses/CDDL+GPL-1.1
 * or LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at LICENSE.txt.
 *
 * GPL Classpath Exception:
 * Oracle designates this particular file as subject to the "Classpath"
 * exception as provided by Oracle in the GPL Version 2 section of the License
 * file that accompanied this code.
 *
 * Modifications:
 * If applicable, add the following below the License Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyright [year] [name of copyright owner]"
 *
 * Contributor(s):
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 */

package com.sun.webui.jsf.component;

import com.sun.faces.annotation.Component;
import com.sun.faces.annotation.Property;
import com.sun.webui.jsf.model.OptionTitle;
import com.sun.webui.jsf.util.ConversionUtilities;
import com.sun.webui.jsf.util.MessageUtil;
import com.sun.webui.jsf.util.ValueType;
import com.sun.webui.jsf.util.ValueTypeEvaluator;
import java.lang.reflect.Array;
import java.util.Iterator;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
import javax.faces.render.Renderer;

/** 
 * Base component for UI components that allow the user to make a selection from
 * a set of options. 
 */
@Component(type = "com.sun.webui.jsf.Selector", family = "com.sun.webui.jsf.Selector",
displayName = "Selector", isTag = false,
helpKey = "projrave_ui_elements_palette_wdstk-jsf1.2_selector",
propertiesHelpKey = "projrave_ui_elements_palette_wdstk-jsf1.2_propsheets_selector_props")
public class Selector extends WebuiInput implements SelectorManager {

    // If true, debugging statements are printed to stdout
    private static final boolean DEBUG = false;
    /**
     * Read only separator string
     */
    private static final String READ_ONLY_SEPARATOR = ", "; //NOI18N
    private boolean multiple;

    // Holds the ValueType of this component
    protected ValueTypeEvaluator valueTypeEvaluator = null;

    public Selector() {
        valueTypeEvaluator = new ValueTypeEvaluator(this);
        setRendererType("com.sun.webui.jsf.Selector");
    }

    /**
     * 

Return the family for this component.

*/ @Override public String getFamily() { return "com.sun.webui.jsf.Selector"; } /** *

Return a flag indicating whether this component is responsible * for rendering its child components. The default implementation * in {@link UIComponentBase#getRendersChildren} tries to find the * renderer for this component. If it does, it calls {@link * Renderer#getRendersChildren} and returns the result. If it * doesn't, it returns false. As of version 1.2 of the JavaServer * Faces Specification, component authors are encouraged to return * true from this method and rely on {@link * UIComponentBase#encodeChildren}.

*/ @Override public boolean getRendersChildren() { return true; } /** * Retrieve the value of this component (the "selected" property) as an * object. This method is invoked by the JSF engine during the validation * phase. The JSF default behaviour is for components to defer the * conversion and validation to the renderer, but for the Selector based * components, the renderers do not share as much functionality as the * components do, so it is more efficient to do it here. * @param context The FacesContext of the request * @param submittedValue The submitted value of the component */ @Override public Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException { return getConvertedValue(this, valueTypeEvaluator, context, submittedValue); } /** * Retrieve the value of this component (the "selected" property) as an * object. This method is invoked by the JSF engine during the validation * phase. The JSF default behaviour is for components to defer the * conversion and validation to the renderer, but for the Selector based * components, the renderers do not share as much functionality as the * components do, so it is more efficient to do it here. * @param component The component whose value to convert * @param context The FacesContext of the request * @param submittedValue The submitted value of the component */ private Object getConvertedValue(UIComponent component, ValueTypeEvaluator valueTypeEvaluator, FacesContext context, Object submittedValue) throws ConverterException { if (DEBUG) { log("getConvertedValue()", component); } if (!(submittedValue instanceof String[])) { Object[] args = {component.getClass().getName()}; String msg = MessageUtil.getMessage("com.sun.webui.jsf.resources.LogMessages", //NOI18N "Selector.invalidSubmittedValue", args); //NOI18N throw new ConverterException(msg); } String[] rawValues = (String[]) submittedValue; // This should never happen // if (rawValues.length == 1 && OptionTitle.NONESELECTED.equals(rawValues[0])) { Object[] args = {OptionTitle.NONESELECTED}; String msg = MessageUtil.getMessage("com.sun.webui.jsf.resources.LogMessages", //NOI18N "Selector.invalidSubmittedValue", args); //NOI18N throw new ConverterException(msg); } // If there are no elements in rawValue nothing was submitted. // If null was rendered, return null // if (rawValues.length == 0) { if (DEBUG) { log("\t no values submitted, we return null", component); } if (ConversionUtilities.renderedNull(component)) { return null; } } // Why does getAttributes.get("multiple") not work? if (((SelectorManager) component).isMultiple()) { if (DEBUG) { log("\tComponent accepts multiple values", component); } if (valueTypeEvaluator.getValueType() == ValueType.ARRAY) { if (DEBUG) { log("\tComponent value is an array", component); } return ConversionUtilities.convertValueToArray(component, rawValues, context); } // This case is not supported yet! else if (valueTypeEvaluator.getValueType() == ValueType.LIST) { if (DEBUG) { log("\tComponent value is a list", component); } /* Until this is fixed throw exception saying it is unsupported return ConversionUtilities.convertValueToList (component, rawValues, context); */ throw new javax.faces.FacesException( "List is not a supported value."); } else { if (DEBUG) { log("\tMultiple selection enabled for non-array value", component); } Object[] params = {component.getClass().getName()}; String msg = MessageUtil.getMessage("com.sun.webui.jsf.resources.LogMessages", //NOI18N "Selector.multipleError", //NOI18N params); throw new ConverterException(msg); } } if (DEBUG) { log("\tComponent value is an object", component); } // Not sure if this case is taken care of consistently // Need to formulate the possible states for the // submitted value and what they mean. // // This can overwrite an unchanged value property // with null when it was originally empty string. /* if(rawValues[0].length() == 0) { if(DEBUG) log("\t empty string submitted, return null", component); return null; } */ String cv = rawValues.length == 0 ? "" : rawValues[0]; if (valueTypeEvaluator.getValueType() == ValueType.NONE) { if (DEBUG) { log("\t valuetype == none, return rawValue", component); } return cv; } if (DEBUG) { log("\t Convert the thing...", component); } return ConversionUtilities.convertValueToObject(component, cv, context); } /** * Return a string suitable for displaying the value in read only mode. * The default is to separate the list values with a comma. * * @param context The FacesContext * @throws javax.faces.FacesException If the list items cannot be processed */ // AVK - instead of doing this here, I think we // should set the value to be displayed when we get the readOnly // child component. It would be a good idea to separate the listItems // processing for the renderer - where we have to reprocess the items // every time, from other times, when this may not be necessary. // I note that although this code has been refactored by Rick, my // original code already did this so the fault is wtih me. protected String getValueAsReadOnly(FacesContext context) { // The comma format READ_ONLY_SEPARATOR should be part of the theme // and/or configurable by the application // return getValueAsString(context, READ_ONLY_SEPARATOR, true); } /** * Get the value (the object representing the selection(s)) of this * component as a String. If the component allows multiple selections, * the strings corresponding to the individual options are separated by * spaces. * @param context The FacesContext of the request * @param separator A String separator between the values public String getValueAsString(FacesContext context, String separator) { return getValueAsString(context, separator, false); } */ /** * Get the value (the object representing the selection(s)) of this * component as a String. If the component allows multiple selections, * the strings corresponding to the individual options are separated * by the separator argument. If readOnly is true, leading and * and trailing separators are omitted. * If readOnly is false the formatted String is suitable for decoding * by ListRendererBase.decode. * * @param context The FacesContext of the request * @param separator A String separator between the values * @param readOnly A readonly formatted String, no leading or trailing * separator string. */ private String getValueAsString(FacesContext context, String separator, boolean readOnly) { // Need to distinguish null value from an empty string // value. See the end of this method for empty string // value formatting // Object value = getValue(); if (value == null) { return new String(); } if (valueTypeEvaluator.getValueType() == ValueType.NONE) { return new String(); } if (valueTypeEvaluator.getValueType() == ValueType.INVALID) { return new String(); } // Multiple selections // // The format should be the same as that returned // from the javascript which always has a leading // and terminating separator. And suitable for decoding // by ListRendererBase.decode // if (valueTypeEvaluator.getValueType() == ValueType.LIST) { StringBuffer valueBuffer = new StringBuffer(256); java.util.List list = (java.util.List) value; Iterator valueIterator = ((java.util.List) value).iterator(); String valueString = null; // Leading delimiter // if (!readOnly && valueIterator.hasNext()) { valueBuffer.append(separator); } while (valueIterator.hasNext()) { valueString = ConversionUtilities.convertValueToString(this, valueIterator.next()); valueBuffer.append(valueString); // Add terminating delimiter // if (!readOnly || (readOnly && valueIterator.hasNext())) { valueBuffer.append(separator); } } return valueBuffer.toString(); } if (valueTypeEvaluator.getValueType() == ValueType.ARRAY) { StringBuffer valueBuffer = new StringBuffer(256); int length = Array.getLength(value); Object valueObject = null; String valueString = null; if (!readOnly && length != 0) { valueBuffer.append(separator); } for (int counter = 0; counter < length; ++counter) { valueObject = Array.get(value, counter); valueString = ConversionUtilities.convertValueToString(this, valueObject); valueBuffer.append(valueString); // Add terminating delimiter // if (!readOnly || (readOnly && counter < length - 1)) { valueBuffer.append(separator); } } return valueBuffer.toString(); } // Empty string looks like '' or if separator == "|" // it'll be "||" // String cv = ConversionUtilities.convertValueToString(this, value); if (readOnly) { return cv; } else { StringBuffer sb = new StringBuffer(64); return sb.append(separator).append(cv).append(separator).toString(); } } public int getLabelLevel() { int labelLevel = _getLabelLevel(); if (labelLevel < 1 || labelLevel > 3) { labelLevel = 2; setLabelLevel(labelLevel); } return labelLevel; } /** * Getter for property multiple. * @return Value of property multiple. */ public boolean isMultiple() { return this.multiple; } /** * Setter for property multiple. * @param multiple New value of property multiple. */ public void setMultiple(boolean multiple) { if (this.multiple != multiple) { valueTypeEvaluator.reset(); this.multiple = multiple; } } /** * Public method toString() * @return A String representation of this component */ @Override public String toString() { String string = this.getClass().getName(); return string; } /** * private method for development time error detecting */ static void log(String s, Object o) { System.out.println(o.getClass().getName() + "::" + s); //NOI18N } /** * private method for development time error detecting */ void log(String s) { System.out.println(this.getClass().getName() + "::" + s); //NOI18N } /** *

Return true if the new value is different from the * previous value.

* * This only implements a compareValues for value if it is an Array. * If value is not an Array, defer to super.compareValues. * The assumption is that the ordering of the elements * between the previous value and the new value is determined * in the same manner. * * Another assumption is that the two object arguments * are of the same type, both arrays of both not arrays. * * @param previous old value of this component (if any) * @param value new value of this component (if any) */ @Override protected boolean compareValues(Object previous, Object value) { // Let super take care of null cases // if (previous == null || value == null) { return super.compareValues(previous, value); } if (value instanceof Object[]) { // If the lengths aren't equal return true // int length = Array.getLength(value); if (Array.getLength(previous) != length) { return true; } // Each element at index "i" in previous must be equal to the // elementa at index "i" in value. // for (int i = 0; i < length; ++i) { Object newValue = Array.get(value, i); Object prevValue = Array.get(previous, i); // This is probably not necessary since // an Option's value cannot be null // if (newValue == null) { if (prevValue == null) { continue; } else { return true; } } if (prevValue == null) { return true; } if (!prevValue.equals(newValue)) { return true; } } return false; } return super.compareValues(previous, value); } public void setSelected(Object selected) { _setSelected(selected); valueTypeEvaluator.reset(); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Tag attribute methods // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** *

Return the ValueExpression stored for the * specified name (if any), respecting any property aliases.

* * @param name Name of value binding expression to retrieve */ @Override public ValueExpression getValueExpression(String name) { if (name.equals("selected")) { return super.getValueExpression("value"); } return super.getValueExpression(name); } /** *

Set the ValueExpression stored for the * specified name (if any), respecting any property * aliases.

* * @param name Name of value binding to set * @param binding ValueExpression to set, or null to remove */ @Override public void setValueExpression(String name, ValueExpression binding) { if (name.equals("selected")) { super.setValueExpression("value", binding); return; } super.setValueExpression(name, binding); } /** *

Flag indicating that the user is not permitted to activate this * component, and that the component's value will not be submitted with the * form.

*/ @Property(name = "disabled", displayName = "Disabled", category = "Behavior") private boolean disabled = false; private boolean disabled_set = false; /** *

Flag indicating that the user is not permitted to activate this * component, and that the component's value will not be submitted with the * form.

*/ public boolean isDisabled() { if (this.disabled_set) { return this.disabled; } ValueExpression _vb = getValueExpression("disabled"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return false; } else { return ((Boolean) _result).booleanValue(); } } return false; } /** *

Flag indicating that the user is not permitted to activate this * component, and that the component's value will not be submitted with the * form.

* @see #isDisabled() */ public void setDisabled(boolean disabled) { this.disabled = disabled; this.disabled_set = true; } /** *

Specifies the options that the web application user can choose * from. The value must be one of an array, Map or Collection * whose members are all subclasses ofcom.sun.webui.jsf.model.Option.

*/ @Property(name = "items", displayName = "Items", category = "Data", editorClassName = "com.sun.rave.propertyeditors.binding.ValueBindingPropertyEditor") private Object items = null; /** *

Specifies the options that the web application user can choose * from. The value must be one of an array, Map or Collection * whose members are all subclasses ofcom.sun.webui.jsf.model.Option.

*/ public Object getItems() { if (this.items != null) { return this.items; } ValueExpression _vb = getValueExpression("items"); if (_vb != null) { return (Object) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Specifies the options that the web application user can choose * from. The value must be one of an array, Map or Collection * whose members are all subclasses ofcom.sun.webui.jsf.model.Option.

* @see #getItems() */ public void setItems(Object items) { this.items = items; } /** *

If set, a label is rendered adjacent to the component with the * value of this attribute as the label text.

*/ @Property(name = "label", displayName = "Label", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.StringPropertyEditor") private String label = null; /** *

If set, a label is rendered adjacent to the component with the * value of this attribute as the label text.

*/ public String getLabel() { if (this.label != null) { return this.label; } ValueExpression _vb = getValueExpression("label"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

If set, a label is rendered adjacent to the component with the * value of this attribute as the label text.

* @see #getLabel() */ public void setLabel(String label) { this.label = label; } /** *

Sets the style level for the generated label, provided the * label attribute has been set. Valid values are 1 (largest), 2 and * 3 (smallest). The default value is 2.

*/ @Property(name = "labelLevel", displayName = "Label Level", category = "Appearance", editorClassName = "com.sun.webui.jsf.component.propertyeditors.LabelLevelsEditor") private int labelLevel = Integer.MIN_VALUE; private boolean labelLevel_set = false; /** *

Sets the style level for the generated label, provided the * label attribute has been set. Valid values are 1 (largest), 2 and * 3 (smallest). The default value is 2.

*/ private int _getLabelLevel() { if (this.labelLevel_set) { return this.labelLevel; } ValueExpression _vb = getValueExpression("labelLevel"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } return 2; } /** *

Sets the style level for the generated label, provided the * label attribute has been set. Valid values are 1 (largest), 2 and * 3 (smallest). The default value is 2.

* @see #getLabelLevel() */ public void setLabelLevel(int labelLevel) { this.labelLevel = labelLevel; this.labelLevel_set = true; } /** *

Scripting code executed when this element loses focus.

*/ @Property(name = "onBlur", displayName = "Blur Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onBlur = null; /** *

Scripting code executed when this element loses focus.

*/ public String getOnBlur() { if (this.onBlur != null) { return this.onBlur; } ValueExpression _vb = getValueExpression("onBlur"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when this element loses focus.

* @see #getOnBlur() */ public void setOnBlur(String onBlur) { this.onBlur = onBlur; } /** *

Scripting code executed when the element * value of this component is changed.

*/ @Property(name = "onChange", displayName = "Value Change Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onChange = null; /** *

Scripting code executed when the element * value of this component is changed.

*/ public String getOnChange() { if (this.onChange != null) { return this.onChange; } ValueExpression _vb = getValueExpression("onChange"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the element * value of this component is changed.

* @see #getOnChange() */ public void setOnChange(String onChange) { this.onChange = onChange; } /** *

Scripting code executed when a mouse click * occurs over this component.

*/ @Property(name = "onClick", displayName = "Click Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onClick = null; /** *

Scripting code executed when a mouse click * occurs over this component.

*/ public String getOnClick() { if (this.onClick != null) { return this.onClick; } ValueExpression _vb = getValueExpression("onClick"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse click * occurs over this component.

* @see #getOnClick() */ public void setOnClick(String onClick) { this.onClick = onClick; } /** *

Scripting code executed when a mouse double click * occurs over this component.

*/ @Property(name = "onDblClick", displayName = "Double Click Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onDblClick = null; /** *

Scripting code executed when a mouse double click * occurs over this component.

*/ public String getOnDblClick() { if (this.onDblClick != null) { return this.onDblClick; } ValueExpression _vb = getValueExpression("onDblClick"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse double click * occurs over this component.

* @see #getOnDblClick() */ public void setOnDblClick(String onDblClick) { this.onDblClick = onDblClick; } /** *

Scripting code executed when this component receives focus. An * element receives focus when the user selects the element by pressing * the tab key or clicking the mouse.

*/ @Property(name = "onFocus", displayName = "Focus Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onFocus = null; /** *

Scripting code executed when this component receives focus. An * element receives focus when the user selects the element by pressing * the tab key or clicking the mouse.

*/ public String getOnFocus() { if (this.onFocus != null) { return this.onFocus; } ValueExpression _vb = getValueExpression("onFocus"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when this component receives focus. An * element receives focus when the user selects the element by pressing * the tab key or clicking the mouse.

* @see #getOnFocus() */ public void setOnFocus(String onFocus) { this.onFocus = onFocus; } /** *

Scripting code executed when the user presses down on a key while the * component has focus.

*/ @Property(name = "onKeyDown", displayName = "Key Down Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onKeyDown = null; /** *

Scripting code executed when the user presses down on a key while the * component has focus.

*/ public String getOnKeyDown() { if (this.onKeyDown != null) { return this.onKeyDown; } ValueExpression _vb = getValueExpression("onKeyDown"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user presses down on a key while the * component has focus.

* @see #getOnKeyDown() */ public void setOnKeyDown(String onKeyDown) { this.onKeyDown = onKeyDown; } /** *

Scripting code executed when the user presses and releases a key while * the component has focus.

*/ @Property(name = "onKeyPress", displayName = "Key Press Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onKeyPress = null; /** *

Scripting code executed when the user presses and releases a key while * the component has focus.

*/ public String getOnKeyPress() { if (this.onKeyPress != null) { return this.onKeyPress; } ValueExpression _vb = getValueExpression("onKeyPress"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user presses and releases a key while * the component has focus.

* @see #getOnKeyPress() */ public void setOnKeyPress(String onKeyPress) { this.onKeyPress = onKeyPress; } /** *

Scripting code executed when the user releases a key while the * component has focus.

*/ @Property(name = "onKeyUp", displayName = "Key Up Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onKeyUp = null; /** *

Scripting code executed when the user releases a key while the * component has focus.

*/ public String getOnKeyUp() { if (this.onKeyUp != null) { return this.onKeyUp; } ValueExpression _vb = getValueExpression("onKeyUp"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user releases a key while the * component has focus.

* @see #getOnKeyUp() */ public void setOnKeyUp(String onKeyUp) { this.onKeyUp = onKeyUp; } /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

*/ @Property(name = "onMouseDown", displayName = "Mouse Down Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseDown = null; /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

*/ public String getOnMouseDown() { if (this.onMouseDown != null) { return this.onMouseDown; } ValueExpression _vb = getValueExpression("onMouseDown"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user presses a mouse button while the * mouse pointer is on the component.

* @see #getOnMouseDown() */ public void setOnMouseDown(String onMouseDown) { this.onMouseDown = onMouseDown; } /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

*/ @Property(name = "onMouseMove", displayName = "Mouse Move Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseMove = null; /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

*/ public String getOnMouseMove() { if (this.onMouseMove != null) { return this.onMouseMove; } ValueExpression _vb = getValueExpression("onMouseMove"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user moves the mouse pointer while * over the component.

* @see #getOnMouseMove() */ public void setOnMouseMove(String onMouseMove) { this.onMouseMove = onMouseMove; } /** *

Scripting code executed when a mouse out movement * occurs over this component.

*/ @Property(name = "onMouseOut", displayName = "Mouse Out Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseOut = null; /** *

Scripting code executed when a mouse out movement * occurs over this component.

*/ public String getOnMouseOut() { if (this.onMouseOut != null) { return this.onMouseOut; } ValueExpression _vb = getValueExpression("onMouseOut"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when a mouse out movement * occurs over this component.

* @see #getOnMouseOut() */ public void setOnMouseOut(String onMouseOut) { this.onMouseOut = onMouseOut; } /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

*/ @Property(name = "onMouseOver", displayName = "Mouse In Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseOver = null; /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

*/ public String getOnMouseOver() { if (this.onMouseOver != null) { return this.onMouseOver; } ValueExpression _vb = getValueExpression("onMouseOver"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user moves the mouse pointer into * the boundary of this component.

* @see #getOnMouseOver() */ public void setOnMouseOver(String onMouseOver) { this.onMouseOver = onMouseOver; } /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

*/ @Property(name = "onMouseUp", displayName = "Mouse Up Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onMouseUp = null; /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

*/ public String getOnMouseUp() { if (this.onMouseUp != null) { return this.onMouseUp; } ValueExpression _vb = getValueExpression("onMouseUp"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when the user releases a mouse button while * the mouse pointer is on the component.

* @see #getOnMouseUp() */ public void setOnMouseUp(String onMouseUp) { this.onMouseUp = onMouseUp; } /** *

Scripting code executed when some text in this * component value is selected.

*/ @Property(name = "onSelect", displayName = "Text Selected Script", category = "Javascript", editorClassName = "com.sun.rave.propertyeditors.JavaScriptPropertyEditor") private String onSelect = null; /** *

Scripting code executed when some text in this * component value is selected.

*/ public String getOnSelect() { if (this.onSelect != null) { return this.onSelect; } ValueExpression _vb = getValueExpression("onSelect"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Scripting code executed when some text in this * component value is selected.

* @see #getOnSelect() */ public void setOnSelect(String onSelect) { this.onSelect = onSelect; } /** *

If this attribute is set to true, the value of the component is * rendered as text, preceded by the label if one was defined.

*/ @Property(name = "readOnly", displayName = "Read-only", category = "Behavior") private boolean readOnly = false; private boolean readOnly_set = false; /** *

If this attribute is set to true, the value of the component is * rendered as text, preceded by the label if one was defined.

*/ public boolean isReadOnly() { if (this.readOnly_set) { return this.readOnly; } ValueExpression _vb = getValueExpression("readOnly"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return false; } else { return ((Boolean) _result).booleanValue(); } } return false; } /** *

If this attribute is set to true, the value of the component is * rendered as text, preceded by the label if one was defined.

* @see #isReadOnly() */ public void setReadOnly(boolean readOnly) { this.readOnly = readOnly; this.readOnly_set = true; } /** *

The object that represents the selections made from the * available options. If multiple selections are allowed, this * must be bound to an Object array, or an array of * primitives.

*/ @Property(name = "selected", displayName = "Selected", category = "Data", editorClassName = "com.sun.rave.propertyeditors.binding.ValueBindingPropertyEditor") public Object getSelected() { return getValue(); } /** *

The object that represents the selections made from the * available options. If multiple selections are allowed, this * must be bound to an Object array, or an array of * primitives.

* @see #getSelected() */ private void _setSelected(Object selected) { setValue(selected); } /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

*/ @Property(name = "style", displayName = "CSS Style(s)", category = "Appearance", editorClassName = "com.sun.jsfcl.std.css.CssStylePropertyEditor") private String style = null; /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

*/ public String getStyle() { if (this.style != null) { return this.style; } ValueExpression _vb = getValueExpression("style"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

CSS style(s) to be applied to the outermost HTML element when this * component is rendered.

* @see #getStyle() */ public void setStyle(String style) { this.style = style; } /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

*/ @Property(name = "styleClass", displayName = "CSS Style Class(es)", category = "Appearance", editorClassName = "com.sun.rave.propertyeditors.StyleClassPropertyEditor") private String styleClass = null; /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

*/ public String getStyleClass() { if (this.styleClass != null) { return this.styleClass; } ValueExpression _vb = getValueExpression("styleClass"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

CSS style class(es) to be applied to the outermost HTML element when this * component is rendered.

* @see #getStyleClass() */ public void setStyleClass(String styleClass) { this.styleClass = styleClass; } /** *

Position of this element in the tabbing order of the current document. * Tabbing order determines the sequence in which elements receive * focus when the tab key is pressed. The value must be an integer * between 0 and 32767.

*/ @Property(name = "tabIndex", displayName = "Tab Index", category = "Accessibility", editorClassName = "com.sun.rave.propertyeditors.IntegerPropertyEditor") private int tabIndex = Integer.MIN_VALUE; private boolean tabIndex_set = false; /** *

Position of this element in the tabbing order of the current document. * Tabbing order determines the sequence in which elements receive * focus when the tab key is pressed. The value must be an integer * between 0 and 32767.

*/ public int getTabIndex() { if (this.tabIndex_set) { return this.tabIndex; } ValueExpression _vb = getValueExpression("tabIndex"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } return Integer.MIN_VALUE; } /** *

Position of this element in the tabbing order of the current document. * Tabbing order determines the sequence in which elements receive * focus when the tab key is pressed. The value must be an integer * between 0 and 32767.

* @see #getTabIndex() */ public void setTabIndex(int tabIndex) { this.tabIndex = tabIndex; this.tabIndex_set = true; } /** *

Sets the value of the title attribute for the HTML element. * The specified text will display as a tooltip if the mouse cursor hovers * over the HTML element.

*/ @Property(name = "toolTip", displayName = "Tool Tip", category = "Behavior", editorClassName = "com.sun.rave.propertyeditors.StringPropertyEditor") private String toolTip = null; /** *

Sets the value of the title attribute for the HTML element. * The specified text will display as a tooltip if the mouse cursor hovers * over the HTML element.

*/ public String getToolTip() { if (this.toolTip != null) { return this.toolTip; } ValueExpression _vb = getValueExpression("toolTip"); if (_vb != null) { return (String) _vb.getValue(getFacesContext().getELContext()); } return null; } /** *

Sets the value of the title attribute for the HTML element. * The specified text will display as a tooltip if the mouse cursor hovers * over the HTML element.

* @see #getToolTip() */ public void setToolTip(String toolTip) { this.toolTip = toolTip; } /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

*/ @Property(name = "visible", displayName = "Visible", category = "Behavior") private boolean visible = false; private boolean visible_set = false; /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

*/ public boolean isVisible() { if (this.visible_set) { return this.visible; } ValueExpression _vb = getValueExpression("visible"); if (_vb != null) { Object _result = _vb.getValue(getFacesContext().getELContext()); if (_result == null) { return false; } else { return ((Boolean) _result).booleanValue(); } } return true; } /** *

Use the visible attribute to indicate whether the component should be * viewable by the user in the rendered HTML page. If set to false, the * HTML code for the component is present in the page, but the component * is hidden with style attributes. By default, visible is set to true, so * HTML for the component HTML is included and visible to the user. If the * component is not visible, it can still be processed on subsequent form * submissions because the HTML is present.

* @see #isVisible() */ public void setVisible(boolean visible) { this.visible = visible; this.visible_set = true; } /** *

Restore the state of this component.

*/ @Override public void restoreState(FacesContext _context, Object _state) { Object _values[] = (Object[]) _state; super.restoreState(_context, _values[0]); this.disabled = ((Boolean) _values[1]).booleanValue(); this.disabled_set = ((Boolean) _values[2]).booleanValue(); this.items = (Object) _values[3]; this.label = (String) _values[4]; this.labelLevel = ((Integer) _values[5]).intValue(); this.labelLevel_set = ((Boolean) _values[6]).booleanValue(); this.onBlur = (String) _values[7]; this.onChange = (String) _values[8]; this.onClick = (String) _values[9]; this.onDblClick = (String) _values[10]; this.onFocus = (String) _values[11]; this.onKeyDown = (String) _values[12]; this.onKeyPress = (String) _values[13]; this.onKeyUp = (String) _values[14]; this.onMouseDown = (String) _values[15]; this.onMouseMove = (String) _values[16]; this.onMouseOut = (String) _values[17]; this.onMouseOver = (String) _values[18]; this.onMouseUp = (String) _values[19]; this.onSelect = (String) _values[20]; this.readOnly = ((Boolean) _values[21]).booleanValue(); this.readOnly_set = ((Boolean) _values[22]).booleanValue(); this.style = (String) _values[23]; this.styleClass = (String) _values[24]; this.tabIndex = ((Integer) _values[25]).intValue(); this.tabIndex_set = ((Boolean) _values[26]).booleanValue(); this.toolTip = (String) _values[27]; this.visible = ((Boolean) _values[28]).booleanValue(); this.visible_set = ((Boolean) _values[29]).booleanValue(); } /** *

Save the state of this component.

*/ @Override public Object saveState(FacesContext _context) { Object _values[] = new Object[30]; _values[0] = super.saveState(_context); _values[1] = this.disabled ? Boolean.TRUE : Boolean.FALSE; _values[2] = this.disabled_set ? Boolean.TRUE : Boolean.FALSE; _values[3] = this.items; _values[4] = this.label; _values[5] = new Integer(this.labelLevel); _values[6] = this.labelLevel_set ? Boolean.TRUE : Boolean.FALSE; _values[7] = this.onBlur; _values[8] = this.onChange; _values[9] = this.onClick; _values[10] = this.onDblClick; _values[11] = this.onFocus; _values[12] = this.onKeyDown; _values[13] = this.onKeyPress; _values[14] = this.onKeyUp; _values[15] = this.onMouseDown; _values[16] = this.onMouseMove; _values[17] = this.onMouseOut; _values[18] = this.onMouseOver; _values[19] = this.onMouseUp; _values[20] = this.onSelect; _values[21] = this.readOnly ? Boolean.TRUE : Boolean.FALSE; _values[22] = this.readOnly_set ? Boolean.TRUE : Boolean.FALSE; _values[23] = this.style; _values[24] = this.styleClass; _values[25] = new Integer(this.tabIndex); _values[26] = this.tabIndex_set ? Boolean.TRUE : Boolean.FALSE; _values[27] = this.toolTip; _values[28] = this.visible ? Boolean.TRUE : Boolean.FALSE; _values[29] = this.visible_set ? Boolean.TRUE : Boolean.FALSE; return _values; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy