Action implementation can be written using any scripting language is supported by JSR 223, Javascript in primis.
Roma treats Virtual Objects in the same way of POJO, so you can define an Employee at the fly in this way:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<class xmlns="http://www.romaframework.org/xml/roma" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:schemaLocation="http://www.romaframework.org/xml/roma http://www.romaframework.org/schema/v2/roma.xsd">
<aspects>
<view>
<form>
<area name="main" type="column">
<area name="fields" size="2" type="grid" />
<area name="actions" type="row" />
</area>
</form>
</view>
</aspects>
<fields>
<field name="id" type="Integer" />
<field name="name" type="String" />
<field name="surname" type="String" />
<field name="born" type="Date" />
<field name="age" type="Integer">
<aspects>
<view enabled="false" />
</aspects>
</field>
<field name="salary" type="Float" />
</fields>
<actions>
<action name="refresh">
<aspects>
<scripting>
org.romaframework.core.Roma.objectChanged(me);
</scripting>
</aspects>
</action>
<action name="print">
<aspects>
<scripting>
print(age);
</scripting>
</aspects>
</action>
<action name="login">
<aspects>
<scripting>
print('Login...');
org.romaframework.frontend.RomaFrontend.flow().forward("ProjectLogin");
</scripting>
</aspects>
</action>
</actions>
<events>
<event name="show">
<aspects>
<scripting>
<![CDATA[
age=32;
Roma.fieldChanged(me, ["age"]);
]]>
</scripting>
</aspects>
</event>
</events>
</class>
And this is the result:
Note that changes to the XML files are loaded in real-time enabling a real productive development (and production why not) environment.
No comments:
Post a Comment