本文整理了Java中com.vaadin.ui.Window.addCloseShortcut()
方法的一些代码示例,展示了Window.addCloseShortcut()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.addCloseShortcut()
方法的具体详情如下:
包路径:com.vaadin.ui.Window
类名称: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 {
内容来源于网络,如有侵权,请联系作者删除!