List of usage examples for com.vaadin.ui Button setVisible
@Override public void setVisible(boolean visible)
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultFormView.java
License:Apache License
@SuppressWarnings("serial") private void createFooterAndPopulateActions(FormActions actions) { CssLayout buttons = new CssLayout(); buttons.setStyleName("actions"); boolean allHidden = true; for (final FormAction action : actions) { final Button button = new Button(action.getTitle()); button.setDisableOnClick(true);//from w w w.j ava2 s .com button.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { presenter.executeAction(action); } finally { button.setEnabled(true); } } }); if (action.getActionHandler() instanceof SearchFormAction) { if (searchAction == null) { searchAction = action; // button.setClickShortcut(KeyCode.ENTER); } } if (action.isHidden()) { button.setVisible(false); } else { allHidden = false; } buttons.addComponent(button); } if (!allHidden) { rootLayout.addComponent(buttons); } }
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultTableView.java
License:Apache License
/** * {@inheritDoc}//ww w . jav a2 s.com * * @see de.unioninvestment.eai.portal.portlet.crud.mvp.views.TableView#setTableActionVisibility(java.lang.String, * boolean) */ public void setTableActionVisibility(String id, boolean visible) { Button button = actionButtons.get(id); if (button != null) { button.setVisible(visible); } else { LOG.warn("Ein Button mit der ID {} existiert nicht. Die Sichtbarkeit kann nicht auf {} gesetzt werden.", id, visible); } }
From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java
License:Open Source License
private void addLogoutButton(String text) { Button logoutButton = new Button(text); logoutButton.addStyleName("default"); logoutButton.setVisible(true); logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 7411091035775152765L; @Override// w ww . j a v a 2s .c o m public void buttonClick(ClickEvent event) { //Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf presenter.doLogout(); } }); logoutButton.setEnabled(true); this.layout.addComponent(logoutButton); this.layout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsMobileView.java
License:Apache License
/** * Initialise la vue//from w ww . j a v a2 s . co m */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) { // On rinitialise la vue removeAllComponents(); // Style setSizeFull(); addStyleName("v-noscrollableelement"); // On rcupre le favori afficher typeFavori = MdwTouchkitUI.getCurrent().getTypeObjListInscrits(); libelleObj = ""; if (typeIsVet() && MdwTouchkitUI.getCurrent().getEtapeListeInscrits() != null) { libelleObj = MdwTouchkitUI.getCurrent().getEtapeListeInscrits().getLibelle(); } if (typeIsElp() && MdwTouchkitUI.getCurrent().getElpListeInscrits() != null) { libelleObj = MdwTouchkitUI.getCurrent().getElpListeInscrits().getLibelle(); } //Rcupration de la liste des inscrits List<Inscrit> linscrits = MdwTouchkitUI.getCurrent().getListeInscrits(); //Rcupration du nombre d'inscrit par page nbEtuParPage = configController.getTrombiMobileNbEtuParPage(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton retour returnButton = new Button(); returnButton.setIcon(FontAwesome.ARROW_LEFT); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { if (MdwTouchkitUI.getCurrent().getTrombinoscopeFromView() != null && MdwTouchkitUI.getCurrent().getTrombinoscopeFromView().equals(FavorisMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateTofavoris(); } if (MdwTouchkitUI.getCurrent().getTrombinoscopeFromView() != null && MdwTouchkitUI.getCurrent().getTrombinoscopeFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); //Title Label labelTrombi = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale())); labelTrombi.setStyleName("v-label-navbar"); navbar.addComponent(labelTrombi); navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER); // bouton pour ajouter en favori si ce n'est pas dj le cas List<Favoris> lfav = favorisController.getFavoris(); FavorisPK favpk = new FavorisPK(); favpk.setLogin(userController.getCurrentUserName()); favpk.setIdfav(MdwTouchkitUI.getCurrent().getCodeObjListInscrits()); favpk.setTypfav(typeFavori); Favoris favori = new Favoris(); favori.setId(favpk); //Si l'objet n'est pas dj en favori if (lfav != null && !lfav.contains(favori)) { //Cration du bouton pour ajouter l'objet aux favoris Button btnAjoutFavori = new Button("+"); btnAjoutFavori.setIcon(FontAwesome.STAR_O); btnAjoutFavori.setStyleName("v-nav-button"); btnAjoutFavori.addClickListener(e -> { //creation du favori en base sur le clic du bouton favorisController.saveFavori(favori); //On cache le bouton de mise en favori btnAjoutFavori.setVisible(false); //Affichage d'un message de confirmation Notification.show( applicationContext.getMessage(NAME + ".message.favoriAjoute", null, getLocale()), Type.TRAY_NOTIFICATION); }); //Ajout du bouton l'interface navbar.addComponent(btnAjoutFavori); } //Bouton Filtre //On a la possibilit de filtrer le trombinoscope que si on est positionn sur un ELP if (typeIsElp()) { FiltreInscritsMobileWindow w = new FiltreInscritsMobileWindow(); //Si on a des lments afficher dans la popup filtre if ((w.getListeEtapes() != null && w.getListeEtapes().size() > 0) || (w.getListeGroupes() != null && w.getListeGroupes().size() > 0)) { filterButton = new Button(); filterButton.setIcon(FontAwesome.ELLIPSIS_V); filterButton.setStyleName("v-nav-button"); filterButton.addClickListener(e -> { w.addCloseListener(f -> { //Si la personne a ferm la popup en appuyant sur le bouton FILTRER if (w.isDemandeFiltrage()) { vetSelectionnee = w.getVetSelectionnee(); groupeSelectionne = w.getGroupeSelectionne(); displayTrombinoscope(false); } }); UI.getCurrent().addWindow(w); }); navbar.addComponent(filterButton); navbar.setComponentAlignment(filterButton, Alignment.MIDDLE_RIGHT); } } navbar.setExpandRatio(labelTrombi, 1); addComponent(navbar); //Test si la liste contient des tudiants if (linscrits != null && linscrits.size() > 0) { pageEnCours = 1; //Calcul du nombre maxi de page if (nbEtuParPage > 0 && linscrits.size() > nbEtuParPage) { pageMax = (linscrits.size() / nbEtuParPage) + 1; } else { //On affiche tous les inscrits sur une seule page pageMax = 1; } infoLayout = new VerticalLayout(); infoLayout.setSizeFull(); infoLayout.setMargin(true); infoLayout.setSpacing(true); infoLayout.addStyleName("v-scrollableelement"); //Layout avec le Libelle HorizontalLayout resumeLayout = new HorizontalLayout(); resumeLayout.setWidth("100%"); resumeLayout.setHeight("20px"); //Label affichant le nb d'inscrits infoLibelleObj = new Label(libelleObj); infoLibelleObj.setStyleName(ValoTheme.LABEL_SMALL); infoLibelleObj.setSizeFull(); resumeLayout.addComponent(infoLibelleObj); resumeLayout.setComponentAlignment(infoLibelleObj, Alignment.TOP_CENTER); infoLayout.addComponent(resumeLayout); //Layout qui contient la liste des inscrits et le trombinoscope dataLayout = new VerticalLayout(); dataLayout.setSizeFull(); //Layout contenant le gridLayout correspondant au trombinoscope verticalLayoutForTrombi = new VerticalLayout(); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.addStyleName("v-scrollablepanel"); //Cration du trombinoscope displayTrombinoscope(false); verticalLayoutForTrombi.addComponent(trombiLayout); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.setHeight(null); if (pageMax > 1) { HorizontalLayout layoutPagination = new HorizontalLayout(); layoutPagination.setWidth("100%"); layoutPagination.setMargin(true); if (pageEnCours < pageMax) { Button btnNext = new Button( applicationContext.getMessage(NAME + ".btn.affichersuite", null, getLocale())); btnNext.setStyleName(ValoTheme.BUTTON_PRIMARY); btnNext.addStyleName("v-popover-button"); btnNext.addClickListener(e -> { pageEnCours++; displayTrombinoscope(true); if (pageEnCours >= pageMax) { btnNext.setVisible(false); } }); layoutPagination.addComponent(btnNext); layoutPagination.setComponentAlignment(btnNext, Alignment.MIDDLE_CENTER); layoutPagination.setExpandRatio(btnNext, 1); } verticalLayoutForTrombi.addComponent(layoutPagination); } //Le layout contient le trombi afficher dataLayout.addComponent(verticalLayoutForTrombi); infoLayout.addComponent(dataLayout); infoLayout.setExpandRatio(dataLayout, 1); addComponent(infoLayout); setExpandRatio(infoLayout, 1); } else { // Layout contenant le label du message indiquant aucun inscrit infoLayout = new VerticalLayout(); infoLayout.setMargin(true); infoLayout.setSpacing(true); // Label du message indiquant aucun inscrit Label infoAucuninscrit = new Label( applicationContext.getMessage(NAME + ".message.aucuninscrit", null, getLocale())); infoAucuninscrit.setSizeFull(); // Ajout du label au layout infoLayout.addComponent(infoAucuninscrit); addComponent(infoLayout); setExpandRatio(infoLayout, 1); } } }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * construye el menu//from w w w . ja va2 s . c o m * * @param request * @return */ CssLayout buildMenu(VaadinRequest request) { HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); //menu.addComponent(createThemeSelect()); 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("<h3><strong>" + getApp().getName() + "</strong></h3>", ContentMode.HTML); Button title = new Button(getApp().getName(), new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); title.addStyleName(ValoTheme.BUTTON_LINK); title.addStyleName("tituloapp"); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); settings = new MenuBar(); settings.addStyleName("user-menu"); settings.addStyleName("mi-user-menu"); menu.addComponent(settings); HorizontalLayout navlinks = new HorizontalLayout(); navlinks.setSpacing(true); { Button nav = new Button(VaadinIcons.ARROWS_CROSS, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!nav", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.setDescription("Search inside menu"); nav.addStyleName("navlink"); navlinks.addComponent(nav); } if (MateuUI.getApp().isFavouritesAvailable()) { Button nav = new Button(VaadinIcons.USER_STAR, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!favourites", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("My favourites"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkFavoritos = nav; navlinks.addComponent(nav); } if (MateuUI.getApp().isLastEditedAvailable()) { Button nav = new Button(VaadinIcons.RECORDS, new ClickListener() { @Override public void buttonClick(ClickEvent event) { Page.getCurrent().open("#!lastedited", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("Last edited records"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkUltimosRegistros = nav; navlinks.addComponent(nav); } HorizontalLayout aux = new HorizontalLayout(navlinks); aux.setSpacing(false); aux.addStyleName("contenedoriconosnav"); menu.addComponent(aux); if (MateuUI.getApp().isFavouritesAvailable()) { aux = new HorizontalLayout(); { Button nav = new Button(VaadinIcons.STAR, new ClickListener() { @Override public void buttonClick(ClickEvent event) { System.out.println(Page.getCurrent().getUriFragment()); System.out.println(Page.getCurrent().getLocation()); } }); nav.addStyleName(ValoTheme.BUTTON_LINK); nav.addStyleName("navlink"); nav.setDescription("Add current page to my favourites"); nav.setVisible(MateuUI.getApp().getUserData() != null); linkNuevoFavorito = nav; aux.addComponent(nav); } aux.setSpacing(false); aux.addStyleName("contenedoriconosnav"); menu.addComponent(aux); } menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); refreshMenu(null, null); return menu; }
From source file:jp.primecloud.auto.ui.TopBar.java
License:Open Source License
@Override public void attach() { addStyleName("TopBar"); setWidth("100%"); setHeight("30px"); setMargin(false, true, false, false); // PrimeCloud Label plbl = new Label(IconUtils.createImageTag(getApplication(), Icons.PCCLOGO), Label.CONTENT_XHTML); plbl.addStyleName("logo"); addComponent(plbl);/*www. ja va 2 s .co m*/ // ?? String versionProp = Config.getVersionProperty("version"); if (StringUtils.isNotEmpty(versionProp)) { StringBuilder version = new StringBuilder(); version.append("ver").append(versionProp); Label versionNo = new Label("<p>" + version.toString() + "</p>", Label.CONTENT_XHTML); versionNo.addStyleName("versionNo"); addComponent(versionNo); } else { Label versionNo = new Label("<p></p>", Label.CONTENT_XHTML); versionNo.addStyleName("versionNoNone"); addComponent(versionNo); } // myCloud? Button myCloudButton = new Button(ViewProperties.getCaption("button.myCloudManage")); myCloudButton.setDescription(ViewProperties.getCaption("description.myCloudManage")); myCloudButton.addStyleName("borderless"); myCloudButton.addStyleName("mycloud"); myCloudButton.setIcon(Icons.CLOUDBIG.resource()); myCloudButton.setVisible(true); myCloudButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { showCloudEditWindow(); } }); addComponent(myCloudButton); // (Zabbix) String useZabbix = Config.getProperty("zabbix.useZabbix"); if (useZabbix == null || BooleanUtils.toBoolean(useZabbix)) { String url = Config.getProperty("zabbix.display"); Link zabbix = new Link(ViewProperties.getCaption("link.zabbix"), new ExternalResource(url)); zabbix.setDescription(ViewProperties.getCaption("description.link.zabbix")); zabbix.setIcon(Icons.MNGSYSTEM.resource()); zabbix.setTargetName("_blank"); zabbix.addStyleName("zabbix"); addComponent(zabbix); } // Button eventLogButton = new Button(ViewProperties.getCaption("link.eventlog")); eventLogButton.setDescription(ViewProperties.getCaption("description.link.eventlog")); eventLogButton.addStyleName("borderless"); eventLogButton.addStyleName("eventlog"); eventLogButton.setIcon(Icons.CUSTOM.resource()); eventLogButton.setVisible(true); eventLogButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinLogView window = new WinLogView(); getApplication().addWindow(window); getApplication().getMainWindow().open(new ExternalResource(window.getURL()), "_blank"); } }); addComponent(eventLogButton); // Boolean usePayment = BooleanUtils.toBooleanObject(Config.getProperty("payment.usePayment")); if (BooleanUtils.isTrue(usePayment)) { String url2 = Config.getProperty("payment.display"); Link payment = new Link(ViewProperties.getCaption("link.payment"), new ExternalResource(url2)); payment.setDescription(ViewProperties.getCaption("description.link.payment")); payment.setIcon(Icons.PAYSYSTEM.resource()); payment.setTargetName("_payment"); payment.addStyleName("payment"); addComponent(payment); } // Button logoutButton = new Button(ViewProperties.getCaption("button.logout")); logoutButton.setDescription(ViewProperties.getCaption("description.logout")); logoutButton.addStyleName("borderless"); logoutButton.addStyleName("logout"); logoutButton.setIcon(Icons.LOGOUT.resource()); logoutButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.dialogConfirm"), ViewMessages.getMessage("IUI-000001"), Buttons.OKCancel); Callback callback = new Callback() { @Override public void onDialogResult(Result result) { if (result == Result.OK) { // ? LoggingUtils.removeContext(); ContextUtils.invalidateSession(); accountButton.setVisible(false); // ???? getApplication().close(); } } }; dialog.setCallback(callback); getApplication().getMainWindow().addWindow(dialog); } }); addComponent(logoutButton); // ? accountButton = new Button(ViewProperties.getCaption("button.account")); accountButton.setDescription(ViewProperties.getCaption("description.account")); accountButton.addStyleName("borderless"); accountButton.addStyleName("account"); accountButton.setIcon(Icons.USER.resource()); accountButton.setVisible(false); addComponent(accountButton); }
From source file:org.apache.usergrid.chop.webapp.view.chart.layout.item.NoteLayout.java
License:Apache License
private Button createButton(String caption, String position, boolean visible) { Button button = UIUtil.addButton(this, caption, position, "50px"); button.setStyleName(Reindeer.BUTTON_LINK); button.setVisible(visible); return button; }
From source file:org.eclipse.emf.ecp.controls.vaadin.AbstractVaadinSimpleControlRenderer.java
License:Open Source License
protected void createSetOrUnsetComponent(final Component component, final HorizontalLayout horizontalLayout, final Setting setting) { final Label unsetLabel = getUnsetComponent(); final Button setButton = getUnsetButton(component, horizontalLayout, setting); setButton.setEnabled(getVElement().isEnabled()); setButton.setVisible(getVElement().isVisible()); setButton.setReadOnly(getVElement().isReadonly()); horizontalLayout.addStyleName("textheight"); horizontalLayout.removeAllComponents(); Component addComponent = component; if (setting.isSet()) { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Set); unsetLabel.setCaption(getUnsetLabel()); addComponent = unsetLabel;/* w ww .j ava 2 s. c om*/ } else { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Unset); } horizontalLayout.setData(addComponent); horizontalLayout.addComponent(addComponent); horizontalLayout.setExpandRatio(addComponent, 1f); horizontalLayout.addComponent(setButton); horizontalLayout.setComponentAlignment(setButton, Alignment.BOTTOM_RIGHT); }
From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java
License:Open Source License
private Button createBulkUploadStatusButton() { final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.BULK_UPLOAD_STATUS_BUTTON, "", "", "", false, null, SPUIButtonStyleSmall.class); button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON); button.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE); button.setWidth("100px"); button.setHtmlContentAllowed(true);/*from www. ja va 2s . co m*/ button.addClickListener(event -> onClickBulkUploadNotificationButton()); button.setVisible(false); return button; }
From source file:org.eclipse.hawkbit.ui.common.table.AbstractTableHeader.java
License:Open Source License
private Button createShowFilterButtonLayout() { final Button button = SPUIComponentProvider.getButton(getShowFilterButtonLayoutId(), null, i18n.getMessage(UIMessageIdProvider.TOOLTIP_SHOW_TAGS), null, false, FontAwesome.TAGS, SPUIButtonStyleNoBorder.class); button.setVisible(false); button.addClickListener(event -> showFilterButtonsIconClicked()); return button; }