Skip to main content

GRIN Commands

2 replies [Last post]
joe_rice
Offline
Joined: 2007-01-04
Points: 0

(I sent this via the email list earlier and it popped up as a response to a separate thread - re-posting as its own thread)

I notice the that custom command interface has changed significantly
recently. No more extensions parser and now we have the ability to
define Java classes in the show file.

Is this now the only way to define custom commands? Looking at the
bookmenu example, it looks like even if the methods to be called are
defined in the Director, one needs to at leastm define a method for
getting the director in java_generated_class.

I'm working on converting some 'old' GRIN code to 'new' GRIN, and
looking for the easiest way to go about it.

I note in the BNF that there is an other_command type, which seems
like it may be closer to the old way of doing things, (although maybe
with the bits defined in the Director instead of the
ExtensionsParser?). However, I don't see any examples of other_command
use in the HDCookbook project. Is there an example in one of the xlets
that I'm missing?

Thanks,
Joe

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chihiro_saito
Offline
Joined: 2006-11-08
Points: 0

Hi Joe,

Yes, the custom command system changed. Related issues are #9 and #39. Sorry, I meant to report about #39 back to you and Mark but haven't got around to it. It is all incremental changes, and not as bad as it seems at first.

In a nutshell, here is what's needed, from the user point of view:

- If you're using any custom extensions, then you need to define java_generated_class section in the show file and compile the generated file into the xlet jar. This is because the class generated from "java_generated_class" is utilized in initializing the custom class at xlet runtime.

- ExtensionParser is still there, and one needs to provide it for parsing custom commands from a text show. Meanwhile ExtensionReader and ExtensionWriter (the classes that used to write out and read in extensions in binary form) are now gone, replaced with Node.java and SENode.java interfaces, in which your extension command should implement. The idea is that now binary reading and writing is handled by the extension classes themselves.

As for BNF, other_command is still used in MenuXlet, for "BOOK:PlayVideo" command. Note that other simpler commands in MenuXlet have been switched to use the java_generated_class approach. The way that MenuXlet is using Director is actually what Mark suggested to us for a better plug-in architecture, especially for making it work on GrinView, and you don't have to do it this way.

Please take a look at the files under grin/samples/Scripts/CustomFeature. The example is a feature extension, but I'm sure that a command extension will be something very similar.

Chihiro

Joe Rice

Thanks, Chihiro! I think that for most of what I'm doing,
other_command is going to be quickest to implement, rather than
defining extensions. I missed that in the show file, as I was
searching for the wrong thing.

Cheers,
Joe

On Mar 5, 2008, at 10:41 AM, bd-j-dev@mobileandembedded.org wrote:

> Hi Joe,
>
> Yes, the custom command system changed. Related issues are #9 and
> #39. Sorry, I meant to report about #39 back to you and Mark but
> haven't got around to it. It is all incremental changes, and not as
> bad as it seems at first.
>
> In a nutshell, here is what's needed, from the user point of view:
>
> - If you're using any custom extensions, then you need to define
> java_generated_class section in the show file and compile the
> generated file into the xlet jar. This is because the class
> generated from "java_generated_class" is utilized in initializing
> the custom class at xlet runtime.
>
> - ExtensionParser is still there, and one needs to provide it for
> parsing custom commands from a text show. Meanwhile
> ExtensionReader and ExtensionWriter (the classes that used to write
> out and read in extensions in binary form) are now gone, replaced
> with Node.java and SENode.java interfaces, in which your extension
> command should implement. The idea is that now binary reading and
> writing is handled by the extension classes themselves.
>
> As for BNF, other_command is still used in MenuXlet, for
> "BOOK:PlayVideo" command. Note that other simpler commands in
> MenuXlet have been switched to use the java_generated_class
> approach. The way that MenuXlet is using Director is actually what
> Mark suggested to us for a better plug-in architecture, especially
> for making it work on GrinView, and you don't have to do it this way.
>
> Please take a look at the files under grin/samples/Scripts/
> CustomFeature. The example is a feature extension, but I'm sure
> that a command extension will be something very similar.
>
> Chihiro
> [Message sent by forum member 'chihiro_saito' (chihiro_saito)]
>
> http://forums.java.net/jive/thread.jspa?messageID=262476
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
> For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net