com.google.gwt.user.client.Window.getClientWidth()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中com.google.gwt.user.client.Window.getClientWidth()方法的一些代码示例,展示了Window.getClientWidth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.getClientWidth()方法的具体详情如下:
包路径:com.google.gwt.user.client.Window
类名称:Window
方法名:getClientWidth

Window.getClientWidth介绍

[英]Gets the width of the browser window's client area excluding the vertical scroll bar.
[中]获取浏览器窗口的客户端区域(不包括垂直滚动条)的宽度。

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
  public void run () {
    // Ignore changes that result from window resize events
    if (windowHeight != Window.getClientHeight() || windowWidth != Window.getClientWidth()) {
      windowHeight = Window.getClientHeight();
      windowWidth = Window.getClientWidth();
      schedule(resizeCheckDelay);
      return;
    }
    // Look for elements that have new dimensions
    checkWidgetSize();
    // Start checking again
    if (resizeCheckingEnabled) {
      schedule(resizeCheckDelay);
    }
  }
};

代码示例来源:origin: libgdx/libgdx

@Override
  public void run () {
    // Ignore changes that result from window resize events
    if (windowHeight != Window.getClientHeight() || windowWidth != Window.getClientWidth()) {
      windowHeight = Window.getClientHeight();
      windowWidth = Window.getClientWidth();
      schedule(resizeCheckDelay);
      return;
    }
    // Look for elements that have new dimensions
    checkWidgetSize();
    // Start checking again
    if (resizeCheckingEnabled) {
      schedule(resizeCheckDelay);
    }
  }
};

代码示例来源:origin: kaaproject/kaa

messageLabel.getElement().getStyle().setProperty("maxHeight", "400px");
messageLabel.getElement().getStyle()
  .setProperty("maxWidth", Window.getClientWidth() * 2 / 3 + "px");
messageLabel.getElement().getStyle().setOverflowY(Overflow.AUTO);
messageLabel.setMessage(message);

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * @deprecated As of GWT 1.5, replaced by {@link Window#getClientWidth()}
 */
@Deprecated
public static int windowGetClientWidth() {
 return Window.getClientWidth();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private int getClientRight() {
  return getClientLeft() + Window.getClientWidth();
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private void setPositionInClient(int left, int top) {
 // Keep the popup inside client area
 if (getOffsetWidth() < Window.getClientWidth()) {
  left = Math.min(left, getClientRight() - getOffsetWidth());
  left = Math.max(getClientLeft(), left);
 }
 setPopupPosition(left, top);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

static void onResize() {
 if (resizeHandlersInitialized) {
  // On webkit and IE we sometimes get duplicate window resize events.
  // Here, we manually filter them.
  int width = getClientWidth();
  int height = getClientHeight();
  if (lastResizeWidth != width || lastResizeHeight != height) {
   lastResizeWidth = width;
   lastResizeHeight = height;
   ResizeEvent.fire(getHandlers(), width, height);
  }
 }
}

代码示例来源:origin: org.jboss.errai/errai-bus

private void resize() {
  contentPanel.setWidth(Window.getClientWidth() * 0.90 + "px");
  contentPanel.setHeight(Window.getClientHeight() * 0.90 + "px");
  contentPanel.getElement().getStyle().setProperty("overflow", "auto");
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public void onResize(ResizeEvent event) {
  Style style = glass.getStyle();
  int winWidth = Window.getClientWidth();
  int winHeight = Window.getClientHeight();
  // Hide the glass while checking the document size. Otherwise it would
  // interfere with the measurement.
  style.setDisplay(Display.NONE);
  style.setWidth(0, Unit.PX);
  style.setHeight(0, Unit.PX);
  int width = Document.get().getScrollWidth();
  int height = Document.get().getScrollHeight();
  // Set the glass size to the larger of the window's client size or the
  // document's scroll size.
  style.setWidth(Math.max(width, winWidth), Unit.PX);
  style.setHeight(Math.max(height, winHeight), Unit.PX);
  // The size is set. Show the glass again.
  style.setDisplay(Display.BLOCK);
 }
};

代码示例来源:origin: com.google.gwt/gwt-servlet

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(

代码示例来源:origin: com.google.gwt/gwt-servlet

int windowRight = Window.getClientWidth() + Window.getScrollLeft();
int windowLeft = Window.getScrollLeft();
int windowRight = Window.getClientWidth() + Window.getScrollLeft();
int windowLeft = Window.getScrollLeft();

代码示例来源:origin: ArcBees/GWTP

/**
 * By default this method centers the popup horizontally.
 * You can override this method to change the horizontal position of the popup.
 * @param popupWidth the width of the popup
 * @return the left position of the popup
 */
protected int getLeft(int popupWidth) {
  return ((Window.getClientWidth() - popupWidth) / 2) + Window.getScrollLeft();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

int width = Math.max(Window.getClientWidth(),
  Document.get().getScrollWidth());
int height = Math.max(Window.getClientHeight(),

代码示例来源:origin: com.google.gwt/gwt-servlet

windowWidth = Window.getClientWidth();
clientLeft = Document.get().getBodyOffsetLeft();
clientTop = Document.get().getBodyOffsetTop();

代码示例来源:origin: com.extjs/gxt

/**
 * Displays the popup.
 */
public void show() {
 Point p = new Point((int) Window.getClientWidth() / 2, (int) Window.getClientHeight() / 2);
 showAt(p.x, p.y);
}

代码示例来源:origin: net.wetheinter/gwt-user

private void setPositionInClient(int left, int top) {
 // Keep the popup inside client area
 if (getOffsetWidth() < Window.getClientWidth()) {
  left = Math.min(left, getClientRight() - getOffsetWidth());
  left = Math.max(getClientLeft(), left);
 }
 setPopupPosition(left, top);
}

代码示例来源:origin: com.ahome-it/lienzo-core

public LienzoPanel(final Viewport view)
{
  if (false == view.adopt(this))
  {
    throw new IllegalArgumentException("Viewport is already adopted.");
  }
  m_view = view;
  setWidth("100%");
  setHeight("100%");
  doPostCTOR(Window.getClientWidth(), Window.getClientHeight(), true);
}

代码示例来源:origin: org.uberfire/uberfire-simple-docks-client

public void setPosition(int offsetWidth,
              int offsetHeight) {
    int left = 0;
    if (parent.getDock().getDockPosition() == UberfireDockPosition.EAST) {
      left = Window.getClientWidth() - getOffsetWidth();
    }
    int top = parent.getAbsoluteTop();
    setPopupPosition(left,
             top);
  }
});

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

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;
}

代码示例来源:origin: net.sf.advanced-gwt/advanced-gwt

/**
 * Shows the panel.
 */
public void lock() {
  setStyleName("advanced-LockingPanel");
  setPopupPosition(0, 0);
  setWidth("100%");
  setHeight("100%");
  setPixelSize(Window.getClientWidth(), Window.getClientHeight());
  show();
}

相关文章