Actions and behaviors

1. Action

    In a dynamic model, any model object can be transformed into an action, and an action can be executed.

2. Behavior

    Models under a model's actions subnode are considered model actions.

<?xml version='1.0' encoding='utf-8'?>

<thing name="Person" _xmeta_id_="379" descriptors="xworker.lang.MetaDescriptor3">
    <attribute name="name"/>
    <attribute name="age" _xmeta_id_="652"/>
    <attribute name="sex" _xmeta_id_="653" inputtype="select">
        <value name="male" _xmeta_id_="654" value="male"/>
        <value name="female" _xmeta_id_="655" value="female"/>
    </attribute>
    <attribute name="birthDay" _xmeta_id_="656" inputtype="datePick"/>
    <attribute name="memo" _xmeta_id_="657" inputtype="html"/>
    <actions>
        <GroovyAction name="sayHello" descriptors="xworker.groovy.GroovyAction" code="println self.get(&quot;name&quot;) + &quot; say hello world!&quot; ;"/>
    </actions>
    <thing name="Child" extends="_transient.p379"/>
</thing>

    For example, in the XML above, <GroovyAction anme="sayHello" .../> under <acttions> is the model <thing name="Person" .../ > behavior definition. That is, Person has a sayHello behavior.

    <actions>
        <GroovyAction name="sayHello" descriptors="xworker.groovy.GroovyAction" code="println self.get(&quot;name&quot;) + &quot; say hello world!&quot; ;"/>
    </actions>

 

Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号