List of usage examples for com.vaadin.data HasValue.ValueChangeEvent getValue
public V getValue();
From source file:dhbw.clippinggorilla.userinterface.views.FooterBar.java
public FooterBar() { setColumns(6);// w w w . j a v a 2 s . com setRows(1); addStyleName("menubar"); setWidth("100%"); setHeightUndefined(); setColumnExpandRatio(4, 5); setSpacing(true); setMargin(true); Image logo = new Image(); try { logo.setSource(new FileResource(FileUtils.getFile("images/logo_small.png").toFile())); } catch (FileNotFoundException ex) { Log.error("Could not find logo!", ex); } logo.setHeight("100%"); addComponent(logo); setComponentAlignment(logo, Alignment.MIDDLE_CENTER); Button aboutUs = new Button(); Language.set(Word.ABOUT_US, aboutUs); aboutUs.addClickListener((ce) -> { ClippingGorillaUI.getCurrent().setMainContent(AboutUsView.getCurrent()); }); aboutUs.setIcon(VaadinIcons.USERS); aboutUs.addStyleName(ValoTheme.BUTTON_BORDERLESS); addComponent(aboutUs); setComponentAlignment(aboutUs, Alignment.MIDDLE_CENTER); Button docs = new Button(); Language.set(Word.DOCUMENTS, docs); docs.addClickListener(ce -> { ClippingGorillaUI.getCurrent().setMainContent(DocumentsView.getCurrent()); }); docs.setIcon(VaadinIcons.ARCHIVE); docs.addStyleName(ValoTheme.BUTTON_BORDERLESS); addComponent(docs); setComponentAlignment(docs, Alignment.MIDDLE_CENTER); Button impressum = new Button(); Language.set(Word.IMPRESSUM, impressum); impressum.addClickListener(ce -> { ClippingGorillaUI.getCurrent().setMainContent(ImpressumView.getCurrent()); }); impressum.setIcon(VaadinIcons.SCALE); impressum.addStyleName(ValoTheme.BUTTON_BORDERLESS); addComponent(impressum); setComponentAlignment(impressum, Alignment.MIDDLE_CENTER); Label spacing = new Label(); addComponent(spacing); setComponentAlignment(spacing, Alignment.MIDDLE_CENTER); ComboBox<Locale> languages = new ComboBox<>(null, Language.getAllLanguages().keySet()); languages.setItemCaptionGenerator(loc -> loc.getDisplayLanguage(loc)); if (!Language.getAllLanguages().containsKey(VaadinSession.getCurrent().getLocale())) { languages.setValue(Locale.ENGLISH); } else { languages.setValue(VaadinSession.getCurrent().getLocale()); } languages.setEmptySelectionAllowed(false); languages.setItemIconGenerator(FooterBar::getIcon); languages.addValueChangeListener( (HasValue.ValueChangeEvent<Locale> loc) -> Language.setLanguage(loc.getValue())); languages.setTextInputAllowed(false); addComponent(languages); setComponentAlignment(languages, Alignment.MIDDLE_CENTER); SESSIONS.put(VaadinSession.getCurrent(), this); }