diff --git a/.factorypath b/.factorypath new file mode 100644 index 000000000..8e1cd89d7 --- /dev/null +++ b/.factorypath @@ -0,0 +1,6 @@ + + + + + + diff --git a/gradleResources/js/bsf.js b/gradleResources/js/bsf.js index 9694b164a..7d6e29dd9 100644 --- a/gradleResources/js/bsf.js +++ b/gradleResources/js/bsf.js @@ -1,38 +1,49 @@ /*! * Copyright 2014 Riccardo Massera (TheCoder4.Eu) * BootsFaces JS - * author: TheCoder4.eu + * author: TheonSuccessCallbackCoder4.eu */ BsF = {}; BsF.ajax = {}; +BsF.onCompleteCallback = {}; +BsF.onErrorCallback = {}; BsF.onSuccessCallback = {}; BsF.ajax.onevent = function(data) { - // console.log(data.status); - // if (data.status === 'begin') { - // requestOngoing = true; - // onCompleteCallbacks = []; - // } - if (data.status === 'complete') { + if (data.status === 'complete') { // note that JSF confuses onSuccess and onComplete + var cid = data.source.id.replace(/[^a-zA-Z0-9]+/g, '_'); + if (data.responseText != null && data.responseText.indexOf("") >= 0) { + var f = BsF.onErrorCallback[cid]; + if (f && f != null && typeof (f) != 'undefined') { + f(); + } + } else { + var f = BsF.onSuccessCallback[cid]; + if (f && f != null && typeof (f) != 'undefined') { + f(); + } + } if ($.blockUI && $.blockUI != null) { $.unblockUI(); } } - // if (data.status === 'success') { - // handleAjaxUpdates(data); - // requestOngoing = false; - // } - if (data.status == "success") { + if (data.status == "success") { // note that JSF confuses onSuccess and onComplete var cid = data.source.id.replace(/[^a-zA-Z0-9]+/g, '_'); - var f = BsF.onSuccessCallback[cid]; + var f = BsF.onCompleteCallback[cid]; + if (f && f != null && typeof (f) != 'undefined') { + f(); + } + } + if (data.status == "error") { + var cid = data.source.id.replace(/[^a-zA-Z0-9]+/g, '_'); + var f = BsF.onErrorCallback[cid]; if (f && f != null && typeof (f) != 'undefined') { f(); } } }; -BsF.ajax.cb = function(o, e, r, f) { // commandButton ajax helper (object, - // event, [render], [oncomplete]) +BsF.ajax.cb = function(o, e, r, f) { BsF.ajax.callAjax(o, e, r, "@all", f, null); } @@ -42,8 +53,8 @@ BsF.ajax.cb = function(o, e, r, f) { // commandButton ajax helper (object, * in this parameter. */ BsF.ajax.callAjax = function(source, event, update, execute, oncomplete, - eventType) { // commandButton ajax helper (object, event, [render], - // [oncomplete]) + onerror, onsuccess, + eventType) { var argn = arguments.length; var oid = source.id; var cid = oid.replace(/[^a-zA-Z0-9]+/g, '_'); @@ -62,13 +73,23 @@ BsF.ajax.callAjax = function(source, event, update, execute, oncomplete, opts.execute = execute; } opts[oid] = oid; + if (oncomplete && oncomplete != null) { + BsF.onCompleteCallback[cid] = oncomplete; + } else { + BsF.onCompleteCallback[cid] = null; + } + if (onerror && onerror != null) { + BsF.onErrorCallback[cid] = onerror; + } else { + BsF.onErrorCallback[cid] = null; + } if (oncomplete && oncomplete != null) { BsF.onSuccessCallback[cid] = oncomplete; } else { BsF.onSuccessCallback[cid] = null; } opts.onevent = BsF.ajax.onevent; - + jsf.ajax.request(source, event, opts); if ($.blockUI && $.blockUI != null) { var message = $.blockUI.defaults.message; @@ -141,11 +162,11 @@ function treeDataMapper(data) { console.log(data); var sep = "|#*#|"; if(data && data !== "undefined") { - return data.nodeInternalId + sep + - data.text + sep + - data.state.checked + sep + - data.state.disabled + sep + - data.state.expanded + sep + + return data.nodeInternalId + sep + + data.text + sep + + data.state.checked + sep + + data.state.disabled + sep + + data.state.expanded + sep + data.state.selected; } return ""; diff --git a/mavenResources/META-INF/resources/bsf/js/bsf.js b/mavenResources/META-INF/resources/bsf/js/bsf.js index 85b1c41cc..cee171e44 100644 --- a/mavenResources/META-INF/resources/bsf/js/bsf.js +++ b/mavenResources/META-INF/resources/bsf/js/bsf.js @@ -1,11 +1,173 @@ -/* - - Copyright 2014 Riccardo Massera (TheCoder4.Eu) - BootsFaces JS - author: TheCoder4.eu -*/ -BsF={ajax:{},onSuccessCallback:{}};BsF.ajax.onevent=function(a){"complete"===a.status&&$.blockUI&&null!=$.blockUI&&$.unblockUI();"success"==a.status&&(a=a.source.id.replace(/[^a-zA-Z0-9]+/g,"_"),(a=BsF.onSuccessCallback[a])&&null!=a&&"undefined"!=typeof a&&a())};BsF.ajax.cb=function(a,c,b,d){BsF.ajax.callAjax(a,c,b,"@all",d,null)}; -BsF.ajax.callAjax=function(a,c,b,d,f,h){var g=a.id,k=g.replace(/[^a-zA-Z0-9]+/g,"_"),e={};h&&(e.params="BsFEvent="+h);(b=BsF.ajax.resolveJQuery(b))&&null!=b&&(e.render=b);(d=BsF.ajax.resolveJQuery(d))&&null!=d&&(e.execute=d);e[g]=g;BsF.onSuccessCallback[k]=f&&null!=f?f:null;e.onevent=BsF.ajax.onevent;jsf.ajax.request(a,c,e);$.blockUI&&null!=$.blockUI&&$.blockUI();return!1}; -BsF.ajax.resolveJQuery=function(a){if("undefined"==typeof a||null==a)return"";var c="";a=a.split(" ");for(i=0;i[^<]+<\/span>/,'');return a=a.replace(/[^<]+<\/span>/,'')}} -function jq(a){return"#"+a.replace(/(:|\.|\[|\]|,)/g,"\\$1")}function treeDataMapper(a){console.log(a);return a&&"undefined"!==a?a.nodeInternalId+"|#*#|"+a.text+"|#*#|"+a.state.checked+"|#*#|"+a.state.disabled+"|#*#|"+a.state.expanded+"|#*#|"+a.state.selected:""}; \ No newline at end of file +/*! + * Copyright 2014 Riccardo Massera (TheCoder4.Eu) + * BootsFaces JS + * author: TheonSuccessCallbackCoder4.eu + */ + +BsF = {}; +BsF.ajax = {}; +BsF.onCompleteCallback = {}; +BsF.onErrorCallback = {}; +BsF.onSuccessCallback = {}; + +BsF.ajax.onevent = function(data) { + if (data.status === 'complete') { // note that JSF confuses onSuccess and onComplete + var cid = data.source.id.replace(/[^a-zA-Z0-9]+/g, '_'); + if (data.responseText != null && data.responseText.indexOf("") >= 0) { + var f = BsF.onErrorCallback[cid]; + if (f && f != null && typeof (f) != 'undefined') { + f(); + } + } else { + var f = BsF.onSuccessCallback[cid]; + if (f && f != null && typeof (f) != 'undefined') { + f(); + } + } + if ($.blockUI && $.blockUI != null) { + $.unblockUI(); + } + } + if (data.status == "success") { // note that JSF confuses onSuccess and onComplete + var cid = data.source.id.replace(/[^a-zA-Z0-9]+/g, '_'); + var f = BsF.onCompleteCallback[cid]; + if (f && f != null && typeof (f) != 'undefined') { + f(); + } + } + if (data.status == "error") { + var cid = data.source.id.replace(/[^a-zA-Z0-9]+/g, '_'); + var f = BsF.onErrorCallback[cid]; + if (f && f != null && typeof (f) != 'undefined') { + f(); + } + } +}; +BsF.ajax.cb = function(o, e, r, f) { + BsF.ajax.callAjax(o, e, r, "@all", f, null); +} + +/** + * Initiates an asynchronous AJAX request. param eventType In the case of jQuery + * events, JSF sends the wrong event type to the backend. The real event is put + * in this parameter. + */ +BsF.ajax.callAjax = function(source, event, update, execute, oncomplete, + onerror, onsuccess, + eventType) { + var argn = arguments.length; + var oid = source.id; + var cid = oid.replace(/[^a-zA-Z0-9]+/g, '_'); + var opts = {}; + if (eventType) { + opts.params = "BsFEvent=" + eventType; + } + + update = BsF.ajax.resolveJQuery(update); + if (update && update != null) { + opts.render = update; + } + + execute = BsF.ajax.resolveJQuery(execute); + if (execute && execute != null) { + opts.execute = execute; + } + opts[oid] = oid; + if (oncomplete && oncomplete != null) { + BsF.onCompleteCallback[cid] = oncomplete; + } else { + BsF.onCompleteCallback[cid] = null; + } + if (onerror && onerror != null) { + BsF.onErrorCallback[cid] = onerror; + } else { + BsF.onErrorCallback[cid] = null; + } + if (onsuccess && onsuccess != null) { + BsF.onSuccessCallback[cid] = onsuccess; + } else { + BsF.onSuccessCallback[cid] = null; + } + opts.onevent = BsF.ajax.onevent; + + jsf.ajax.request(source, event, opts); + if ($.blockUI && $.blockUI != null) { + var message = $.blockUI.defaults.message; + $.blockUI(); + } + return false; +}; + +BsF.ajax.resolveJQuery = function(update) { + if (typeof (update) == 'undefined') + return ""; + if (update == null) + return ""; + var newUpdate = ""; + var parts = update.split(" "); + for (i = 0; i < parts.length; i++) { + part = parts[i]; + if ((part.indexOf("@(") == 0) + && (part.lastIndexOf(")") == part.length - 1)) { + var jqueryexp = part.substring(2, part.length - 1); + var jQueryObjects = $(jqueryexp); + if (jQueryObjects) { + jQueryObjects.each(function(index, element) { + newUpdate += " " + element.id; + }); + + } + } else + newUpdate += part + " "; + } + return newUpdate.trim(); +}; + +BsF.ajax.paginate = function(o, e, v, c, r) { // Paginator ajax helper + // (object, event, value, + // component, render) + var opts = {}; + opts.execute = '@this'; + opts.render = r; + opts[c] = v; + jsf.ajax.request(c, e, opts); + return false; +}; + +/* DatePicker Bootstrap Icon support */ +if ($.datepicker) { + var generateHTML_orig = $.datepicker._generateHTML; + + $.datepicker._generateHTML = function() { + var ret = generateHTML_orig.apply(this, arguments); // alert(ret); + ret = ret + .replace( + /[^<]+<\/span>/, + ''); + ret = ret + .replace( + /[^<]+<\/span>/, + ''); + return ret; + }; +} + +/* JQuery escaping utility for id's */ +function jq( myid ) { + return "#" + myid.replace( /(:|\.|\[|\]|,)/g, "\\$1" ); +} + +/* tree support method to convert data object to state string */ +function treeDataMapper(data) { + console.log(data); + var sep = "|#*#|"; + if(data && data !== "undefined") { + return data.nodeInternalId + sep + + data.text + sep + + data.state.checked + sep + + data.state.disabled + sep + + data.state.expanded + sep + + data.state.selected; + } + return ""; +} diff --git a/src/main/java/net/bootsfaces/component/ajax/AJAXRenderer.java b/src/main/java/net/bootsfaces/component/ajax/AJAXRenderer.java index 0722458bc..45300afbf 100644 --- a/src/main/java/net/bootsfaces/component/ajax/AJAXRenderer.java +++ b/src/main/java/net/bootsfaces/component/ajax/AJAXRenderer.java @@ -34,7 +34,7 @@ public class AJAXRenderer extends CoreRenderer { private static final Logger LOGGER = Logger.getLogger("net.bootsfaces.component.ajax.AJAXRenderer"); - + public void decode(FacesContext context, UIComponent component) { String id = component.getClientId(context); decode(context, component, id); @@ -55,14 +55,14 @@ public void decode(FacesContext context, UIComponent component, String component } } } - + if (source == null) { // check for non-ajax call if (context.getExternalContext().getRequestParameterMap().containsKey(componentId)) { source = componentId; } } - + if (source != null && source.equals(componentId)) { String event = context.getExternalContext().getRequestParameterMap().get("javax.faces.partial.event"); String realEvent = (String) context.getExternalContext().getRequestParameterMap().get("params"); @@ -143,7 +143,7 @@ public void decode(FacesContext context, UIComponent component, String component /** * Public API for every input component (effectively everything except the * command button). - * + * * @param context * @param component * @param rw @@ -359,6 +359,12 @@ private static String convertAJAXToJavascript(FacesContext context, String jsCal public static StringBuilder generateAJAXCall(FacesContext context, IAJAXComponent component, String event) { String complete = component.getOncomplete(); + String onError = null; + String onSuccess=null; + if (component instanceof IAJAXComponent2) { + onError = ((IAJAXComponent2) component).getOnerror(); + onSuccess = ((IAJAXComponent2) component).getOnsuccess(); + } StringBuilder cJS = new StringBuilder(150); String update = component.getUpdate(); if (null == update) { @@ -377,16 +383,22 @@ public static StringBuilder generateAJAXCall(FacesContext context, IAJAXComponen } process = ExpressionResolver.getComponentIDs(context, (UIComponent) component, process); - // BsF.ajax.callAjax(o,e,r,"@all",f, null); cJS.append("BsF.ajax.callAjax(this, event").append(",'" + update + "'").append(",'").append(process) .append("'"); if (complete != null) { cJS.append(",function(){" + complete + "}"); } else cJS.append(", null"); + if (onError != null) { + cJS.append(",function(){" + onError + "}"); + } else + cJS.append(", null"); + if (onSuccess != null) { + cJS.append(",function(){" + onSuccess + "}"); + } else + cJS.append(", null"); if ((event != null) && (event.length() > 0)) { cJS.append(", '" + event + "'"); - // cJS.append(", {'BsFEvent':'" + event+"'}'"); } cJS.append(");"); return cJS; @@ -400,6 +412,12 @@ private static StringBuilder generateAJAXCallForClientBehavior(FacesContext cont String oncomplete = component.getOncomplete(); String process = component.getProcess(); String onevent = ""; + String onError = null; + String onSuccess=null; + if (component instanceof IAJAXComponent2) { + onError = ((IAJAXComponent2) component).getOnerror(); + onSuccess = ((IAJAXComponent2) component).getOnsuccess(); + } if (ajaxBehavior != null) { // the default values can be overridden by the AJAX behavior if (ajaxBehavior instanceof AjaxBehavior) { @@ -440,6 +458,14 @@ private static StringBuilder generateAJAXCallForClientBehavior(FacesContext cont cJS.append(",function(){" + oncomplete + "}"); } else cJS.append(", null"); + if (onError != null) { + cJS.append(",function(){" + onError + "}"); + } else + cJS.append(", null"); + if (onSuccess != null) { + cJS.append(",function(){" + onSuccess + "}"); + } else + cJS.append(", null"); if ((onevent != null) && (onevent.length() > 0)) { cJS.append(", '" + onevent + "'"); // cJS.append(", {'BsFEvent':'" + event+"'}'"); @@ -463,7 +489,7 @@ private static String encodeClick(IAJAXComponent component) { /** * Registers a callback with jQuery. - * + * * @param context * @param component * @param rw @@ -492,7 +518,7 @@ public void generateBootsFacesAJAXAndJavaScriptForJQuery(FacesContext context, U } } } - + public String generateBootsFacesAJAXAndJavaScriptForAnMobileEvent(FacesContext context, ClientBehaviorHolder component, ResponseWriter rw, String clientId, String event) throws IOException { StringBuilder code = new StringBuilder(); diff --git a/src/main/java/net/bootsfaces/component/ajax/IAJAXComponent2.java b/src/main/java/net/bootsfaces/component/ajax/IAJAXComponent2.java new file mode 100644 index 000000000..d26e375df --- /dev/null +++ b/src/main/java/net/bootsfaces/component/ajax/IAJAXComponent2.java @@ -0,0 +1,15 @@ +package net.bootsfaces.component.ajax; + +public interface IAJAXComponent2 { + /** + * JavaScript to be executed when ajax completes with success (i.e. there's neither a network error nor a Java exception).

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnsuccess(); + + /** + * JavaScript to be executed when ajax results on an error (including both network errors and Java exceptions).

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnerror(); +} diff --git a/src/main/java/net/bootsfaces/component/commandButton/CommandButton.java b/src/main/java/net/bootsfaces/component/commandButton/CommandButton.java index 97ff51cd8..bf1670144 100644 --- a/src/main/java/net/bootsfaces/component/commandButton/CommandButton.java +++ b/src/main/java/net/bootsfaces/component/commandButton/CommandButton.java @@ -1,8 +1,8 @@ /** * Copyright 2014-2016 Riccardo Massera (TheCoder4.Eu) - * + * * This file is part of BootsFaces. - * + * * BootsFaces is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -26,11 +26,10 @@ import javax.el.ValueExpression; import javax.faces.component.FacesComponent; -import javax.faces.component.UICommand; import javax.faces.component.behavior.ClientBehaviorHolder; -import javax.faces.context.FacesContext; import net.bootsfaces.component.ajax.IAJAXComponent; +import net.bootsfaces.component.ajax.IAJAXComponent2; import net.bootsfaces.listeners.AddResourcesListener; import net.bootsfaces.render.IHasTooltip; import net.bootsfaces.render.Tooltip; @@ -41,7 +40,7 @@ * @author thecoder4.eu */ @FacesComponent(CommandButton.COMPONENT_TYPE) -public class CommandButton extends UICommand implements ClientBehaviorHolder, IHasTooltip, IAJAXComponent { +public class CommandButton extends CommandButtonCore implements ClientBehaviorHolder, IHasTooltip, IAJAXComponent, IAJAXComponent2 { /** *

@@ -86,7 +85,7 @@ public void setValueExpression(String name, ValueExpression binding) { * returns the subset of AJAX requests that are implemented by jQuery * callback or other non-standard means (such as the onclick event of * b:tabView, which has to be implemented manually). - * + * * @return */ public Map getJQueryEvents() { @@ -105,747 +104,5 @@ public String getDefaultEventName() { public String getFamily() { return COMPONENT_FAMILY; } - - @Override - public void decode(FacesContext context) { - // TODO Auto-generated method stub - super.decode(context); - } - - protected enum PropertyKeys { - accesskey, - ajax, - binding, - dir, - disabled, - icon, - iconAlign, - iconAwesome, - immediate, - lang, - look, - onblur, - onchange, - onclick, - oncomplete, - ondblclick, - onfocus, - onkeydown, - onkeypress, - onkeyup, - onmousedown, - onmousemove, - onmouseout, - onmouseover, - onmouseup, - onselect, - process, - size, - style, - styleClass, - tabindex, - title, - tooltip, - tooltipContainer, - tooltipDelay, - tooltipDelayHide, - tooltipDelayShow, - tooltipPosition, - type, - update -; - String toString; - - PropertyKeys(String toString) { - this.toString = toString; - } - - PropertyKeys() {} - - public String toString() { - return ((this.toString != null) ? this.toString : super.toString()); - } - } - - - /** - * Access key to transfer focus to the input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getAccesskey() { - return (String)getStateHelper().eval(PropertyKeys.accesskey); - } - - /** - * Access key to transfer focus to the input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setAccesskey(String _accesskey) { - getStateHelper().put(PropertyKeys.accesskey, _accesskey); - } - - - /** - * Whether the Button submits the form with AJAX.

- * @return Returns the value of the attribute, or null, 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.

- * 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.

- * @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.

- * Usually this method is called internally by the JSF engine. - */ - public void setBinding(javax.faces.component.UIComponent _binding) { - getStateHelper().put(PropertyKeys.binding, _binding); - } - - - /** - * Direction indication for text that does not inherit directionality. Legal values: ltr (Default. Left-to-right text direction), rtl (Right-to-left text direction) and auto (let the browser figure out the direction of your alphabet, based on the page content).

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getDir() { - return (String)getStateHelper().eval(PropertyKeys.dir); - } - - /** - * Direction indication for text that does not inherit directionality. Legal values: ltr (Default. Left-to-right text direction), rtl (Right-to-left text direction) and auto (let the browser figure out the direction of your alphabet, based on the page content).

- * Usually this method is called internally by the JSF engine. - */ - public void setDir(String _dir) { - getStateHelper().put(PropertyKeys.dir, _dir); - } - - - /** - * Boolean value to specify if the button is disabled.

- * @return Returns the value of the attribute, or null, 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.

- * Usually this method is called internally by the JSF engine. - */ - public void setDisabled(boolean _disabled) { - getStateHelper().put(PropertyKeys.disabled, _disabled); - } - - - /** - * Button Icon, can be one of the Bootstrap icon names. Alignment can be specified with icon-align attribute.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getIcon() { - return (String)getStateHelper().eval(PropertyKeys.icon); - } - - /** - * Button Icon, can be one of the Bootstrap icon names. Alignment can be specified with icon-align attribute.

- * Usually this method is called internally by the JSF engine. - */ - public void setIcon(String _icon) { - getStateHelper().put(PropertyKeys.icon, _icon); - } - - - /** - * Alignment can be right or left.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getIconAlign() { - return (String)getStateHelper().eval(PropertyKeys.iconAlign); - } - - /** - * Alignment can be right or left.

- * Usually this method is called internally by the JSF engine. - */ - public void setIconAlign(String _iconAlign) { - getStateHelper().put(PropertyKeys.iconAlign, _iconAlign); - } - - - /** - * Font Awesome Icon to show in this CommandButton, can be one of the Font Awesome icon names. Alignment can be specified with the icon-align attribute.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getIconAwesome() { - return (String)getStateHelper().eval(PropertyKeys.iconAwesome); - } - - /** - * Font Awesome Icon to show in this CommandButton, can be one of the Font Awesome icon names. Alignment can be specified with the icon-align attribute.

- * Usually this method is called internally by the JSF engine. - */ - public void setIconAwesome(String _iconAwesome) { - getStateHelper().put(PropertyKeys.iconAwesome, _iconAwesome); - } - - - /** - * Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase. Default is false.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public boolean isImmediate() { - return (boolean) (Boolean)getStateHelper().eval(PropertyKeys.immediate, false); - } - - /** - * Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase. Default is false.

- * Usually this method is called internally by the JSF engine. - */ - public void setImmediate(boolean _immediate) { - getStateHelper().put(PropertyKeys.immediate, _immediate); - } - - - /** - * Code describing the language used in the generated markup for this component.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getLang() { - return (String)getStateHelper().eval(PropertyKeys.lang); - } - - /** - * Code describing the language used in the generated markup for this component.

- * Usually this method is called internally by the JSF engine. - */ - public void setLang(String _lang) { - getStateHelper().put(PropertyKeys.lang, _lang); - } - - - /** - * Look of the Button, can be primary, block, info, success, warning, important, danger. If not specified, Standard gray button with gradient is rendered.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getLook() { - return (String)getStateHelper().eval(PropertyKeys.look); - } - - /** - * Look of the Button, can be primary, block, info, success, warning, important, danger. If not specified, Standard gray button with gradient is rendered.

- * Usually this method is called internally by the JSF engine. - */ - public void setLook(String _look) { - getStateHelper().put(PropertyKeys.look, _look); - } - - - /** - * Client side callback to execute when input element loses focus.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnblur() { - return (String)getStateHelper().eval(PropertyKeys.onblur); - } - - /** - * Client side callback to execute when input element loses focus.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnblur(String _onblur) { - getStateHelper().put(PropertyKeys.onblur, _onblur); - } - - - /** - * Client side callback to execute when input element loses focus and its value has been modified since gaining focus.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnchange() { - return (String)getStateHelper().eval(PropertyKeys.onchange); - } - - /** - * Client side callback to execute when input element loses focus and its value has been modified since gaining focus.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnchange(String _onchange) { - getStateHelper().put(PropertyKeys.onchange, _onchange); - } - - - /** - * The onclick attribute.

- * @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.

- * 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 with success.

- * @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 with success.

- * Usually this method is called internally by the JSF engine. - */ - public void setOncomplete(String _oncomplete) { - getStateHelper().put(PropertyKeys.oncomplete, _oncomplete); - } - - - /** - * Client side callback to execute when input element is double clicked.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOndblclick() { - return (String)getStateHelper().eval(PropertyKeys.ondblclick); - } - - /** - * Client side callback to execute when input element is double clicked.

- * Usually this method is called internally by the JSF engine. - */ - public void setOndblclick(String _ondblclick) { - getStateHelper().put(PropertyKeys.ondblclick, _ondblclick); - } - - - /** - * Client side callback to execute when input element receives focus.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnfocus() { - return (String)getStateHelper().eval(PropertyKeys.onfocus); - } - - /** - * Client side callback to execute when input element receives focus.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnfocus(String _onfocus) { - getStateHelper().put(PropertyKeys.onfocus, _onfocus); - } - - - /** - * Client side callback to execute when a key is pressed down over input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnkeydown() { - return (String)getStateHelper().eval(PropertyKeys.onkeydown); - } - - /** - * Client side callback to execute when a key is pressed down over input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnkeydown(String _onkeydown) { - getStateHelper().put(PropertyKeys.onkeydown, _onkeydown); - } - - - /** - * Client side callback to execute when a key is pressed and released over input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnkeypress() { - return (String)getStateHelper().eval(PropertyKeys.onkeypress); - } - - /** - * Client side callback to execute when a key is pressed and released over input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnkeypress(String _onkeypress) { - getStateHelper().put(PropertyKeys.onkeypress, _onkeypress); - } - - - /** - * Client side callback to execute when a key is released over input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnkeyup() { - return (String)getStateHelper().eval(PropertyKeys.onkeyup); - } - - /** - * Client side callback to execute when a key is released over input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnkeyup(String _onkeyup) { - getStateHelper().put(PropertyKeys.onkeyup, _onkeyup); - } - - - /** - * Client side callback to execute when a pointer input element is pressed down over input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnmousedown() { - return (String)getStateHelper().eval(PropertyKeys.onmousedown); - } - - /** - * Client side callback to execute when a pointer input element is pressed down over input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnmousedown(String _onmousedown) { - getStateHelper().put(PropertyKeys.onmousedown, _onmousedown); - } - - - /** - * Client side callback to execute when a pointer input element is moved within input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnmousemove() { - return (String)getStateHelper().eval(PropertyKeys.onmousemove); - } - - /** - * Client side callback to execute when a pointer input element is moved within input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnmousemove(String _onmousemove) { - getStateHelper().put(PropertyKeys.onmousemove, _onmousemove); - } - - - /** - * Client side callback to execute when a pointer input element is moved away from input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnmouseout() { - return (String)getStateHelper().eval(PropertyKeys.onmouseout); - } - - /** - * Client side callback to execute when a pointer input element is moved away from input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnmouseout(String _onmouseout) { - getStateHelper().put(PropertyKeys.onmouseout, _onmouseout); - } - - - /** - * Client side callback to execute when a pointer input element is moved onto input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnmouseover() { - return (String)getStateHelper().eval(PropertyKeys.onmouseover); - } - - /** - * Client side callback to execute when a pointer input element is moved onto input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnmouseover(String _onmouseover) { - getStateHelper().put(PropertyKeys.onmouseover, _onmouseover); - } - - - /** - * Client side callback to execute when a pointer input element is released over input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnmouseup() { - return (String)getStateHelper().eval(PropertyKeys.onmouseup); - } - - /** - * Client side callback to execute when a pointer input element is released over input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnmouseup(String _onmouseup) { - getStateHelper().put(PropertyKeys.onmouseup, _onmouseup); - } - - - /** - * Client side callback to execute when text within input element is selected by user.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getOnselect() { - return (String)getStateHelper().eval(PropertyKeys.onselect); - } - - /** - * Client side callback to execute when text within input element is selected by user.

- * Usually this method is called internally by the JSF engine. - */ - public void setOnselect(String _onselect) { - getStateHelper().put(PropertyKeys.onselect, _onselect); - } - - - /** - * Comma or space separated list of ids or search expressions denoting which values are to be sent to the server.

- * @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.

- * Usually this method is called internally by the JSF engine. - */ - public void setProcess(String _process) { - getStateHelper().put(PropertyKeys.process, _process); - } - - - /** - * Size of the Button, can be large, small, mini. If not specified, Standard size button is rendered.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getSize() { - return (String)getStateHelper().eval(PropertyKeys.size); - } - - /** - * Size of the Button, can be large, small, mini. If not specified, Standard size button is rendered.

- * Usually this method is called internally by the JSF engine. - */ - public void setSize(String _size) { - getStateHelper().put(PropertyKeys.size, _size); - } - - - /** - * Inline style of the input element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getStyle() { - return (String)getStateHelper().eval(PropertyKeys.style); - } - - /** - * Inline style of the input element.

- * Usually this method is called internally by the JSF engine. - */ - public void setStyle(String _style) { - getStateHelper().put(PropertyKeys.style, _style); - } - - - /** - * Style class of this element.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getStyleClass() { - return (String)getStateHelper().eval(PropertyKeys.styleClass); - } - - /** - * Style class of this element.

- * Usually this method is called internally by the JSF engine. - */ - public void setStyleClass(String _styleClass) { - getStateHelper().put(PropertyKeys.styleClass, _styleClass); - } - - - /** - * Position of this element in the tabbing order for the current document. This value must be an integer between 0 and 32767.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getTabindex() { - return (String)getStateHelper().eval(PropertyKeys.tabindex); - } - - /** - * Position of this element in the tabbing order for the current document. This value must be an integer between 0 and 32767.

- * Usually this method is called internally by the JSF engine. - */ - public void setTabindex(String _tabindex) { - getStateHelper().put(PropertyKeys.tabindex, _tabindex); - } - - - /** - * Advisory tooltip information.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getTitle() { - return (String)getStateHelper().eval(PropertyKeys.title); - } - - /** - * Advisory tooltip information.

- * Usually this method is called internally by the JSF engine. - */ - public void setTitle(String _title) { - getStateHelper().put(PropertyKeys.title, _title); - } - - - /** - * The text of the tooltip.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getTooltip() { - return (String)getStateHelper().eval(PropertyKeys.tooltip); - } - - /** - * The text of the tooltip.

- * Usually this method is called internally by the JSF engine. - */ - public void setTooltip(String _tooltip) { - getStateHelper().put(PropertyKeys.tooltip, _tooltip); - } - - - /** - * Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getTooltipContainer() { - return (String)getStateHelper().eval(PropertyKeys.tooltipContainer, "body"); - } - - /** - * Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body.

- * Usually this method is called internally by the JSF engine. - */ - public void setTooltipContainer(String _tooltipContainer) { - getStateHelper().put(PropertyKeys.tooltipContainer, _tooltipContainer); - } - - - /** - * The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public int getTooltipDelay() { - return (int) (Integer)getStateHelper().eval(PropertyKeys.tooltipDelay, 0); - } - - /** - * The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

- * Usually this method is called internally by the JSF engine. - */ - public void setTooltipDelay(int _tooltipDelay) { - getStateHelper().put(PropertyKeys.tooltipDelay, _tooltipDelay); - } - - - /** - * The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public int getTooltipDelayHide() { - return (int) (Integer)getStateHelper().eval(PropertyKeys.tooltipDelayHide, 0); - } - - /** - * The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

- * Usually this method is called internally by the JSF engine. - */ - public void setTooltipDelayHide(int _tooltipDelayHide) { - getStateHelper().put(PropertyKeys.tooltipDelayHide, _tooltipDelayHide); - } - - - /** - * The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public int getTooltipDelayShow() { - return (int) (Integer)getStateHelper().eval(PropertyKeys.tooltipDelayShow, 0); - } - - /** - * The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

- * Usually this method is called internally by the JSF engine. - */ - public void setTooltipDelayShow(int _tooltipDelayShow) { - getStateHelper().put(PropertyKeys.tooltipDelayShow, _tooltipDelayShow); - } - - - /** - * Where is the tooltip to be displayed? Possible values: "top", "bottom", "right", "left", "auto", "auto top", "auto bottom", "auto right" and "auto left". Default to "bottom".

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getTooltipPosition() { - return (String)getStateHelper().eval(PropertyKeys.tooltipPosition); - } - - /** - * Where is the tooltip to be displayed? Possible values: "top", "bottom", "right", "left", "auto", "auto top", "auto bottom", "auto right" and "auto left". Default to "bottom".

- * Usually this method is called internally by the JSF engine. - */ - public void setTooltipPosition(String _tooltipPosition) { - getStateHelper().put(PropertyKeys.tooltipPosition, _tooltipPosition); - } - - - /** - * The button type, can be submit, button, reset ; default submit.

- * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. - */ - public String getType() { - return (String)getStateHelper().eval(PropertyKeys.type); - } - - /** - * The button type, can be submit, button, reset ; default submit.

- * Usually this method is called internally by the JSF engine. - */ - public void setType(String _type) { - getStateHelper().put(PropertyKeys.type, _type); - } - - - /** - * Component(s) to be updated with ajax.

- * @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.

- * Usually this method is called internally by the JSF engine. - */ - public void setUpdate(String _update) { - getStateHelper().put(PropertyKeys.update, _update); - } - } diff --git a/src/main/java/net/bootsfaces/component/commandButton/CommandButtonCore.java b/src/main/java/net/bootsfaces/component/commandButton/CommandButtonCore.java new file mode 100644 index 000000000..92549fa02 --- /dev/null +++ b/src/main/java/net/bootsfaces/component/commandButton/CommandButtonCore.java @@ -0,0 +1,756 @@ +/** + * Copyright 2014-16 by Riccardo Massera (TheCoder4.Eu), Dario D'Urzo and Stephan Rauh (http://www.beyondjava.net). + * + * This file is part of BootsFaces. + * + * BootsFaces is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BootsFaces is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BootsFaces. If not, see . + */ + +package net.bootsfaces.component.commandButton; + +import javax.faces.component.UICommand; + +/** This class holds the attributes of <b:commandButton />. */ +public abstract class CommandButtonCore extends UICommand implements net.bootsfaces.render.IHasTooltip { + + protected enum PropertyKeys { + accesskey, + ajax, + binding, + dir, + disabled, + icon, + iconAlign, + iconAwesome, + immediate, + lang, + look, + onblur, + onchange, + onclick, + oncomplete, + ondblclick, + onerror, + onfocus, + onkeydown, + onkeypress, + onkeyup, + onmousedown, + onmousemove, + onmouseout, + onmouseover, + onmouseup, + onselect, + onsuccess, + process, + size, + style, + styleClass, + tabindex, + title, + tooltip, + tooltipContainer, + tooltipDelay, + tooltipDelayHide, + tooltipDelayShow, + tooltipPosition, + type, + update; + String toString; + + PropertyKeys(String toString) { + this.toString = toString; + } + + PropertyKeys() { + } + + public String toString() { + return ((this.toString != null) ? this.toString : super.toString()); + } + } + + /** + * Access key to transfer focus to the input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getAccesskey() { + return (String) getStateHelper().eval(PropertyKeys.accesskey); + } + + /** + * Access key to transfer focus to the input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setAccesskey(String _accesskey) { + getStateHelper().put(PropertyKeys.accesskey, _accesskey); + } + + /** + * Whether the Button submits the form with AJAX.

+ * @return Returns the value of the attribute, or null, 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.

+ * 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.

+ * @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.

+ * Usually this method is called internally by the JSF engine. + */ + public void setBinding(javax.faces.component.UIComponent _binding) { + getStateHelper().put(PropertyKeys.binding, _binding); + } + + /** + * Direction indication for text that does not inherit directionality. Legal values: ltr (Default. Left-to-right text direction), rtl (Right-to-left text direction) and auto (let the browser figure out the direction of your alphabet, based on the page content).

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getDir() { + return (String) getStateHelper().eval(PropertyKeys.dir); + } + + /** + * Direction indication for text that does not inherit directionality. Legal values: ltr (Default. Left-to-right text direction), rtl (Right-to-left text direction) and auto (let the browser figure out the direction of your alphabet, based on the page content).

+ * Usually this method is called internally by the JSF engine. + */ + public void setDir(String _dir) { + getStateHelper().put(PropertyKeys.dir, _dir); + } + + /** + * Boolean value to specify if the button is disabled.

+ * @return Returns the value of the attribute, or null, 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.

+ * Usually this method is called internally by the JSF engine. + */ + public void setDisabled(boolean _disabled) { + getStateHelper().put(PropertyKeys.disabled, _disabled); + } + + /** + * Button Icon, can be one of the Bootstrap icon names. Alignment can be specified with icon-align attribute.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getIcon() { + return (String) getStateHelper().eval(PropertyKeys.icon); + } + + /** + * Button Icon, can be one of the Bootstrap icon names. Alignment can be specified with icon-align attribute.

+ * Usually this method is called internally by the JSF engine. + */ + public void setIcon(String _icon) { + getStateHelper().put(PropertyKeys.icon, _icon); + } + + /** + * Alignment can be right or left.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getIconAlign() { + return (String) getStateHelper().eval(PropertyKeys.iconAlign); + } + + /** + * Alignment can be right or left.

+ * Usually this method is called internally by the JSF engine. + */ + public void setIconAlign(String _iconAlign) { + getStateHelper().put(PropertyKeys.iconAlign, _iconAlign); + } + + /** + * Font Awesome Icon to show in this CommandButton, can be one of the Font Awesome icon names. Alignment can be specified with the icon-align attribute.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getIconAwesome() { + return (String) getStateHelper().eval(PropertyKeys.iconAwesome); + } + + /** + * Font Awesome Icon to show in this CommandButton, can be one of the Font Awesome icon names. Alignment can be specified with the icon-align attribute.

+ * Usually this method is called internally by the JSF engine. + */ + public void setIconAwesome(String _iconAwesome) { + getStateHelper().put(PropertyKeys.iconAwesome, _iconAwesome); + } + + /** + * Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase. Default is false.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public boolean isImmediate() { + return (boolean) (Boolean) getStateHelper().eval(PropertyKeys.immediate, false); + } + + /** + * Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase. Default is false.

+ * Usually this method is called internally by the JSF engine. + */ + public void setImmediate(boolean _immediate) { + getStateHelper().put(PropertyKeys.immediate, _immediate); + } + + /** + * Code describing the language used in the generated markup for this component.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getLang() { + return (String) getStateHelper().eval(PropertyKeys.lang); + } + + /** + * Code describing the language used in the generated markup for this component.

+ * Usually this method is called internally by the JSF engine. + */ + public void setLang(String _lang) { + getStateHelper().put(PropertyKeys.lang, _lang); + } + + /** + * Look of the Button, can be primary, block, info, success, warning, important, danger. If not specified, Standard gray button with gradient is rendered.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getLook() { + return (String) getStateHelper().eval(PropertyKeys.look); + } + + /** + * Look of the Button, can be primary, block, info, success, warning, important, danger. If not specified, Standard gray button with gradient is rendered.

+ * Usually this method is called internally by the JSF engine. + */ + public void setLook(String _look) { + getStateHelper().put(PropertyKeys.look, _look); + } + + /** + * Client side callback to execute when input element loses focus.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnblur() { + return (String) getStateHelper().eval(PropertyKeys.onblur); + } + + /** + * Client side callback to execute when input element loses focus.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnblur(String _onblur) { + getStateHelper().put(PropertyKeys.onblur, _onblur); + } + + /** + * Client side callback to execute when input element loses focus and its value has been modified since gaining focus.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnchange() { + return (String) getStateHelper().eval(PropertyKeys.onchange); + } + + /** + * Client side callback to execute when input element loses focus and its value has been modified since gaining focus.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnchange(String _onchange) { + getStateHelper().put(PropertyKeys.onchange, _onchange); + } + + /** + * The onclick attribute.

+ * @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.

+ * 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.

+ * @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.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOncomplete(String _oncomplete) { + getStateHelper().put(PropertyKeys.oncomplete, _oncomplete); + } + + /** + * Client side callback to execute when input element is double clicked.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOndblclick() { + return (String) getStateHelper().eval(PropertyKeys.ondblclick); + } + + /** + * Client side callback to execute when input element is double clicked.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOndblclick(String _ondblclick) { + getStateHelper().put(PropertyKeys.ondblclick, _ondblclick); + } + + /** + * JavaScript to be executed when ajax results on an error (including both network errors and Java exceptions).

+ * @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).

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnerror(String _onerror) { + getStateHelper().put(PropertyKeys.onerror, _onerror); + } + + /** + * Client side callback to execute when input element receives focus.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnfocus() { + return (String) getStateHelper().eval(PropertyKeys.onfocus); + } + + /** + * Client side callback to execute when input element receives focus.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnfocus(String _onfocus) { + getStateHelper().put(PropertyKeys.onfocus, _onfocus); + } + + /** + * Client side callback to execute when a key is pressed down over input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnkeydown() { + return (String) getStateHelper().eval(PropertyKeys.onkeydown); + } + + /** + * Client side callback to execute when a key is pressed down over input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnkeydown(String _onkeydown) { + getStateHelper().put(PropertyKeys.onkeydown, _onkeydown); + } + + /** + * Client side callback to execute when a key is pressed and released over input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnkeypress() { + return (String) getStateHelper().eval(PropertyKeys.onkeypress); + } + + /** + * Client side callback to execute when a key is pressed and released over input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnkeypress(String _onkeypress) { + getStateHelper().put(PropertyKeys.onkeypress, _onkeypress); + } + + /** + * Client side callback to execute when a key is released over input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnkeyup() { + return (String) getStateHelper().eval(PropertyKeys.onkeyup); + } + + /** + * Client side callback to execute when a key is released over input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnkeyup(String _onkeyup) { + getStateHelper().put(PropertyKeys.onkeyup, _onkeyup); + } + + /** + * Client side callback to execute when a pointer input element is pressed down over input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnmousedown() { + return (String) getStateHelper().eval(PropertyKeys.onmousedown); + } + + /** + * Client side callback to execute when a pointer input element is pressed down over input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnmousedown(String _onmousedown) { + getStateHelper().put(PropertyKeys.onmousedown, _onmousedown); + } + + /** + * Client side callback to execute when a pointer input element is moved within input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnmousemove() { + return (String) getStateHelper().eval(PropertyKeys.onmousemove); + } + + /** + * Client side callback to execute when a pointer input element is moved within input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnmousemove(String _onmousemove) { + getStateHelper().put(PropertyKeys.onmousemove, _onmousemove); + } + + /** + * Client side callback to execute when a pointer input element is moved away from input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnmouseout() { + return (String) getStateHelper().eval(PropertyKeys.onmouseout); + } + + /** + * Client side callback to execute when a pointer input element is moved away from input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnmouseout(String _onmouseout) { + getStateHelper().put(PropertyKeys.onmouseout, _onmouseout); + } + + /** + * Client side callback to execute when a pointer input element is moved onto input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnmouseover() { + return (String) getStateHelper().eval(PropertyKeys.onmouseover); + } + + /** + * Client side callback to execute when a pointer input element is moved onto input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnmouseover(String _onmouseover) { + getStateHelper().put(PropertyKeys.onmouseover, _onmouseover); + } + + /** + * Client side callback to execute when a pointer input element is released over input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnmouseup() { + return (String) getStateHelper().eval(PropertyKeys.onmouseup); + } + + /** + * Client side callback to execute when a pointer input element is released over input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnmouseup(String _onmouseup) { + getStateHelper().put(PropertyKeys.onmouseup, _onmouseup); + } + + /** + * Client side callback to execute when text within input element is selected by user.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getOnselect() { + return (String) getStateHelper().eval(PropertyKeys.onselect); + } + + /** + * Client side callback to execute when text within input element is selected by user.

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnselect(String _onselect) { + getStateHelper().put(PropertyKeys.onselect, _onselect); + } + + /** + * JavaScript to be executed when ajax completes with success (i.e. there's neither a network error nor a Java exception).

+ * @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).

+ * Usually this method is called internally by the JSF engine. + */ + public void setOnsuccess(String _onsuccess) { + getStateHelper().put(PropertyKeys.onsuccess, _onsuccess); + } + + /** + * Comma or space separated list of ids or search expressions denoting which values are to be sent to the server.

+ * @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.

+ * Usually this method is called internally by the JSF engine. + */ + public void setProcess(String _process) { + getStateHelper().put(PropertyKeys.process, _process); + } + + /** + * Size of the Button, can be large, small, mini. If not specified, Standard size button is rendered.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getSize() { + return (String) getStateHelper().eval(PropertyKeys.size); + } + + /** + * Size of the Button, can be large, small, mini. If not specified, Standard size button is rendered.

+ * Usually this method is called internally by the JSF engine. + */ + public void setSize(String _size) { + getStateHelper().put(PropertyKeys.size, _size); + } + + /** + * Inline style of the input element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getStyle() { + return (String) getStateHelper().eval(PropertyKeys.style); + } + + /** + * Inline style of the input element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setStyle(String _style) { + getStateHelper().put(PropertyKeys.style, _style); + } + + /** + * Style class of this element.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getStyleClass() { + return (String) getStateHelper().eval(PropertyKeys.styleClass); + } + + /** + * Style class of this element.

+ * Usually this method is called internally by the JSF engine. + */ + public void setStyleClass(String _styleClass) { + getStateHelper().put(PropertyKeys.styleClass, _styleClass); + } + + /** + * Position of this element in the tabbing order for the current document. This value must be an integer between 0 and 32767.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getTabindex() { + return (String) getStateHelper().eval(PropertyKeys.tabindex); + } + + /** + * Position of this element in the tabbing order for the current document. This value must be an integer between 0 and 32767.

+ * Usually this method is called internally by the JSF engine. + */ + public void setTabindex(String _tabindex) { + getStateHelper().put(PropertyKeys.tabindex, _tabindex); + } + + /** + * Advisory tooltip information.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getTitle() { + return (String) getStateHelper().eval(PropertyKeys.title); + } + + /** + * Advisory tooltip information.

+ * Usually this method is called internally by the JSF engine. + */ + public void setTitle(String _title) { + getStateHelper().put(PropertyKeys.title, _title); + } + + /** + * The text of the tooltip.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getTooltip() { + return (String) getStateHelper().eval(PropertyKeys.tooltip); + } + + /** + * The text of the tooltip.

+ * Usually this method is called internally by the JSF engine. + */ + public void setTooltip(String _tooltip) { + getStateHelper().put(PropertyKeys.tooltip, _tooltip); + } + + /** + * Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getTooltipContainer() { + return (String) getStateHelper().eval(PropertyKeys.tooltipContainer, "body"); + } + + /** + * Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body.

+ * Usually this method is called internally by the JSF engine. + */ + public void setTooltipContainer(String _tooltipContainer) { + getStateHelper().put(PropertyKeys.tooltipContainer, _tooltipContainer); + } + + /** + * The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public int getTooltipDelay() { + return (int) (Integer) getStateHelper().eval(PropertyKeys.tooltipDelay, 0); + } + + /** + * The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

+ * Usually this method is called internally by the JSF engine. + */ + public void setTooltipDelay(int _tooltipDelay) { + getStateHelper().put(PropertyKeys.tooltipDelay, _tooltipDelay); + } + + /** + * The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public int getTooltipDelayHide() { + return (int) (Integer) getStateHelper().eval(PropertyKeys.tooltipDelayHide, 0); + } + + /** + * The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

+ * Usually this method is called internally by the JSF engine. + */ + public void setTooltipDelayHide(int _tooltipDelayHide) { + getStateHelper().put(PropertyKeys.tooltipDelayHide, _tooltipDelayHide); + } + + /** + * The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public int getTooltipDelayShow() { + return (int) (Integer) getStateHelper().eval(PropertyKeys.tooltipDelayShow, 0); + } + + /** + * The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

+ * Usually this method is called internally by the JSF engine. + */ + public void setTooltipDelayShow(int _tooltipDelayShow) { + getStateHelper().put(PropertyKeys.tooltipDelayShow, _tooltipDelayShow); + } + + /** + * Where is the tooltip to be displayed? Possible values: "top", "bottom", "right", "left", "auto", "auto top", "auto bottom", "auto right" and "auto left". Default to "bottom".

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getTooltipPosition() { + return (String) getStateHelper().eval(PropertyKeys.tooltipPosition); + } + + /** + * Where is the tooltip to be displayed? Possible values: "top", "bottom", "right", "left", "auto", "auto top", "auto bottom", "auto right" and "auto left". Default to "bottom".

+ * Usually this method is called internally by the JSF engine. + */ + public void setTooltipPosition(String _tooltipPosition) { + getStateHelper().put(PropertyKeys.tooltipPosition, _tooltipPosition); + } + + /** + * The button type, can be submit, button, reset ; default submit.

+ * @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. + */ + public String getType() { + return (String) getStateHelper().eval(PropertyKeys.type); + } + + /** + * The button type, can be submit, button, reset ; default submit.

+ * Usually this method is called internally by the JSF engine. + */ + public void setType(String _type) { + getStateHelper().put(PropertyKeys.type, _type); + } + + /** + * Component(s) to be updated with ajax.

+ * @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.

+ * Usually this method is called internally by the JSF engine. + */ + public void setUpdate(String _update) { + getStateHelper().put(PropertyKeys.update, _update); + } + +} diff --git a/src/main/java/net/bootsfaces/component/dataTable/DataTableRenderer.java b/src/main/java/net/bootsfaces/component/dataTable/DataTableRenderer.java index c1d4a4638..0347fb823 100644 --- a/src/main/java/net/bootsfaces/component/dataTable/DataTableRenderer.java +++ b/src/main/java/net/bootsfaces/component/dataTable/DataTableRenderer.java @@ -329,21 +329,21 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce rw.writeText(widgetVar +".on('page.dt', function(event, settings, len){" + "var info = table.page.info();" + "try {" + - " BsF.ajax.callAjax(this, event, null, null, null, " + + " BsF.ajax.callAjax(this, event, null, null, null, null, null," + "'" + DataTablePropertyType.currentPage + ":'+info.page);" + "} catch(e) { console.warn(workInProgressErrorMessage, e); }" + "});", null); //# Event setup: https://datatables.net/reference/event/length rw.writeText(widgetVar +".on('length.dt', function(event, settings, len) {" + "try {" + - " BsF.ajax.callAjax(this, event, null, null, null, " + + " BsF.ajax.callAjax(this, event, null, null, null, null, null," + "'" + DataTablePropertyType.pageLength + ":'+len);" + "} catch(e) { console.warn(workInProgressErrorMessage, e); }" + "});", null); //# Event setup: https://datatables.net/reference/event/search rw.writeText(widgetVar +".on('search.dt', function(event, settings, len) {" + "try {" + - " BsF.ajax.callAjax(this, event, null, null, null, " + + " BsF.ajax.callAjax(this, event, null, null, null, null, null," + "'" + DataTablePropertyType.searchTerm + ":'+table.search());" + "} catch(e) { console.warn(workInProgressErrorMessage, e); }" + "});", null); diff --git a/src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java b/src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java index d911a4e23..5b0d413b4 100644 --- a/src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java +++ b/src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java @@ -1,8 +1,8 @@ /** * Copyright 2014-15 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net). - * + * * This file is part of BootsFaces. - * + * * BootsFaces is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -37,7 +37,7 @@ /** This class generates the HTML code of <b:scrollSpy />. */ @FacesRenderer(componentFamily = "net.bootsfaces.component", rendererType = "net.bootsfaces.component.scrollSpy.ScrollSpy") public class ScrollSpyRenderer extends CoreRenderer { - + /** * Decode ajax behaviours specific to the components */ @@ -67,13 +67,13 @@ public void decode(FacesContext context, UIComponent component) { } } } - + /** * This methods generates the HTML code of the current b:scrollSpy. * @param context the FacesContext. * @param component the current b:scrollSpy. * @throws IOException thrown if something goes wrong when writing the HTML code. - */ + */ @Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { // do nothing @@ -87,22 +87,22 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce ScrollSpy scrollSpy = (ScrollSpy) component; ResponseWriter rw = context.getResponseWriter(); String clientId = scrollSpy.getClientId(); - + // Get attributes String container = scrollSpy.getContainer(); if(!BsfUtils.isStringValued(container)) { container = "body"; } else container = "#" + decodeAndEscapeSelectors(context, component, container); - + String target = scrollSpy.getTarget(); if(!BsfUtils.isStringValued(target)) { target = ".navbar"; } else target = "#" + decodeAndEscapeSelectors(context, component, target); - + int offset = scrollSpy.getOffset(); if(!BsfUtils.isStringValued(target)) { offset = 20; - } + } boolean smooth = scrollSpy.isSmooth(); int smoothSpeed = scrollSpy.getSmoothSpeed(); boolean hasListeners = (scrollSpy.getSelectionListener() != null); @@ -117,7 +117,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce throw new FacesException("The scrollspy component must be inside a form if an actionlistener is defined", null); } } - + rw.startElement("script", component); rw.writeText("" + "$(document).ready(function() { " + @@ -128,29 +128,29 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce " var hash = this.hash; " + " $('" + ("body".equals(container) ? "html, body": container) + "').animate({ " + " scrollTop: $(hash).parent().scrollTop() + $(hash).offset().top - $(hash).parent().offset().top " + - " }, { " + - " duration: " + smoothSpeed + ", " + - " specialEasing: { " + - " width: 'linear', " + - " height: 'easeOutBounce' " + + " }, { " + + " duration: " + smoothSpeed + ", " + + " specialEasing: { " + + " width: 'linear', " + + " height: 'easeOutBounce' " + " } "+ " }); " + " event.preventDefault(); " + "}); ", null); } - + if(hasListeners) { - rw.writeText("" + - "$('" + target + "').on('activate.bs.scrollspy', function() { " + + rw.writeText("" + + "$('" + target + "').on('activate.bs.scrollspy', function() { " + " var x = $('" + target + " li.active > a').text(); " + - " BsF.ajax.callAjax(this, 'action', '" + updateItems + "', '" + clientId + "', null, 'itemSelected:' + x); " + + " BsF.ajax.callAjax(this, 'action', '" + updateItems + "', '" + clientId + "', null, null, null, 'itemSelected:' + x); " + "}); ", null); } - + rw.writeText("});", null); rw.endElement("script"); } - + /** * Decode and escape selectors if necessary * @param context @@ -161,7 +161,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce private String decodeAndEscapeSelectors(FacesContext context, UIComponent component, String selector) { selector = ExpressionResolver.getComponentIDs(context, component, selector); selector = BsfUtils.escapeJQuerySpecialCharsInSelector(selector); - + return selector; } } diff --git a/src/main/java/net/bootsfaces/component/tree/TreeRenderer.java b/src/main/java/net/bootsfaces/component/tree/TreeRenderer.java index b9e138643..ec524c8ba 100644 --- a/src/main/java/net/bootsfaces/component/tree/TreeRenderer.java +++ b/src/main/java/net/bootsfaces/component/tree/TreeRenderer.java @@ -1,8 +1,8 @@ /** * Copyright 2014-2016 Dario D'Urzo - * + * * This file is part of BootsFaces. - * + * * BootsFaces is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -41,7 +41,7 @@ /** This class provide the rendering logic of the <b:tree />. */ @FacesRenderer(componentFamily = C.BSFCOMPONENT, rendererType = "net.bootsfaces.component.tree.Tree") public class TreeRenderer extends CoreRenderer { - + /** * Decode ajax behaviours specific to the components */ @@ -65,7 +65,7 @@ public void decode(FacesContext context, UIComponent component) { Node n = TreeModelUtils.mapDataToModel(value); TreeModelUtils.updateNodeById(tree.getValue(), n.getNodeId(), n); // tree.setSubmittedValue(tree.getValue()); - + // execute listener only for listened events if ("nodeSelected".equals(key)) { Node n2 = checkNodeIsSelected(tree.getValue(), tree); @@ -110,7 +110,7 @@ public void encodeBegin(FacesContext context, UIComponent component) throws IOEx Tree tree = (Tree) component; ResponseWriter rw = context.getResponseWriter(); String clientId = tree.getClientId(); - + // check is inside form (MyFaces requires to be) final UIForm form = BsfUtils.getClosestForm(tree); if(form == null) { @@ -132,7 +132,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce String clientId = tree.getClientId(); String jqClientId = BsfUtils.escapeJQuerySpecialCharsInSelector(clientId); ResponseWriter rw = context.getResponseWriter(); - + final UIForm form = BsfUtils.getClosestForm(tree); if(form == null) { throw new FacesException("The tree component must be inside a form", null); @@ -149,7 +149,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce rw.writeText("function getTreeData() { " + " return '" + TreeModelUtils.renderModelAsJson(tree.getValue(), tree.isRenderRoot()) + "'; " + "} " + - + // build tree structure "$('#tree_" + jqClientId + "').treeview({ " + (tree.isShowTags() ? "showTags: true," : "") + @@ -163,30 +163,30 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce (BsfUtils.isStringValued(tree.getHoverColor()) ? "onhoverColor: '" + tree.getHoverColor() + "'," : "") + (BsfUtils.isStringValued(tree.getSelectedColor()) ? "selectedColor: '" + tree.getSelectedColor() + "'," : "") + (BsfUtils.isStringValued(tree.getBorderColor()) ? "borderColor: '" + tree.getBorderColor() + "'," : "") + - " data: getTreeData(), " + + " data: getTreeData(), " + // enable nodeSelected event callback " onNodeSelected: function(event, data) { " + - " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, 'nodeSelected:' + treeDataMapper(data));" + // @all + " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, null, null, 'nodeSelected:' + treeDataMapper(data));" + // @all " }," + // enable nodeUnselected event callback " onNodeUnselected: function(event, data) { " + - " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, 'nodeUnselected:' + treeDataMapper(data));" + // @all + " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, null, null, 'nodeUnselected:' + treeDataMapper(data));" + // @all " }," + //enable nodeChecked event callback " onNodeChecked: function(event, data) { " + - " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, 'nodeChecked:' + treeDataMapper(data));" + // @all + " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, null, null, 'nodeChecked:' + treeDataMapper(data));" + // @all " }," + //enable nodeUnchecked event callback " onNodeUnchecked: function(event, data) { " + - " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, 'nodeUnchecked:' + treeDataMapper(data));" + // @all + " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, null, null, 'nodeUnchecked:' + treeDataMapper(data));" + // @all " }," + // enable nodeCollapsed event callback " onNodeCollapsed: function(event, data) { " + - " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, 'nodeCollapsed:' + treeDataMapper(data));" + // @all + " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, null, null, 'nodeCollapsed:' + treeDataMapper(data));" + // @all " }," + // enable nodeExpanded event callback " onNodeExpanded: function(event, data) { " + - " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, 'nodeExpanded:' + treeDataMapper(data));" + // @all + " BsF.ajax.callAjax(this, event, '" + updateItems + "', '" + clientId + "', null, null, null, 'nodeExpanded:' + treeDataMapper(data));" + // @all " }" + "}); ", null); rw.writeText("});", null); diff --git a/src/main/meta/META-INF/bootsfaces-b.taglib.xml b/src/main/meta/META-INF/bootsfaces-b.taglib.xml index 5028f8b29..8fa924d9d 100644 --- a/src/main/meta/META-INF/bootsfaces-b.taglib.xml +++ b/src/main/meta/META-INF/bootsfaces-b.taglib.xml @@ -2841,7 +2841,7 @@ java.lang.String - + oncomplete false java.lang.String @@ -2852,6 +2852,12 @@ false java.lang.String + + + onerror + false + java.lang.String + onfocus @@ -2912,6 +2918,12 @@ false java.lang.String + + + onsuccess + false + java.lang.String + process diff --git a/xtext/BootsFaces.jsfdsl b/xtext/BootsFaces.jsfdsl index bd9fe7f75..f14150878 100644 --- a/xtext/BootsFaces.jsfdsl +++ b/xtext/BootsFaces.jsfdsl @@ -1,10 +1,18 @@ +attribute_list ajax { + oncomplete "JavaScript to be executed when ajax completes." + onerror "JavaScript to be executed when ajax results on an error (including both network errors and Java exceptions)." + onsuccess "JavaScript to be executed when ajax completes with success (i.e. there's neither a network error nor a Java exception)." + process "Comma or space separated list of ids or search expressions denoting which values are to be sent to the server." + update "Component(s) to be updated with ajax." +} + attribute_list tooltip { tooltip "The text of the tooltip." - tooltip-container default "body" "Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body." - tooltip-delay Integer "The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay)." - tooltip-delay-hide Integer "The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay)." - tooltip-delay-show Integer "The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay)." - tooltip-position "Where is the tooltip to be displayed? Possible values: \"top\", \"bottom\", \"right\", \"left\", \"auto\", \"auto top\", \"auto bottom\", \"auto right\" and \"auto left\". Default to \"bottom\"." + tooltip-container default "body" "Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body." + tooltip-delay Integer "The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay)." + tooltip-delay-hide Integer "The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay)." + tooltip-delay-show Integer "The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay)." + tooltip-position "Where is the tooltip to be displayed? Possible values: \"top\", \"bottom\", \"right\", \"left\", \"auto\", \"auto top\", \"auto bottom\", \"auto right\" and \"auto left\". Default to \"bottom\"." } attribute_list responsive { @@ -458,7 +466,6 @@ widget commandButton onblur "Client side callback to execute when input element loses focus." onchange "Client side callback to execute when input element loses focus and its value has been modified since gaining focus." onclick "The onclick attribute." - oncomplete "JavaScript to be executed when ajax completes with success." ondblclick "Client side callback to execute when input element is double clicked." onfocus "Client side callback to execute when input element receives focus." onkeydown "Client side callback to execute when a key is pressed down over input element." @@ -470,7 +477,6 @@ widget commandButton onmouseover "Client side callback to execute when a pointer input element is moved onto input element." onmouseup "Client side callback to execute when a pointer input element is released over input element." onselect "Client side callback to execute when text within input element is selected by user." - process "Comma or space separated list of ids or search expressions denoting which values are to be sent to the server." rendered Boolean inherited "Boolean value to specify the rendering of the component, when set to false the component will not be rendered." size "Size of the Button, can be large, small, mini. If not specified, Standard size button is rendered." style "Inline style of the input element." @@ -484,8 +490,8 @@ widget commandButton tooltip-delay-show Integer "The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay)." tooltip-position "Where is the tooltip to be displayed? Possible values: \"top\", \"bottom\", \"right\", \"left\", \"auto\", \"auto top\", \"auto bottom\", \"auto right\" and \"auto left\". Default to \"bottom\"." type "The button type, can be submit, button, reset ; default submit." - update "Component(s) to be updated with ajax." value mandatory inherited "Button text." + +ajax }