com.vaadin.ui.Window.setPositionX()方法的使用及代码示例

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

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

Window.setPositionX介绍

[英]Sets the distance of Window left border in pixels from left border of the containing (main window). Has effect only if in WindowMode#NORMALmode.
[中]设置窗口左边框与主窗口左边框的距离(以像素为单位)。仅在WindowMode#Normal Mode下有效。

代码示例

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * Sets the position of the window on the screen using
 * {@link #setPositionX(int)} and {@link #setPositionY(int)}.
 *
 * @since 7.5
 * @param x
 *            The new x coordinate for the window
 * @param y
 *            The new y coordinate for the window
 */
public void setPosition(int x, int y) {
  setPositionX(x);
  setPositionY(y);
}

代码示例来源:origin: com.vaadin/vaadin-server

@Override
  public void windowMoved(int x, int y) {
    if (x != getState(false).positionX) {
      setPositionX(x);
    }
    if (y != getState(false).positionY) {
      setPositionY(y);
    }
  }
};

代码示例来源:origin: com.vaadin/vaadin-server

setPositionX(x < 0 ? -1 : x);

代码示例来源:origin: com.vaadin/vaadin-server

@Override
public void readDesign(Element design, DesignContext context) {
  super.readDesign(design, context);
  if (design.hasAttr("center")) {
    center();
  }
  if (design.hasAttr("position")) {
    String[] position = design.attr("position").split(",");
    setPositionX(Integer.parseInt(position[0]));
    setPositionY(Integer.parseInt(position[1]));
  }
  // Parse shortcuts if defined, otherwise rely on default behavior
  if (design.hasAttr("close-shortcut")) {
    // Parse shortcuts
    String[] shortcutStrings = DesignAttributeHandler
        .readAttribute("close-shortcut", design.attributes(),
            String.class)
        .split("\\s+");
    removeAllCloseShortcuts();
    for (String part : shortcutStrings) {
      if (!part.isEmpty()) {
        ShortcutAction shortcut = DesignAttributeHandler
            .getFormatter()
            .parse(part.trim(), ShortcutAction.class);
        addCloseShortcut(shortcut.getKeyCode(),
            shortcut.getModifiers());
      }
    }
  }
}

代码示例来源:origin: KrailOrg/krail

/**
 * Forces a x position for the message dialog.
 *
 * @param x The x position
 * @return The {@link MessageBox} instance itself
 */
public MessageBox withDialogPositionX(int x) {
  window.setPositionX(x);
  return this;
}

代码示例来源:origin: com.github.markash/components

notificationsWindow.setPositionX(event.getClientX() - event.getRelativeX() - 300);
getUI().addWindow(notificationsWindow);
notificationsWindow.focus();

相关文章