[Mobile Client interworks]

4 views
Skip to first unread message

VLegakis

unread,
Jul 28, 2008, 3:28:49 AM7/28/08
to porcupine-users
Hi all,
I want to implement a new list entry in the main menu of my
application.

So I have created a new mui.Synch.muix template file under
mobile.templates package.
here is the file:

<?xml version="1.0" encoding="utf-8"?>
<dialog text="Synch" icon="res/reload.png" modal="true">
<script><![CDATA[
set btn [find $$source "btnSynch"]
setfocus $$btn]]>
</script>
<panel columns="1" background="#FFFFFF"
left="4" top="4" right="4" bottom="4" gap="4">
<textarea text="Are you sure you want to synch with Lifeline
server?" border="false"
wrap="true" editable="false" rows="3" columns="15" weightx="1"/>
<panel gap="2">
<label weightx="1"/>
<button name="btnSynch" text="Yes">

<script method="action"><![CDATA[
rpc "" "logoff" quit]]>
</script>

</button>
<button text="Cancel" action="closewindow"/>
</panel>
</panel>

</dialog>

This is actually a dialog box asking for Yes or Cancel.

Then I just couldn't invoke it through the RootFolder.

Here is my entry in the mui.Desktop.muix:
<item icon="mlifeline/images/folder_synch.png" property="url=?
cmd=synch"/>

and here is my webmethod entry in rootfolder.py :
@webmethods.mobileui(of_type=users.LifeLineGroup,
template='../templates/mui.Synch.muix')
def synch(self):
print 1
return {}

The template never gets invoked. What might be the problem? (I take
care of the icons. Its not the problem)

VLegakis

unread,
Jul 28, 2008, 4:01:07 AM7/28/08
to porcupine-users
Hi all,
I've got a turnaround this with thomas help by changing the item entry
into:
<item icon="mlifeline/images/folder_synch.png" property="url=
$MY_FRIENDS?cmd=synch"/>
and moving the respective webmethod into groups.py instead of
rootfolder.py.
Strange ehh! Can't really explain why but its working (dialog launches
as expected).


Anyway here is a client core problem I face now:

I have implemented the client method which does the stuff I want and I
want to invoke it by pushing the above mentioned YES in the dialog box
I managed to launch.

I have concentrated 3 method of my interest in the event handling core
of the client (thinlet class)
Those are:

1) boolean processKeyPress(Object component, boolean shiftdown,
boolean controldown, int modifiers, int keychar, int keycode)
then this calls:
2) boolean invoke(Object component, Object part, String event)
which apparently calls
3) void invokeImpl(Object method, Object part, String event)

All of these take the generic Object argument
So I've made some debugging to see whats going on:

In the main screen when I press the list option to launch my dialog
here is what happens:
processKeyPress - classname=list
invoke - method:[Ljava.lang.Object;@1bc43462 event:perform
invokeImpl - data:[Ljava.lang.Object;@724068e args:null
invoke - method:[Ljava.lang.Object;@1bc43462 event:focuslost
invoke - method:[Ljava.lang.Object;@3c628a4 event:focusgained

Here the dialog launches so I want to push Yes in order to invoke the
method I've writen. Here is what happens when I push the yes button:
processKeyPress - classname=button
invoke - method:[Ljava.lang.Object;@acddf72 event:action

So my method is not recognized.

I'm working on how to register a method so I can scan and call.
If anybody knows how this is done on the server side please help.

VLegakis

unread,
Jul 31, 2008, 12:00:57 PM7/31/08
to porcupine-users
So I've made it.
The problem's cause included some lack of knowledge of Hecl and the
Porcupine framework all together combined producing amazingly chaotic
affects ;-)

Here is how you implement some addition Java functionality and invoke
it though the porcupine generic framework:

I wrote my separate class and implemented my extremely cleverly
working functions

I created the dialog template I posted before and bound it to
groups.py (I still don't know why it doesn't work on Root Folder). The
only difference is some simplification. Now (instead of a whole Hecl
script) I only send 1 synch command to the client through this node:
<button name="btnSynch" text="Yes" action="synch"/>

Now I implement the relevant Hecl command -Class which is:

package org.innoscript.mobile.browser.hecl.commands;

public class Synch implements Command
{
public void cmdCode(Interp interp, Thing[] argv) throws HeclException
{
//debug

System.out.println("org.innoscript.mobile.browser.hecl.commands.Synch
- cmdCode");
Browser.getCanvas().synch();
}
}


Then I check weather the handset supports the features I'm interested
in and implement this command in HInterp.java

if (Browser.supportsPIM)
{
commands.put("synch", new Synch());
}

As you see from above this calls the canvas synch() method.
Finally I just implement the method I'm calling in Canvas. This should
be launching additional dialogs, invoke the already implemented "real"
funtionality etc.



This seemingly simple solution cost me like 2 days of running around
Hecl, Browser, Thinlet and Canvas serialized code but at least now I
have an idea of the flow.
Now we have to implement the server side method which will act as a
receiver for my methods output.

I still can't get the class casting interworks but still working on
it.

Thread closed ;-)

tkouts

unread,
Aug 8, 2008, 4:11:44 AM8/8/08
to porcupine-users
On Jul 28, 10:28 am, VLegakis <vlega...@gmail.com> wrote:
Vassili this is because your web method is bound to the LifeLineGroup
class and you are invoking a web method of the root folder (your URL
is "?cmd=synch"). If you bind the web method to the root folder
instead then everything should work.
Reply all
Reply to author
Forward
0 new messages