com.vaadin.client.ui.VOverlay Java Examples
The following examples show how to use
com.vaadin.client.ui.VOverlay.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableWidgetDelegate.java From cuba with Apache License 2.0 | 6 votes |
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); } }
Example #2
Source File: JQueryFileUploadOverlay.java From cuba with Apache License 2.0 | 5 votes |
protected static boolean isUnderOverlay(Element dropZoneElement) { Widget dropZoneWidget = WidgetUtil.findWidget(dropZoneElement, null); if (dropZoneWidget == null) return false; ComponentConnector dropZoneConnector = Util.findConnectorFor(dropZoneWidget); if (dropZoneConnector == null) return false; ApplicationConnection ac = dropZoneConnector.getConnection(); List<WindowConnector> windowConnectors = ac.getUIConnector().getSubWindows(); if (windowConnectors == null || windowConnectors.size() == 0) return false; List<VWindow> windows = windowConnectors.stream() .map(WindowConnector::getWidget) .collect(Collectors.toList()); Widget dropZoneTopParent = getWidgetTopParent(dropZoneWidget); if (dropZoneTopParent instanceof VWindow) { return modalWindowIsUnderOverlay((VWindow) dropZoneTopParent, windows); } else if (dropZoneTopParent instanceof VUI) { return containsModalWindow(windows); } else { Widget topParentOwner = ((VOverlay) dropZoneTopParent).getOwner(); Widget ownerParent = getWidgetTopParent(topParentOwner); if (ownerParent instanceof VWindow) { return modalWindowIsUnderOverlay((VWindow) ownerParent, windows); } else { return containsModalWindow(windows); } } }
Example #3
Source File: JQueryFileUploadOverlay.java From cuba with Apache License 2.0 | 5 votes |
protected static Widget getWidgetTopParent(Widget widget) { Widget parent = widget.getParent(); while (!(parent instanceof VWindow) && !(parent instanceof VUI) && !(parent instanceof VOverlay)) { parent = parent.getParent(); } return parent; }
Example #4
Source File: VContextMenu.java From cuba with Apache License 2.0 | 5 votes |
@Override protected VOverlay createOverlay() { VOverlay overlay = super.createOverlay(); for (VMenuBar current = this; current != null; current = current .getParentMenu()) { if (current.client != null) { overlay.setApplicationConnection(current.client); break; } } return overlay; }
Example #5
Source File: SuggestPopup.java From cuba with Apache License 2.0 | 5 votes |
protected void createDescriptionPopup() { descriptionPopup = new VOverlay(); descriptionPopup.setOwner(getOwner()); descriptionPopup.setStylePrimaryName("aceeditor-suggestpopup-description"); HTML lbl = new HTML(); lbl.setWordWrap(true); descriptionPopup.setWidget(lbl); updateDescriptionPopupPosition(); descriptionPopup.setWidth(DESCRIPTION_WIDTH + "px"); }
Example #6
Source File: VContextMenu.java From context-menu with Apache License 2.0 | 5 votes |
@Override protected VOverlay createOverlay() { VOverlay overlay = super.createOverlay(); for (VMenuBar current = this; current != null; current = current .getParentMenu()) { if (current.client != null) { overlay.setApplicationConnection(current.client); break; } } return overlay; }
Example #7
Source File: Tools.java From cuba with Apache License 2.0 | 4 votes |
protected static VOverlay createTableContextMenu() { return new TableOverlay(); }
Example #8
Source File: Tools.java From cuba with Apache License 2.0 | 4 votes |
public static void showPopup(VOverlay overlay, int left, int top) { overlay.setAutoHideEnabled(true); overlay.setVisible(false); overlay.show(); Widget widget = overlay.getWidget(); if (widget instanceof VVerticalLayout) { resetItemSelection(widget); VVerticalLayout verticalLayout = (VVerticalLayout) widget; if (verticalLayout.getStyleName().contains(CUBA_CONTEXT_MENU_CONTAINER)) { int widgetCount = verticalLayout.getWidgetCount(); if (widgetCount > 1) { Widget verticalSlot = verticalLayout.getWidget(0); Widget buttonWidget = ((Slot) verticalSlot).getWidget(); buttonWidget.addStyleName(SELECTED_ITEM_STYLE); if (buttonWidget instanceof FocusWidget) { ((FocusWidget) buttonWidget).setFocus(true); } } } } // mac FF gets bad width due GWT popups overflow hacks, // re-determine width int offsetWidth = overlay.getOffsetWidth(); int offsetHeight = overlay.getOffsetHeight(); if (offsetWidth + left > Window.getClientWidth()) { left = left - offsetWidth; if (left < 0) { left = 0; } } if (offsetHeight + top > Window.getClientHeight()) { top = top - offsetHeight; if (top < 0) { top = 0; } } overlay.setPopupPosition(left, top); overlay.setVisible(true); }
Example #9
Source File: TableWidgetDelegate.java From cuba with Apache License 2.0 | 4 votes |
public void showSortMenu(final Element target, final String columnId) { final VOverlay sortDirectionPopup = GWT.create(VOverlay.class); sortDirectionPopup.setOwner(tableWidget.getOwner()); FlowPanel sortDirectionMenu = new FlowPanel(); Label sortByDescendingButton = new Label(tableWidget.getSortDescendingLabel()); Label sortByAscendingButton = new Label(tableWidget.getSortAscendingLabel()); Label sortClearSortButton = new Label(tableWidget.getSortResetLabel()); sortByDescendingButton.addStyleName(TABLE_SORT_CONTEXTMENU_ITEM); sortByAscendingButton.addStyleName(TABLE_SORT_CONTEXTMENU_ITEM); sortClearSortButton.addStyleName(TABLE_SORT_CONTEXTMENU_ITEM); sortDirectionMenu.add(sortByAscendingButton); sortDirectionMenu.add(sortByDescendingButton); sortDirectionMenu.add(sortClearSortButton); sortByDescendingButton.addClickHandler(event -> { updateVariable("sortcolumn", columnId, false); updateVariable( "sortascending", false, false); tableWidget.getRowRequestHandler().deferRowFetch(); // some validation + // defer 250ms tableWidget.getRowRequestHandler().cancel(); // instead of waiting tableWidget.getRowRequestHandler().run(); // run immediately sortDirectionPopup.hide(); }); sortByAscendingButton.addClickHandler(event -> { updateVariable("sortcolumn", columnId, false); updateVariable("sortascending", true, false); tableWidget.getRowRequestHandler().deferRowFetch(); // some validation + // defer 250ms tableWidget.getRowRequestHandler().cancel(); // instead of waiting tableWidget.getRowRequestHandler().run(); // run immediately sortDirectionPopup.hide(); }); sortClearSortButton.addClickHandler(event -> { updateVariable( "resetsortorder", columnId, true); sortDirectionPopup.hide(); }); sortDirectionMenu.addStyleName("c-table-contextmenu"); sortDirectionPopup.setWidget(sortDirectionMenu); sortDirectionPopup.setAutoHideEnabled(true); ComputedStyle sortIndicatorStyle = new ComputedStyle(target); Tools.showPopup(sortDirectionPopup, target.getAbsoluteLeft(), target.getAbsoluteTop() + ((int) sortIndicatorStyle.getHeight())); }
Example #10
Source File: MyVMenuBar.java From consulo with Apache License 2.0 | 4 votes |
@Override protected VOverlay createOverlay() { return new MyVOverlay(true, false); }
Example #11
Source File: Tools.java From cuba with Apache License 2.0 | 3 votes |
public static VOverlay createCubaTablePopup(boolean autoClose) { VOverlay tableCustomPopup = autoClose ? createTableContextMenu() : new VOverlay(); tableCustomPopup.setStyleName("c-table-popup"); return tableCustomPopup; }
Example #12
Source File: Tools.java From cuba with Apache License 2.0 | 3 votes |
public static VOverlay createCubaTableContextMenu() { VOverlay tableContextMenu = createTableContextMenu(); tableContextMenu.setStyleName("c-context-menu"); return tableContextMenu; }