List of usage examples for com.vaadin.ui Button Button
public Button(Resource icon)
From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java
@Override protected List<Button> buildActionMenuButtons(ViewChangeEvent event) { List<Button> buttons = super.buildActionMenuButtons(event); ConfirmDialogButton restart = new ConfirmDialogButton($("UpdateManagerViewImpl.restartButton")) { @Override/*from w w w . j a v a 2 s. c om*/ protected String getConfirmDialogMessage() { return $("UpdateManagerViewImpl.restartwarning"); } @Override protected void confirmButtonClick(ConfirmDialog dialog) { presenter.restart(); } }; restart.setDialogMode(ConfirmDialogButton.DialogMode.WARNING); buttons.add(restart); reindex = new ConfirmDialogButton($("UpdateManagerViewImpl.restartAndReindexButton")) { @Override protected String getConfirmDialogMessage() { return $("UpdateManagerViewImpl.reindexwarning"); } @Override protected void confirmButtonClick(ConfirmDialog dialog) { presenter.restartAndReindex(); } }; reindex.setDialogMode(ConfirmDialogButton.DialogMode.WARNING); reindex.setEnabled(presenter.isRestartWithReindexButtonEnabled()); buttons.add(reindex); standardUpdate = new Button($("UpdateManagerViewImpl.automatic")); standardUpdate.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { presenter.standardUpdateRequested(); } }); buttons.add(standardUpdate); alternateUpdate = new Button($("UpdateManagerViewImpl." + presenter.getAlternateUpdateName())); alternateUpdate.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { presenter.alternateUpdateRequested(); } }); alternateUpdate.setVisible(presenter.isAlternateUpdateAvailable()); buttons.add(alternateUpdate); license = new Button($("UpdateManagerViewImpl.licenseButton")); license.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { presenter.licenseUpdateRequested(); } }); buttons.add(license); return buttons; }
From source file:com.conx.logistics.kernel.ui.editors.vaadin.tests.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window);//from w w w.j a va2s . c om Button button = new Button("Click Me!"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { window.addComponent(new Label("Thank you for clicking!!!")); } }); window.addComponent(button); }
From source file:com.cxplonka.feature.ui.vaadin.VaadinUI.java
private Button createNavigationButton(String caption, final String viewName) { Button button = new Button(caption); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener(e -> getUI().getNavigator().navigateTo(viewName)); return button; }
From source file:com.demo.tutorial.agenda.ui.SearchView.java
public SearchView(final MyUI app) { this.app = app; setCaption("Buscar Contactos"); setSizeFull();//from www .j av a 2s . c o m addStyleName("view"); /* Usar un FormLayout como layout principal para este Panel*/ FormLayout formLayout = new FormLayout(); /* Creando componente UI */ txtTextField = new TextField("Buscar"); cmbFieldtoSearch = new NativeSelect("Campo por buscar"); chkSaveSearch = new CheckBox("Guardar Bsqueda"); txtSearchName = new TextField("Buscar nombre"); Button btnBuscar = new Button("Buscar"); btnBuscar.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { performSearch(); } }); /* Inicializar combo */ for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) { cmbFieldtoSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]); cmbFieldtoSearch.setItemCaption(PersonContainer.NATURAL_COL_ORDER[i], PersonContainer.COL_HEADERS_ENGLISH[i]); } cmbFieldtoSearch.setValue("apPaterno"); cmbFieldtoSearch.setNullSelectionAllowed(false); /* Inicializando save checkbox */ chkSaveSearch.setValue(true); chkSaveSearch.setImmediate(true); chkSaveSearch.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } }); /* chkSaveSearch.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } });*/ /* Aadiendo los componentes creados al formulario */ formLayout.addComponent(txtTextField); formLayout.addComponent(cmbFieldtoSearch); formLayout.addComponent(chkSaveSearch); formLayout.addComponent(txtSearchName); formLayout.addComponent(btnBuscar); setContent(formLayout); }
From source file:com.demo.tutorial.agenda.ui.SharingOptions.java
public SharingOptions() { setModal(true);// w w w .j a v a 2 s. c o m setWidth("50%"); center(); setCaption("Sharing Options"); VerticalLayout subContent = new VerticalLayout(); subContent.addComponent(new Label(SHARING_HTML_SNNIPET)); subContent.addComponent(new CheckBox("Gmail")); subContent.addComponent(new CheckBox(".Mac")); Button close = new Button("Ok"); close.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); subContent.addComponent(close); setContent(subContent); }
From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java
License:Apache License
@Override public void init() { setTheme("bootstrap"); window = new Window("My Vaadin Application"); setMainWindow(window);/*ww w.j a v a 2s.com*/ Button button = new Button("Click Me"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { window.addComponent(new Label("Thank you for clicking")); } }); CssLayout container = new CssLayout(); container.setWidth("100%"); container.addStyleName("container"); typography(container); tables(container); forms(container); buttons(container); window.setContent(container); }
From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java
License:Apache License
private void forms(ComponentContainer container) { VerticalLayout form = new VerticalLayout(); form.addStyleName(Bootstrap.Forms.FORM.styleName()); form.setSpacing(true);/*w w w.j av a 2s .co m*/ form.setCaption("Legend"); TextField email = new TextField("Email address"); email.setInputPrompt("Enter email"); form.addComponent(email); PasswordField password = new PasswordField("Password"); password.setInputPrompt("Password"); form.addComponent(password); Upload upload = new Upload("File input", null); form.addComponent(upload); Label help = new Label("Example block-level help text here."); help.addStyleName("help-block"); form.addComponent(help); CheckBox check = new CheckBox("Check me out"); form.addComponent(check); Button submit = new Button("Submit"); submit.addStyleName(Bootstrap.Buttons.DEFAULT.styleName()); form.addComponent(submit); container.addComponent(form); }
From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java
License:Apache License
private void buttons(CssLayout container) { _HorizontalLayout buttons = new _HorizontalLayout(); buttons.setSpacing(true);/*from w w w .j ava 2s . co m*/ buttons.setMargin(true); container.addComponent(buttons); Button normal = new Button("Default"); normal.addStyleName(Bootstrap.Buttons.DEFAULT.styleName()); Button primary = new Button("Primary"); primary.addStyleName(Bootstrap.Buttons.PRIMARY.styleName()); Button success = new Button("Success"); success.addStyleName(Bootstrap.Buttons.SUCCESS.styleName()); Button info = new Button("Info"); info.addStyleName(Bootstrap.Buttons.INFO.styleName()); Button warning = new Button("Warning"); warning.addStyleName(Bootstrap.Buttons.WARNING.styleName()); Button danger = new Button("Danger"); danger.addStyleName(Bootstrap.Buttons.DANGER.styleName()); Button link = new Button("Link"); link.addStyleName(Bootstrap.Buttons.LINK.styleName()); buttons.addComponents(normal, primary, info, success, warning, danger, link); }
From source file:com.ejt.vaadin.loginform.LoginForm.java
License:Apache License
/** * Customize the login button. Only for overriding, do not call. * @return the login button//from www . j a v a 2s . co m */ protected Button createLoginButton() { checkInitialized(); return new Button(getLoginButtonCaption()); }
From source file:com.esofthead.mycollab.common.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout().withSpacing(true).withMargin(false) .withWidth("100%").withStyleName("message"); MVerticalLayout userBlock = new MVerticalLayout().withSpacing(true).withMargin(false).withWidth("80px"); userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER); ClickListener gotoUser = new ClickListener() { private static final long serialVersionUID = 1L; @Override//from ww w . j a v a 2 s .c o m public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoRead(this, comment.getCreateduser())); } }; Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(comment.getOwnerAvatarId(), comment.getOwnerFullName()); userAvatarBtn.addClickListener(gotoUser); userBlock.addComponent(userAvatarBtn); Button userName = new Button(comment.getOwnerFullName()); userName.setStyleName("user-name"); userName.addStyleName("link"); userName.addStyleName(UIConstants.WORD_WRAP); userName.addClickListener(gotoUser); userBlock.addComponent(userName); layout.addComponent(userBlock); CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout().withSpacing(true) .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label timePostLbl = new Label( AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), DateTimeUtils.getPrettyDateValue(comment.getCreatedtime(), AppContext.getUserLocale())), ContentMode.HTML); timePostLbl.setDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.addComponent(timePostLbl); messageHeader.setExpandRatio(timePostLbl, 1.0f); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment.getId(), AppContext.getUsername(), AppContext.getAccountId()); CommentRowDisplayHandler.this.owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new UrlDetectableLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withMargin(true) .withWidth("100%").withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.addComponent(attachmentDisplay); messageFooter.setComponentAlignment(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.addComponent(rowLayout); layout.setExpandRatio(rowLayout, 1.0f); return layout; }