javax.faces.component.html.HtmlCommandScript Maven / Gradle / Ivy
Show all versions of javax.faces-api Show documentation
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 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://glassfish.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/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 packager/legal/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 javax.faces.component.html;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
/*
* ******* GENERATED CODE - DO NOT EDIT *******
*/
/**
* Represents an HTML script
element for a function that acts
* like an ajax form submit. This component must be placed inside
* a form, and requires JavaScript to be enabled in the client.
* By default, the rendererType
property must be set to "javax.faces.Script
".
* This value can be changed by calling the setRendererType()
method.
*/
public class HtmlCommandScript extends javax.faces.component.UICommand {
private static final String OPTIMIZED_PACKAGE = "javax.faces.component.";
public HtmlCommandScript() {
super();
setRendererType("javax.faces.Script");
}
/**
* The standard component type for this component.
*/
public static final String COMPONENT_TYPE = "javax.faces.HtmlCommandScript";
protected enum PropertyKeys {
autorun,
execute,
name,
onerror,
onevent,
render,
resetValues,
;
String toString;
PropertyKeys(String toString) { this.toString = toString; }
PropertyKeys() { }
public String toString() {
return ((toString != null) ? toString : super.toString());
}
}
/**
* Return the value of the autorun
property.
* @return the property value
* Contents: Whether to execute declared JavaScript function during load
event of the window
.
* Defaults to false
.
*/
public boolean isAutorun() {
return (java.lang.Boolean) getStateHelper().eval(PropertyKeys.autorun, false);
}
/**
*
Set the value of the autorun
property.
* @param autorun the new property value
*/
public void setAutorun(boolean autorun) {
getStateHelper().put(PropertyKeys.autorun, autorun);
}
/**
* Return the value of the execute
property.
* @return the property value
* Contents: This is a space separated list of client identifiers of components
* that will participate in the "execute" portion of the Request Processing Lifecycle.
* If a literal is specified the identifiers must be space delimited.
* Any of the keywords "@this", "@form", "@all", "@none" may be specified in the identifier list.
* If not specified, the default value of "@this" is assumed.
* For example, @this clientIdOne clientIdTwo
.
*/
public java.lang.String getExecute() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.execute);
}
/**
*
Set the value of the execute
property.
* @param execute the new property value
*/
public void setExecute(java.lang.String execute) {
getStateHelper().put(PropertyKeys.execute, execute);
}
/**
* Return the value of the name
property.
* @return the property value
* Contents: Name of JavaScript function to be declared, e.g. name="functionName"
.
* This can be a namespaced function name, e.g. name="ez.functionName"
.
*/
public java.lang.String getName() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.name);
}
/**
*
Set the value of the name
property.
* @param name the new property value
*/
public void setName(java.lang.String name) {
getStateHelper().put(PropertyKeys.name, name);
}
/**
* Return the value of the onerror
property.
* @return the property value
* Contents: The name of the JavaScript function that will handle errors.
*/
public java.lang.String getOnerror() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.onerror);
}
/**
*
Set the value of the onerror
property.
* @param onerror the new property value
*/
public void setOnerror(java.lang.String onerror) {
getStateHelper().put(PropertyKeys.onerror, onerror);
}
/**
* Return the value of the onevent
property.
* @return the property value
* Contents: The name of the JavaScript function that will handle UI events.
*/
public java.lang.String getOnevent() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.onevent);
}
/**
*
Set the value of the onevent
property.
* @param onevent the new property value
*/
public void setOnevent(java.lang.String onevent) {
getStateHelper().put(PropertyKeys.onevent, onevent);
}
/**
* Return the value of the render
property.
* @return the property value
* Contents: This is a space separated list of client identifiers of components
* that will participate in the "render" portion of the Request Processing Lifecycle.
* If a literal is specified the identifiers must be space delimited.
* Any of the keywords "@this", "@form", "@all", "@none" may be specified in the identifier list.
* If not specified, the default value of "@none" is assumed.
* For example, @this clientIdOne clientIdTwo
.
*/
public java.lang.String getRender() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.render);
}
/**
*
Set the value of the render
property.
* @param render the new property value
*/
public void setRender(java.lang.String render) {
getStateHelper().put(PropertyKeys.render, render);
}
/**
* Return the value of the resetValues
property.
* @return the property value
* Contents: Reset specific input values.
* Interpret the value of the render
attribute as a space separated list of client identifiers
* suitable for passing directly to UIViewRoot.resetValues()
.
* The implementation must cause an ActionListener
to be attached to the ActionSource
* component in which this tag is nested that calls UIViewRoot.resetValues()
passing the value
* of the render
attribute as the argument.
*/
public java.lang.Boolean getResetValues() {
return (java.lang.Boolean) getStateHelper().eval(PropertyKeys.resetValues);
}
/**
*
Set the value of the resetValues
property.
* @param resetValues the new property value
*/
public void setResetValues(java.lang.Boolean resetValues) {
getStateHelper().put(PropertyKeys.resetValues, resetValues);
}
private void handleAttribute(String name, Object value) {
List setAttributes = (List) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet");
if (setAttributes == null) {
String cname = this.getClass().getName();
if (cname != null && cname.startsWith(OPTIMIZED_PACKAGE)) {
setAttributes = new ArrayList(6);
this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes);
}
}
if (setAttributes != null) {
if (value == null) {
ValueExpression ve = getValueExpression(name);
if (ve == null) {
setAttributes.remove(name);
}
} else if (!setAttributes.contains(name)) {
setAttributes.add(name);
}
}
}
}