/** * Copyright 2014-2017 Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net). * * This file is part of BootsFaces. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.bootsfaces.component.remoteCommand; import javax.faces.component.*; import net.bootsfaces.utils.BsfUtils; /** This class holds the attributes of <b:remoteCommand />. */ public abstract class RemoteCommandCore extends UICommand { protected enum PropertyKeys { ajax, binding, disabled, name, onclick, oncomplete, onerror, onsuccess, parameters, process, update; String toString; PropertyKeys(String toString) { this.toString = toString; } PropertyKeys() { } public String toString() { return ((this.toString != null) ? this.toString : super.toString()); } } /** * Whether the Button submits the form with AJAX. <P> * @return Returns the value of the attribute, or , false, if it hasn't been set by the JSF file. */ public boolean isAjax() { return (boolean) (Boolean) getStateHelper().eval(PropertyKeys.ajax, false); } /** * Whether the Button submits the form with AJAX. <P> * Usually this method is called internally by the JSF engine. */ public void setAjax(boolean _ajax) { getStateHelper().put(PropertyKeys.ajax, _ajax); } /** * An EL expression referring to a server side UIComponent instance in a backing bean. <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public javax.faces.component.UIComponent getBinding() { return (javax.faces.component.UIComponent) getStateHelper().eval(PropertyKeys.binding); } /** * An EL expression referring to a server side UIComponent instance in a backing bean. <P> * Usually this method is called internally by the JSF engine. */ public void setBinding(javax.faces.component.UIComponent _binding) { getStateHelper().put(PropertyKeys.binding, _binding); } /** * Boolean value to specify if the button is disabled. <P> * @return Returns the value of the attribute, or , false, if it hasn't been set by the JSF file. */ public boolean isDisabled() { return (boolean) (Boolean) getStateHelper().eval(PropertyKeys.disabled, false); } /** * Boolean value to specify if the button is disabled. <P> * Usually this method is called internally by the JSF engine. */ public void setDisabled(boolean _disabled) { getStateHelper().put(PropertyKeys.disabled, _disabled); } /** * Name of the JavaScript function. <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getName() { return (String) getStateHelper().eval(PropertyKeys.name); } /** * Name of the JavaScript function. <P> * Usually this method is called internally by the JSF engine. */ public void setName(String _name) { getStateHelper().put(PropertyKeys.name, _name); } /** * The onclick attribute. <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getOnclick() { return (String) getStateHelper().eval(PropertyKeys.onclick); } /** * The onclick attribute. <P> * Usually this method is called internally by the JSF engine. */ public void setOnclick(String _onclick) { getStateHelper().put(PropertyKeys.onclick, _onclick); } /** * JavaScript to be executed when ajax completes. <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getOncomplete() { return (String) getStateHelper().eval(PropertyKeys.oncomplete); } /** * JavaScript to be executed when ajax completes. <P> * Usually this method is called internally by the JSF engine. */ public void setOncomplete(String _oncomplete) { getStateHelper().put(PropertyKeys.oncomplete, _oncomplete); } /** * JavaScript to be executed when ajax results on an error (including both network errors and Java exceptions). <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getOnerror() { return (String) getStateHelper().eval(PropertyKeys.onerror); } /** * JavaScript to be executed when ajax results on an error (including both network errors and Java exceptions). <P> * Usually this method is called internally by the JSF engine. */ public void setOnerror(String _onerror) { getStateHelper().put(PropertyKeys.onerror, _onerror); } /** * JavaScript to be executed when ajax completes with success (i.e. there's neither a network error nor a Java exception). <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getOnsuccess() { return (String) getStateHelper().eval(PropertyKeys.onsuccess); } /** * JavaScript to be executed when ajax completes with success (i.e. there's neither a network error nor a Java exception). <P> * Usually this method is called internally by the JSF engine. */ public void setOnsuccess(String _onsuccess) { getStateHelper().put(PropertyKeys.onsuccess, _onsuccess); } /** * Optional list of parameters to be added to the parameter list of the JavaScript function. The JSF bean can read these parameters from the request parameters (FacesContext.getCurrentContext.getRequestParameter('name1')). If you need more than one parameter, separate them with commas. Don't add a type because this is the signature of the JavaScript function. <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getParameters() { return (String) getStateHelper().eval(PropertyKeys.parameters); } /** * Optional list of parameters to be added to the parameter list of the JavaScript function. The JSF bean can read these parameters from the request parameters (FacesContext.getCurrentContext.getRequestParameter('name1')). If you need more than one parameter, separate them with commas. Don't add a type because this is the signature of the JavaScript function. <P> * Usually this method is called internally by the JSF engine. */ public void setParameters(String _parameters) { getStateHelper().put(PropertyKeys.parameters, _parameters); } /** * Comma or space separated list of ids or search expressions denoting which values are to be sent to the server. <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getProcess() { return (String) getStateHelper().eval(PropertyKeys.process); } /** * Comma or space separated list of ids or search expressions denoting which values are to be sent to the server. <P> * Usually this method is called internally by the JSF engine. */ public void setProcess(String _process) { getStateHelper().put(PropertyKeys.process, _process); } /** * Component(s) to be updated with ajax. <P> * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getUpdate() { return (String) getStateHelper().eval(PropertyKeys.update); } /** * Component(s) to be updated with ajax. <P> * Usually this method is called internally by the JSF engine. */ public void setUpdate(String _update) { getStateHelper().put(PropertyKeys.update, _update); } }