List of usage examples for com.google.gwt.user.client Window getClientWidth
public static int getClientWidth()
From source file:edu.caltech.ipac.fftools.core.StandaloneUI.java
public void relayoutMainArea() { Application.getInstance().getLayoutManager().getRegion(LayoutManager.RESULT_REGION).setDisplay(main); main.setSize("100%", "100%"); main.clear();/*from w w w . j a v a2 s . co m*/ boolean hasXY = false, hasImage = false, hasTable = false; Widget xyLayout = null; if (xyPlots.getNTabs() > 1 || (xyPlots.getNTabs() == 1 && xyPlots.getTab(XYVIEW_TAB_NAME) == null)) { if (xyPlots.getTab(XYVIEW_TAB_NAME) != null) { xyPlots.getTab(XYVIEW_TAB_NAME).setContent(xyPlotter.getWidget()); } xyPlots.setSize("100%", "100%"); xyLayout = xyPlots; hasXY = true; } else if (hasCatalogResults() && xyPlotAreaStandalone != null) { xyPlotAreaStandalone.clear(); xyPlotAreaStandalone.add(xyPlotter.getWidget()); xyPlotAreaStandalone.setSize("100%", "100%"); xyLayout = xyPlotAreaStandalone; hasXY = true; } if (dynMultiViewerTab == null && hasPlotResults()) { dynMultiViewerTab = imageTabPane.addTab(dynMultiViewer.getWidget(), "Image data", "FITS Image", false); hasImage = true; } else if (!hasPlotResults() && dynMultiViewerTab != null) { imageTabPane.removeTab(dynMultiViewerTab); dynMultiViewerTab = null; } if (hasImageMultiViewerResults()) { hasImage = true; } if (coverageTab != null || hasPlotResults()) { hasImage = true; } if (hasXY) { if (hasImage || hasTable) { main.addSouth(xyLayout, 300); } else { main.add(xyLayout); } } if (hasImage) { int eastSize = 400; int winWidth = Window.getClientWidth(); if (winWidth > 50) eastSize = (int) (.6 * Window.getClientWidth()); main.addEast(catalogDeck, eastSize); main.add(imageArea); } else { main.add(catalogDeck); } main.forceLayout(); }
From source file:edu.caltech.ipac.firefly.core.Application.java
public void resize() { if (getLayoutManager() != null) { try {/*from w ww . j a v a 2 s. co m*/ getLayoutManager().resize(); WebEventManager.getAppEvManager().fireEvent(new WebEvent(this, Name.WINDOW_RESIZE, new ResizeEvent(Window.getClientWidth(), Window.getClientHeight()) { })); } catch (Exception e) { GWT.log("unexpected exception", e); } } }
From source file:edu.caltech.ipac.firefly.core.layout.ResizableLayoutManager.java
@Override public void resize() { int rh = Window.getClientHeight(); int rw = Window.getClientWidth(); int h = Math.max(getMinHeight(), rh - mainPanel.getAbsoluteTop() - 30 + yOffset); int w = Math.max(getMinWidth(), rw - 20); Region rr = getResizableRegion(); if (rr != null) { int rrh = h - rr.getDisplay().getAbsoluteTop() + mainPanel.getAbsoluteTop(); rr.getDisplay().setHeight(rrh + "px"); }// w w w . j av a2 s . co m }
From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java
public static void showAtCenter(PopupPanel popup) { int h = Window.getClientHeight(); int w = Window.getClientWidth(); popup.show();//from w w w . j a v a2 s . c o m int offsetx = StringUtils.getInt(DOM.getStyleAttribute(popup.getElement(), "width"), 300); int offsety = StringUtils.getInt(DOM.getStyleAttribute(popup.getElement(), "height"), 200); int x = (w - offsetx) / 2; int y = (h - offsety) / 2; popup.setPopupPosition(x, y); }
From source file:edu.caltech.ipac.firefly.ui.panels.ToolbarDropdown.java
public Dimension getDropDownSize() { int top = dpanel.getAbsoluteTop(); int h = Window.getClientHeight() - top; int w = Window.getClientWidth() - 10; int minH = Application.getInstance().getLayoutManager().getMinHeight(); return new Dimension(w, Math.max(minH, h)); }
From source file:edu.caltech.ipac.firefly.ui.PopupContainerForStandAlone.java
public Dimension getAvailableSize() { int w = Window.getClientWidth(); int h = Window.getClientHeight(); return new Dimension(w - 20, h - (HEIGHT_OFFSET + 20 + TOOLBAR_HEIGHT)); }
From source file:edu.caltech.ipac.firefly.ui.PopupContainerForStandAlone.java
public void computePosition(boolean offset) { if (_popout.isExpanded()) { if (BrowserUtil.isOldIE() || offset) { GwtUtil.setStyle(_main, "position", "absolute"); GwtUtil.setStyle(_topBackground, "position", "absolute"); int x = Window.getScrollLeft(); int y = Window.getScrollTop(); _main.setPopupPosition(x + 5, y + HEIGHT_OFFSET); } else {/*from ww w.j av a 2 s .com*/ GwtUtil.setStyle(_main, "position", "fixed"); GwtUtil.setStyle(_topBackground, "position", "fixed"); GwtUtil.setStyles(_main, "left", "5px", "top", HEIGHT_OFFSET + "px"); } int w = Window.getClientWidth(); int h = Window.getClientHeight(); _main.setPixelSize(w - 20, h - (HEIGHT_OFFSET + 20)); _popout.onResize(); _layout.onResize(); } }
From source file:edu.caltech.ipac.firefly.ui.PopupPane.java
/** * resize the popup when the browser area is smaller then the popup size *//*ww w. ja v a 2 s . c om*/ private void adjustResizable() { if (_expandW != null && optimalWidth > 0 && optimalHeight > 0) { int width = content.getOffsetWidth(); int height = content.getOffsetHeight(); if (width > Window.getClientWidth()) { width = Window.getClientWidth() - 20; } else if (width < optimalWidth) { width = Math.min(optimalWidth, Window.getClientWidth() - 20); } if (height > Window.getClientHeight()) { height = Window.getClientHeight() - 35; } else if (height < optimalHeight) { height = Math.min(optimalHeight, Window.getClientHeight() - 35); } if (width < minWidth) { width = minWidth; _doAlign = false; //turn off the automatic align, the dialog will jump around when users scrolls } if (height < minHeight) { height = minHeight; _doAlign = false; //turn off the automatic align, the dialog will jump around when users scrolls } if (height != content.getOffsetHeight() || width != content.getOffsetWidth()) { content.getWidget().setSize(width + "px", height + "px"); ((RequiresResize) _expandW).onResize(); } } }
From source file:edu.caltech.ipac.firefly.ui.PopupPane.java
/** * Determine where the place the popup. This is a huge and central method to PopupPane - it needs come cleaning up * @param xoffset offset x added to alignment * @param yoffset offset y added to alignment *///from w w w .j a va 2 s . co m private void alignPopup(final int xoffset, final int yoffset) { int x, y; if (popup != null) GwtUtil.setStyle(popup, "clip", "auto"); if (firstAlign) { optimalWidth = content.getOffsetWidth(); optimalHeight = content.getOffsetHeight(); DeferredCommand.addCommand(new Command() { public void execute() { adjustResizable(); } }); } firstAlign = false; locateMask(); PointerDir dir = PointerDir.NONE; if (alignAt == Align.DISABLE) { if (_pointerPopup) alignPointer(PointerDir.NORTH); return; } Widget alignWidget = this.alignWidget; if (alignWidget == null) alignWidget = RootPanel.get(); int popupHeight = popup.getOffsetHeight(); int popupWidth = popup.getOffsetWidth(); int rootHeight = Window.getClientHeight(); int rootWidth = Window.getClientWidth(); int alignX = alignWidget.getAbsoluteLeft(); int alignY = alignWidget.getAbsoluteTop(); int alignWidth = alignWidget.getOffsetWidth(); int alignHeight = alignWidget.getOffsetHeight(); if (alignAt == Align.BOTTOM_LEFT) { x = alignX + xoffset; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.BOTTOM_RIGHT) { x = alignX + alignWidth + xoffset; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.AUTO_POINTER) { dir = PointerDir.NORTH; definePointerDirection(dir); x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight + yoffset; if (y + popupHeight > Window.getClientHeight()) { dir = PointerDir.SOUTH_WEST; definePointerDirection(dir); x = alignX + alignWidth + xoffset; if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = (alignY - popupHeight + 5) - yoffset; } } else if (alignAt == Align.BOTTOM_CENTER) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.VISIBLE_BOTTOM) { //todo rootHeight = Window.getClientHeight(); x = Window.getScrollLeft() + xoffset; y = Window.getScrollTop() + Window.getClientHeight() - popupHeight + yoffset; } else if (alignAt == Align.BOTTOM_CENTER_POPUP_BOTTOM) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight - popupHeight + yoffset; } else if (alignAt == Align.TOP_CENTER) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = (alignY - popupHeight) - yoffset; } else if (alignAt == Align.TOP_RIGHT) { x = alignX + alignWidth + xoffset - popupWidth; y = alignY + yoffset; } else if (alignAt == Align.TOP_RIGHT_POPUP_RIGHT) { x = alignX + alignWidth + xoffset; y = alignY + yoffset; } else if (alignAt == Align.CENTER) { if (alignWidget == null) { int left = (Window.getClientWidth() - popupWidth) >> 1; int top = (Window.getClientHeight() - popupHeight) >> 1; x = Window.getScrollLeft() + left; y = Window.getScrollTop() + top; } else { int width = content.getOffsetWidth(); int height = content.getOffsetHeight(); x = alignX + alignWidth / 2; x = x - width / 2 + xoffset; y = alignY + alignHeight / 2; y = y - height / 2 + yoffset; } if (y < 0) y = 10; if (x < 0) x = 10; } else if (alignAt == Align.TOP_LEFT_POPUP_RIGHT) { x = alignX + xoffset - popupWidth; if (x < 0) x = 0; y = alignY + yoffset; } else if (alignAt == Align.TOP_LEFT_POPUP_BOTTOM) { x = alignX + xoffset; if (x < 0) x = 0; y = alignY + yoffset - popupHeight; } else if (alignAt == Align.TOP_RIGHT_OR_LEFT) { if (Window.getClientWidth() < (alignWidth + popupWidth)) { x = Window.getClientWidth() - ((xoffset + 35) + popupWidth); if (x < 0) x = 0; y = alignY + yoffset; } else { x = alignX + alignWidth + xoffset; y = alignY + yoffset; } } else { // default to TOP_LEFT x = 1 + xoffset; y = 1 + yoffset; } //---- // Now adjust the popup to fit in the viewable area //---- if (x + popupWidth > rootWidth) { x = x - ((x + popupWidth) - rootWidth); // move if over by the amount it is off the side } if (y + popupHeight > rootHeight && rootHeight > 10) { //if bottom of dialog is off the bottom, if root height is near 0 then don't adjust y = y - ((y + popupHeight) - rootHeight); // move if up by the amount it is off the bottom } if (y < Window.getScrollTop()) y = Window.getScrollTop() + 1; // if it is off the top set it to the top +1 if (x < Window.getScrollLeft()) x = Window.getScrollLeft() + 1;// if it is off the left set it to the left +1 if (_doAlign) _doAlign = _autoAlign; alignPointer(dir); if (popup.isVisible()) { if (popup.getAbsoluteLeft() != x || popup.getAbsoluteTop() != y) { popup.setPopupPosition(x, y); } } }
From source file:edu.caltech.ipac.firefly.visualize.PlotWidgetOps.java
public void plot3Internal(final WebPlotRequest red, final WebPlotRequest green, final WebPlotRequest blue, final boolean addToHistory, final boolean enableMods, final boolean plotExpanded, final boolean canCollapse, final AsyncCallback<WebPlot> notify) { _mpw.setDefaultPlotRequest(new DefaultRequestInfo(red, green, blue)); _mpw.setCanCollapse(canCollapse);// w ww.jav a 2s. co m if (plotExpanded) { for (WebPlotRequest r : new WebPlotRequest[] { red, green, blue }) { if (r != null) { r.setZoomType(ZoomType.FULL_SCREEN); r.setZoomToWidth(Window.getClientWidth()); r.setZoomToHeight(Window.getClientHeight() - 125); } } } if (plotExpanded) { Vis.init(_mpw, new Vis.InitComplete() { public void done() { DeferredCommand.addCommand(new Command() { public void execute() { doExpand3Color(red, green, blue, addToHistory, enableMods, notify); } }); } }); } else { _mpw.initAndPlot(red, green, blue, true, addToHistory, enableMods, notify); } }