@Override public void setClickShortcut(int keyCode, int... modifiers) { super.setClickShortcut(keyCode, modifiers); //To change body of generated methods, choose Tools | Templates. }
@Override public ButtonBuilder clickShortcut(int keyCode, int... modifiers) { getInstance().setClickShortcut(keyCode, modifiers); return this; }
@Override public com.holonplatform.vaadin7.components.builders.ButtonConfigurator.BaseButtonConfigurator clickShortcut( int keyCode, int... modifiers) { getInstance().setClickShortcut(keyCode, modifiers); return this; }
@Override public ButtonBuilder clickShortcut(int keyCode, int... modifiers) { getInstance().setClickShortcut(keyCode, modifiers); return this; }
@Override public com.holonplatform.vaadin.components.builders.ButtonConfigurator.BaseButtonConfigurator clickShortcut( int keyCode, int... modifiers) { getInstance().setClickShortcut(keyCode, modifiers); return this; }
@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()); } }
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; }
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; }
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; }
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; }
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))); } }
@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)); }
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); }
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"); }
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"); }
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); }
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); }
@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; }
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); }
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; }