Friday, October 3, 2008

Sun Tech Days 2008

The Brazilian edition of Sun Tech Days (September 29 & 30) opened up space for lightening talks.
Diamond Powder was presented among other projects.

Thanks to my friend Cristiano Monteiro, who was in the audience and took this pictures.

Here I am, at the middle of the stage. On the left, we see Vinicius Senger (SuperCRUD) and Mauricio Leal (Sun). Just behind them we see the projected Diamond Powder Logo.

Here, I'm telling the audience about the fuel consume control application, based on Diamond Powder. On the right we se the other lightening talk speakers: Vinicius Senger (about SuperCRUD), Jefferson Prestes (about PHP with Java), and Wagner Santos (Java EE 6 / EJB 3.1)

Wagner Santos, my friend, and a NetBeans Evangelist, helped me to set up the environment.

Friday, September 26, 2008

Runtime Delivered Schema

This sample was used to present Diamond Powder during Just Java 2008 and was shown to Roger Brinkley in the interview for Java Mobility Podcast.

The data collector that's been used collects time sheet entries. The cool features of this sample are:
  • The schema can be maintened outside the Midlet application, in a web application
  • The Midlet application is able to request new schema versions to some web server
  • The Collector is able to parse a new schema on the fly
First download the timesheet_dynamic sample from here.

You'll get two projects from the zip file:
  • dynaschema - is a regular NetBeans 6.1 Java EE Web project - once deployed to Tomcat it allows one to edit a schema definition using Diamond Powder syntax.
  • dynaschemaConsumer - is a data collector Midlet application that asks for a timesheet schema, through a HTTP connection.
The screen shot bellow shows the web application being accessed, with a predefined (and editable) schema:

Next we see the Midlet application running, and the first menu option, that has to be selected to request a schema (the application starts with no schema):

Once the schema is loaded from the web application we're able to enter some timesheet activities, and to browse amongst them:

The real fun starts when we switch back to the web application and type some new schema definitions - to enable schema edition, click on Define Schema link, on the main web app page:

In this example, we've added a second page, and modified the flow to introduce such page. Once the schema edition has been done, click on "submit button".

Now we can use the same running Midlet instance to load the brand new schema version (the 1st option on the main menu), and benefit from a more sophisticated data collector:
  • New activities will be collected along 2 pages;
  • Old collected activities can be reviewed to be complemented with cost account management info.

You can go further and define new pages and fields on the schema with the web application and reload it from the Midlet. Just keep in mind that this Midlet application manages timesheet entries, and expects to receive a schema named "timesheet", and browse amongst records that supply at least the following fields : "date", "time1" and "activity". If you change the schema name, or supress some of this three fields in the schema definition, the Midlet is supposed to stop working.

Thursday, September 25, 2008

Roger Brinkley at Just Java 2008

This year Just Java 2008 (a very important Brazilian Java conference) was remarkable, due to the presence of Roger Brinkley (the gentleman playing golf on the stage, below) - who is a Senior Engineer at Sun Microsystems and the Mobile & Embedded Community Leader at

Roger attended our congress to talk about several subjects concerning Java ME development:

In the picture below Roger attached a Sun Spot device at the end of his club and measured his "swing" in the graphics on the left.

Not only did he brought essential and up to date information to our community, but also interview Brazilian ME project developers, in order to disseminate such initiatives through Java Mobility Podcast.

In this context Diamond Powder was presented to him, and we discussed the project in a interview, released on Java Mobility Podcast.

In the next post I'll show a Time Sheet project, based on Diamond Powder, that was shown to Roger and used as example to present Diamond Powder to the Brazilian Java Community during the congress.

Saturday, September 6, 2008

Just Java 2008

From September 10th to 12th, in Sao Paulo, Brazil, the congress Just Java 2008 will take place.
This year I'll be presenting two talks with Wagner Santos:
  • Java EE 6 / EJB 3.1 and the future of Enterprise Java
  • Diamond Powder - Open Source Productivity with Java ME
For general information about the event, click here.
Check the programming here.

Sunday, August 24, 2008

PSP Adventure

Yesterday one of my students, Diego, brought his PSP (PlayStation Portable) to the class, and we had the opportunity to register Diamond Powder doing its job, through a PSP KVM.

We used the Fuel Control sample application, and the following details came up:
  • The responsiveness was very good, particularly in the brands filter screen;
  • In the absence of a keyboard this KVM implementation offers a virtual keyboard;
  • The LCDUI support takes advantage of the wide screen - the same didn't happen with some Java ME games, restricted to the screen right half.
There is a video capture right below.

If you're interested in testing Diamond Powder in your mobile device leave a comment here, or send an email to

Thanks Diego !

Wednesday, August 20, 2008

Summarize, Review, with Dynamic Fields

During data collection activities the user should have the opportunity to review info that has been entered. In the image on the right we see a review or summary screen from our fuel control application that allows the user to consider fields values, before storage.

Such screen can be easily defined in Diamond Powder schemas with the Dynamic Fileds concept: a field can use data defined in another field. In our example stringitem fileds capture their values from other fields previously manipulated by application user.

Here comes the how to:

// a review page, and its fields
schema.put("page.summary", "Please, review;" +
"summDate;summOdometer;" +
"summFuelAmount;summFuelPrice;summGSName;" +

// the dynamic fields
schema.put("field.summDate", "stringitem;when:;${date}");
schema.put("field.summOdometer", "stringitem;odometer:;${odometer}");
schema.put("field.summFuelAmount", "stringitem;fuel amount:;${fuelAmount}");
schema.put("field.summFuelPrice", "stringitem;fuel price:;${fuelPrice}");
schema.put("field.summGSName", "stringitem;gas station:;${gasStationName}");
schema.put("field.summGSBrand", "stringitem;brand:;${gasStationBrand}");
schema.put("field.summFacilit", "stringitem;facilities:;${facilities}");
schema.put("help.summary", "You're just one step from saving this record. Review your entries before proceeding.");

The ${field name} notation tells Dyamond Powder where to capture information from. We are using field names defined in the same schema.

In our example (add-cmd-diamond-powder) we reserved the last page to show dynamic fields, but this is not a rule. You could mix in the same page input fields and dynamic fields.

Thursday, August 14, 2008

Add Commands

Inside a data collector flow you can browse forward and backwards through pages.
What if the user needs to access another Midlet screen in the middle of data input ?
What if the user decides to abort the data input ?

Diamond Powder provides the possibility to add commands at will to a collector, because a collector is a Form. The only issue you must keep in mind is that you can have just one OK button and just one BACK button. Besides that, you are able to add how many SCREEN, CANCEL, EXIT commands you want, and wire them with other components inside your Midlet.

The add-cmd-diammond-powder example introduces a CANCEL command in the collector. From a command you can perform any navigation logic. In our example we'll see a alert screen preventing user from loss of data, and thus the possibility to go back to the current collector.

There is no surprise in source code:

collector = new Collector(getDisplay(), getSchema(), "basicRecord");

Wednesday, August 6, 2008

Diamond Powder Talk in São Paulo

In english:
On August 11th, at 7:00pm, we'll introduce the Diamond Powder project at Globalcode auditorium in São Paulo.

The following topics will be covered:

* Java ME basic concepts
* Rising productivity in Java ME with Diamond Powder
* Collaborating with Diamond Powder project
* DiamondPowder & SuperCRUD (Software Template Community)

If you're interested on collaborating with Diamond Powder project and are not able to show up, send an email, introducing yourself to

The same in portuguese:
No dia 11 de agosto às 19h apresentaremos o projeto Diamond Powder no auditório da Globalcode em São Paulo, onde os seguintes assuntos serão abordados:

* Conceitos básicos de Java ME: para quem quer começar a desenvolver para dispositivos móveis
* Aumentando a produtividade em Java ME: para quem quer utilizar o framework Diamond Powder em projetos.
* Participando do projeto Diamond Powder: para quem quer incrementar o currículo colaborando com um projeto Open Source.
* Diamond Powder e SuperCRUD: do Mobile ao Enterprise num piscar de olhos

Caso tenha interesse e não possa comparecer, apresente-se enviando um mini-currículo para:

Thursday, July 31, 2008

Once in a lifetime

The Developer's Conference 2008 was great !
The organizers have received very good feedback !
Congratulations !

A once in a lifetime photo:

me (diamond-powder), Ed Burns (JSF 2.0), Reza Rahman (EJB 3.1 / Java EE 6).

I have to save it for my grandchilds.

Beer at the end of day two:
Burr Sutter (Red Hat), Melissa and Yara (Globalcode), Edgar Silva (Red Hat), and me (diamond-powder)

First-class networking:
Rodrigo (GUJavaSC), Ed Burns (JSF 2.0), Wagner Santos (diamond-powder / netfeijao)

Tuesday, July 22, 2008

the developer's conferece 2008

During July 25 and 26 I'll be at the developer's conference - a Java Conference organized by Globalcode, in São Paulo - Brazil.

This year the conference gathers three international speakers:
  • Reza Rahman, EJB 3.1 expert group
  • Ed Burns, JSF 2.0 spec leader
  • Burr Sutter, SOA expert from JBoss

I'll speak on July 25 about Architectures of Persistence Layers in Java EE projects.
Sure, I'll be pleased to talk about diamond-powder with any one interested.

Friday, July 18, 2008

Monday, July 14, 2008

Moving backwards

The aim of diamond powder is to provide a simple way to construct data collectors inside JavaME MIDlets. The framework is based on LCDUI and RMS APIs, and do not demand any MIDP 2.0 feature.

Therefore, version 0.4 contains several refactors to adhere to CLCD-1.0 / MIDP-1.0 platform.
(Of course, it stills MIDP-2.0 compatible)

The add-cmd-diamond-powder sample project has been configured with CLCD-1.0 / MIDP-1.0 platform.

Friday, July 11, 2008

Multiple Choices

In our last example (too-many-choices) the MIDlet displays as last screen a ChoiceGroup that allows multiple selection:

This is possible due to the following schema configuration:

schema.put("field.facilities", "choicegroup;;allFacilities;multiple");

And the choicegroup is connected to the following listmodel:

"1;Air Pump;2;Oil Change;7;Car Wash;4;Snack Bar;6;Convenience Store;12;Repair Shop");

Two noteworthy related features:
  • A listmodel has a good reason for a requiring numerical ids for each displayable choice: it saves RMS - when a Collector is submited to a StorageManager, only the ids from selecteted choices are stored, as primitive shorts.

  • The filter componentes are able to deal with choicegroups whatever is their selection modes: exclusive or multiple.

Plus, one noteworthy non-related feature:
  • The last page doesn't have a help definition - in this case Diamond Powder manages to remove the Help Command from screen.

Monday, July 7, 2008

we've got some reinforcements

Wagner Santos, a former atendee of my Java classes, has been doing a great job in brazilian NetBeans community, and now Diamond Powder is pleased have him as a collaborator.
He is in charge of developing a Diamond Powder schema generation NetBeans plug-in.
Be very welcomed Wagner !

Thursday, July 3, 2008

Too many choices

We all know, many Java ME devices impose several restrictions in terms of user interface. The screen are small, the non-Qwerty keyboards are clumsy if you're not a SMS addicted.
It's not hard to figure out: the less you demand user typing, the more successful your mobile application is prone to be.
Well planed LCDUI ChoiceGroups are valuable to keep user away from typing.
When modeling a Data Collector inside a MIDlet I often find at least one big ChoiceGroup with too many elements to display. Indeed it can save user typing, however it poses another problem:the scrolling will be annoying with more than 15 ChoiceGroup elements.
It takes a turn for worse if your ChoiceGroup is huge: While acceptable in emulators at development time, a huge list can break your MIDlet once deployed to a real device. My Sony Ericsson K300i does not tolerate more than 256 ChoiceGroup elements.

Can Diamond Powder address this issue ?
Keep reading...

Everybody is used to fill suggestion boxes in Desktop or Web 2.0 applications. It handles big or huge lists of choices, and restrain it to small lists of choices.
If you have already tried Diamond Powder choicegroups and listmodels (see previous posts), you're exactly one line of schema configuration from building a kind of LCDUI suggestion box.

The too-many-choices sample brings a huge list of gas station brands: there are over 700 elements. It works with diamond-powder-0.3.jar (or newer).
We use the concept of Filter to shrink such a huge list of options. Take a look:

The field brandFilter is your (brand) new friend:

schema.put("field.brandFilter", "filter;brands filter;gasStationBrand;sorted");
  • filter: is the field type (actually it is rendered as a TextField)
  • 'brands filter': is the filter label
  • gasStationBrand: a choicegroup, that´s going to be 'filtered'
  • sorted: a flag telling our filter that the choicegroup elements are alphabetically sorted - it speeds up processing. The other values allowed here are 'unsorted' (the self-explanatory default), and 'initials'. During your experiences, try 'initials', and watch the difference.
The choicegroup gasStationBrand has a never seen before property:

schema.put("field.gasStationBrand", "choicegroup;brand;allBrands;exclusive;true");
  • true: It means that a choicegroup is completely ruled by a filter, from the very beginning - in this case, an empty filter will prevent from showing choicegroup elements (and prevent you MIDlet from crash in real world if your choicegroup is huge). Try 'false' (the default) and watch the difference.
Finally, listmodel allBrands carries too many gas station brands.

Monday, June 30, 2008

Save me !

Lets explore the RMS management available in Diamond Powder.
The MIDlet project save-me-diamond-powder deals with new records and enable old record edition through StorageManager.

The numbered arrows are related to the following relevant code fragments:

(1) The collector gains focus to receive a new record. There is no difference from previous sample (hello world)
(2) The collector finishes his job and a StorageManager saves collected data into a RMS record. We can store a new record or update an old one.

(3) The StorageManager is asked about all record numbers from a given schema. Afterwards, the StorageManager is manipulated to retrieve values from specific fields for each identified record. This gives us enough information to build a menu of old records.

(4) The StorageManager is manipulated to load a whole record into our collector. At this point we use the collector to edit a previously stored record.

Saturday, June 28, 2008

A Hello World, step by step on NetBeans

This step by step is based on NetBeans 6.1 with Mobility Pack.
Check this out: besides schema sintax there are only two Diamond Powder API elements to learn - a constructor and a method.
Download Diamond Powder JAR and this hello world sample project at

Please, choose a slide-show format:

Friday, June 27, 2008

Project created at

Hi everybody !
The Diamond Powder project has been created at
This blog is going to be supplied with examples, tips and articles about the use of this framework.

About Diamond Powder:
  • Diamond Powder is an open source Java ME framework that speeds up the creation of data collectors inside MIDP applications.
  • By data collector we understand a software component, that helps the user to quickly take note of informations, and also manages the storage of such information.
  • In order to describe a data collector (forms, fields, help messages) Diamond Powder uses a simple and straightforward format - aka schema, based on key-value pairs, that resembles LCDUI API.
  • A data collector schema can be stored inside the device or delivered at runtime.
  • The central point of Diamond Powder is that a schema is parsed at runtime and rendered as a sequence of LCDUI forms to allow user input.
  • At the end of user interaction Diamond Powder is able to store gathered data, and to deliver it to another MIDP application layer (validation, network, ...).
  • It is based on MIDP 1.0 and CLCD 1.0, and fits for NetBeans Mobility Pack.