List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:org.activiti.explorer.ui.profile.ProfilePanel.java
License:Apache License
protected Button initEditProfileButton() { Button editProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_EDIT)); editProfileButton.setIcon(Images.EDIT); editProfileButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { editable = true;//from w w w . j a va 2 s .c om initUi(); } }); return editProfileButton; }
From source file:org.activiti.explorer.ui.profile.ProfilePanel.java
License:Apache License
protected Button initSaveProfileButton() { Button saveProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_SAVE)); saveProfileButton.setIcon(Images.SAVE); saveProfileButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { user.setFirstName((String) firstNameField.getValue()); user.setLastName((String) lastNameField.getValue()); user.setEmail((String) emailField.getValue()); identityService.saveUser(user); identityService.setUserInfo(user.getId(), Constants.USER_INFO_JOB_TITLE, jobTitleField.getValue().toString()); if (birthDateField.getValue() != null && !"".equals(birthDateField.getValue().toString())) { identityService.setUserInfo(user.getId(), Constants.USER_INFO_BIRTH_DATE, new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).format(birthDateField.getValue())); }/*from www . j a va2 s .c o m*/ identityService.setUserInfo(user.getId(), Constants.USER_INFO_LOCATION, locationField.getValue().toString()); identityService.setUserInfo(user.getId(), Constants.USER_INFO_PHONE, phoneField.getValue().toString()); identityService.setUserInfo(user.getId(), Constants.USER_INFO_TWITTER, twitterField.getValue().toString()); identityService.setUserInfo(user.getId(), Constants.USER_INFO_SKYPE, skypeField.getValue().toString()); // UI editable = false; loadProfileData(); initUi(); } }); return saveProfileButton; }
From source file:org.activiti.explorer.ui.task.TaskMenuBar.java
License:Apache License
protected void initActions() { Button newCaseButton = new Button(); newCaseButton.setCaption(i18nManager.getMessage(Messages.TASK_NEW)); newCaseButton.setIcon(Images.TASK_16); addButton(newCaseButton);//from w w w . j a v a 2 s. c om newCaseButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { NewCasePopupWindow newTaskPopupWindow = new NewCasePopupWindow(); viewManager.showPopupWindow(newTaskPopupWindow); } }); }
From source file:org.activiti.kickstart.ui.MainMenuBar.java
License:Apache License
protected Button addMenuButton(String label, Resource icon, boolean active, float width) { Button button = new Button(label); button.addStyleName(STYLE_MAIN_MENU_BUTTON); button.addStyleName(Reindeer.BUTTON_LINK); button.setHeight(54, UNITS_PIXELS);/*from w w w . j a v a 2 s . c o m*/ button.setIcon(icon); button.setWidth(width, UNITS_PIXELS); addComponent(button); setComponentAlignment(button, Alignment.TOP_CENTER); return button; }
From source file:org.activiti.kickstart.ui.panel.KickstartWorkflowPanel.java
License:Apache License
protected void initButtons(GridLayout layout) { final Button saveButton = new Button("Save"); saveButton.setEnabled(nameField.getValue() != null && !"".equals((String) nameField.getValue())); saveButton.setIcon(saveImage); saveButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 3546324122090420533L; public void buttonClick(ClickEvent event) { try { adhocWorkflowService.deployKickstartWorkflow(createAdhocWorkflow()); Panel successPanel = new Panel(); successPanel.setStyleName(Reindeer.PANEL_LIGHT); Label successLabel = new Label("Process successfully deployed"); successPanel.addComponent(successLabel); viewManager.switchWorkArea(ViewManager.PROCESS_SUCESSFULLY_DEPLOYED, successPanel); } catch (Exception e) { e.printStackTrace();// w w w .j a v a2 s.co m viewManager.showPopupWindow(new ErrorPopupWindow(e)); } } }); // Dependending on namefield value, save button is enabled nameField.addListener(new ValueChangeListener() { private static final long serialVersionUID = -4357300368046546003L; public void valueChange(ValueChangeEvent event) { if (nameField.getValue() != null && !"".equals((String) nameField.getValue())) { saveButton.setEnabled(true); } else { saveButton.setEnabled(false); } } }); Button generateImageButton = new Button("View image"); generateImageButton.setIcon(generateImageImage); generateImageButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 5671158538486627690L; public void buttonClick(ClickEvent event) { viewManager.showPopupWindow(new ProcessImagePopupWindow(viewManager, createAdhocWorkflow())); } }); HorizontalLayout footer = new HorizontalLayout(); footer.setSpacing(true); footer.addComponent(saveButton); footer.addComponent(generateImageButton); layout.addComponent(new Label()); layout.addComponent(footer); }
From source file:org.apache.ace.webui.vaadin.component.BaseObjectPanel.java
License:Apache License
/** * Creates a remove-item button for the given repository object. * // w w w .j a va 2 s . co m * @param object * the object to create a remove-item button, cannot be <code>null</code>; * @param displayName * the display name for the description of the button, cannot be <code>null</code>. * @return a remove-item button, never <code>null</code>. */ protected final Button createRemoveItemButton(RepositoryObject object, String displayName) { Button result = new Button(); result.setIcon(createIconResource("trash")); result.setData(object.getDefinition()); result.setStyleName("small tiny"); result.setDescription("Delete " + displayName); result.setDisableOnClick(true); result.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { try { handleItemRemoveObject(event.getButton().getData()); } catch (Exception e) { // ACE-246: notify user when the removal failed! getWindow().showNotification("Failed to remove item!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); return result; }
From source file:org.apache.ace.webui.vaadin.component.BaseObjectPanel.java
License:Apache License
/** * Creates a remove-link button for the given repository object. * //from www. ja v a2 s . c o m * @param object * the object to create a remove-link button, cannot be <code>null</code>; * @param displayName * the display name for the description of the button, cannot be <code>null</code>. * @return a remove-link button, never <code>null</code>. */ protected final Button createRemoveLinkButton(RepositoryObject object, String displayName) { Button result = new Button(); result.setIcon(createIconResource("unlink")); result.setStyleName("small tiny"); result.setData(object.getDefinition()); result.setDescription("Unlink " + displayName); // Only enable this button when actually selected... result.setEnabled(false); result.setDisableOnClick(true); result.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { handleItemRemoveLink(event.getButton().getData()); } }); return result; }
From source file:org.apache.tamaya.ui.NavBar.java
License:Apache License
private void addLogoutAndSettingsButton(final ApplicationLayout appLayout) { MessageProvider messages = ServiceContextManager.getServiceContext().getService(MessageProvider.class); Button logout = new Button(messages.getMessage("default.label.logout"), new Button.ClickListener() { @Override/*from w w w . j a va 2 s .com*/ public void buttonClick(Button.ClickEvent clickEvent) { User user = CurrentUser.get(); if (user != null) { user.logout(); EventBus.post(new LogoutEvent(user)); } CurrentUser.set(null); } }); logout.addStyleName(UIConstants.BUTTON_LOGOUT); logout.addStyleName(UIConstants.BUTTON_BORDERLESS); logout.setIcon(FontAwesome.SIGN_OUT); Button settings = new Button("...", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { // UISettingsDialog dlog = new UISettingsDialog(appLayout.getNavigationBar()); // dlog.show(); } }); settings.addStyleName(UIConstants.BUTTON_SETTINGS); settings.addStyleName(UIConstants.BUTTON_BORDERLESS); VerticalLayout buttons = new VerticalLayout(logout, settings); addComponent(buttons); }
From source file:org.bubblecloud.ilves.site.Site.java
License:Apache License
/** * Gets button.// w w w. j a v a 2 s. c om * @param key the button key * @return the key */ public Button getButton(final String key) { final Button button = new Button(localize("button-" + key)); button.setIcon(getIcon("button-icon-" + key)); return button; }
From source file:org.bubblecloud.ilves.site.view.valo.DefaultValoView.java
License:Apache License
private CssLayout buildMenu() { final HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); topLayout.addStyleName("valo-menu-title"); menu.addComponent(topLayout);/* w w w .ja va 2s . c om*/ final Button showMenu = new Button("Menu", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>" + Site.getCurrent().localize(getViewVersion().getTitle()) + "</h3>", ContentMode.HTML); title.setSizeUndefined(); topLayout.addComponent(title); topLayout.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); final String user = Site.getCurrent().getSecurityProvider().getUser(); final String userMenuCaption; final Resource userMenuIcon; if (user == null) { userMenuCaption = Site.getCurrent().localize("page-link-login"); userMenuIcon = new ThemeResource("ilves_logo.png"); } else { final URL gravatarUrl = GravatarUtil.getGravatarUrl(user, 64); userMenuIcon = new ExternalResource(gravatarUrl); userMenuCaption = ((SecurityProviderSessionImpl) Site.getCurrent().getSecurityProvider()) .getUserFromSession().getFirstName(); } final MenuBar.MenuItem settingsItem = settings.addItem(userMenuCaption, userMenuIcon, null); if (user != null) { settingsItem.addItem(Site.getCurrent().localize("page-link-account"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { UI.getCurrent().getNavigator().navigateTo("account"); } }); settingsItem.addSeparator(); settingsItem.addItem(Site.getCurrent().localize("button-logout"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { LoginService.logout(Site.getCurrent().getSiteContext()); final Company company = Site.getCurrent().getSiteContext().getObject(Company.class); getUI().getPage().setLocation(company.getUrl()); getSession().getSession().invalidate(); getSession().close(); } }); } else { settingsItem.addItem(Site.getCurrent().localize("page-link-login"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { UI.getCurrent().getNavigator().navigateTo("login"); } }); } menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); final Site site = Site.getCurrent(); final NavigationVersion navigationVersion = site.getCurrentNavigationVersion(); for (final String pageName : navigationVersion.getRootPages()) { final ViewVersion pageVersion = site.getCurrentViewVersion(pageName); if (pageVersion == null) { throw new SiteException("Unknown page: " + pageName); } if (pageVersion.getViewerRoles().length > 0) { boolean roleMatch = false; for (final String role : pageVersion.getViewerRoles()) { if (site.getSecurityProvider().getRoles().contains(role)) { roleMatch = true; break; } } if (!roleMatch) { continue; } } if (navigationVersion.hasChildPages(pageName)) { final String localizedPageName = pageVersion.isDynamic() ? pageName : site.localize("page-link-" + pageName); final Label label = new Label(localizedPageName, ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); final List<String> childPages = navigationVersion.getChildPages(pageName); for (final String childPage : childPages) { addMenuLink(navigationVersion, childPage); } label.setValue( label.getValue() + " <span class=\"valo-menu-badge\">" + childPages.size() + "</span>"); } else { addMenuLink(navigationVersion, pageName); } } return menu; }