Class AbstractEventAttribute
java.lang.Object
com.webfirmframework.wffweb.tag.core.AbstractTagBase
com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute
com.webfirmframework.wffweb.tag.html.attribute.event.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
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 Summary
ConstructorsModifierConstructorDescriptionprotected
protected
AbstractEventAttribute
(String attributeName, boolean preventDefault, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData) protected
AbstractEventAttribute
(String attributeName, String value) protected
AbstractEventAttribute
(String attributeName, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody) protected
AbstractEventAttribute
(String attributeName, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData) -
Method Summary
Modifier and TypeMethodDescriptiongetValue()
gets the value of this attributeprotected void
init()
invokes only once per objectprotected boolean
This is applicable for some special attributes like OnSubmit.protected void
setAttributeName
(String attributeName) Set attribute name, eg: width, height, name, type etc..void
setJsFilterFunctionBody
(String jsFilterFunctionBody) Sets the filter function body JavaScript.void
setJsPostFunctionBody
(String jsPostFunctionBody) Sets the post function body JavaScript.void
setJsPreFunctionBody
(String jsPreFunctionBody) Sets the pre function body JavaScript.protected void
setPreIndexedAttribute
(PreIndexedAttributeName preIndexedAttrName) NB: only for internal use.protected void
setPreventDefault
(boolean preventDefault) true to call event.preventDefault(); on event.protected void
setServerAsyncMethod
(boolean preventDefault, String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData) void
setServerAsyncMethod
(ServerAsyncMethod serverAsyncMethod) void
setServerAsyncMethod
(String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody) void
setServerAsyncMethod
(String jsPreFunctionBody, ServerAsyncMethod serverAsyncMethod, String jsFilterFunctionBody, String jsPostFunctionBody, Object serverSideData) void
setServerSideData
(Object serverSideData) void
sets the value for this attributeMethods inherited from class com.webfirmframework.wffweb.tag.html.attribute.core.AbstractAttribute
addAllToAttributeValueMap, addAllToAttributeValueSet, addAllToAttributeValueSet, addToAttributeValueMap, addToAttributeValueSet, addValueChangeListener, beforePrintStructure, beforePrintStructureCompressedByIndex, beforeWffPrintStructure, getAttributeName, getAttributeValue, getAttributeValueMap, getAttributeValueSet, getBinaryStructureCompressedByIndex, getBinaryStructureCompressedByIndex, getCharset, getOwnerTag, getOwnerTags, getPrintStructure, getPrintStructure, getReadLocks, getValueChangeListeners, getWffPrintStructure, getWriteLocks, lockAndGetReadLocks, lockAndGetReadLocksWithAttrLock, lockAndGetWriteLocks, lockAndGetWriteLocksWithAttrLock, removeAllFromAttributeValueMap, removeAllFromAttributeValueSet, removeAllFromAttributeValueSet, removeFromAttributeValueMap, removeFromAttributeValueMap, removeFromAttributeValueMapByKeys, removeFromAttributeValueSet, removeValueChangeListener, replaceAllInAttributeValueSet, replaceAllInAttributeValueSet, setAttributeValue, setAttributeValue, setAttributeValueMap, setAttributeValueSet, setCharset, setModified, setModifiedLockless, setOwnerTag, toCompressedBytesByIndex, toCompressedBytesByIndex, toHtmlString, toHtmlString, toHtmlString, toHtmlString, toHtmlString, toHtmlString, toString, toWffString, unsetOwnerTag
Methods inherited from class com.webfirmframework.wffweb.tag.core.AbstractTagBase
equals, getData, hashCode, isModified, isRebuild, setData, setRebuild
-
Constructor Details
-
AbstractEventAttribute
protected AbstractEventAttribute() -
AbstractEventAttribute
- 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 attributejsPreFunctionBody
- It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side beforeserverAsyncMethod
. If the jsPrefunction returns true then onlyserverAsyncMethod
method will invoke (if it is implemented). It has implicit objects in its scope. They areevent
,source
which gives the reference of the current tag andaction
. Theaction
implicit object has a function namedperform()
which can be used to invokejsFilterFunctionBody
andserverAsyncMethod
(it works just like returning true in thejsPreFunctionBody
). If theaction.perform()
is called insidejsPreFunctionBody
then returning true in it has no effect. Theaction
implicit object is only available since 3.0.15.
Eg:-if (source.type == 'button') { return true; } return false;
NB: callingaction.perform()
insidejsFilterFunctionBody
andjsPostFunctionBody
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 argumentwffBMObject
. ThewffBMObject
is the representational javascript object returned byjsFilterFunctionBody
.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 inserverAsyncMethod
aswffBMObject
parameter. There are implicit objectsevent
andsource
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). ThewffBMObject
returned byserverAsyncMethod
will be available as an implicit objectjsObject
in the scope. There are common implicit objectsevent
andsource
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 attributejsPreFunctionBody
- It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side beforeserverAsyncMethod
. If the jsPrefunction returns true then onlyserverAsyncMethod
method will invoke (if it is implemented). It has implicit objects in its scope. They areevent
,source
which gives the reference of the current tag andaction
. Theaction
implicit object has a function namedperform()
which can be used to invokejsFilterFunctionBody
andserverAsyncMethod
(it works just like returning true in thejsPreFunctionBody
). If theaction.perform()
is called insidejsPreFunctionBody
then returning true in it has no effect. Theaction
implicit object is only available since 3.0.15.
Eg:-if (source.type == 'button') { return true; } return false;
NB: callingaction.perform()
insidejsFilterFunctionBody
andjsPostFunctionBody
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 argumentwffBMObject
. ThewffBMObject
is the representational javascript object returned byjsFilterFunctionBody
.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 inserverAsyncMethod
aswffBMObject
parameter. There are implicit objectsevent
andsource
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). ThewffBMObject
returned byserverAsyncMethod
will be available as an implicit objectjsObject
in the scope. There are common implicit objectsevent
andsource
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 attributepreventDefault
- true to call event.preventDefault(); on eventjsPreFunctionBody
- It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side beforeserverAsyncMethod
. If the jsPrefunction returns true then onlyserverAsyncMethod
method will invoke (if it is implemented). It has implicit objects in its scope. They areevent
,source
which gives the reference of the current tag andaction
. Theaction
implicit object has a function namedperform()
which can be used to invokejsFilterFunctionBody
andserverAsyncMethod
(it works just like returning true in thejsPreFunctionBody
). If theaction.perform()
is called insidejsPreFunctionBody
then returning true in it has no effect. Theaction
implicit object is only available since 3.0.15.
Eg:-if (source.type == 'button') { return true; } return false;
NB: callingaction.perform()
insidejsFilterFunctionBody
andjsPostFunctionBody
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 argumentwffBMObject
. ThewffBMObject
is the representational javascript object returned byjsFilterFunctionBody
.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 inserverAsyncMethod
aswffBMObject
parameter. There are implicit objectsevent
andsource
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). ThewffBMObject
returned byserverAsyncMethod
will be available as an implicit objectjsObject
in the scope. There are common implicit objectsevent
andsource
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
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 classAbstractAttribute
- Parameters:
preIndexedAttrName
- PreIndexedAttributeName object
-
setAttributeName
Description copied from class:AbstractAttribute
Set attribute name, eg: width, height, name, type etc..- Overrides:
setAttributeName
in classAbstractAttribute
- Parameters:
attributeName
- the attributeName to set
-
setValue
sets the value for this attribute- Parameters:
value
- the value for the attribute.- Since:
- 2.0.0
-
getValue
gets the value of this attribute- Returns:
- the value of the attribute
- Since:
- 2.0.0
-
setServerAsyncMethod
- Parameters:
serverAsyncMethod
- theServerAsyncMethod
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 beforeserverAsyncMethod
. If the jsPrefunction returns true then onlyserverAsyncMethod
method will invoke (if it is implemented). It has implicit objects in its scope. They areevent
,source
which gives the reference of the current tag andaction
. Theaction
implicit object has a function namedperform()
which can be used to invokejsFilterFunctionBody
andserverAsyncMethod
(it works just like returning true in thejsPreFunctionBody
). If theaction.perform()
is called insidejsPreFunctionBody
then returning true in it has no effect. Theaction
implicit object is only available since 3.0.15.
Eg:-if (source.type == 'button') { return true; } return false;
NB: callingaction.perform()
insidejsFilterFunctionBody
andjsPostFunctionBody
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 argumentwffBMObject
. ThewffBMObject
is the representational javascript object returned byjsFilterFunctionBody
.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 inserverAsyncMethod
aswffBMObject
parameter. There are implicit objectsevent
andsource
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). ThewffBMObject
returned byserverAsyncMethod
will be available as an implicit objectjsObject
in the scope. There are common implicit objectsevent
andsource
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 beforeserverAsyncMethod
. If the jsPrefunction returns true then onlyserverAsyncMethod
method will invoke (if it is implemented). It has implicit objects in its scope. They areevent
,source
which gives the reference of the current tag andaction
. Theaction
implicit object has a function namedperform()
which can be used to invokejsFilterFunctionBody
andserverAsyncMethod
(it works just like returning true in thejsPreFunctionBody
). If theaction.perform()
is called insidejsPreFunctionBody
then returning true in it has no effect. Theaction
implicit object is only available since 3.0.15.
Eg:-if (source.type == 'button') { return true; } return false;
NB: callingaction.perform()
insidejsFilterFunctionBody
andjsPostFunctionBody
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 argumentwffBMObject
. ThewffBMObject
is the representational javascript object returned byjsFilterFunctionBody
.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 inserverAsyncMethod
aswffBMObject
parameter. There are implicit objectsevent
andsource
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). ThewffBMObject
returned byserverAsyncMethod
will be available as an implicit objectjsObject
in the scope. There are common implicit objectsevent
andsource
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 eventjsPreFunctionBody
- It is the body part of JavaScript function (without function declaration). It must return true/false. This function will invoke at client side beforeserverAsyncMethod
. If the jsPrefunction returns true then onlyserverAsyncMethod
method will invoke (if it is implemented). It has implicit objects in its scope. They areevent
,source
which gives the reference of the current tag andaction
. Theaction
implicit object has a function namedperform()
which can be used to invokejsFilterFunctionBody
andserverAsyncMethod
(it works just like returning true in thejsPreFunctionBody
). If theaction.perform()
is called insidejsPreFunctionBody
then returning true in it has no effect. Theaction
implicit object is only available since 3.0.15.
Eg:-if (source.type == 'button') { return true; } return false;
NB: callingaction.perform()
insidejsFilterFunctionBody
andjsPostFunctionBody
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 argumentwffBMObject
. ThewffBMObject
is the representational javascript object returned byjsFilterFunctionBody
.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 inserverAsyncMethod
aswffBMObject
parameter. There are implicit objectsevent
andsource
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). ThewffBMObject
returned byserverAsyncMethod
will be available as an implicit objectjsObject
in the scope. There are common implicit objectsevent
andsource
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
- Specified by:
getServerAsyncMethod
in interfaceEventAttribute
-
getJsPostFunctionBody
- Specified by:
getJsPostFunctionBody
in interfaceEventAttribute
-
getJsFilterFunctionBody
- Returns:
- the js filter function body
- Since:
- 2.1.9
-
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 isServerAsyncMethod
. 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
Sets the post function body JavaScript.- Parameters:
jsPostFunctionBody
- the post function body JavaScript.
-
setJsPreFunctionBody
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 beforeserverAsyncMethod
. If the jsPrefunction returns true then onlyserverAsyncMethod
method will invoke (if it is implemented). It has implicit objects in its scope. They areevent
,source
which gives the reference of the current tag andaction
. Theaction
implicit object has a function namedperform()
which can be used to invokejsFilterFunctionBody
andserverAsyncMethod
(it works just like returning true in thejsPreFunctionBody
). If theaction.perform()
is called insidejsPreFunctionBody
then returning true in it has no effect. Theaction
implicit object is only available since 3.0.15.
NB: callingaction.perform()
insidejsFilterFunctionBody
andjsPostFunctionBody
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
Sets the filter function body JavaScript.- Parameters:
jsFilterFunctionBody
- the js filter function body- Since:
- 2.1.9
-
getServerSideData
- Specified by:
getServerSideData
in interfaceEventAttribute
- Returns:
- the serverSideData
- Since:
- 3.0.2
-
setServerSideData
- Parameters:
serverSideData
- the serverSideData to set- Since:
- 3.0.2
-