wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/attribute/event/AbstractEventAttribute.java
public void setServerAsyncMethod(final String jsPreFunctionBody,
            final ServerAsyncMethod serverAsyncMethod,
            final String jsFilterFunctionBody, final String jsPostFunctionBody,
            final Object serverSideData) {

        this.serverSideData = serverSideData;

        if (serverAsyncMethod != null) {

            if (jsPreFunctionBody != null && jsPostFunctionBody != null
                    && jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithPreFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsPreFunctionBody))
                                .append(',')
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());

            } else if (jsPreFunctionBody != null
                    && jsPostFunctionBody != null) {

                super.setAttributeValue(new StringBuilder(invokeAsyncWithPreFun)
                        .append("(event, this,'").append(getAttributeName())
                        .append("',")
                        .append(getPreparedJsFunctionBody(jsPreFunctionBody))
                        .append(')').toString());

            } else if (jsPreFunctionBody != null
                    && jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithPreFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsPreFunctionBody))
                                .append(',')
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());

            } else if (jsPostFunctionBody != null
                    && jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());

            } else if (jsPreFunctionBody != null) {

                super.setAttributeValue(new StringBuilder(invokeAsyncWithPreFun)
                        .append("(event, this,'").append(getAttributeName())
                        .append("',")
                        .append(getPreparedJsFunctionBody(jsPreFunctionBody))
                        .append(')').toString());

            } else if (jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());
            } else if (jsPostFunctionBody != null) {
                super.setAttributeValue(new StringBuilder(invokeAsync)
                        .append("(event, this,'").append(getAttributeName())
                        .append("')").toString());
            } else {

                super.setAttributeValue(new StringBuilder(invokeAsync)
                        .append("(event, this,'").append(getAttributeName())
                        .append("')").toString());
            }

            this.jsPreFunctionBody = jsPreFunctionBody;
            this.jsFilterFunctionBody = jsFilterFunctionBody;
            this.jsPostFunctionBody = jsPostFunctionBody;
            this.serverAsyncMethod = serverAsyncMethod;
        } else {
            LOGGER.warning(
                    "serverAsyncMethod is null so jsPreFunctionBody, jsFilterFunctionBody and jsPostFunctionBody are not also set.They are valid only if serverAsyncMethod is NOT null.");
        }
    }
public void setServerAsyncMethod(final String jsPreFunctionBody,
            final ServerAsyncMethod serverAsyncMethod,
            final String jsFilterFunctionBody, final String jsPostFunctionBody,
            final Object serverSideData) {

        this.serverSideData = serverSideData;

        if (serverAsyncMethod != null) {

            if (jsPreFunctionBody != null && jsPostFunctionBody != null
                    && jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithPreFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsPreFunctionBody))
                                .append(',')
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());

            } else if (jsPreFunctionBody != null
                    && jsPostFunctionBody != null) {

                super.setAttributeValue(new StringBuilder(invokeAsyncWithPreFun)
                        .append("(event, this,'").append(getAttributeName())
                        .append("',")
                        .append(getPreparedJsFunctionBody(jsPreFunctionBody))
                        .append(')').toString());

            } else if (jsPreFunctionBody != null
                    && jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithPreFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsPreFunctionBody))
                                .append(',')
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());

            } else if (jsPostFunctionBody != null
                    && jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());

            } else if (jsPreFunctionBody != null) {

                super.setAttributeValue(new StringBuilder(invokeAsyncWithPreFun)
                        .append("(event, this,'").append(getAttributeName())
                        .append("',")
                        .append(getPreparedJsFunctionBody(jsPreFunctionBody))
                        .append(')').toString());

            } else if (jsFilterFunctionBody != null) {

                super.setAttributeValue(
                        new StringBuilder(invokeAsyncWithFilterFun)
                                .append("(event, this,'")
                                .append(getAttributeName()).append("',")
                                .append(getPreparedJsFunctionBody(
                                        jsFilterFunctionBody))
                                .append(')').toString());
            } else if (jsPostFunctionBody != null) {
                super.setAttributeValue(new StringBuilder(invokeAsync)
                        .append("(event, this,'").append(getAttributeName())
                        .append("')").toString());
            } else {

                super.setAttributeValue(new StringBuilder(invokeAsync)
                        .append("(event, this,'").append(getAttributeName())
                        .append("')").toString());
            }

            this.jsPreFunctionBody = jsPreFunctionBody;
            this.jsFilterFunctionBody = jsFilterFunctionBody;
            this.jsPostFunctionBody = jsPostFunctionBody;
            this.serverAsyncMethod = serverAsyncMethod;
        } else {
            LOGGER.warning(
                    "serverAsyncMethod is null so jsPreFunctionBody, jsFilterFunctionBody and jsPostFunctionBody are not also set.They are valid only if serverAsyncMethod is NOT null.");
        }
    }
@param jsPreFunctionBody
the body part javascript function
(without function declaration). It must
return true/false. This function will
invoke at client side before
{@code serverAsyncMethod}. If the
jsPrefunction returns true then only
{@code serverAsyncMethod} method will
invoke (if it is implemented). It has
implicit objects like {@code event} and
{@code source} which gives the reference
of the current tag. <br>
Eg:-

<pre>
if (source.type == 'button') {
return true;
}
return false;
</pre>

@param serverAsyncMethod
This method will invoke at server side
with an argument {@code wffBMObject}. The
{@code wffBMObject} is the
representational javascript object
returned by {@code jsFilterFunctionBody}.

@param jsFilterFunctionBody
The body part of a javascript function
(without function declaration). It can
return a javascript object so that it
will be available at server side in
{@code serverAsyncMethod} as
{@code wffBMObject} parameter. There are
implicit objects {@code event} and
{@code source} in the scope.<br>
Eg:-

<pre>
var bName = source.name;
return {buttonName: bName, author:'wff', dateOfYear: 2014};
</pre>

@param jsPostFunctionBody
The body part of a javascript function
(without function declaration). The
{@code wffBMObject} returned by
{@code serverAsyncMethod} will be
available as an implicit object
{@code jsObject} in the scope. There are
common implicit objects {@code event} and
{@code source} in the scope.
@param serverSideData
this data will be available in the Event
object of ServerAsyncMethod.asyncMethod
method.
@since 3.0.2
@author WFF