public void showContextMenuPopup(int left, int top) { if (this.customContextMenu instanceof HasWidgets) { if (!((HasWidgets) this.customContextMenu).iterator().hasNext()) { // there are no actions to show return; } } // Store the currently focused element, which will be re-focused when // context menu is closed Element focusedElement = WidgetUtil.getFocusedElement(); this.customContextMenuPopup = Tools.createCubaTableContextMenu(); this.customContextMenuPopup.setOwner(table); this.customContextMenuPopup.setWidget(this.customContextMenu); this.customContextMenuPopup.addCloseHandler(e -> { Element currentFocus = WidgetUtil.getFocusedElement(); if (focusedElement != null && (currentFocus == null || customContextMenuPopup.getElement().isOrHasChild(currentFocus) || RootPanel.getBodyElement().equals(currentFocus))) { focusedElement.focus(); } customContextMenuPopup = null; }); Tools.showPopup(this.customContextMenuPopup, left, top); }
public void showCustomPopup() { if (this.customPopupWidget != null) { if (this.customPopupWidget instanceof HasWidgets) { if (!((HasWidgets) this.customPopupWidget).iterator().hasNext()) { // there are no component to show return; } } // Store the currently focused element, which will be re-focused when // context menu is closed Element focusedElement = WidgetUtil.getFocusedElement(); this.customPopupOverlay = Tools.createCubaTablePopup(this.customPopupAutoClose); this.customPopupOverlay.setOwner(table); this.customPopupOverlay.setWidget(this.customPopupWidget); this.customPopupOverlay.addCloseHandler(e -> { Element currentFocus = WidgetUtil.getFocusedElement(); if (focusedElement != null && (currentFocus == null || customPopupOverlay.getElement().isOrHasChild(currentFocus) || RootPanel.getBodyElement().equals(currentFocus))) { focusedElement.focus(); } customPopupOverlay = null; }); Tools.showPopup(this.customPopupOverlay, this.lastClickClientX, this.lastClickClientY); } }
public void showPresentationEditorPopup(Event event, Widget presentationsEditIcon) { if (event.getEventTarget().cast() == presentationsEditIcon.getElement() && tableWidget.isEnabled()) { this.presentationsEditorPopup = new VOverlay(); this.presentationsEditorPopup.setStyleName("c-table-prefs-editor"); this.presentationsEditorPopup.setOwner(table); this.presentationsEditorPopup.setWidget(this.presentationsMenu); // Store the currently focused element, which will be re-focused when // context menu is closed Element focusedElement = WidgetUtil.getFocusedElement(); this.presentationsEditorPopup.addCloseHandler(e -> { Element currentFocus = WidgetUtil.getFocusedElement(); if (focusedElement != null && (currentFocus == null || presentationsEditorPopup.getElement().isOrHasChild(currentFocus) || RootPanel.getBodyElement().equals(currentFocus))) { focusedElement.focus(); } presentationsEditorPopup = null; }); this.presentationsEditorPopup.setAutoHideEnabled(true); this.presentationsEditorPopup.showRelativeTo(presentationsEditIcon); } }