List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:com.klwork.explorer.ui.custom.SelectUsersPopupWindow.java
License:Apache License
protected void initSelectMyselfButton(HorizontalLayout searchLayout) { final LoggedInUser loggedInUser = LoginHandler.getLoggedInUser(); if (ignoredUserIds == null || !ignoredUserIds.contains(loggedInUser.getId())) { Button meButton = new Button(i18nManager.getMessage(Messages.PEOPLE_SELECT_MYSELF)); meButton.setIcon(Images.USER_16); searchLayout.addComponent(meButton); searchLayout.setComponentAlignment(meButton, Alignment.MIDDLE_LEFT); if (multiSelect) { meButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { selectUser(loggedInUser.getId(), loggedInUser.getFullName()); }/* w ww . j a v a 2 s. c om*/ }); } else { meButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { addMatchingUser(loggedInUser.getId(), loggedInUser.getFullName()); matchingUsersTable.select(loggedInUser.getId()); fireEvent(new SubmitEvent(doneButton, SubmitEvent.SUBMITTED)); close(); } }); } } }
From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) { Button button = new Button(label); button.addStyleName(type);//from w w w . j a v a 2 s. c om button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON); button.addStyleName(Reindeer.BUTTON_LINK); button.setHeight(54, Unit.PIXELS); button.setIcon(icon); button.setWidth(width, Unit.PIXELS); addComponent(button); setComponentAlignment(button, Alignment.TOP_CENTER); return button; }
From source file:com.klwork.explorer.ui.task.TaskMenuBar.java
License:Apache License
protected void initActions() { Button newCaseButton = new Button(); newCaseButton.setCaption(i18nManager.getMessage(Messages.TASK_NEW)); //WW_TODO Fix newCaseButton.setIcon(Images.TASK_16); addButton(newCaseButton);/* w ww . j av a2s. c o m*/ newCaseButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { NewTaskPopupWindow newTaskPopupWindow = new NewTaskPopupWindow(); ViewToolManager.showPopupWindow(newTaskPopupWindow); } }); }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected Button initEditProfileButton() { Button editProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_EDIT)); editProfileButton.setIcon(Images.EDIT); editProfileButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { editable = true;/*from w ww . j a v a 2 s . c o m*/ initUi(); } }); return editProfileButton; }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected Button initSaveProfileButton() { Button saveProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_SAVE)); saveProfileButton.setIcon(Images.SAVE); saveProfileButton.addClickListener(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 ww w. j ava 2 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(); // Update user cache ViewToolManager.getUserCache().notifyUserDataChanged(user.getId()); } }); return saveProfileButton; }
From source file:com.kpg.diary.ui.MenuLayout.java
License:Apache License
/** * Builds the menu.//from w ww .j av a 2 s .co m * * @param navigator * the navigator * @return the css layout */ private CssLayout buildMenu(Navigator navigator) { // Add items menuItemsMap(); HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.addStyleName(ValoTheme.MENU_TITLE); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); // menu.addComponent(createThemeSelect()); menu.addComponent(top); Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(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); Label title = new Label("<h2>Diary</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); for (final Entry<String, String> item : menuItems.entrySet()) { Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(ClickEvent event) { navigator.navigateTo(item.getKey()); } }); b.setHtmlContentAllowed(true); b.setPrimaryStyleName(ValoTheme.MENU_ITEM); if (IConstants.NavigationMenu.ADDRESS.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.BOOK); } else if (IConstants.NavigationMenu.PERSON.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.USER); } else { b.setIcon(FontAwesome.APPLE); } menuItemsLayout.addComponent(b); } return menu; }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidget.java
public UserDetailsWidget() { HorizontalLayout h = new HorizontalLayout(); addComponent(h);/* w w w. j a va 2 s. c o m*/ h.setSizeFull(); //h.setSpacing(true); Button userPhoto = new Button(); userPhoto.setIcon(FontAwesome.USER); userPhoto.setHeight("100px"); userPhoto.setWidth("100px"); h.addComponent(userPhoto); //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT); VerticalLayout v = new VerticalLayout(); //v.setStyleName("backColorBlack"); h.addComponent(v); v.setStyleName("v-layout-padding-left"); //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT); v.setHeight("106px"); v.setWidth("100px"); // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); Button editProfile = new Button("Profile"); editProfile.setStyleName("v-button-type3"); editProfile.setIcon(FontAwesome.USER); editProfile.setWidth("100px"); editProfile.setWidth("102px"); v.addComponent(editProfile); //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT); Button settings = new Button("Settings"); settings.setStyleName("v-button-type3"); settings.setIcon(FontAwesome.WRENCH); settings.setWidth("100px"); settings.setWidth("102px"); v.addComponent(settings); //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT); Button logOut = new Button("Log Out"); logOut.setStyleName("v-button-type3"); logOut.setIcon(FontAwesome.KEY); logOut.setWidth("100px"); logOut.setWidth("102px"); v.addComponent(logOut); //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT); //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); }
From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java
public PrimaryMasterPage() { //ContextWidget c= new ContextWidget(); HorizontalLayout iHorizontalLayout = new HorizontalLayout(); //addComponent(iHorizontalLayout,"top:0px;left:0px"); iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth())); iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight())); iHorizontalLayout.setStyleName("backColorBlack"); //String[] captions1 = {"Logo Here", "My Cool School", "Third"}; //Layout A and its sub components Panel AP = new Panel(); iHorizontalLayout.addComponent(AP);/* www . ja v a 2 s .c om*/ AP.setSizeFull(); AP.setStyleName("backColorBlack"); VerticalLayout A1 = new VerticalLayout(); AP.setContent(A1); //A.setSizeFull(); A1.setSpacing(true); iHorizontalLayout.setExpandRatio(AP, 1); A1.setStyleName("backColorBlack"); A1.setMargin(new MarginInfo(true, true, true, true)); Button logoImage = new Button(); logoImage.setIcon(FontAwesome.PICTURE_O); logoImage.setWidth("80px"); logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS); //logoImage.setWidth("100px"); A1.addComponent(logoImage); A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER); Label schoolName = new Label("The School Of Future"); schoolName.setStyleName("v-label-big"); A1.addComponent(schoolName); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); Label schoolMinorName = new Label("Random Branch"); schoolMinorName.setStyleName("v-label-small"); A1.addComponent(schoolMinorName); VerticalLayout A2 = new VerticalLayout(); A1.addComponent(A2); MainMenuWidget iMainMenuWidget = new MainMenuWidget(); A2.addComponent(iMainMenuWidget); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); //Layout B ContextWidgetTop c = new ContextWidgetTop(); c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP, SliderPanelStyles.COLOR_RED); VerticalLayout B = new VerticalLayout(); B.setSizeFull(); //B.setSpacing(true); iHorizontalLayout.addComponent(c); c.addComponent(B); iHorizontalLayout.setExpandRatio(c, 7); //Layout B1 and its sub Components HorizontalLayout B1 = new HorizontalLayout(); B.addComponent(B1); //B.setExpandRatio(B1, 1); //B1.setHeight("70px"); B1.setSizeFull(); //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED); HorizontalLayout B11 = new HorizontalLayout(); B1.addComponent(B11); B1.setStyleName("backColorBlack"); B11.setSizeFull(); B1.setHeight("45px"); //B1.setStyleName("backColorWhite"); //B1.setMargin(new MarginInfo(false, true, false, true)); TextField iTextField = new TextField(); iTextField.setWidth("200px"); iTextField.setInputPrompt("Search!"); iTextField.setStyleName("v-text-type-search"); iTextField.focus(); B11.addComponent(iTextField); B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT); //Layout B2 and its Sub Components ContextWidget B2 = new ContextWidget(); B2.setSizeFull(); B.addComponent(B2); B.setExpandRatio(B2, 10); B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT, SliderPanelStyles.COLOR_BLUE); //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED); VerticalLayout v = new VerticalLayout(); B2.addComponent(v); Button b1111 = new Button( "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this"); v.addComponent(b1111); Button b1112 = new Button("Put all the inner components like this"); v.addComponent(b1112); /* Panel p = new Panel(); VerticalLayout v= new VerticalLayout(); v.addComponent(new TextField("Name")); v.addComponent(new TextField("Street address")); v.addComponent(new TextField("Postal code")); p.setContent(v); B2.addComponent(p); v.setWidth(String.valueOf(B2.getWidth()*10)+"px"); //v.setSizeFull();// <- This will cause issues. Don't do this p.setSizeFull(); */ //ContextWidget iContextPanel= new ContextWidget(p); //B2.addComponent(iContextPanel); //setPosition(p, iComponentPositionPanel); addComponent(iHorizontalLayout); }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java
License:Apache License
public Menu(Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);//from w w w . j av a 2s . c o m Label title = new Label("My CRUD"); title.addStyleName(ValoTheme.LABEL_H3); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/table-logo.png")); image.setStyleName("logo"); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuItem selectedItem) { VaadinSession.getCurrent().getSession().invalidate(); Page.getCurrent().reload(); } }); logoutMenu.addStyleName("user-menu"); menuPart.addComponent(logoutMenu); // button for toggling the visibility of the menu when on a small screen final Button showMenu = new Button("Menu", new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(FontAwesome.NAVICON); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java
License:Apache License
private void createViewButton(final String name, String caption, Resource icon) { Button button = new Button(caption, new ClickListener() { /**/*from w w w . j a v a2 s .c om*/ * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { navigator.navigateTo(name); } }); button.setPrimaryStyleName(ValoTheme.MENU_ITEM); button.setIcon(icon); menuItemsLayout.addComponent(button); viewButtons.put(name, button); }