use of com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler in project gwt-test-utils by gwt-test-utils.
the class WindowTest method hide.
@Test
public void hide() {
// Given
window.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
assertThat(event.getSource()).isEqualTo(window);
hide = true;
}
});
window.show();
// When
window.hide();
// Then
assertThat(hide).isTrue();
}
use of com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler in project activityinfo by bedatadriven.
the class LogicalTabPanel method onItemContextMenu.
protected void onItemContextMenu(final M item, int x, int y) {
if (closeMenu) {
if (closeContextMenu == null) {
closeContextMenu = new Menu();
closeContextMenu.addHideHandler(new HideHandler() {
@Override
public void onHide(HideEvent event) {
contextMenuItem = null;
}
});
closeContextMenu.add(new MenuItem(getMessages().closeTab(), new SelectionHandler<MenuItem>() {
@Override
public void onSelection(SelectionEvent<MenuItem> event) {
close(contextMenuItem);
}
}));
closeContextMenu.add(new MenuItem(getMessages().closeOtherTabs(), new SelectionHandler<MenuItem>() {
@Override
public void onSelection(SelectionEvent<MenuItem> event) {
List<M> models = new ArrayList<M>();
for (int i = 0, len = getModelCount(); i < len; i++) {
models.add(getModel(i));
}
for (M w : models) {
TabItemConfig config = getConfig(w);
if (w != contextMenuItem && config.isClosable()) {
close(w);
}
}
}
}));
}
TabItemConfig c = configMap.get(item);
MenuItem mi = (MenuItem) closeContextMenu.getWidget(0);
mi.setEnabled(c.isClosable());
contextMenuItem = item;
boolean hasClosable = false;
for (int i = 0, len = getModelCount(); i < len; i++) {
Widget item2 = container.getWidget(i);
TabItemConfig config = configMap.get(item2);
if (config.isClosable() && item2 != item) {
hasClosable = true;
break;
}
}
MenuItem m = (MenuItem) closeContextMenu.getWidget(1);
m.setEnabled(hasClosable);
closeContextMenu.showAt(x, y);
}
}
Aggregations