SmartGWT 2.5 in Chrome (but probably others too)
Here is a CheckedMenuItem class I built so that the graphical display would look like the underlying status. If I call getChecked() the state is reported correctly, but I can't seem to get the menu to reflect this by hiding/displaying the checkbox.
Here is a CheckedMenuItem class I built so that the graphical display would look like the underlying status. If I call getChecked() the state is reported correctly, but I can't seem to get the menu to reflect this by hiding/displaying the checkbox.
Code:
package com.imagehawk.tcv.client; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.menu.Menu; import com.smartgwt.client.widgets.menu.MenuItem; import com.smartgwt.client.widgets.menu.MenuItemIfFunction; public class CheckedMenuItem extends MenuItem implements MenuItemIfFunction { private boolean isChecked = true; CheckedMenuItem(String title) { super(title); this.setChecked(this.isChecked); this.setCheckIfCondition(this); } @Override public void setChecked(Boolean checked) { isChecked = checked; super.setChecked(checked); } @Override public boolean execute(Canvas target, Menu menu, MenuItem item) { CheckedMenuItem thisItem = (CheckedMenuItem)item; return thisItem.isChecked; } }
Comment