com.google.gwt.user.client.Window类的使用及代码示例

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

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

Window介绍

[英]This class provides access to the browser window's methods, properties, and events.
[中]此类提供对浏览器窗口的方法、属性和事件的访问。

代码示例

代码示例来源: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: com.google.gwt/gwt-servlet

public boolean confirm(String message) {
  return Window.confirm(message);
 }
}

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

/** Set whether or not resize checking is enabled. If disabled, elements will still be resized on window events, but the timer
 * will not check their dimensions periodically.
 * 
 * @param enabled true to enable the resize checking timer */
public void setResizeCheckingEnabled (boolean enabled) {
  if (enabled && !resizeCheckingEnabled) {
    resizeCheckingEnabled = true;
    if (windowHandler == null) {
      windowHandler = Window.addResizeHandler(this);
    }
    resizeCheckTimer.schedule(resizeCheckDelay);
  } else if (!enabled && resizeCheckingEnabled) {
    resizeCheckingEnabled = false;
    if (windowHandler != null) {
      windowHandler.removeHandler();
      windowHandler = null;
    }
    resizeCheckTimer.cancel();
  }
}

代码示例来源:origin: org.kuali.student.lum/ks-lum-ui-common

@Override
public void handleFailure(Throwable caught) {
  GWT.log("getLoCategoryTypes failed", caught);
  Window.alert("Get LoCategory Types failed");
}
@Override

代码示例来源: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: kaaproject/kaa

messageLabel.getElement().getStyle().setWhiteSpace(WhiteSpace.PRE_WRAP);
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: oVirt/ovirt-engine

private void styleAndPositionMenuContainer(final int eventX, final int eventY) {
  menuContainer.addStyleName(OPEN);
  clickButton.getElement().setAttribute(ARIA_EXPANDED, Boolean.TRUE.toString());
  menuContainer.getElement().getStyle().setPosition(Position.ABSOLUTE);
  menuContainer.getElement().getStyle().setTop(Window.getScrollTop() + eventY, Unit.PX);
  menuContainer.getElement().getStyle().setLeft(eventX, Unit.PX);
}

代码示例来源: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

int width = Math.max(Window.getClientWidth(),
  Document.get().getScrollWidth());
int height = Math.max(Window.getClientHeight(),
  Document.get().getScrollHeight());
glassElem.getStyle().setHeight(height, Unit.PX);
glassElem.getStyle().setWidth(width, Unit.PX);
Document.get().getBody().appendChild(glassElem);
mouseDown = false;
glassElem.removeFromParent();

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

/** Fix top value if need. Need in case if bottom part of menu not display */
private void adjustTopPosition() {
 int totalHeight = listPanel.getWidgetCount() * 19; // 19 height of menu item
 int y = getAbsoluteTop() + 19 + totalHeight;
 if (y > Window.getClientHeight()) {
  y = getAbsoluteTop() - 8 - totalHeight; // 8 need some correction for looking good in UI
  popupPanel.getElement().getStyle().clearProperty("top");
 } else {
  y = getAbsoluteTop() + 19;
 }
 popupPanel.getElement().getStyle().setProperty("top", "" + y + "px");
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

@Override
public void activate(ActivationEvent event) {
  active = true;
  activationMessage = event.getActivationMessage();
  overlay = new VOverlay();
  overlay.addStyleName("v-window");
  overlay.addStyleName("v-touchkit-offlinemode");
  Style style = overlay.getElement().getStyle();
  style.setZIndex(Z_INDEX); // Make sure this is overloading the indicator
  flowPanel = new FlowPanel();
  overlay.add(flowPanel);
  buildDefaultContent();
  overlay.show();
  overlay.setWidth(Window.getClientWidth() + "px");
  overlay.setHeight(Window.getClientHeight() + "px");
}

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

public boolean edit(WSGrid.WSCell element) {
 wsCellReference = element;
 editCellReference = this;
 datePicker.setValue(date);
 datePicker.setCurrentMonth(date);
 Style s = datePicker.getElement().getStyle();
 int left = (element.getAbsoluteLeft() + element.getOffsetWidth() - 20);
 if ((left + datePicker.getOffsetWidth()) > Window.getClientHeight()) {
  left = Window.getClientHeight() - datePicker.getOffsetHeight();
 }
 s.setProperty("left", left + "px");
 s.setProperty("top", (element.getAbsoluteTop() + element.getOffsetHeight()) + "px");
 datePicker.setVisible(true);
 return true;
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

private void prepareForScrolling(Widget p) {
  if (p != null) {
    // we'll swift the element to place where even ios 6 webkit don't
    // sink events for it
    Style style = p.getElement().getParentElement().getStyle();
    String property = style.getProperty(Css3Propertynames.transform());
    MatchResult exec = regExp3dValues.exec(property);
    style.setProperty(
        Css3Propertynames.transform(),
        "translate3d(" + exec.getGroup(1) + ",-"
            + Window.getClientHeight() + "px,0)");
  }
}

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

/**
 * Download the SDK.
 *
 * @param key the SDK key
 */
public static void downloadSdk(String key) {
 String getUrl = composeUrl(KAA_SDK_SERVLET_PATH,
   SDK_KEY_PARAMETER + "=" + URL.encodeQueryString(key));
 String url = GWT.getModuleBaseURL() + getUrl;
 Window.open(url, "_self", "enabled");
}

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

elem.getStyle().setPropertyPx("left", 0);
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(
  Window.getScrollTop() + top, 0));

代码示例来源:origin: org.kie.guvnor/guvnor-guided-dtable-editor-client

public void onClick( ClickEvent w ) {
    if ( !canConditionBeDeleted( c ) ) {
      Window.alert( Constants.INSTANCE.UnableToDeleteConditionColumn( c.getHeader() ) );
      return;
    }
    String cm = Constants.INSTANCE.DeleteConditionColumnWarning( c.getHeader() );
    if ( Window.confirm( cm ) ) {
      dtable.deleteColumn( c );
      refreshConditionsWidget();
    }
  }
} );

代码示例来源: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();
int windowTop = Window.getScrollTop();
int windowBottom = Window.getScrollTop() + Window.getClientHeight();

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

if (!Element.is(eventTarget)) {
 return;
 if (TableCellElement.TAG_TD.equalsIgnoreCase(cur.getTagName()) && 
   tableBuilder.isColumn(cur.getFirstChildElement())) {
  cur = cur.getFirstChildElement();
    int clientX = event.getClientX() + Window.getScrollLeft();
    int clientY = event.getClientY() + Window.getScrollTop();
    int rowLeft = hoveringRow.getAbsoluteLeft();
    int rowTop = hoveringRow.getAbsoluteTop();

代码示例来源:origin: com.smartgwt/smartgwt

public void onUncaughtException(Throwable e) {
    if (!GWT.isScript()) {
      Window.alert("Uncaught exception escaped : " + e.getClass().getName() + "\n" + e.getMessage() +
          "\nSee the Development console log for details." +
          "\nRegister a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling."
      );
    }
    GWT.log("Uncaught exception escaped", e);
  }
});

代码示例来源:origin: fr.putnami.pwt/pwt

public void reset() {
  Element e = this.getElement();
  StyleUtils.addStyle(e, Affixed.TOP);
  this.clearElementStyle();
  this.clientHeigth = Window.getClientHeight();
  this.pinnedOffset = e.getAbsoluteTop();
  this.offsetWidth = e.getClientWidth();
  StyleUtils.addStyle(e, this.affixed);
  this.resetPosistion();
}

相关文章