yesterday and today I added scripting support to AriaMidp
by copying a few classes from the main project and tweaking
some code. I state the two demo XML files below, which should
give an impression about my results.
It works well with WTK2.5.2/DefaultPhone. I have to test it
on a real phone yet.
Requesting a Page
-----------------
Additionally, I added support for the prefix "page:" to the
Events "method" attribute, to be able to show another page:
<Event method="page:Welcome" args="next" type="OK"/>
I assume, that you will have a different point of view regarding this,
probably by introducing a new attribute named "page". I somehow feel,
that I abused the attribute "method".
Script Execution
----------------
Calls an procedure given in the Script-tag, by loading the content
of the Script tag and simply adding the procedure call. Then the
whole script gets executed:
<Event method="${script.myProcdureCall}" args="next" type="OK"/>
Executes some script directly, this one writes "Let's exit ...":
<Event method="${script:puts {Let's exit ...}}" args="next" type="EXIT"/>
My next steps
-------------
- Add mobile specific HECL commands, like sending SMS or whatever.
- Add a HECL command to access the variables/elements of a Page from
HECL script.
- Check out NetBeans, I converted the project to Eclipse and
played around with ant/antenna. I prefer custom ant scripts.
My questions
------------
- You wrote that you wanted to refactor the AriaMidp source and update
it with the main trunk of Aria. Does it at make sense to you my source
code over in the near future?
- The license for AriaMidp is GPL. Aria itself is GPS/LGPL.
Is this done deliberately?
HECL is under license Apache 2.0.
Thanks!
Erik
-----------------------------------------------------------------
Welcome.xml
-----------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<XPage class="test.project.Welcome">
<Components>
<Ticker content="Hello World, Welcome to MIDP Aria"/>
<DateField label="Date:" date="1198368000000"/>
<Image name="myImg" label="Image:" content="/aria_icon.png"/>
<TextField label="Text Field:" content="Testing 1,2,3"/>
<Label label="A Label:" content="How did I get here?"/>
</Components>
<Events>
<Event method="${script.myProcdureCall}" args="next" type="OK"/>
<Event method="${script:puts {Let's exit ...}}" args="next" type="EXIT"/>
</Events>
<Scripts>
# Simple Procedure Call
proc myProcdureCall {} {
puts {Hello, world! From inside of the procedure in the Script tag.}
return PageTwo
}
</Scripts>
</XPage>
-----------------------------------------------------------------
PageTwo.xml
-----------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<XPage class="test.project.Welcome">
<Components>
<Ticker content="This is page TWO 2 TWO 2"/>
<TextField name="speciesField" label="Data bound value:" content="THIS SHOULD BE REPLACED!"/>
</Components>
<Events>
<Event method="page:Welcome" args="next" type="OK"/>
</Events>
<Data>
<Bind target="speciesField" source="coffee/species/1"/>
</Data>
</XPage>
I've added you now, so you should have SVN access. Please keep all
changes to the AriaMobileMidp project.
Looking forward to the addition :-)
Regards
Luan