the problem is that in method getItems() of Menu.java is created an array of
basemenuitem in the called method
convertFromNativeBaseItemsArray,
this is the code:
public BaseItem[] getItems() {
JavaScriptObject nativeArray = getItems(getOrCreateJsObj());
return convertFromNativeBaseItemsArray(nativeArray);
};
private static BaseItem[]
convertFromNativeBaseItemsArray(JavaScriptObject nativeArray) {
JavaScriptObject[] itemsj =
JavaScriptObjectHelper.toArray(nativeArray);
BaseItem[] items = new BaseItem[itemsj.length];
for (int i = 0; i < itemsj.length; i++) {
JavaScriptObject item = itemsj[i];
items[i] = new BaseItem(item);
}
return items;
}
Any suggestion to retrieve simply the value of checked attribute??
Bye Patrizio
2009/5/28 Patrizio De Michele <[email protected]>
> Hi,
> it's the second time i meet a strange (for me) problem using Menu.
> i have a ToolBarMenuButton with attached a Menu, this menu
> contains various CheckMenuItems.....
> When i call menu.getItems() it returns an array of BaseItem and not
> CheckItem so i can't call item.isChecked() to control if is checked or not.
> Did someone encountered the same problem?
> Did you know a solution/trickaround?
> Is it my fault assuming that getItems() should return CheckItem instead of
> BaseMenuItem?
>
> Source Code Follows:
> .
> .
> .
> .
> final ToolbarMenuButton toolbarMenuCCButton = new
> ToolbarMenuButton("CODES");
> //menu creation
> final Menu menu = new Menu();
> int i=0;
> for (Iterator<String> iterator = codes.iterator(); iterator.hasNext(); ++i)
> {
> final CheckItem checkItem = new CheckItem(iterator.next());
> menu.addItem(checkItem);
> }
> toolbarMenuCCButton.setMenu(menu);
>
> //item retrieving
> BaseItem[] biMenu = menu.getItems();
> for (int i = 0; i < biMenu.length; i++) {
> if (((CheckItem)biMenu[i]).isChecked()) {//this doesn't work because
> isn't a CheckItem but a BaseItem
> choosedCcodes.add(biMenu[i].getTitle());
> }
> }
> .
> .
> .
>
> I hope someone could help me,
> bye Patrizio
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" 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/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---