Class AbstractEventAttribute

All Implemented Interfaces:
TagBase, EventAttribute, Serializable, Cloneable
Direct Known Subclasses:
AnimationEnd, AnimationIteration, AnimationStart, CustomEventAttribute, OnAbort, OnAfterPrint, OnBeforePrint, OnBeforeUnload, OnBlur, OnCanPlay, OnCanPlayThrough, OnChange, OnClick, OnContextMenu, OnCopy, OnCut, OnDblClick, OnDrag, OnDragEnd, OnDragEnter, OnDragLeave, OnDragOver, OnDragStart, OnDrop, OnDurationChange, OnEmptied, OnEnded, OnError, OnFocus, OnFocusIn, OnFocusOut, OnHashChange, OnInput, OnInvalid, OnKeyDown, OnKeyPress, OnKeyUp, OnLoad, OnLoadedData, OnLoadedMetaData, OnLoadStart, OnMouseDown, OnMouseEnter, OnMouseLeave, OnMouseMove, OnMouseOut, OnMouseOver, OnMouseUp, OnOffline, OnOnline, OnPageHide, OnPageShow, OnPaste, OnPause, OnPlay, OnPlaying, OnPopState, OnProgress, OnRateChange, OnReset, OnResize, OnScroll, OnSearch, OnSeeked, OnSeeking, OnSelect, OnShow, OnStalled, OnStorage, OnSubmit, OnSuspend, OnTimeUpdate, OnToggle, OnTouchCancel, OnTouchEnd, OnTouchMove, OnTouchStart, OnUnload, OnVolumeChange, OnWaiting, OnWheel, TransitionEnd

public abstract class AbstractEventAttribute extends AbstractAttribute implements EventAttribute
All event attributes will be extend by this class. It contains some common features which all event attribute classes want.
Since:
2.0.0
See Also:
  • Constructor Details

    • AbstractEventAttribute

      protected AbstractEventAttribute()
    • AbstractEventAttribute

      protected AbstractEventAttribute(String attributeName, String value)
      Parameters:
      value - the value for the attribute
      Since:
      2.0.0
    • AbstractEventAttribute

      protected AbstractEventAttribute(String attributeName, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody)
      Parameters:
      attributeName - the name of the attribute
      jsPreFunctionBody - It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side before serverAsyncMethod. If the jsPrefunction returns true then only serverAsyncMethod method will invoke (if it is implemented). It has implicit objects in its scope. They are event, source which gives the reference of the current tag and action. The action implicit object has a function named perform() which can be used to invoke jsFilterFunctionBody and serverAsyncMethod (it works just like returning true in the jsPreFunctionBody). If the action.perform() is called inside jsPreFunctionBody then returning true in it has no effect. The action implicit object is only available since 3.0.15.
      Eg:-
                                    if (source.type == 'button') {
                                        return true;
                                    }
                                    return false;
                                   

      NB: calling action.perform() inside jsFilterFunctionBody and jsPostFunctionBody of the same event attribute will be harmful as it will make an infinite recursive call.
      serverAsyncMethod - This method will invoke at server side with an argument wffBMObject. The wffBMObject is the representational javascript object returned by jsFilterFunctionBody.
      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 serverAsyncMethod as wffBMObject parameter. There are implicit objects event and source in the scope.
      Eg:-
                                                                                                      var bName = source.name;
                                                                                                      return {buttonName: bName, author:'wff', dateOfYear: 2014};
                                   
      jsPostFunctionBody - The body part of a javascript function (without function declaration). The wffBMObject returned by serverAsyncMethod will be available as an implicit object jsObject in the scope. There are common implicit objects event and source in the scope.
      Since:
      2.0.0
    • AbstractEventAttribute

      protected AbstractEventAttribute(String attributeName, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData)
      Parameters:
      attributeName - the name of the attribute
      jsPreFunctionBody - It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side before serverAsyncMethod. If the jsPrefunction returns true then only serverAsyncMethod method will invoke (if it is implemented). It has implicit objects in its scope. They are event, source which gives the reference of the current tag and action. The action implicit object has a function named perform() which can be used to invoke jsFilterFunctionBody and serverAsyncMethod (it works just like returning true in the jsPreFunctionBody). If the action.perform() is called inside jsPreFunctionBody then returning true in it has no effect. The action implicit object is only available since 3.0.15.
      Eg:-
                                    if (source.type == 'button') {
                                        return true;
                                    }
                                    return false;
                                   

      NB: calling action.perform() inside jsFilterFunctionBody and jsPostFunctionBody of the same event attribute will be harmful as it will make an infinite recursive call.
      serverAsyncMethod - This method will invoke at server side with an argument wffBMObject. The wffBMObject is the representational javascript object returned by jsFilterFunctionBody.
      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 serverAsyncMethod as wffBMObject parameter. There are implicit objects event and source in the scope.
      Eg:-
                                                                                                      var bName = source.name;
                                                                                                      return {buttonName: bName, author:'wff', dateOfYear: 2014};
                                   
      jsPostFunctionBody - The body part of a javascript function (without function declaration). The wffBMObject returned by serverAsyncMethod will be available as an implicit object jsObject in the scope. There are common implicit objects event and source in the scope.
      serverSideData - this data will be available in the Event object of ServerAsyncMethod.asyncMethod method.
      Since:
      3.0.2
    • AbstractEventAttribute

      protected AbstractEventAttribute(String attributeName, boolean preventDefault, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData)
      Parameters:
      attributeName - the name of the attribute
      preventDefault - true to call event.preventDefault(); on event
      jsPreFunctionBody - It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side before serverAsyncMethod. If the jsPrefunction returns true then only serverAsyncMethod method will invoke (if it is implemented). It has implicit objects in its scope. They are event, source which gives the reference of the current tag and action. The action implicit object has a function named perform() which can be used to invoke jsFilterFunctionBody and serverAsyncMethod (it works just like returning true in the jsPreFunctionBody). If the action.perform() is called inside jsPreFunctionBody then returning true in it has no effect. The action implicit object is only available since 3.0.15.
      Eg:-
                                    if (source.type == 'button') {
                                        return true;
                                    }
                                    return false;
                                   

      NB: calling action.perform() inside jsFilterFunctionBody and jsPostFunctionBody of the same event attribute will be harmful as it will make an infinite recursive call.
      serverAsyncMethod - This method will invoke at server side with an argument wffBMObject. The wffBMObject is the representational javascript object returned by jsFilterFunctionBody.
      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 serverAsyncMethod as wffBMObject parameter. There are implicit objects event and source in the scope.
      Eg:-
                                                                                                      var bName = source.name;
                                                                                                      return {buttonName: bName, author:'wff', dateOfYear: 2014};
                                   
      jsPostFunctionBody - The body part of a javascript function (without function declaration). The wffBMObject returned by serverAsyncMethod will be available as an implicit object jsObject in the scope. There are common implicit objects event and source in the scope.
      serverSideData - this data will be available in the Event object of ServerAsyncMethod.asyncMethod method.
      Since:
      3.0.15
  • Method Details

    • init

      protected void init()
      invokes only once per object
      Since:
      2.0.0
    • setPreIndexedAttribute

      protected void setPreIndexedAttribute(PreIndexedAttributeName preIndexedAttrName)
      Description copied from class: AbstractAttribute
      NB: only for internal use. Signature of this method may be modified in future version. Sets PreIndexedAttributeName for name and index
      Overrides:
      setPreIndexedAttribute in class AbstractAttribute
      Parameters:
      preIndexedAttrName - PreIndexedAttributeName object
    • setAttributeName

      protected void setAttributeName(String attributeName)
      Description copied from class: AbstractAttribute
      Set attribute name, eg: width, height, name, type etc..
      Overrides:
      setAttributeName in class AbstractAttribute
      Parameters:
      attributeName - the attributeName to set
    • setValue

      public void setValue(String value)
      sets the value for this attribute
      Parameters:
      value - the value for the attribute.
      Since:
      2.0.0
    • getValue

      public String getValue()
      gets the value of this attribute
      Returns:
      the value of the attribute
      Since:
      2.0.0
    • setServerAsyncMethod

      public void setServerAsyncMethod(ServerAsyncMethod serverAsyncMethod)
      Parameters:
      serverAsyncMethod - the ServerAsyncMethod object to set.
    • setServerAsyncMethod

      public void setServerAsyncMethod(String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody)
      Parameters:
      jsPreFunctionBody - It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side before serverAsyncMethod. If the jsPrefunction returns true then only serverAsyncMethod method will invoke (if it is implemented). It has implicit objects in its scope. They are event, source which gives the reference of the current tag and action. The action implicit object has a function named perform() which can be used to invoke jsFilterFunctionBody and serverAsyncMethod (it works just like returning true in the jsPreFunctionBody). If the action.perform() is called inside jsPreFunctionBody then returning true in it has no effect. The action implicit object is only available since 3.0.15.
      Eg:-
                                    if (source.type == 'button') {
                                        return true;
                                    }
                                    return false;
                                   

      NB: calling action.perform() inside jsFilterFunctionBody and jsPostFunctionBody of the same event attribute will be harmful as it will make an infinite recursive call.
      serverAsyncMethod - This method will invoke at server side with an argument wffBMObject. The wffBMObject is the representational javascript object returned by jsFilterFunctionBody.
      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 serverAsyncMethod as wffBMObject parameter. There are implicit objects event and source in the scope.
      Eg:-
                                                                                                      var bName = source.name;
                                                                                                      return {buttonName: bName, author:'wff', dateOfYear: 2014};
                                   
      jsPostFunctionBody - The body part of a javascript function (without function declaration). The wffBMObject returned by serverAsyncMethod will be available as an implicit object jsObject in the scope. There are common implicit objects event and source in the scope.
      Since:
      2.0.0
    • setServerAsyncMethod

      public void setServerAsyncMethod(String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData)
      Parameters:
      jsPreFunctionBody - It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side before serverAsyncMethod. If the jsPrefunction returns true then only serverAsyncMethod method will invoke (if it is implemented). It has implicit objects in its scope. They are event, source which gives the reference of the current tag and action. The action implicit object has a function named perform() which can be used to invoke jsFilterFunctionBody and serverAsyncMethod (it works just like returning true in the jsPreFunctionBody). If the action.perform() is called inside jsPreFunctionBody then returning true in it has no effect. The action implicit object is only available since 3.0.15.
      Eg:-
                                    if (source.type == 'button') {
                                        return true;
                                    }
                                    return false;
                                   

      NB: calling action.perform() inside jsFilterFunctionBody and jsPostFunctionBody of the same event attribute will be harmful as it will make an infinite recursive call.
      serverAsyncMethod - This method will invoke at server side with an argument wffBMObject. The wffBMObject is the representational javascript object returned by jsFilterFunctionBody.
      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 serverAsyncMethod as wffBMObject parameter. There are implicit objects event and source in the scope.
      Eg:-
                                                                                                      var bName = source.name;
                                                                                                      return {buttonName: bName, author:'wff', dateOfYear: 2014};
                                   
      jsPostFunctionBody - The body part of a javascript function (without function declaration). The wffBMObject returned by serverAsyncMethod will be available as an implicit object jsObject in the scope. There are common implicit objects event and source in the scope.
      serverSideData - this data will be available in the Event object of ServerAsyncMethod.asyncMethod method.
      Since:
      3.0.2
    • setServerAsyncMethod

      protected void setServerAsyncMethod(boolean preventDefault, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData)
      Parameters:
      preventDefault - true to call event.preventDefault(); on event
      jsPreFunctionBody - It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side before serverAsyncMethod. If the jsPrefunction returns true then only serverAsyncMethod method will invoke (if it is implemented). It has implicit objects in its scope. They are event, source which gives the reference of the current tag and action. The action implicit object has a function named perform() which can be used to invoke jsFilterFunctionBody and serverAsyncMethod (it works just like returning true in the jsPreFunctionBody). If the action.perform() is called inside jsPreFunctionBody then returning true in it has no effect. The action implicit object is only available since 3.0.15.
      Eg:-
                                    if (source.type == 'button') {
                                        return true;
                                    }
                                    return false;
                                   

      NB: calling action.perform() inside jsFilterFunctionBody and jsPostFunctionBody of the same event attribute will be harmful as it will make an infinite recursive call.
      serverAsyncMethod - This method will invoke at server side with an argument wffBMObject. The wffBMObject is the representational javascript object returned by jsFilterFunctionBody.
      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 serverAsyncMethod as wffBMObject parameter. There are implicit objects event and source in the scope.
      Eg:-
                                                                                                      var bName = source.name;
                                                                                                      return {buttonName: bName, author:'wff', dateOfYear: 2014};
                                   
      jsPostFunctionBody - The body part of a javascript function (without function declaration). The wffBMObject returned by serverAsyncMethod will be available as an implicit object jsObject in the scope. There are common implicit objects event and source in the scope.
      serverSideData - this data will be available in the Event object of ServerAsyncMethod.asyncMethod method.
      Since:
      3.0.15
    • isPreventDefault

      protected boolean isPreventDefault()
      This is applicable for some special attributes like OnSubmit.
      Returns:
      true or false. true means to call event.preventDefault() on event otherwise false.
      Since:
      3.0.15
    • getServerAsyncMethod

      public ServerAsyncMethod getServerAsyncMethod()
      Specified by:
      getServerAsyncMethod in interface EventAttribute
    • getJsPostFunctionBody

      public String getJsPostFunctionBody()
      Specified by:
      getJsPostFunctionBody in interface EventAttribute
    • getJsFilterFunctionBody

      public String getJsFilterFunctionBody()
      Returns:
      the js filter function body
      Since:
      2.1.9
    • getJsPreFunctionBody

      public String getJsPreFunctionBody()
      Returns:
      the js prefunction body
      Since:
      2.1.9
    • setPreventDefault

      protected void setPreventDefault(boolean preventDefault)
      true to call event.preventDefault(); on event. It will set only if there is ServerAsyncMethod. This is applicable for some special attributes like OnSubmit.
      Parameters:
      preventDefault - true to call event.preventDefault(); on event otherwise false.
      Since:
      3.0.15
    • setJsPostFunctionBody

      public void setJsPostFunctionBody(String jsPostFunctionBody)
      Sets the post function body JavaScript.
      Parameters:
      jsPostFunctionBody - the post function body JavaScript.
    • setJsPreFunctionBody

      public void setJsPreFunctionBody(String jsPreFunctionBody)
      Sets the pre function body JavaScript. It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side before serverAsyncMethod. If the jsPrefunction returns true then only serverAsyncMethod method will invoke (if it is implemented). It has implicit objects in its scope. They are event, source which gives the reference of the current tag and action. The action implicit object has a function named perform() which can be used to invoke jsFilterFunctionBody and serverAsyncMethod (it works just like returning true in the jsPreFunctionBody). If the action.perform() is called inside jsPreFunctionBody then returning true in it has no effect. The action implicit object is only available since 3.0.15.
      NB: calling action.perform() inside jsFilterFunctionBody and jsPostFunctionBody of the same event attribute will be harmful as it will make an infinite recursive call.
      Parameters:
      jsPreFunctionBody - the JavaScript to execute.
      Since:
      2.1.9
    • setJsFilterFunctionBody

      public void setJsFilterFunctionBody(String jsFilterFunctionBody)
      Sets the filter function body JavaScript.
      Parameters:
      jsFilterFunctionBody - the js filter function body
      Since:
      2.1.9
    • getServerSideData

      public Object getServerSideData()
      Specified by:
      getServerSideData in interface EventAttribute
      Returns:
      the serverSideData
      Since:
      3.0.2
    • setServerSideData

      public void setServerSideData(Object serverSideData)
      Parameters:
      serverSideData - the serverSideData to set
      Since:
      3.0.2