@Test public void testBuildItemWithNormalIsWidget() { BaseMenuCustom menuItem = (BaseMenuCustom) MenuUtils.buildItem(isWidget); assertEquals(widget, menuItem.build()); menuItem.setEnabled(true); assertTrue(menuItem.isEnabled()); menuItem.setEnabled(false); assertFalse(menuItem.isEnabled()); }
public static MenuItem buildItem(final IsWidget widget) { return new MenuFactory.CustomMenuBuilder() { @Override public void push(MenuFactory.CustomMenuBuilder element) { } @Override public MenuItem build() { return new BaseMenuCustom<Widget>() { @Override public Widget build() { return widget.asWidget(); } @Override public boolean isEnabled() { if (widget instanceof HasEnabledIsWidget) { return ((HasEnabledIsWidget) widget).isEnabled(); } else { return super.isEnabled(); } } @Override public void setEnabled(boolean enabled) { if (widget instanceof HasEnabledIsWidget) { ((HasEnabledIsWidget) widget).setEnabled(enabled); } else { super.setEnabled(enabled); } } }; } }.build(); }
MenuUtils { public static MenuItem buildItem(final IsWidget widget) { return new MenuFactory.CustomMenuBuilder() { @Override public void push(MenuFactory.CustomMenuBuilder element) { } @Override public MenuItem build() { return new BaseMenuCustom<Widget>() { @Override public Widget build() { return widget.asWidget(); } @Override public boolean isEnabled() { if (widget instanceof HasEnabledIsWidget) { return ((HasEnabledIsWidget) widget).isEnabled(); } else { return super.isEnabled(); } } @Override public void setEnabled(boolean enabled) { if (widget instanceof HasEnabledIsWidget) { ((HasEnabledIsWidget) widget).setEnabled(enabled); } else { super.setEnabled(enabled); } } }; } }.build(); } }
MenuUtils { public static MenuItem buildItem(final IsWidget widget) { return new MenuFactory.CustomMenuBuilder() { @Override public void push(MenuFactory.CustomMenuBuilder element) { } @Override public MenuItem build() { return new BaseMenuCustom<Widget>() { @Override public Widget build() { return widget.asWidget(); } @Override public boolean isEnabled() { if (widget instanceof HasEnabledIsWidget) { return ((HasEnabledIsWidget) widget).isEnabled(); } else { return super.isEnabled(); } } @Override public void setEnabled(boolean enabled) { if (widget instanceof HasEnabledIsWidget) { ((HasEnabledIsWidget) widget).setEnabled(enabled); } else { super.setEnabled(enabled); } } }; } }.build(); }  }
MenuUtils { public static MenuItem buildItem(final IsWidget widget) { return new MenuFactory.CustomMenuBuilder() { @Override public void push(MenuFactory.CustomMenuBuilder element) { } @Override public MenuItem build() { return new BaseMenuCustom<Widget>() { @Override public Widget build() { return widget.asWidget(); } @Override public boolean isEnabled() { if (widget instanceof HasEnabledIsWidget) { return ((HasEnabledIsWidget) widget).isEnabled(); } else { return super.isEnabled(); } } @Override public void setEnabled(boolean enabled) { if (widget instanceof HasEnabledIsWidget) { ((HasEnabledIsWidget) widget).setEnabled(enabled); } else { super.setEnabled(enabled); } } }; } }.build(); }  static MenuItem buildItem(final IsWidget widget); static HasEnabledIsWidget buildHasEnabledWidget(final Button button); static HasEnabledIsWidget buildHasEnabledWidget(final ButtonGroup buttonGroup,
                                                           final Button button); }
MenuUtils { public static MenuItem buildItem(final IsWidget widget) { return new MenuFactory.CustomMenuBuilder() { @Override public void push(MenuFactory.CustomMenuBuilder element) { } @Override public MenuItem build() { return new BaseMenuCustom<Widget>() { @Override public Widget build() { return widget.asWidget(); } @Override public boolean isEnabled() { if (widget instanceof HasEnabledIsWidget) { return ((HasEnabledIsWidget) widget).isEnabled(); } else { return super.isEnabled(); } } @Override public void setEnabled(boolean enabled) { if (widget instanceof HasEnabledIsWidget) { ((HasEnabledIsWidget) widget).setEnabled(enabled); } else { super.setEnabled(enabled); } } }; } }.build(); }  static MenuItem buildItem(final IsWidget widget); static HasEnabledIsWidget buildHasEnabledWidget(final Button button); static HasEnabledIsWidget buildHasEnabledWidget(final ButtonGroup buttonGroup,
                                                           final Button button);  }