469,343 Members | 5,686 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

J2ME Hashtable question

Hi all,

I'm designing a phone application using J2ME that uses the Open Source Diamond Powder methodology. The below getSchema method will eventually read in data to build screens on the phone dynamically from an XML file, but for now I've hard coded the method to do some testing. My code below is working just fine, and it is generating the screen the way I expect it to.

Expand|Select|Wrap|Line Numbers
  1. public Hashtable getSchema() {
  2.         Hashtable schema = new Hashtable();
  4.         //schema declaration:  name;version
  5.         schema.put("schema", "mobileDataPort;1");
  6.         //flow declaration: page1;page2;...
  7.         schema.put("flow.basicRecord", "addressInfo");
  8.         //page declaration: title;field1;field2;...
  9.         schema.put("page.addressInfo", "Address Info;addrCity;timeWindow;spcInst" +
  10.                 ";arrivalTime;pro;loose;skids;weight;hazmat;emptySpots;exception;notes;departureTime");
  12.         schema.put("field.addrCity", "stringitem;Milwaukee, WI");
  13.         schema.put("field.timeWindow", "stringitem;7/20/09 3:20:00 PM");
  14.         schema.put("field.spcInst", "stringitem;Only deliver on Wednesdays");
  15.         schema.put("field.arrivalTime", "datefield;Arrival Time");
  16.         schema.put("field.pro", "textfield;Pro;20;abc");
  17.         schema.put("field.loose", "textfield;Loose;20;abc");
  18.         schema.put("field.skids", "textfield;Skids;20;abc");
  19.         schema.put("field.weight", "textfield;Weight;20;abc");
  20.         schema.put("field.hazmat", "textfield;Hazmat;20;abc");
  21.         schema.put("field.emptySpots", "textfield;Empty Spots;20;abc");
  22.         schema.put("field.exception", "textfield;Exception;20;abc");
  23.         schema.put("field.notes", "textfield;Notes;20;abc");
  24.         schema.put("field.departureTime", "datefield;Departure Time;");
  26. //        //choice gorup declaration: field type;label;list model;mode
  27. //        schema.put("field.gasStationBrand",
  28. //                        "choicegroup;brand;allBrands;exclusive");
  29. //        //list model declaration: value1;label1;value2;label2;...
  30. //        schema.put("listmodel.allBrands",
  31. //                        "999;undefined;1;Atlantic;2;Chevron;3;Esso;4;Texaco");
  33.         return schema;
  34.     }
I have a question, though. The example line of code below adds a radio (option) button group to the screen based on a list model called allBrands (for the sake of the question, the name of the field doesn't actually matter):

schema.put("field.gasStationBrand", "choicegroup;brand;allBrands;exclusive");

Now, if I replace the word exclusive with multiple, the radio button group becomes a check box group. But if I replace the word exclusive with popup, instead of formating the field as a combo box, it formats it on the screen as a radio button group. My question is, how do I format a field as a combo box on the mobile device screen instead of a radio button or check box group?

Also, is there any way to force the textfields that I'm adding to the hash table to have the label and text box appear on the same line, regardless of the size (max. number of characters) of the string that can be entered into the text box? Right now, the text box is appearing under the label associated with it, but I want these two to appear on the same line. Is there anyway to make this happen?

Thanks in advance!
Jul 22 '09 #1
0 2439

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Dave Rathnow | last post: by
1 post views Thread by Sveta | last post: by
1 post views Thread by Ralph Yozzo | last post: by
3 posts views Thread by pei_world | last post: by
5 posts views Thread by francois | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.