J2ME Hashtable question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WaluigiCubed
    New Member
    • Jan 2008
    • 12

    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.

    Code:
    public Hashtable getSchema() {
            Hashtable schema = new Hashtable();
    
            //schema declaration:  name;version
            schema.put("schema", "mobileDataPort;1");
            //flow declaration: page1;page2;...
            schema.put("flow.basicRecord", "addressInfo");
            //page declaration: title;field1;field2;...
            schema.put("page.addressInfo", "Address Info;addrCity;timeWindow;spcInst" +
                    ";arrivalTime;pro;loose;skids;weight;hazmat;emptySpots;exception;notes;departureTime");
    
            schema.put("field.addrCity", "stringitem;Milwaukee, WI");
            schema.put("field.timeWindow", "stringitem;7/20/09 3:20:00 PM");
            schema.put("field.spcInst", "stringitem;Only deliver on Wednesdays");
            schema.put("field.arrivalTime", "datefield;Arrival Time");
            schema.put("field.pro", "textfield;Pro;20;abc");
            schema.put("field.loose", "textfield;Loose;20;abc");
            schema.put("field.skids", "textfield;Skids;20;abc");
            schema.put("field.weight", "textfield;Weight;20;abc");
            schema.put("field.hazmat", "textfield;Hazmat;20;abc");
            schema.put("field.emptySpots", "textfield;Empty Spots;20;abc");
            schema.put("field.exception", "textfield;Exception;20;abc");
            schema.put("field.notes", "textfield;Notes;20;abc");
            schema.put("field.departureTime", "datefield;Departure Time;");
    
    //        //choice gorup declaration: field type;label;list model;mode
    //        schema.put("field.gasStationBrand",
    //                        "choicegroup;brand;allBrands;exclusive");
    //        //list model declaration: value1;label1;value2;label2;...
    //        schema.put("listmodel.allBrands",
    //                        "999;undefined;1;Atlantic;2;Chevron;3;Esso;4;Texaco");
    
            return schema;
        }
    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("fie ld.gasStationBr and", "choicegroup;br and;allBrands;e xclusive");

    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!
Working...