List of usage examples for com.google.gwt.user.client Window getClientWidth
public static int getClientWidth()
From source file:com.seanchenxi.gwt.effect.core.Fly.java
License:Apache License
@Override public boolean doPrepare() { getStyle().setPosition(Position.ABSOLUTE); if (targetTop == -1) { targetLeft = (Window.getClientWidth() - getWidget().getOffsetWidth()) >> 1; targetTop = (Window.getClientHeight() - getWidget().getOffsetHeight()) >> 1; }//from ww w.j av a 2 s .com startLeft = getWidget().getAbsoluteLeft(); startTop = getWidget().getAbsoluteTop(); distL = targetLeft - startLeft; distT = targetTop - startTop; return true; }
From source file:com.sencha.gxt.fx.client.Draggable.java
License:sencha.com license
protected void handleStart(int x, int y, Event event, Element target) { startBounds = dragWidgetElement.getBounds(); startElement = target;//from w w w .j a va2s .c o m dragStartX = x; dragStartY = y; eventPreview.add(); clientWidth = Window.getClientWidth() + XDOM.getBodyScrollLeft(); clientHeight = Window.getClientHeight() + XDOM.getBodyScrollTop(); if (container != null) { conX = container.getAbsoluteLeft(); conY = container.getAbsoluteTop(); conWidth = container.getOffsetWidth(); conHeight = container.getOffsetHeight(); } if (startDragDistance == 0) { startDrag(event); } }
From source file:com.sencha.gxt.fx.client.Shim.java
License:sencha.com license
/** * Creates and covers the area with a Shim. If shimIframes is true will only * covers IFrames.//from ww w . j a v a 2 s. c o m * * @param shimIframes true if you want to cover only iframes */ public void cover(boolean shimIframes) { XElement body = Document.get().getBody().<XElement>cast(); if (shimIframes) { NodeList<Element> elements = body.select("iframe:not(.x-noshim)"); shim(elements); elements = body.select("object:not(.x-noshim)"); shim(elements); elements = body.select("applet:not(.x-noshim)"); shim(elements); elements = body.select("embed:not(.x-noshim)"); shim(elements); } else { shims.add(createShim(null, 0, 0, Window.getClientWidth(), Window.getClientHeight())); } }
From source file:com.sencha.gxt.widget.core.client.Component.java
License:sencha.com license
@Override protected void onLoad() { super.onLoad(); if (!allowTextSelection) { setAllowTextSelection(false);/*from ww w .ja v a2s. co m*/ } if (monitorWindowResize) { if (windowResizeTask == null) { windowResizeTask = new DelayedTask() { @Override public void onExecute() { onWindowResize(Window.getClientWidth(), Window.getClientHeight()); } }; } // window resizing in some cases when initially showing positioned widgets if (GXT.isIE8()) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { resizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { windowResizeTask.delay(windowResizeDelay); } }); } }); } else { resizeHandler = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { windowResizeTask.delay(windowResizeDelay); } }); } } }
From source file:com.sencha.gxt.widget.core.client.container.Viewport.java
License:sencha.com license
/** * Creates a viewport layout container with the specified appearance. * /*from w w w. j a v a 2s .c o m*/ * @param appearance the appearance of the viewport layout container */ public Viewport(ViewportAppearance appearance) { super(true); SafeHtmlBuilder sb = new SafeHtmlBuilder(); appearance.render(sb); setElement((Element) XDOM.create(sb.toSafeHtml())); monitorWindowResize = true; getFocusSupport().setIgnore(false); setPixelSize(Window.getClientWidth(), Window.getClientHeight()); }
From source file:com.sencha.gxt.widget.core.client.container.Viewport.java
License:sencha.com license
@Override protected void onAttach() { setEnableScroll(enableScroll); super.onAttach(); setPixelSize(Window.getClientWidth(), Window.getClientHeight()); }
From source file:com.sencha.gxt.widget.core.client.Popup.java
License:sencha.com license
/** * Displays the popup./* w ww. ja va2 s . c om*/ */ public void show() { if (!fireCancellableEvent(new BeforeShowEvent())) { return; } Point p = new Point((int) Window.getClientWidth() / 2, (int) Window.getClientHeight() / 2); showAt(p.getX(), p.getY()); }
From source file:com.sencha.gxt.widget.core.client.Popup.java
License:sencha.com license
protected Popup onShowPopup() { RootPanel.get().add(this); hidden = false;//from www . jav a2 s.c o m Point p = null; if (alignElem != null) { alignPos = alignPos != null ? alignPos : getDefaultAlign(); p = getElement().getAlignToXY(alignElem, alignPos, alignOffsetX, alignOffsetY); } else if (alignPoint != null) { p = alignPoint; } getElement().makePositionable(true); getElement().setVisibility(false); getElement().setLeftTop(p.getX(), p.getY()); alignElem = null; alignPos = null; alignPoint = null; if (constrainViewport) { int clientHeight = Window.getClientHeight() + XDOM.getBodyScrollTop(); int clientWidth = Window.getClientWidth() + XDOM.getBodyScrollLeft(); Rectangle r = getElement().getBounds(); int x = r.getX(); int y = r.getY(); if (y + r.getHeight() > clientHeight) { y = clientHeight - r.getHeight() - getYOffset(); getElement().setTop(y); } if (x + r.getWidth() > clientWidth) { x = clientWidth - r.getWidth() - getXOffset(); getElement().setLeft(x); } } getElement().setVisibility(true); if (autoHide) { preview.add(); } if (animate) { Fx fx = new Fx(); fx.addAfterAnimateHandler(new AfterAnimateHandler() { @Override public void onAfterAnimate(AfterAnimateEvent event) { afterShow(); } }); fx.run(new FadeIn(getElement())); } else { afterShow(); } return this; }
From source file:com.sinewavemultimedia.easeljs.framework.js.CreateJS.java
License:Open Source License
public CreateJS() { this(Window.getClientWidth(), Window.getClientHeight()); }
From source file:com.sitecake.contentmanager.client.toolbar.ContentManagerToolbar.java
@Override protected void onAttach() { super.onAttach(); int posX = Window.getClientWidth() / 2 - this.getOffsetWidth() / 2; Integer left = propertyManager.getPropertyFloat(POSITION_X, (float) posX, PropertyScope.APPLICATION) .intValue();//from w ww .j a v a 2 s . co m Integer top = propertyManager.getPropertyFloat(POSITION_Y, (float) 20, PropertyScope.APPLICATION) .intValue(); setPosition(left, top, true, true); windowResizeHandlerRegistration = Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { onWindowResize(); } }); }