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

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

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

Window.addCloseShortcut介绍

[英]Adds a close shortcut - pressing this key while holding down all (if any) modifiers specified while this Window is in focus will close the Window.
[中]添加一个关闭快捷方式-按下此键,同时按住此窗口处于焦点时指定的所有(如果有)修改器,将关闭窗口。

代码示例

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

/**
 * Removes all keyboard shortcuts previously set with
 * {@link #setCloseShortcut(int, int...)} and
 * {@link #addCloseShortcut(int, int...)}, then adds the default
 * {@link KeyCode#ESCAPE} shortcut.
 * <p>
 * This is the old way of removing the (single) keyboard close shortcut, and
 * is retained only for exact backwards compatibility. For all new code, use
 * the new keyboard shortcuts API: {@link #addCloseShortcut(int,int...)},
 * {@link #removeCloseShortcut(int,int...)},
 * {@link #removeAllCloseShortcuts()}, {@link #hasCloseShortcut(int,int...)}
 * and {@link #getCloseShortcuts()}.
 *
 * @deprecated Use {@link #removeCloseShortcut(int, int...)} instead.
 */
@Deprecated
public void removeCloseShortcut() {
  for (CloseShortcut sc : closeShortcuts) {
    removeAction(sc);
  }
  closeShortcuts.clear();
  addCloseShortcut(KeyCode.ESCAPE);
}

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

public void setCloseShortcut(int keyCode, int... modifiers) {
  removeCloseShortcut();
  addCloseShortcut(keyCode, modifiers);

代码示例来源: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: com.holon-platform.vaadin7/holon-vaadin-navigator

@Override
public ViewWindowConfigurator withCloseShortcut(int keyCode, int... modifiers) {
  getInstance().addCloseShortcut(keyCode, modifiers);
  return this;
}

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

notificationsWindow.setResizable(true);
  notificationsWindow.setDraggable(true);
  notificationsWindow.addCloseShortcut(KeyCode.ESCAPE);
  notificationsWindow.setContent(notificationsLayout);
} else {

相关文章

微信公众号

最新文章

更多