Package org.zkoss.zk.ui.metainfo
Class WidgetListener
- java.lang.Object
-
- org.zkoss.zk.ui.metainfo.WidgetListener
-
- All Implemented Interfaces:
java.io.Serializable
,Condition
- Direct Known Subclasses:
WidgetOverride
public class WidgetListener extends java.lang.Object
Represents a client-side event listener for the peer widget. Notice that, unlikeWidgetOverride
,getScript(org.zkoss.zk.ui.Component)
has only the function's body (withoutfunction (event)
).- Since:
- 5.0.0
- Author:
- tomyeh
- See Also:
EventHandler
,WidgetOverride
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WidgetListener(EvaluatorRef evalr, java.lang.String name, java.lang.String script, ConditionImpl cond)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(Component comp)
ConditionImpl
getCondition()
Returns the effectiveness condition.EvaluatorRef
getEvaluatorRef()
Returns the evaluator reference.java.lang.String
getName()
Returns the event name, such as, onClick.java.lang.String
getRawScript()
Returns the script passed to the constructor.java.lang.String
getScript(Component comp)
Returns the script associated with this event handler.boolean
isEffective(Component comp)
Used to evaluate whether it is effective.boolean
isEffective(Page page)
Used to evaluate whether it is effective.void
setCondition(ConditionImpl cond)
Sets the effectiveness condition.boolean
withCondition()
Tests if the condition is set
-
-
-
Field Detail
-
_name
protected final java.lang.String _name
-
_script
protected final ExValue _script
-
-
Constructor Detail
-
WidgetListener
public WidgetListener(EvaluatorRef evalr, java.lang.String name, java.lang.String script, ConditionImpl cond)
- Parameters:
name
- the event name, such as onClickscript
- the script snippet. EL is allowed.- Throws:
java.lang.IllegalArgumentException
- if name or script is null
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the event name, such as, onClick.
-
getScript
public java.lang.String getScript(Component comp)
Returns the script associated with this event handler.- Since:
- 5.0.2
-
getRawScript
public java.lang.String getRawScript()
Returns the script passed to the constructor. In other words, it might contains EL.- Since:
- 5.0.2
-
assign
public void assign(Component comp)
-
getEvaluatorRef
public EvaluatorRef getEvaluatorRef()
Returns the evaluator reference.
-
getCondition
public ConditionImpl getCondition()
Returns the effectiveness condition.
-
setCondition
public void setCondition(ConditionImpl cond)
Sets the effectiveness condition.
-
withCondition
public boolean withCondition()
Tests if the condition is set
-
isEffective
public boolean isEffective(Component comp)
Description copied from interface:Condition
Used to evaluate whether it is effective.- Specified by:
isEffective
in interfaceCondition
- Parameters:
comp
- used as the self variable. Ignored if null.
-
isEffective
public boolean isEffective(Page page)
Description copied from interface:Condition
Used to evaluate whether it is effective.- Specified by:
isEffective
in interfaceCondition
- Parameters:
page
- used as the self variable. Ignored if null.
-
-