本文整理了Java中com.vaadin.ui.Button.setClickShortcut()
方法的一些代码示例,展示了Button.setClickShortcut()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setClickShortcut()
方法的具体详情如下:
包路径:com.vaadin.ui.Button
类名称:Button
方法名:setClickShortcut
[英]Makes it possible to invoke a click on this button by pressing the given KeyCode and (optional) ModifierKeys.
The shortcut is global (bound to the containing Window).
[中]通过按给定的键代码和(可选)ModifierKeys,可以调用单击此按钮。
快捷方式是全局的(绑定到包含的窗口)。
代码示例来源:origin: viritin/viritin
@Override
public void setClickShortcut(int keyCode, int... modifiers) {
super.setClickShortcut(keyCode, modifiers); //To change body of generated methods, choose Tools | Templates.
}
代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin
@Override
public ButtonBuilder clickShortcut(int keyCode, int... modifiers) {
getInstance().setClickShortcut(keyCode, modifiers);
return this;
}
代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin
@Override
public com.holonplatform.vaadin7.components.builders.ButtonConfigurator.BaseButtonConfigurator clickShortcut(
int keyCode, int... modifiers) {
getInstance().setClickShortcut(keyCode, modifiers);
return this;
}
代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin
@Override
public ButtonBuilder clickShortcut(int keyCode, int... modifiers) {
getInstance().setClickShortcut(keyCode, modifiers);
return this;
}
代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin
@Override
public com.holonplatform.vaadin.components.builders.ButtonConfigurator.BaseButtonConfigurator clickShortcut(
int keyCode, int... modifiers) {
getInstance().setClickShortcut(keyCode, modifiers);
return this;
}
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void readDesign(Element design, DesignContext designContext) {
super.readDesign(design, designContext);
Attributes attr = design.attributes();
String content;
// plain-text (default is html)
Boolean plain = DesignAttributeHandler
.readAttribute(DESIGN_ATTR_PLAIN_TEXT, attr, Boolean.class);
if (plain == null || !plain) {
setCaptionAsHtml(true);
content = design.html();
} else {
// content is not intended to be interpreted as HTML,
// so html entities need to be decoded
content = DesignFormatter.decodeFromTextNode(design.html());
}
setCaption(content);
if (attr.hasKey("icon-alt")) {
setIconAlternateText(DesignAttributeHandler
.readAttribute("icon-alt", attr, String.class));
}
// click-shortcut
removeClickShortcut();
ShortcutAction action = DesignAttributeHandler
.readAttribute("click-shortcut", attr, ShortcutAction.class);
if (action != null) {
setClickShortcut(action.getKeyCode(), action.getModifiers());
}
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
private Button createCancelButton(final String cancelLabel) {
final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.CANCEL_BUTTON, cancelLabel, "",
null, false, null, SPUIButtonStyleTiny.class);
button.addClickListener(this);
button.setClickShortcut(KeyCode.ESCAPE);
return button;
}
代码示例来源:origin: eclipse/hawkbit
private Button createOkButton(final String okLabel) {
final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.OK_BUTTON, okLabel, "",
ValoTheme.BUTTON_PRIMARY, false, null, SPUIButtonStyleTiny.class);
button.addClickListener(this);
button.setClickShortcut(KeyCode.ENTER);
return button;
}
代码示例来源:origin: eclipse/hawkbit
private Button createCancelButton(final String cancelLabel) {
final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.CANCEL_BUTTON, cancelLabel, "",
null, false, null, SPUIButtonStyleTiny.class);
button.addClickListener(this);
button.setClickShortcut(KeyCode.ESCAPE);
return button;
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
private Button createOkButton(final String okLabel) {
final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.OK_BUTTON, okLabel, "",
ValoTheme.BUTTON_PRIMARY, false, null, SPUIButtonStyleTiny.class);
button.addClickListener(this);
button.setClickShortcut(KeyCode.ENTER);
return button;
}
代码示例来源:origin: apache/ace
public static void addShortcut(WebBrowser browser, Button button, String description, int key, int... modifiers) {
if (!browser.isTouchDevice()) {
button.setClickShortcut(key, modifiers);
button.setDescription(String.format("%s (%s)", description, formatShortcut(key, modifiers)));
}
}
代码示例来源:origin: uk.q3c.krail/krail
@Override
protected void setIds() {
super.setIds();
submitButton.setId(ID.getId(Optional.empty(), this, submitButton));
submitButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
submitButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
usernameBox.setId(ID.getId(Optional.of("username"), this, usernameBox));
passwordBox.setId(ID.getId(Optional.of("password"), this, passwordBox));
statusMsgLabel.setId(ID.getId(Optional.of("status"), this, statusMsgLabel));
label.setId(ID.getId(Optional.of("label"), this, label));
}
代码示例来源:origin: com.haulmont.cuba/cuba-web
public static void setClickShortcut(Button button, String shortcut) {
KeyCombination closeCombination = KeyCombination.create(shortcut);
int[] closeModifiers = Modifier.codes(closeCombination.getModifiers());
int closeCode = closeCombination.getKey().getCode();
button.setClickShortcut(closeCode, closeModifiers);
}
代码示例来源:origin: eclipse/hawkbit
private void buildSignInButton() {
final String caption = isDemo ? i18n.getMessage("button.login.agreeandsignin")
: i18n.getMessage("button.login.signin");
signIn = new Button(caption);
signIn.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL + " " + "login-button");
signIn.setClickShortcut(KeyCode.ENTER);
signIn.focus();
signIn.setId("login-signin");
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
private void buildSignInButton() {
final String caption = isDemo
? i18n.getMessage("button.login.agreeandsignin")
: i18n.getMessage("button.login.signin");
signIn = new Button(caption);
signIn.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL + " " + "login-button");
signIn.setClickShortcut(KeyCode.ENTER);
signIn.focus();
signIn.setId("login-signin");
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
private void createSaveButton() {
saveButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_SAVE), "", "", true, FontAwesome.SAVE,
SPUIButtonStyleNoBorderWithIcon.class);
saveButton.setSizeUndefined();
saveButton.addStyleName("default-color");
addCloseListenerForSaveButton();
saveButton.setEnabled(false);
saveButton.setClickShortcut(KeyCode.ENTER);
buttonsLayout.addComponent(saveButton);
buttonsLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_RIGHT);
buttonsLayout.setExpandRatio(saveButton, 1.0F);
}
代码示例来源:origin: eclipse/hawkbit
private void createSaveButton() {
saveButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON,
i18n.getMessage(UIMessageIdProvider.BUTTON_SAVE), "", "", true, FontAwesome.SAVE,
SPUIButtonStyleNoBorderWithIcon.class);
saveButton.setSizeUndefined();
saveButton.addStyleName("default-color");
addCloseListenerForSaveButton();
saveButton.setEnabled(false);
saveButton.setClickShortcut(KeyCode.ENTER);
buttonsLayout.addComponent(saveButton);
buttonsLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_RIGHT);
buttonsLayout.setExpandRatio(saveButton, 1.0F);
}
代码示例来源:origin: com.github.markash/components
@SuppressWarnings("serial")
private Component buildFields() {
HorizontalLayout fields = new HorizontalLayout();
fields.setSpacing(true);
fields.addStyleName("fields");
usernameField.setIcon(VaadinIcons.USER);
usernameField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
usernameField.setDescription("The users are <br />"
+ "<ul>"
+ "<li><strong>admin</strong> with password <strong>password</strong>"
+ "<li><strong>katie</strong> with password <strong>password</strong>"
+ "<li><strong>marmite</strong> with password <strong>password</strong>"
+ "<li><strong>brown</strong> with password <strong>password</strong>"
+ "<li><strong>linus</strong> with password <strong>password</strong>"
+ "<li><strong>lucy</strong> with password <strong>password</strong>"
+ "</ul>");
passwordField.setIcon(VaadinIcons.LOCK);
passwordField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
loginButton.focus();
fields.addComponents(usernameField, passwordField, loginButton);
fields.setComponentAlignment(loginButton, Alignment.BOTTOM_LEFT);
return fields;
}
代码示例来源:origin: peholmst/SpringSecurityDemo
public LoginForm(LoginCallback callback) {
setMargin(true);
setSpacing(true);
TextField username = new TextField("Username");
addComponent(username);
PasswordField password = new PasswordField("Password");
addComponent(password);
Button login = new Button("Login", evt -> {
String pword = password.getValue();
password.setValue("");
if (!callback.login(username.getValue(), pword)) {
Notification.show("Login failed");
username.focus();
}
});
login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
addComponent(login);
}
代码示例来源:origin: org.aperteworkflow/editor
private ComponentContainer buildHeader(final AbstractStepEditorWindow sew, String stepType) {
Component label = getHeaderLabel();
Select stepList = prepareStepList(stepType);
Button saveButton = new Button(I18NSource.ThreadUtil.getThreadI18nSource().getMessage("jse.button.save"), new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
sew.save();
}
});
saveButton.setClickShortcut(ShortcutAction.KeyCode.S,
ShortcutAction.ModifierKey.CTRL
);
saveButton.setDescription("Ctrl-S");
HorizontalLayout headerLayout = new HorizontalLayout();
headerLayout.setSpacing(true);
headerLayout.setWidth("100%");
headerLayout.addComponent(label);
headerLayout.addComponent(saveButton);
headerLayout.addComponent(stepList);
headerLayout.setExpandRatio(label, 1.0f);
headerLayout.setComponentAlignment(saveButton, Alignment.TOP_RIGHT);
headerLayout.setComponentAlignment(stepList, Alignment.TOP_RIGHT);
return headerLayout;
}
内容来源于网络,如有侵权,请联系作者删除!