I'm wondering about the setCheckIfCondition() method of the MenuItem class, I just created a menu, and want it's item to automatically select one item based on some external condition (the callback)
here's the code (this method is from a class extending Menu) :
the problem is that the callback never gets called. Perhaps I'm missing something here?
here's the code (this method is from a class extending Menu) :
Code:
public void addMenuItem(String title, final Tab tab) { MenuItem menuItem = new MenuItem(title); menuItem.setCheckIfCondition(new MenuItemIfFunction() { @Override public boolean execute(Canvas target, Menu menu, MenuItem item) { Window.alert(item.getTitle()); return GridTabs.getInstance().getTabSet().getSelectedTab().equals(tab); } }); menuItem.addClickHandler(new ClickHandler() { @Override public void onClick(MenuItemClickEvent event) { GridTabs.getInstance().getTabSet().selectTab(tab); Application.getInstance().doSessionCheck(); } }); addItem(menuItem); }
Comment