blob: 66c8e3ff253e61e7a5f99ee2137e1148628331fd [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!--
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-->
<head>
<link rel="stylesheet" type="text/css" href="../../netbeans.css">
<meta name="author" content="Mobile Distillery">
<meta name="keywords">
<meta name=""
content="NetBeans IDE, Mobile Distillery, Celsius Porting Suite, Java ME, Device Fragmentation">
<title>How to Easily Manage Device Fragmentation Directly from
NetBeans IDE with the Celsius Automated Porting Suite</title>
</head>
<body>
<h1><img style="width: 192px; height: 97px;" alt="ICEfaces"
src="../../images_www/partners/mobiledistillery.jpg" align="right">How to
Easily Manage Device Fragmentation Directly from NetBeans IDE
with the Celsius Automated Porting Suite</h1>
<br>
Deploying a new technology that enables mobile application development
is never easy and providing developers with a familiar environment they
can master is critical. When Sun Microsystems delivered the NetBeans
IDE (Integrated Development Environment), many mobile application
developers adopted this solution due to its usability and ease of
learning. <br>
<br>
Mobile Distillery quickly recognized the need to integrate its
solution, Celsius, with the IDE. Celsius enables automatic porting of
mobile applications from a single code source bringing this powerful
development and debugging solution in a familiar environment to the
developer community. Now Celsius, in partnership between Sun
Microsystems and Mobile Distillery, is fully integrated into the
NetBeans IDE to help developers in every step of their work by offering
a plug-in to create ports of mobile application projects and allow them
access to the broad range of tools offered by Mobile Distillery.<br>
<br>
One example of this solution is a UI (User Interface) that combines
functional engineering and personalized appearance linked by a
Bluetooth connection. This is no easy task when using only what is
available to Java ME developers. One basic approach is to link all of
the classes to a form and the other components used and refer to JSR-82
documentation to establish the requirements for Bluetooth connections.
However it is clearly impossible to personalize
the components placement (combo box, radio buttons, etc) or to
implement customized branding of the UI. The other challenge developers
face is managing JSR-82 implementations that do not work properly
on a number of handsets.<br>
<br>
The aim of this article is to highlight how simple and reliable
programming an application becomes when using Celsius, and how the
integration with NetBeans makes things even easier.<br>
<br>
<h2>NetBeans and Celsius: Complete Integration</h2>
Let&#8217;s see how integration is done in NetBeans IDE.<br>
<br>
<h3>After Installation of the Plugin</h3>
<br>
<img style="width: 860px; height: 245px;" alt="Installation of Plugin"
src="../../images_www/articles/mobiledistillery-celcius-porting/installation.png"><br>
<br>
<h3>Creating the Project</h3>
<br>
<img style="width: 725px; height: 247px;" alt="Creating the Project"
src="../../images_www/articles/mobiledistillery-celcius-porting/create-project.png"><br>
<br>
<br>
<img style="width: 739px; height: 242px;" alt="Creating the Project2"
src="../../images_www/articles/mobiledistillery-celcius-porting/create-project2.png"><br>
<br>
Once the project has been created, the developer is provided with a
personalized environment. The project is added to the workspace and
access to the main classes of a mobile applications (Midlet and Canvas)
can easily be found. Code can be added where appropriate to take full
advantage of features provided by NetBeans in accessing JavaDoc
libraries. The developer can also use the auto-completion feature to
get an overview of the different classes offered by Celsius. Thus we
discover how this solution manages different APIs in the form of simple
modules.<br>
<br>
<h3>Workspace and CelsiusCanvas</h3>
<br>
<img style="width: 325px; height: 534px;"
alt="Workspace and Celsius Canvas"
src="../../images_www/articles/mobiledistillery-celcius-porting/celcius-canvas.png"><br>
<br>
<br>
<img style="width: 534px; height: 395px;"
alt="Workspace and Celsius Canvas2"
src="../../images_www/articles/mobiledistillery-celcius-porting/celcius-canvas2.png"><br>
<br>
<span style="font-weight: bold;"></span>
<h2>Graphical User Interface and BlueTooth: How to
Easily Set Up Elements<br>
</h2>
Applications providing UI components for editing data often use system
methods (Form, Editbox, Combobox, etc) to quickly display components.
Unfortunately this does not address several problematic issues such as
the list management or navigation between different screens.
Because the system components do not offer customization either in
terms of rendering or placement, it becomes difficult to provide a
compelling and user friendly experience. Furthermore, whatever the type
of application, the developer is faced with similar and even identical
limitations, without having a chance to make modifications.<br>
<br>
Developers and project managers are therefore forced to adapt the
application specification (eg: storyboards&nbsp; or scenarios) to the
system layer's capability, and they cannot create the designs they
want,
but instead must deal with system limitations. Additionally, the
requirement of obtaining homogeneous graphical rendering, regardless of
the device properties (screen size, MIPD type, colors, etc.), makes it
difficult to handle due to the varied manufacturer implementations.
Once
that is achieved, the Bluetooth issue still needs to be resolved to
establish connectivity and offer the latest mobile application
development capabilities.<br>
<br>
The following section aims to illustrate what it is necessary to
overcome these limitations.<br>
<br>
<h2>Using Celsius in NetBeans: Simplicity and Ease of Use</h2>
<ol>
</ol>
The UI developer is provided a user-friendly template with a simplified
architecture to get started and has advanced functionality available
that is made easily understandable by the JavaDoc integration in <br>
NetBeans. All of the tools used for developing an application (e.g. the
Resource Manager) can be directly accessed from within the standard
NetBeans interface and the developer including the project source code
and the Visual Editor linked to the project.<br>
<br>
<h3>JavaDoc</h3>
<br>
<img style="width: 654px; height: 195px;" alt="JavaDoc"
src="../../images_www/articles/mobiledistillery-celcius-porting/javadoc.png"><br>
<h3>Toolbar</h3>
<br>
<img style="width: 726px; height: 61px;" alt="Toolbar"
src="../../images_www/articles/mobiledistillery-celcius-porting/toolbar.png"><br>
<br>
Once these concepts are understood, the developer can launch the
application and observe the interactions as well as the start up
process and easily modify the proposed source code to add new
functionalities such as a Bluetooth connection.<br>
<br>
Below is the result of an application launch generated by the template.
After launch we can alter the main menu to add new functionality and
enable Bluetooth connection management.<br>
<h3>Main Menu and Capture Screen</h3>
<br>
<img style="width: 319px; height: 724px;" alt="Main Menu"
src="../../images_www/articles/mobiledistillery-celcius-porting/main-menu.png">
<img style="width: 325px; height: 725px;" alt="Capture Screen"
src="../../images_www/articles/mobiledistillery-celcius-porting/capture-screen.png"><br>
<br>
These screens can quickly be personalized using a feature directly
accessible from the NetBeans toolbar. The launch of the Resource
Manager allows the developer to access and modify resources such as
images, texts, and sounds, apply the changes and watch the results
obtained -- all during the development phase. This allows any necessary
changes to be made before the application is released.<br>
<h3>The Resources Manager</h3>
<ol>
</ol>
<img style="width: 714px; height: 381px;" alt="Resources Manager"
src="../../images_www/articles/mobiledistillery-celcius-porting/resource-manager.png"><br>
<br>
<h2>Adding Functionality: Using Templates</h2>
The application template architecture that manages the UI is very easy
to access and makes adding new functionality very simple. We will add a
new option for managing Bluetooth connections in the main menu of the
generated application.<br>
<h3>Main Menu<br>
</h3>
<br>
<img style="width: 373px; height: 313px;" alt="Main Menu"
src="../../images_www/articles/mobiledistillery-celcius-porting/main-menu2.png"><br>
<br>
<h3>Modified Main Menu</h3>
<br>
<img style="width: 385px; height: 344px;" alt="Modified Main Menu"
src="../../images_www/articles/mobiledistillery-celcius-porting/modified-menu.png"><br>
<h3>Adding New Functionality</h3>
<br>
<img style="width: 806px; height: 460px;" alt="New Functionality"
src="../../images_www/articles/mobiledistillery-celcius-porting/new-functionality.png"><br>
<br>
Let&#8217;s look at the results now:<br>
<h3>The New Main Menu</h3>
<br>
<img style="width: 315px; height: 661px;" alt="New Main Menu"
src="../../images_www/articles/mobiledistillery-celcius-porting/new-menu.png"><br>
<br>
Notice that with just a few added lines it's simple to add new screens.
Using the Resource Manager makes&nbsp; modifying the look and feel of
applications easy and we can test as many games or graphical sets as
often as needed. Once this new functionality for managing Bluetooth
is integrated in the interface it uses Celsius advanced methods.
<br>
<br>
By making some simplified classes available to the developer, managing
Bluetooth becomes as simple as it can be.<br>
<br>
<h2>An Example of Simple Device Searching Using Celsius:</h2>
Simple device searching source code:<br>
<br>
<span style="font-weight: bold;">package</span> MyMidlet;<br>
&nbsp;<br>
<span style="font-style: italic;">import
com.mobiledistillery.celsius.wireless.bluetooth.*;</span><br
style="font-style: italic;">
<span style="font-style: italic;">import javax.bluetooth.UUID;</span><br
style="font-style: italic;">
<span style="font-style: italic;">import javax.bluetooth.ServiceRecord;</span><br
style="font-style: italic;">
<span style="font-style: italic;">import javax.bluetooth.RemoteDevice;</span><br>
&nbsp;<br>
<span style="font-weight: bold;">public class</span> BtDemoDevices <span
style="font-weight: bold;">extends</span> BtDemoBase <span
style="font-weight: bold;">implements</span>
CelsiusBluetoothListener<br>
{<br>
&nbsp;&nbsp;&nbsp; // will search for all devices, not mobiles only<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public static</span>
int BLUETOOTH_CLASS = 0;<br>
&nbsp;&nbsp;&nbsp; // no name matching, all devices will be retrieved<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public static</span>
String BLUETOOTH_MATCHNAME = "";<br>
&nbsp;&nbsp;&nbsp; // if we want to first search a "known" device, to
get rid of inquiry time<br>
&nbsp;&nbsp;&nbsp; // (the inquiry will be performed only if the device
is not found)<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public static</span>
String BLUETOOTH_START = "";<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public</span>
CelsiusBluetoothCommunication btComm;<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public</span>
BtDemoDevices(BluetoothScreenReport
screenReport)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">super</span>(screenReport);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; btComm = <span
style="font-weight: bold;">new</span>
CelsiusBluetoothCommunication(<span style="font-weight: bold;">true</span>);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Does this mobile supports JSR
82 ?<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (btComm.getStatus() ==
CelsiusBluetoothCommunication.STATUS_INIT_ERROR)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; report("Error
: JSR 82 is certainly not correctly supported !");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span
style="font-weight: bold;">return</span>;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // this class will be the listener<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; btComm.setSearchListener(<span
style="font-weight: bold;">this</span>);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // will retrieve cached &amp;
preknown devices<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; btComm.setRetrieveDevices(<span
style="font-weight: bold;">true,
true</span>);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // discover timeout to 5 minutes,
service search timer to 1 minute<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; btComm.setTimeout(300000, 60000);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // launch search : find(boolean
searchDevices, boolean searchServices, int device_class, String
matchName, String startAddr, UUID uuid, boolean firstOnly)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!btComm.find(<span
style="font-weight: bold;">true, false</span>,
BLUETOOTH_CLASS, BLUETOOTH_MATCHNAME, BLUETOOTH_START, <span
style="font-weight: bold;">null, false</span>))<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; report("Error : " + btComm.getErrorMessage());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp;
report("Processing ...");<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public</span> void
close()<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; btComm.close();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; btComm = <span
style="font-weight: bold;">null</span>;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public</span> void
notifySearchEvent(int status)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch(status)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case
CelsiusBluetoothCommunication.STATUS_SEARCH_ERROR:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; report("Error : " + btComm.getErrorMessage());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">break</span>;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case
CelsiusBluetoothCommunication.STATUS_SEARCH_COMPLETE:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; report("Inquiry complete (" +
Integer.toString(btComm.getFinder().getInquiryDuration()) + " ms)");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; report("Names retrieved (" +
Integer.toString(btComm.getFinder().getAskNamesDuration()) + " ms)");<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; // Display found devices information<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; for (int i=0;
i&lt;btComm.getFinder().getDevices().size(); i++)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Report found devices<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
report((String)(btComm.getFinder().getDevicesAddresses().elementAt(i))
+ <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; "
- " + <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
(String)(btComm.getFinder().getDevicesNames().elementAt(i)));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">break</span>;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case
CelsiusBluetoothCommunication.STATUS_INIT_ERROR:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; report("Error : Bluetooth is certainly turned off");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">break</span>;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public</span> void
deviceFound(RemoteDevice btDevice) <br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // to debug window only ...<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println("[Client]
deviceFound listener : " + <br>
btDevice.getBluetoothAddress());<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">public</span> void
serviceFound(RemoteDevice btDevice,
ServiceRecord[] servRecord) <br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // to debug window only ...<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println("[Client]
serviceFound listener : " + <br>
btDevice.getBluetoothAddress());<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
<h2>Conclusion:</h2>
Promoting a middleware technology such as Celsius through an IDE like
NetBeans is without any doubt a straightforward way of approaching the
mobile developer community by offering them ease of use in both the
environment and the technology. Resource management facilitated by
NetBeans enables this single source code approach. Auto-completion,
Syntax analysis, JavaDocs, and the tools for developing and debugging
translates into considerable help for developers that need to create a
huge number of mobile applications rich in content and functionality.
The learning curve for new Celsius users is thus reduced to a minimum
by utilizing the familiar habits formed during years of practice with a
tool like NetBeans IDE.<br>
<br>
<small><span style="font-weight: bold;">Basics of the Celsius mobile
applications automated porting
suite:</span> Based on an exclusive <span style="font-weight: bold;">Parametric
Development&reg; architecture</span> and on
more than 7 years of research in mobile technologies and in-depth
device knowledge, Celsius allows developers from <span
style="font-weight: bold;">one Java ME source
code to automatically port</span> different optimized versions of their
application across more than 1000 <span style="font-weight: bold;">Java,
Brew and Windows Mobile</span> devices
worldwide. With Celsius, developers can create complex applications
harnessing mobile technologies like Bluetooth, rich multimedia, (NFC)
Near Field Communications, and the mobile web using integrated code
libraries and its comprehensive development tools. With Celsius,
developers can experience Hassle Free Mobile Development &amp; Porting
<span style="font-weight: bold;">Directly from within NetBeans IDE</span>.
More features on
<a href="http://www.mobile-distillery.com">www.mobile-distillery.com</a></small><br>
<br>
<div style="text-align: right;"><span style="font-style: italic;">(November
2008)</span> <br>
</div>
<br>
<br>
</body>
</html>