List of usage examples for com.google.gwt.user.client Window getClientWidth
public static int getClientWidth()
From source file:net.sf.mmm.client.ui.gwt.widgets.PopupMouseHandler.java
License:Apache License
/** * {@inheritDoc}/*from w w w . j av a 2 s. c om*/ */ @Override protected void onMouseMove(int deltaX, int deltaY, NativeEvent nativeEvent) { Rectangle newRectangle; if (this.resizeDirection == null) { // move... Rectangle clippingArea = new Rectangle(0, 0, Window.getClientWidth() + this.popupRectangle.getWidth() - 32, Window.getClientHeight() + this.popupRectangle.getHeight() - 32); newRectangle = this.popupRectangle.moveBy(deltaX, deltaY).clipTo(clippingArea, true); } else { newRectangle = this.popupRectangle.resize(deltaX, deltaY, this.resizeDirection, this.minWidth, this.minHeight); } this.popupWindow.setPixelSize(newRectangle.getWidth(), newRectangle.getHeight()); this.popupWindow.setPopupPosition(newRectangle.getX(), newRectangle.getY()); }
From source file:net.sf.mmm.client.ui.gwt.widgets.PopupWindow.java
License:Apache License
/** * {@inheritDoc}//from ww w . j a v a 2 s . c o m */ @Override public void setMaximized(boolean maximized) { if (this.maximized == maximized) { return; } if (maximized) { this.savedX = getAbsoluteLeft(); this.savedY = getAbsoluteTop(); this.savedWidth = getOffsetWidth(); this.savedHeight = getOffsetHeight(); setPopupPosition(Window.getScrollLeft(), Window.getScrollTop()); setPixelSize(Window.getClientWidth(), Window.getClientHeight()); if (this.movable) { this.titleBar.removeStyleName(CssStyles.MOVABLE); } if (this.resizable) { doSetResizable(false); } } else { setPopupPosition(this.savedX, this.savedY); setPixelSize(this.savedWidth, this.savedHeight); if (this.movable) { this.titleBar.addStyleName(CssStyles.MOVABLE); } if (this.resizable) { doSetResizable(true); } } this.maximized = maximized; this.maximizeButton.setValue(Boolean.valueOf(maximized), false); }
From source file:net.sf.mmm.client.ui.impl.gwt.widget.window.adapter.UiWidgetAdapterGwtMainWindow.java
License:Apache License
/** * {@inheritDoc}// ww w . jav a 2 s. c o m */ @Override public void setLength(LengthProperty property, Length value) { switch (property) { case HEIGHT: Window.resizeTo(Window.getClientWidth(), convertLength(value)); break; case WIDTH: Window.resizeTo(convertLength(value), Window.getClientHeight()); break; // TODO hohwille min/max width/height default: break; } }
From source file:net.sf.mmm.client.ui.impl.gwt.widget.window.adapter.UiWidgetAdapterGwtMainWindow.java
License:Apache License
/** * {@inheritDoc}/*from w w w. j av a 2s . c o m*/ */ @Override public double getWidthInPixel() { // return JavaScriptUtil.getInstance().getBrowserWidth(); return Window.getClientWidth(); }
From source file:next.celebs.controller.PhotoDragController.java
License:Apache License
@Override public IsWidget getViewContent() { Photo p = getPhoto();//from w w w . java 2 s . c o m SimplePanel widg = new SimplePanel(); Style s = widg.getElement().getStyle(); widg.setWidth(p.getWidth() + "px"); widg.setHeight(p.getHeight() + "px"); s.setProperty("backgroundImage", "url(" + p.getUrl() + ")"); s.setProperty("backgroundRepeat", "no-repeat"); int h = p.getHeight(); int w = p.getWidth(); int ofh = getView().asWidget().getOffsetHeight(); int ofw = Window.getClientWidth(); if (h < ofh) { s.setProperty("marginTop", (ofh - h) / 2 + "px"); } if (w < ofw) { s.setProperty("marginLeft", (ofw - w) / 2 + "px"); } return widg; }
From source file:next.celebs.DemoUtils.java
License:Apache License
public static void openWiki(String source, final String url) { int h = Window.getClientHeight(); int w = Window.getClientWidth(); // mobile phone if (h + w < 1000) { openURL(url);//from w ww. j av a 2 s . co m } else { final Frame frame = new Frame(url); Style s = frame.getElement().getStyle(); s.setProperty("width", "100%"); s.setProperty("height", "100%"); final XPopup popup = new XPopup(); final XDragScrollView view = new XDragScrollView(); view.add(frame); popup.setWidget(view); popup.setTop("35px"); popup.setRight("5%"); popup.setLeft("10%"); popup.setBottom("10%"); popup.show(); } }
From source file:next.celebs.page.SearchImageWidget.java
License:Apache License
void setPopupPosition(Photo p, OverlayPopup popup) { int w = p.getWidth() > 1024 ? 1024 : p.getWidth(); int h = p.getHeight() > 550 ? 550 : p.getHeight(); int left = (Window.getClientWidth() - w) >> 1; int top = (Window.getClientHeight() - h) >> 1; popup.setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max(Window.getScrollTop() + top, 0)); }
From source file:next.celebs.ui.OverlayPopup.java
License:Apache License
public void doShow() { this.setPopupPositionAndShow(new PositionCallback() { @Override/*from w w w.j av a 2s . c o m*/ public void setPosition(int offsetWidth, int offsetHeight) { int winY = Window.getClientHeight(); int y = (winY - offsetHeight) / 2; int x = (Window.getClientWidth() - offsetWidth) / 2; OverlayPopup.this.setPopupPosition(x, y); } }); }
From source file:next.common.ui.ui.Logger.java
License:Apache License
public static void debug(PopupPanel popup) { Element el = DOM.getElementById(ElementIds.DEBUG); if (el != null) { Logger.debug("offsetWidth:" + popup.getOffsetWidth() + ", offsetHeight:" + popup.getOffsetHeight() + "<br>" + ", ClientWidth" + Window.getClientWidth() + ", ClientHeight" + Window.getClientHeight() + "<br>ScrollLeft" + Window.getScrollLeft() + ", ScrollTop" + Window.getScrollTop()); }/* w w w . j a v a2 s . c om*/ }
From source file:next.i.view.Utils.java
License:Apache License
static boolean isVisible(Element element) { int left = element.getAbsoluteLeft(); int top = element.getAbsoluteTop(); int winH = Window.getClientHeight(); int winW = Window.getClientWidth(); boolean isVisible = (left >= 0 && left < winW) && (top >= 0 && top < winH); // Log.info("top=" + top + ", left=" + left); return isVisible; }