private void configureComponents() { save.setStyleName(ValoTheme.BUTTON_PRIMARY); save.setClickShortcut(ShortcutAction.KeyCode.ENTER); cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE); variantField.setNullSelectionAllowed(false); variantField.setInvalidAllowed(false); variantField.addItems(Variant.values()); nominal.setNullSelectionAllowed(true); nominal.setInvalidAllowed(false); nominal.addItems(NominalValue.values()); }
private void initLayout() { FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined(); loginForm.addComponent(userName = new TextField("Username")); loginForm.addComponent(passwordField = new PasswordField("Password")); loginForm.addComponent(login = new Button("Login")); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeUndefined(); loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(rootLayout); setSizeFull(); }
private com.vaadin.ui.Component buildFields() { HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.setIcon(FontAwesome.USER); username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final PasswordField password = new PasswordField("Password"); password.setIcon(FontAwesome.LOCK); password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button signin = new Button("Sign In"); signin.addStyleName(ValoTheme.BUTTON_PRIMARY); signin.setClickShortcut(ShortcutAction.KeyCode.ENTER); signin.focus(); fields.addComponents(username, password, signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); signin.addClickListener( new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { DashboardEventBus.post( new UserLoginRequestedEvent(username.getValue(), password.getValue())); } }); return fields; }
private void configureComponents() { /* * Highlight primary actions. * * With Vaadin built-in styles you can highlight the primary save button * and give it a keyboard shortcut for a better UX. */ save.setStyleName(ValoTheme.BUTTON_PRIMARY); save.setClickShortcut(ShortcutAction.KeyCode.ENTER); setVisible(false); }
private HorizontalLayout getButtons() { final HorizontalLayout layout = new HorizontalLayout(); layout.setSizeUndefined(); layout.setSpacing(true); save.addStyleName(Reindeer.BUTTON_DEFAULT); save.setClickShortcut(ShortcutAction.KeyCode.ENTER); layout.addComponent(save); layout.addComponent(edit); layout.addComponent(update); layout.addComponent(cancel); layout.addComponent(exit); return layout; }
private Component createConnectionButtons(final ProfileInfoPanelHolder infoPanelHolder) { Button connectButton = new Button( "Connect", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { ConnectionProfileLoginPanelFactory panel = infoPanelHolder.getPanelFactory(); ConnectionProfile profile = panel.createConnectionProfile(); try { databaseSessionManager.createSession(profile); } catch (Exception ex) { Notification.show( "Failed to connect\n", ex.getMessage(), Notification.Type.ERROR_MESSAGE); } } }); connectButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); HorizontalLayout buttons = new HorizontalLayout(connectButton); buttons.setSpacing(true); return buttons; }
@Override public ComponentContainer getLayout() { final VerticalLayout layout = new VerticalLayout(); this.informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 6); layout.addComponent(this.informationLayout.getLayout()); final MHorizontalLayout controlsBtn = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false)); layout.addComponent(controlsBtn); final Button approveBtn = new Button( "Approve & Close", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { if (EditForm.this.validateForm()) { // Save bug status and assignee bug.setStatus(BugStatus.Verified.name()); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateSelectiveWithSession(bug, AppContext.getUsername()); // Save comment String commentValue = commentArea.getValue(); if (StringUtils.isNotBlank(commentValue)) { CommentWithBLOBs comment = new CommentWithBLOBs(); comment.setComment( Jsoup.clean(commentArea.getValue(), Whitelist.relaxed())); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(ProjectTypeConstants.BUG); comment.setTypeid("" + bug.getId()); comment.setExtratypeid(CurrentProjectVariables.getProjectId()); CommentService commentService = ApplicationContextUtil.getSpringBean(CommentService.class); commentService.saveWithSession(comment, AppContext.getUsername()); } ApproveInputWindow.this.close(); callbackForm.refreshBugItem(); } } }); approveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); approveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER); controlsBtn.with(approveBtn).withAlign(approveBtn, Alignment.MIDDLE_LEFT); Button cancelBtn = new Button( AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { ApproveInputWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); controlsBtn.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_LEFT); layout.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return layout; }