Xoetrope

 Wiki : XuiMobileMIDP

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Xui Mobile MIDP version


LCDUI/MIDP support has now been added to XUI as an incubator project under a GPL license (for now). The new support provides for the same declarative specification of the GUI, the events, validations and data bindings.

Like the desktop version of XUI the MIDP version supports the declarative file format for creating the LCDUI and for specifying events, validations and data bindings.

Difference from XUI on the Desktop

The MIDP profile does not support reflection and this means that XUI's event handling must be slightly different to that used for Java SE. The MIDP version therefore includes an "invoke" method:

public void invoke( String method, String[] args )
{
}


where the method parameter is the name of the method to be invoked.

The NanoXML parser used in the SE version is not suitable for Java ME and therefore a minimal XML parser has been included in the source. The parser just supports what XUI needs, it does not validate and so far it does not allow the inclusion of comments.

A Simple Example

The following XML defines a simple form with some test components (please not that this example is more of a test case than an example of how an application should appear!):

<?xml version="1.0" encoding="UTF-8"?>
<XPage class="test.project.Welcome">
  <Components>
	<Ticker content="Hello World, Welcome to MIDP XUI"/>
	<DateField label="Date:" date="1198368000000"/>
	<Image label="Image:" content="/xui_icon.png"/>
	<TextField label="Text Field:" content="Testing 1,2,3"/>
	<Label label="A Label:" content="How did I get here?"/>
  </Components>
  <Events>
	<Event method="showPage" args="next" type="OK"/>
  </Events>
</XPage>


this gets rendered as (click to enlarge):



the page includes a link to another test page:

<?xml version="1.0" encoding="UTF-8"?>
<XPage class="test.project.Welcome">
  <Components>
	<Ticker content="This is page TWO 2 TWO 2"/>
	<TextField name="speciesField" label="Data bound value:" content="THIS SHOULD BE REPLACED!"/>
  </Components>
  <Events>
	<Event method="home" args="next" type="OK"/>
  </Events>
  <Data>
	<Bind target="speciesField" source="coffee/species/1"/>
  </Data>
</XPage>


and in turn this second page is rendered as



both pages rely on the same Java class for their navigation:

package test.project;

import net.xoetrope.midp.XImageItem;
import net.xoetrope.xui.XPage;


/**
 *  A simple test page showing some MIDP components
 * @author luano
 */
public class Welcome extends XPage
{
  private XImageItem myImg;
  
  public Welcome()
  {    
  }
  
  public void pageCreated()
  {
	    // Lookup/attach a component
	myImg = (XImageItem)findComponent( "myImg" );
  }
  
  public void invoke( String method, String[] args )
  {
	if ( "showPage".equals( method ))
	  showPage( "PageTwo" );
	else if ( "home".equals( method ))
	  showPage( "Welcome" );
  }
}


In the above example the data bound to the text widget on the second page comes from an XML file:

<Datasets>
  <dataset id="coffee">
	<list id="species">
	  <item value="Arabica" id="1" /> 
	  <item value="Benghalensis" id="2" /> 
	  <item value="Bonnieri" id="6" /> 
	  <item value="Canephora" id="3" /> 
	  <item value="Congensis" id="4" /> 
	  <item value="Excelsa" id="5" /> 
	  <item value="Gallienii" id="6" /> 
	  <item value="Mogeneti" id="7" /> 
	  <item value="Liberica" id="8" /> 
	  <item value="Stenophylla" id="9" /> 
	</list>
  </dataset>
  <dataset id="customer">
	<data id="dob" value="01/01/1970" /> 
  </dataset>
</Datasets>


In this case the data a static datasource, but XUI can also load data from database, web services and other dynamic sources.

Size

The XUI MIDP package stands at about 200K but we expect that this can be shrunk to about 100K when some of the Java SE features that are not appropriate to MIDP are stripped out. Some of the classes and interfaces provided in the SE version may also be coalesced to compact the library as the features they provide are not possible for a MIDP device.

Status

XUI's MIDP support is in incubator form, use at your own discretion!

So far the implementation includes the basic elements of XUI for building LCDUI forms and specifying events. The remaining features should follow shortly and should use the same mechanism. In particular only basic support for the Form. List, Alert and TextBox containers/displayables is implemented and all but the Form container need some refactoring.

The component registration has been reinserted and no longer relies on reflection. The registration of component factories allows support for the inclusion of third party components/widgets.

Basic data binding has also been enabled for the text components (and the rest is just a matter of choosing suitable interfaces for the remaining components). The example application now includes some basic text bindings on page 2.

Once the initial implementation is complete the framework will be put on a diet so as to shrink the implementation and remove unnecessary methods and interfaces left over from the port from Java SE.

License

The XUI MIDP version is released under the GPL license, but please note that this may change prior to a full release.

Getting Involved

We are looking for experienced mobile developers to become involved in testing, evaluation and development. If you would like to get involved please contact me (luano at xoetrope.com).

There are no comments on this page. [Add comment]

Page was generated in 0.1184 seconds