Java Code Examples for com.google.gwt.user.client.Window#getClientWidth()
The following examples show how to use
com.google.gwt.user.client.Window#getClientWidth() .
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: SimpleDropdown.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void open() { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN); Element menuElt = this.menuContainer.getElement(); int topMenu = menuElt.getAbsoluteTop() - Window.getScrollTop(); int menuHeight = menuElt.getOffsetHeight(); int anchorHeight = this.anchor.getOffsetHeight(); int clientHeight = Window.getClientHeight(); if (topMenu + menuHeight > clientHeight && topMenu >= anchorHeight + menuHeight) { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_UP); } int leftMenu = menuElt.getAbsoluteLeft() - Window.getScrollLeft(); int menuWidth = menuElt.getOffsetWidth(); int anchorWidth = this.anchor.getOffsetWidth(); int clientWidth = Window.getClientWidth(); if (leftMenu + menuWidth > clientWidth && leftMenu >= anchorWidth + menuWidth) { StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_LEFT); } this.open = true; this.updateHandlers(); }
Example 2
Source File: FilterBox.java From unitime with Apache License 2.0 | 6 votes |
private void position(final UIObject relativeObject, int offsetWidth, int offsetHeight) { int textBoxOffsetWidth = relativeObject.getOffsetWidth(); int offsetWidthDiff = offsetWidth - textBoxOffsetWidth; int left = relativeObject.getAbsoluteLeft(); if (offsetWidthDiff > 0) { int windowRight = Window.getClientWidth() + Window.getScrollLeft(); int windowLeft = Window.getScrollLeft(); int distanceToWindowRight = windowRight - left; int distanceFromWindowLeft = left - windowLeft; if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) { left -= offsetWidthDiff; } } int top = relativeObject.getAbsoluteTop(); int windowTop = Window.getScrollTop(); int windowBottom = Window.getScrollTop() + Window.getClientHeight(); int distanceFromWindowTop = top - windowTop; int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight()); if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) { top -= offsetHeight; } else { top += relativeObject.getOffsetHeight(); } setPopupPosition(left, top); }
Example 3
Source File: FolderSelectPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Shows the popup */ public void show() { initButtons(); status.setVisible(false); int left = (Window.getClientWidth() - 450) / 2; int top = (Window.getClientHeight() - 440) / 2; setPopupPosition(left, top); setText(Main.i18n("trash.directory.select.label")); // Resets to initial tree value folderSelectTree.reset(); super.show(); }
Example 4
Source File: GroupPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Show the popup error * * @param msg Error message */ public void show() { int left = (Window.getClientWidth() - 300) / 2; int top = (Window.getClientHeight() - 100) / 2; setPopupPosition(left, top); setText(Main.i18n("group.label")); validate = -1; groupListBox.clear(); propertyListBox.clear(); propertyListBox.setVisible(false); propertyLabel.setVisible(false); getAllGroups(); // Gets all groups addButton.setEnabled(false); super.show(); }
Example 5
Source File: WorkflowPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Show the popup error * * @param msg Error message */ public void show() { setText(Main.i18n("workflow.label")); findLatestProcessDefinitions(); // Gets all groups listBox.setVisible(true); addButton.setEnabled(false); workflowWidget = null; listBox.setVisible(true); sp.setVisible(false); sp.clear(); int left = (Window.getClientWidth() - 300) / 2; int top = (Window.getClientHeight() - 100) / 2; setPopupPosition(left, top); super.show(); }
Example 6
Source File: RichTextPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Shows de popup */ public void show() { url.setText("http://"); int left = (Window.getClientWidth() - 300) / 2; int top = (Window.getClientHeight() - 125) / 2; setPopupPosition(left, top); super.show(); }
Example 7
Source File: FindSimilarDocumentSelectPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Shows the popup */ public void show() { initButtons(); int left = (Window.getClientWidth() - 700) / 2; int top = (Window.getClientHeight() - 350) / 2; setPopupPosition(left, top); setText(Main.i18n("search.similar.document")); // Resets to initial tree value removeAllRows(); evaluateEnableAction(); super.show(); }
Example 8
Source File: ErrorPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Show the popup error * * @param msg Error message */ public void show(String msg) { //TODO: aqui pueden haber problemas de concurrencia al ser llamado simultaneamente este método // cabe la posibilidad de perder algun mensaje de error. if (!text.getHTML().equals("")) { text.setHTML(text.getHTML() + "<br><br>" + msg); } else { text.setHTML(msg); } setText(Main.i18n("error.label")); int left = (Window.getClientWidth() - 380) / 2; int top = (Window.getClientHeight() - 200) / 2; setPopupPosition(left, top); super.show(); }
Example 9
Source File: PopupPositioner.java From jetpad-projectional-open-source with Apache License 2.0 | 5 votes |
private Rectangle getVisiblePart() { if (DomUtil.hasScrollers(myContext.rootElement)) { return DomUtil.visiblePart(myContext.rootElement); } else { return new Rectangle(Window.getScrollLeft(), Window.getScrollTop(), Window.getClientWidth(), Window.getClientHeight()); } }
Example 10
Source File: PageLabel.java From unitime with Apache License 2.0 | 5 votes |
public PageLabel() { if (Window.getClientWidth() <= 800) iDisplay = GWT.create(PageLabelDisplay.Mobile.class); else iDisplay = GWT.create(PageLabelDisplay.class); initWidget(iDisplay.asWidget()); }
Example 11
Source File: ConfirmPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Shows de popup */ public void show() { setText(GeneralComunicator.i18nExtension("confirm.label")); int left = (Window.getClientWidth() - 300) / 2; int top = (Window.getClientHeight() - 125) / 2; setPopupPosition(left, top); super.show(); }
Example 12
Source File: ConfirmPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Shows de popup */ public void show() { setText(GeneralComunicator.i18n("confirm.label")); int left = (Window.getClientWidth() - 300) / 2; int top = (Window.getClientHeight() - 125) / 2; setPopupPosition(left, top); super.show(); }
Example 13
Source File: ThesaurusSelectPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Shows the popup */ public void show(int selectedFrom) { this.selectedFrom = selectedFrom; initButtons(); int left = (Window.getClientWidth() - 400) / 2; int top = (Window.getClientHeight() - 325) / 2; setPopupPosition(left, top); setText(Main.i18n("thesaurus.directory.select.label")); // Resets to initial tree value thesaurusPanel.reset(); center(); }
Example 14
Source File: CubaFileUploadProgressWindow.java From cuba with Apache License 2.0 | 5 votes |
private boolean cursorInsideBrowserContentArea(Event event) { if (event.getClientX() < 0 || event.getClientY() < 0) { // Outside to the left or above return false; } if (event.getClientX() > Window.getClientWidth() || event.getClientY() > Window.getClientHeight()) { // Outside to the right or below return false; } return true; }
Example 15
Source File: UniTimeFrameDialog.java From unitime with Apache License 2.0 | 5 votes |
public static void openDialog(String title, String source, String width, String height, boolean noCacheTS) { if (sDialog == null) { if (Window.getClientWidth() <= 800) sDialog = GWT.create(UniTimeFrameDialogDisplay.Mobile.class); else sDialog = GWT.create(UniTimeFrameDialogDisplay.class); } sDialog.openDialog(title, source, width, height, noCacheTS); }
Example 16
Source File: FindFolderSelectPopup.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Shows the popup */ public void show() { initButtons(); int left = (Window.getClientWidth() - 700) / 2; int top = (Window.getClientHeight() - 350) / 2; setPopupPosition(left, top); setText(Main.i18n("search.folder.filter")); // Resets to initial tree value removeAllRows(); keyword.setText(""); evaluateEnableAction(); super.show(); keyword.setFocus(true); }
Example 17
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 18
Source File: StartUpPopup.java From document-management-system with GNU General Public License v2.0 | 4 votes |
public StartUpPopup() { // Establishes auto-close when click outside super(false, true); vPanel = new VerticalPanel(); status = new VerticalPanel(); table = new FlexTable(); button = new Button(Main.i18n("button.close"), this); scrollPanel = new ScrollPanel(status); scrollPanel.setAlwaysShowScrollBars(false); scrollPanel.setSize("490px", "160px"); scrollPanel.setStyleName("okm-Input"); status.setWidth("" + (490 - IE_SIZE_RECTIFICATION) + "px"); vPanel.add(new HTML(" ")); vPanel.add(scrollPanel); vPanel.add(new HTML(" ")); vPanel.add(table); vPanel.add(button); vPanel.add(new HTML(" ")); button.setVisible(false); button.setStyleName("okm-YesButton"); vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(table, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER); vPanel.setCellVerticalAlignment(scrollPanel, HasAlignment.ALIGN_MIDDLE); int left = (Window.getClientWidth() - 510) / 2; int top = (Window.getClientHeight() - 220) / 2; vPanel.setWidth("510px"); vPanel.setHeight("220px"); for (int i = 0; i < StartUp.STARTUP_LOADING_HISTORY_SEARCH; i++) { table.setWidget(0, i, new Image(OKMBundleResources.INSTANCE.loadedDisabledIcon())); } setText(Main.i18n("startup.openkm")); setPopupPosition(left, top); setWidget(vPanel); }
Example 19
Source File: LayerEditDialog.java From geowe-core with GNU General Public License v3.0 | 4 votes |
private int computeWidth() { return Window.getClientWidth() - (HORIZONTAL_MARGIN * 2); }
Example 20
Source File: UniTimeMenuBar.java From unitime with Apache License 2.0 | 4 votes |
private boolean needsMove() { return iLastClientWidth != Window.getClientWidth() || iLastScrollLeft != Window.getScrollLeft() || iLastScrollTop != Window.getScrollTop(); }