I create menu options from a database.

I assign option manager with the following code:

            Command menuCommand = new Command() {
                public void execute() {
                        doSomething(id, url, ope);
                }
            };


is suitable this ??

My code is:

JSONArray items = response.get("o").isArray();

for (int i = 0; i < items.size(); i++) {
        JSONObject item = items.get(i).isObject();
        String id = ((JSONString) item.get("id")).stringValue();
        String url = ((JSONString) item.get("url")).stringValue();
        String ope = ((JSONString) item.get("ope")).stringValue();
        String caption = ((JSONString) item.get("caption")).stringValue();
        MenuBar opcion = new MenuBar(true);
        opcion.setAnimationEnabled(true);
        menu.addItem(new MenuItem(caption,opcion));

        JSONArray opciones = item.get("opc").isArray();

        for (int j = 0; j < opciones.size(); j++) {

                JSONObject opcion2 = opciones.get(j).isObject();

                final String caption2 = ((JSONString) opcion2.get
("caption")).stringValue();

            Command menuCommand = new Command() {
                public void execute() {
                        doSomething(id, url, ope);
                }
            };

                opcion.addItem(caption2,menuCommand);

        }
}




Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to