Thursday, June 12, 2008
Picking Arbitrary MIDlets In The Resource Editor
The Resource Editor was mentioned by Comverse as one of the most important features they saw in LWUIT and with good reason, it allows them to separate the roles of developers and designers while delegating to people who aren't necessarily technical in nature.
One of the cool features I added in the latest version of the resource editor is the ability to pick an arbitrary MIDlet to run within the preview panel for theme editing, theme preview allows us to see the theme changes applied directly to our custom MIDlet. However, like in everything there are caveats in this feature that should be clarified...
To understand the feature we need to understand how the resource editor preview works, the resource editor preview is essentially a port of LWUIT running on top of Java SE. To run the preview we load the MIDlet and invoke its startApp() method in Java SE, Since LWUIT is running as usual pretty much everything within LWUIT would work in the same way as it would on the device (although currently key events aren't handled, only mouse navigation).
What happens when you invoke a MIDP API such as RMS, GCF etc.?
Nothing, these API's are currently implemented as stubs and would just do nothing or return null/0 where appropriate. This will probably cause a problem with your code... You will need to adapt your MIDlet so it can handle this situation and load the GUI when necessary.
Furthermore, if your MIDlet tries to set the current theme it might cause minor issues but these should be easily fixable by refreshing the UI.
If there is a failure in the MIDlet the resource editor will silently load the LWUIT Demo in the preview and use it instead. To debug this you can run the resource editor in command line (java -jar editor.jar) and when you will go to the theme option you would see the stack for your MIDlet allowing you to fix this.
To use this feature do the following:
1. Make sure your MIDlet will work without networking & GCF, you can dynamically detect running under Java SE using one of the many System.getProperty() values from Java SE.
2. In the MIDlets menu select Pick MIDlet
3. Choose the Jar for your MIDlet and the specific MIDlet to run.
4. Open your theme file and select the theme
Subscribe to:
Post Comments (Atom)
I tried picking my own custom midlet and it failed. When I ran ResourceEditor through the command line, I found that the name of the class it was trying to load was truncated, I think right where it is folded in the manifest. Is there a problem in the way its reading the class names from the manifest when the line exceeds the 70 character folding limit?
ReplyDeleteYes this is probably a bug, thanks for bringing it to my attention. I'll try to fix this for the next release.
ReplyDeletegetting an exception thrown when i try to use MIDlet > Pick MIDlet in the resource editor:
ReplyDeleteException in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: javax.swing.JDialog: method <init>(Ljava/awt/Window;)V not found
at com.sun.jwt.resources.editor.PickMIDlet.showPickMIDletDialog(PickMIDlet.java:68)
at com.sun.jwt.resourc ..............
Any ideas? Running on Mac OS X if that helps..?
There is apparently an issue of compatibility with older VM's (Java 5) and this feature affecting the Mac. I fixed this particular exception for the next drop, for now if you can use Java 6 it should solve it.
ReplyDelete