public void onValueChange(ValueChangeEvent<String> event) { if (autoHideOnHistoryEvents) { hide(); } } });
setVisible(false); setAnimationEnabled(false); show(); Element elem = getElement(); elem.getStyle().setPropertyPx("left", 0); elem.getStyle().setPropertyPx("top", 0); int left = (Window.getClientWidth() - getOffsetWidth()) >> 1; int top = (Window.getClientHeight() - getOffsetHeight()) >> 1; setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max( Window.getScrollTop() + top, 0)); setAnimationEnabled(initiallyAnimated); impl.setClip(getElement(), "rect(0px, 0px, 0px, 0px)"); setVisible(true); resizeAnimation.run(ANIMATION_DURATION); } else { setVisible(true);
template = GWT.create(Template.class); String definedStyles = getElement().getAttribute("style"); getElement().setAttribute("style", definedStyles + "; vertical-align:middle;"); Element textElement = DOM.createElement("span"); DOM.appendChild(getElement(), caretSpan); actionsPopup = new PopupPanel(true, false); actionsPopup.addStyleName(Utils.kaaAdminStyle.actionPopup()); actionsPopup.setWidget(menu); actionsPopup.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { actionsPopup.addAutoHidePartner(getElement());
public void onClick(ClickEvent event) { if (!actionsPopup.isShowing()) { // Instantiate the popup and show it. final Element parent = ActionsLabel.this.getElement(); actionsPopup .setPopupPositionAndShow(new PopupPanel.PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { int left = parent.getAbsoluteLeft(); int top = parent.getAbsoluteTop() + parent.getOffsetHeight() + 2; if (left + actionsPopup.getOffsetWidth() > Window .getClientWidth()) { left = parent.getAbsoluteRight() - actionsPopup.getOffsetWidth(); } actionsPopup.setPopupPosition(left, top); } }); } else { actionsPopup.hide(); } } });
/** * Sets whether this object is visible. This method just sets the * <code>visibility</code> style attribute. You need to call {@link #show()} * to actually attached/detach the {@link PopupPanel} to the page. * * @param visible <code>true</code> to show the object, <code>false</code> to * hide it * @see #show() * @see #hide() */ @Override public void setVisible(boolean visible) { // We use visibility here instead of UIObject's default of display // Because the panel is absolutely positioned, this will not create // "holes" in displayed contents and it allows normal layout passes // to occur so the size of the PopupPanel can be reliably determined. getElement().getStyle().setProperty("visibility", visible ? "visible" : "hidden"); // If the PopupImpl creates an iframe shim, it's also necessary to hide it // as well. if (glass != null) { glass.getStyle().setProperty("visibility", visible ? "visible" : "hidden"); } }
@Override public void show() { int x = getAbsoluteLeft() + getOffsetWidth() - 6; int y = getAbsoluteTop() + 19; popupPanel.show(); popupPanel.getElement().getStyle().setProperty("position", "absolute"); popupPanel.getElement().getStyle().clearProperty("left"); popupPanel.getElement().getStyle().setProperty("right", "calc(100% - " + x + "px"); popupPanel.getElement().getStyle().setProperty("top", "" + y + "px"); }
private void onInstantaneousRun() { maybeShowGlass(); if (showing) { // Set the position attribute, and then attach to the DOM. Otherwise, // the PopupPanel will appear to 'jump' from its static/relative // position to its absolute position (issue #1231). curPanel.getElement().getStyle().setProperty("position", "absolute"); if (curPanel.topPosition != -1) { curPanel.setPopupPosition(curPanel.leftPosition, curPanel.topPosition); } RootPanel.get().add(curPanel); } else { if (!isUnloading) { RootPanel.get().remove(curPanel); } } curPanel.getElement().getStyle().setProperty("overflow", "visible"); } }
public static void adjustPopupLocationToFitScreenAndShow(final PopupPanel popup, int left, int top, MenuBar parentMenu, int itemHeight) { Style style = popup.getElement().getStyle(); style.setLeft(0, Unit.PX); style.setTop(0, Unit.PX); style.setProperty("height", "auto"); //$NON-NLS-1$ //$NON-NLS-2$ style.setProperty("width", "auto"); //$NON-NLS-1$ //$NON-NLS-2$ popup.show(); adjustPopupLocationToFitScreenAndShow(popup, left, top, -parentMenu.getOffsetWidth(), 0, itemHeight); }
Window.addResizeHandler(popupResizeHandler); if (!suggestBox.getElement().getStyle().getZIndex().equals("")) { try { getPopupPanel().getElement().getStyle() .setZIndex(Integer.valueOf(suggestBox.getElement().getStyle().getZIndex())); } catch (Exception e) {
/** Fix top value if need. Need in case if bottom part of menu not display */ private void adjustTopPosition() { int totalHeight = listPanel.getWidgetCount() * 19; // 19 height of menu item int y = getAbsoluteTop() + 19 + totalHeight; if (y > Window.getClientHeight()) { y = getAbsoluteTop() - 8 - totalHeight; // 8 need some correction for looking good in UI popupPanel.getElement().getStyle().clearProperty("top"); } else { y = getAbsoluteTop() + 19; } popupPanel.getElement().getStyle().setProperty("top", "" + y + "px"); }
@Override public void hide() { super.hide(); if (parent != null) { parent.getElement().getStyle().setVisibility(Style.Visibility.VISIBLE); } }
@Override public void go(final HasWidgets container) { m_addImage.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { GWT.log("clicked (showing = " + m_mainPopup.isShowing() + ", visible = " + m_mainPopup.isVisible() + ")"); if (m_mainPopup.isShowing()) { m_mainPopup.hide(); m_mainPopup.getElement().getStyle().setDisplay(Display.NONE); } else { m_mainPopup.getElement().getStyle().setDisplay(Display.BLOCK); m_mainPopup.showRelativeTo(m_addImage); } } }); m_mainPopup.setVisible(false); m_mainPopup.getElement().getStyle().setDisplay(Display.NONE); m_mainPopup.addAutoHidePartner(m_addImage.getElement()); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(final ResizeEvent event) { final int[] positions = calculateMainPopupPosition(); m_mainPopup.setPopupPosition(positions[0], positions[1]); } }); container.clear(); container.add(m_addImage); container.add(m_mainPopup.asWidget()); }
@Override public void onClick(final ClickEvent event) { GWT.log("clicked (showing = " + m_mainPopup.isShowing() + ", visible = " + m_mainPopup.isVisible() + ")"); if (m_mainPopup.isShowing()) { m_mainPopup.hide(); m_mainPopup.getElement().getStyle().setDisplay(Display.NONE); } else { m_mainPopup.getElement().getStyle().setDisplay(Display.BLOCK); m_mainPopup.showRelativeTo(m_addImage); } } });
@Override protected void onStart() { offsetHeight = curPanel.getOffsetHeight(); offsetWidth = curPanel.getOffsetWidth(); curPanel.getElement().getStyle().setProperty("overflow", "hidden"); super.onStart(); }
public CustomSuggestionDisplay() { super(); final PopupPanel popup = getPopupPanel(); popup.setStyleName(Styles.DROPDOWN_MENU); popup.getElement().getStyle().setDisplay(Display.BLOCK); }
@Override public void onSelectionChange(SelectionChangeEvent event) { int selectedItems = selectionModel.asMultiSelectionModel().getSelectedList().size(); if (selectedItems < 2) { return; } if (tooltip != null) { tooltip.hide(); } tooltip = new PopupPanel(true); tooltip.setWidget(new Label(selectionModel.asMultiSelectionModel().getSelectedList().size() + " " + constants.selectedActionTable())); //$NON-NLS-1$ if (mousePosition[0] == 0 && mousePosition[1] == 0) { mousePosition[0] = Window.getClientWidth() / 2; mousePosition[1] = Window.getClientHeight() / 3; } tooltip.setPopupPosition(mousePosition[0] + 15, mousePosition[1]); tooltip.show(); Timer t = new Timer() { @Override public void run() { tooltip.hide(); } }; t.schedule(500); }
VerticalPanel mainPanel = new VerticalPanel(); mainPanel.setBorderWidth(1); mainPanel.getElement().getStyle().setBackgroundColor("white"); new WindowResizeHandler(resizeIcon); super.setWidget(mainPanel); show();
/** * Determines whether or not this popup is visible. Note that this just checks * the <code>visibility</code> style attribute, which is set in the * {@link #setVisible(boolean)} method. If you want to know if the popup is * attached to the page, use {@link #isShowing()} instead. * * @return <code>true</code> if the object is visible * @see #setVisible(boolean) */ @Override public boolean isVisible() { return !"hidden".equals(getElement().getStyle().getProperty("visibility")); }
int windowRight = Window.getClientWidth() + Window.getScrollLeft(); int windowLeft = Window.getScrollLeft(); setPopupPosition(left, top);