Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Mobile Java Gets a Much-needed Boost from Sun's New Mobility Toolkit : Page 2

J2ME developers are accustomed to neglect, but the new NetBeans Mobility Pack 4.1 is among the best updates to the wireless development toolbox yet this decade.


advertisement
Already in Mobility Pack 4.0
Prior to 4.1, the Mobility Pack 4.0 (and NetBeans 4.0 IDE) already offered considerable functionality, which if you have not had a chance to explore yet, you might find the feature set surprising. The initial 4.0 release of the Mobility Pack already offered:
  • Integration with Wireless Toolkit 2.2
  • API Permissions
  • MIDlet Signing
  • Certificate Management
  • Over-the-air (OTA) emulation
  • Push Registry
  • Obfuscation
  • Support for adding 3rd party emulators
  • MIDP localization
  • Device defragmentation
The list was extensive and the additions in the 4.1 release provide strong indication that Sun is making a serious run at providing J2ME developers, especially those with limited budgets or committed to open source tools, with the next generation of IDE that goes well beyond that of the Wireless Toolkit. I encourage you to look at the guides and tutorials referenced in this article for more information about these features. Also, you will find the NetBeans IDE Help extremely useful and detailed in helping describe and instruct on the features of NetBeans and Mobility Pack development.

Figure 2. Visual Designer Tabs: The Mobility Pack 4.1 MIDlet Visual Designer allows you to switch between the Screen and Flow Designers for visual GUI and MIDlet work flow development and the actual source code.

Features of NetBeans Mobility Pack 4.1
For a dot release, Mobility Pack 4.1 contains a significant number of new features. Interestingly, the feature that has—and will continue—to grab most of the community's attention (the Visual Mobile Designer) will probably still leave many developers wanting. In fact, I would submit that the major features of this release are all good first steps, but will need to be enhanced to give us the IDE we long for.



Visual Mobile Designer
The most anticipated enhancement with NetBeans Mobility Pack 4.1 is the Visual Designer. With Mobility Pack 4.1, Sun has taken an initial stab at providing a drag-and-drop user interface development tool for visually/graphically developing javax.microedition.lcdui Alerts, Forms, Lists, and Text Boxes and designing a MIDlet's work flow. The tool, called MIDP Visual Designer (MVD), has three tabs (see Figure 2) that allow you to switch between MIDlet source code, the Screen Designer for GUI development, and the Flow Designer for modeling how a MIDlet creates views and what command actions force them to display.

The Screen Designer allows you to drag and drop commands and items from a palette on to the various javax.microedition.lcdui.Screen elements that are associated with a MIDlet. Like visual editors associated with Web or Swing application development, you can then edit properties associated with the screen as well as the components (see Figure 3).

Figure 3. Screen Design: The Screen Designer allows you to pick commands and GUI items from the palette (left of the screen) to the screen designer and then set the properties to anything on the screen with the properties editor on the right side of the IDE.

The Screen Designer is a step in the right direction, but many of you will soon see that this first release tool has many shortcomings. First of all, the tool is only valid for new development projects and does not offer reverse engineering. If you inspect the generated MIDlet source code created using the Screen Designer, there is a read-only section in it (as shown in the example code snip below) which old MIDlets obviously will not have. As the generated code comment suggests, modifying this code section will invalidate your ability to use the visual editors:

// --- This section is auto-generated by NetBeans IDE. Do not modify or you may lose your changes.// /** * This method initializes UI of the application. */ private void initialize() { // For adding user code into this block, select "Design" item in the inspector and invoke property editor on Action property in Properties window. javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_entryForm()); }

In fact, when you go to create a new MIDlet, you are asked whether you wish to create a "Visual" MIDlet or to create a MIDlet without use of the MVD (see Figure 4). Only "Visual" MIDlets can be worked on in the MVD.

Figure 4. Visual vs. Non-Visual MIDlet Creation: When creating a new MIDlet, you will have to specifically request to use the new MIDlet Visual Designer or not. The MVD can only be used with new NetBeans 4.1 projects.

The second shortcoming of the MVD is that all the visual components are embedded within the MIDlet class. Therefore, the MVD does not easily support the creation of independent (and reusable) forms, lists, alerts, etc. that can be shared by many MIDlets. Finally, the MVD does not support the visual development of Canvas-based user interfaces. Based on recent on-line chat sessions with the NetBean developers, the development team hopes to rectify some of these shortcomings in future releases of the Mobility Pack (the Transcript of the June 2 Chat on NetBeans Mobility Pack was still to be posted at the time of this writing—check this page under "Chats" for updates).

The Flow Designer offers a feature I have not seen in any J2ME IDE to date. The Flow Designer allows you to define the screens and actions that take users from one screen to the other in a visual manner (see Figure 5). For those developers working on applications with a complex user interface that allows users to move back and forth among screens with many commands, this tool can help you keep track of the user options and system reactions in your MIDlet. Again, the visual tool, in its current implementation, may limit the manner in which you implement your system (connecting almost everything through the MIDlet code), but it can help make sure you implement all the menu options that your users see.

Figure 5. Flow Designer: The Flow Designer allows you to see the relationship between MIDlet, screens, and the actions that take you to each.

In general, the MVD is a good first start to a set of visual editing tools that will make J2ME development user interfaces and application flow much easier. Coding GUI components by hand is a tiresome and error prone activity that will be greatly improved by MVD, especially when you can reverse engineer your current applications and build reusable GUI components like Forms.

Last month, I wrote an article about turning your J2ME devices into Web service clients. If you download and run the Web service included with that article, I have rewritten the accompanying J2ME client as a "Visual" MIDlet. Download the code associated with this current article and you will find three zip files in the download. Extract the contents of the GetQuote.zip into your NetBeans Projects folder (C:\Documents and Settings\<user folder> by default on Windows XP systems). After doing so, you should be able to open the project called GetQuote in the NetBeans IDE. If you open the GetQuoteMIDlet, you can view the GetQuoteMIDlet with the Screen and Flow Editors. Again, because the MVD requires all the visual components to be embedded within the MIDlet, the formerly separate EntryForm and PolicyList classes are now embedded into the GetQuote MIDlet class. If you get the Web service running from the last article, you can run the updated Visual MIDlet client against that Web service with no changes to the server-side.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap