List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupRoleDifferent.java
License:Open Source License
/** * Permet de dessiner le tableau /* w w w . j av a 2s .c o m*/ */ public void drawTab(Tab tab) { GridLayout gl = new GridLayout(4, 1 + tab.lines.size()); gl.setWidth("800px"); gl.setSpacing(false); contentLayout.addComponent(gl); // Construction du titre Label l = new Label(tab.titre); l.addStyleName(tab.styleTitre); l.setWidth("100%"); gl.addComponent(l, 0, 0, 3, 0); List<TabLine> lines = tab.lines; for (int i = 0; i < lines.size(); i++) { TabLine line = lines.get(i); int height = computeHeight(line); // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire height = Math.max(height, 36); Label l1 = new Label(line.col1); l1.addStyleName(line.styleCol1); l1.setWidth("100%"); l1.setHeight(height + "px"); gl.addComponent(l1, 0, i + 1); Label l2 = new Label(line.col2); l2.addStyleName(line.styleCol2); l2.setWidth("100%"); l2.setHeight(height + "px"); gl.addComponent(l2, 1, i + 1); Label l3 = new Label(line.col3); l3.addStyleName(line.styleCol3); l3.setWidth("100%"); l3.setHeight(height + "px"); gl.addComponent(l3, 2, i + 1); if (line.col4 != null) { Button b = new Button(line.col4); b.addStyleName(line.styleCol4); b.addClickListener(e -> handleButton(line.role)); b.setWidth("100%"); gl.addComponent(b, 3, i + 1); gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); } else { Label l4 = new Label(""); l4.addStyleName(line.styleCol4); l4.setWidth("100%"); l4.setHeight(height + "px"); gl.addComponent(l4, 3, i + 1); } } }
From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupToutAutorise.java
License:Open Source License
/** * Permet de dessiner le tableau /*from w w w . j a v a 2 s . c om*/ */ public void drawTab(Tab tab) { GridLayout gl = new GridLayout(3, 1 + tab.lines.size()); gl.setWidth("600px"); gl.setSpacing(false); contentLayout.addComponent(gl); // Construction du titre Label l = new Label(tab.titre); l.addStyleName(tab.styleTitre); l.setWidth("100%"); gl.addComponent(l, 0, 0, 2, 0); List<TabLine> lines = tab.lines; for (int i = 0; i < lines.size(); i++) { TabLine line = lines.get(i); int height = computeHeight(line); // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire height = Math.max(height, 36); Label l1 = new Label(line.col1); l1.addStyleName(line.styleCol1); l1.setWidth("100%"); l1.setHeight(height + "px"); gl.addComponent(l1, 0, i + 1); Label l2 = new Label(line.col2); l2.addStyleName(line.styleCol2); l2.setWidth("100%"); l2.setHeight(height + "px"); gl.addComponent(l2, 1, i + 1); if (line.col3 != null) { Button b = new Button(line.col3); b.addStyleName(line.styleCol3); b.addClickListener(e -> handleButton(line.cell)); b.setWidth("100%"); gl.addComponent(b, 2, i + 1); gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); } else { Label l3 = new Label(""); l3.addStyleName(line.styleCol3); l3.setWidth("100%"); l3.setHeight(height + "px"); gl.addComponent(l3, 2, i + 1); } } }
From source file:fr.amapj.view.views.permanence.mespermanences.MesPermanencesView.java
License:Open Source License
public void refresh() { mesContratsDTO = new MesPermanencesService().getMesPermanenceDTO(SessionManager.getUserId()); layout = this; layout.removeAllComponents();// w ww .j a v a 2 s . c o m if (mesContratsDTO.mesPeriodesPermanences.size() > 0) { // Le titre addLabel(layout, "S'inscrire aux permanences"); // la liste des inscriptions possibles for (UnePeriodePermanenceDTO c : mesContratsDTO.mesPeriodesPermanences) { Panel p = new Panel(); p.addStyleName(PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab = new Label(c.nom); lab.addStyleName(LABEL_TITRECONTRAT); vl.addComponent(lab); String str = formatLibelleContrat(c, true); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); String libButton = getLibButton(c); Button b = addButtonInscription(libButton, c); b.setWidth("100%"); b.addStyleName(BUTTON_PRINCIPAL); vl2.addComponent(b); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } } // addLabel(layout, "Les dates de mes permanences"); VerticalLayout vl1 = BaseUiTools.addPanel(this, "mes-permanences"); String mesPermanences = getLibMesPermanences(); BaseUiTools.addHtmlLabel(vl1, mesPermanences, "ligne"); addLabel(layout, "Consulter les plannings de permanence"); VerticalLayout vl2 = BaseUiTools.addPanel(this, "mes-permanences"); // Le bouton pour visualiser les permanences en ligne Button onLineButton = new Button("Visualiser les plannings de permanence ..."); onLineButton.setIcon(FontAwesome.EYE); onLineButton.addStyleName("borderless"); onLineButton.addStyleName("large"); onLineButton.addClickListener(e -> handleVisualiser()); vl2.addComponent(onLineButton); vl2.setComponentAlignment(onLineButton, Alignment.MIDDLE_LEFT); // Le bouton pour tlcharger les permanences Button telechargerButton = new Button("Tlcharger les plannings de permanence au format tableur ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); vl2.addComponent(telechargerButton); vl2.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); }
From source file:fr.amapj.view.views.permanence.PeriodePermanenceSelectorPart.java
License:Open Source License
public HorizontalLayout getChoixPeriodeComponent() { // Partie choix HorizontalLayout toolbar1 = new HorizontalLayout(); toolbar1.addStyleName("periode-permanence-selectorpart"); Label pLabel = new Label("Priode de permanence"); pLabel.addStyleName("periode-permanence"); pLabel.setSizeUndefined();/*from w w w . j a v a 2 s. co m*/ toolbar1.addComponent(pLabel); constructMultiplePeriode(toolbar1); toolbar1.setSpacing(true); toolbar1.setMargin(false); toolbar1.setWidth("100%"); return toolbar1; }
From source file:fr.amapj.view.views.producteur.basicform.ProducteurBasicForm.java
License:Open Source License
@Override public void enterIn(ViewChangeEvent event) { // Lecture dans la base de donnes mcInfos = new BeanItemContainer<ProducteurDTO>(ProducteurDTO.class); // Bind it to a component cdesTable = createTable(mcInfos);/* w w w. j a va 2 s. co m*/ // Titre des colonnes cdesTable.setVisibleColumns(new String[] { "nom", "delaiModifContrat" }); cdesTable.setColumnHeader("nom", "Nom"); cdesTable.setColumnHeader("delaiModifContrat", "Dlai avant modification d'un contrat"); cdesTable.setSelectable(true); cdesTable.setImmediate(true); // Activation au desactivation des boutons delete et edit cdesTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setModificationsEnabled(event.getProperty().getValue() != null); } private void setModificationsEnabled(boolean b) { enableButtonBar(b); } }); cdesTable.setSizeFull(); cdesTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { cdesTable.select(event.getItemId()); } } }); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("stdlistpart-hlayout-button"); Label title2 = new Label("Liste des producteurs"); title2.setSizeUndefined(); title2.addStyleName("stdlistpart-text-title"); newButton = new Button("Crer un nouveau producteur"); newButton.setId("amapj.view.producteur." + "new_button"); newButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleAjouter(); } }); editButton = new Button("Modifier"); editButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleEditer(); } }); deleteButton = new Button("Supprimer"); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleSupprimer(); } }); searchField = new TextField(); searchField.setInputPrompt("Rechercher par nom"); searchField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { textFilter = event.getText(); updateFilters(); } }); toolbar.addComponent(newButton); toolbar.addComponent(editButton); toolbar.addComponent(deleteButton); toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); addComponent(title2); addComponent(toolbar); addComponent(cdesTable); setExpandRatio(cdesTable, 1); refreshTable(); }
From source file:fr.amapj.view.views.producteur.contrats.ProducteurContratListPart.java
License:Open Source License
@Override public void enterIn(ViewChangeEvent event) { //// w w w. j ava 2 s .c om producteurSelector = new ProducteurSelectorPart(this); // Lecture dans la base de donnes mcInfos = new BeanItemContainer<ModeleContratSummaryDTO>(ModeleContratSummaryDTO.class); // Bind it to a component cdesTable = createTable(mcInfos); // Titre des colonnes cdesTable.setVisibleColumns(new String[] { "etat", "nom", "finInscription", "dateDebut", "dateFin", "nbLivraison", "nbProduit" }); cdesTable.setColumnHeader("etat", "Etat"); cdesTable.setColumnHeader("nom", "Nom"); cdesTable.setColumnHeader("nomProducteur", "Producteur"); cdesTable.setColumnHeader("finInscription", "Fin inscription"); cdesTable.setColumnHeader("dateDebut", "Premire livraison"); cdesTable.setColumnHeader("dateFin", "Dernire livraison"); cdesTable.setColumnHeader("nbLivraison", "Nb de livraisons"); cdesTable.setColumnHeader("nbProduit", "Nb de produits"); // cdesTable.setConverter("finInscription", new DateToStringConverter()); cdesTable.setConverter("dateDebut", new DateToStringConverter()); cdesTable.setConverter("dateFin", new DateToStringConverter()); cdesTable.setSelectable(true); cdesTable.setImmediate(true); // Activation au desactivation des boutons delete et edit cdesTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setModificationsEnabled(event.getProperty().getValue() != null); } private void setModificationsEnabled(boolean b) { enableButtonBar(b); } }); cdesTable.setSizeFull(); cdesTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { cdesTable.select(event.getItemId()); } } }); Label title2 = new Label("Liste des contrats d'un producteur"); title2.setSizeUndefined(); title2.addStyleName("stdlistpart-text-title"); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("stdlistpart-hlayout-button"); testButton = new Button("Tester"); testButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleTester(); } }); telechargerButton = new Button("Tlcharger ..."); telechargerButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleTelecharger(); } }); searchField = new TextField(); searchField.setInputPrompt("Rechercher par nom"); searchField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { textFilter = event.getText(); updateFilters(); } }); toolbar.addComponent(testButton); toolbar.addComponent(telechargerButton); toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); addComponent(producteurSelector.getChoixProducteurComponent()); addComponent(title2); addComponent(toolbar); addComponent(cdesTable); setExpandRatio(cdesTable, 1); refreshTable(); }
From source file:fr.amapj.view.views.producteur.ProducteurSelectorPart.java
License:Open Source License
private void constructMultipleProducteur(HorizontalLayout toolbar1) { if (isCompactMode == false) { Label pLabel = new Label("Producteur"); pLabel.addStyleName("xproducteurs"); pLabel.setSizeUndefined();/*from w ww . j av a 2 s . c om*/ toolbar1.addComponent(pLabel); } producteurBox = new Searcher(SearcherList.PRODUCTEUR, null, allowedProducteurs); producteurBox.setImmediate(true); producteurBox.addValueChangeListener(e -> handleProducteurChange()); reinitButton = new Button("Changer de producteur"); reinitButton.addClickListener(e -> handleReinit()); toolbar1.addComponent(producteurBox); toolbar1.addComponent(reinitButton); toolbar1.setExpandRatio(reinitButton, 1); toolbar1.setComponentAlignment(reinitButton, Alignment.TOP_RIGHT); }
From source file:fr.amapj.view.views.saisiepermanence.SaisiePermanenceListPart.java
License:Open Source License
@Override public void enterIn(ViewChangeEvent event) { // Lecture dans la base de donnes mcInfos = new BeanItemContainer<PermanenceDTO>(PermanenceDTO.class); // Bind it to a component cdesTable = createTable(mcInfos);//from w w w .ja va 2 s . c o m // Titre des colonnes cdesTable.setVisibleColumns(new String[] { "datePermanence", "utilisateurs", "numeroSession" }); cdesTable.setColumnHeader("datePermanence", "Date"); cdesTable.setColumnHeader("utilisateurs", "Personnes de permanence"); cdesTable.setColumnHeader("numeroSession", "Numro de la session"); cdesTable.setConverter("datePermanence", new DateToStringConverter()); cdesTable.setSelectable(true); cdesTable.setImmediate(true); // Activation au desactivation des boutons delete et edit cdesTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setModificationsEnabled(event.getProperty().getValue() != null); } private void setModificationsEnabled(boolean b) { enableButtonBar(b); } }); cdesTable.setSizeFull(); cdesTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { cdesTable.select(event.getItemId()); } } }); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("stdlistpart-hlayout-button"); Label title2 = new Label("Planning des permanences"); title2.setSizeUndefined(); title2.addStyleName("stdlistpart-text-title"); newButton = new Button("Crer une nouvelle permanence"); newButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleAjouter(); } }); editButton = new Button("Modifier"); editButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleEditer(); } }); deleteButton = new Button("Supprimer"); deleteButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleSupprimer(); } }); planifButton = new Button("Planifier"); planifButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handlePlanification(); } }); rappelButton = new Button("Envoyer un rappel"); rappelButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleRappel(); } }); deleteListButton = new Button("Supprimer plusieurs permanences"); deleteListButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleDeleteList(); } }); searchField = new TextField(); searchField.setInputPrompt("Rechercher par nom"); searchField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { textFilter = event.getText(); updateFilters(); } }); toolbar.addComponent(newButton); toolbar.addComponent(editButton); toolbar.addComponent(deleteButton); toolbar.addComponent(planifButton); toolbar.addComponent(rappelButton); toolbar.addComponent(deleteListButton); toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); addComponent(title2); addComponent(toolbar); addComponent(LinkCreator.createLink(new EGPlanningPermanence(new Date()))); addComponent(cdesTable); setExpandRatio(cdesTable, 1); setSizeFull(); setMargin(true); setSpacing(true); refreshTable(); }
From source file:fr.amapj.view.views.suiviacces.SuiviAccesView.java
License:Open Source License
/** * /*from w ww . j av a 2 s . c om*/ */ @Override public void enterIn(ViewChangeEvent event) { listPartContainer = new BeanItemContainer<>(ConnectedUserDTO.class); // on trie par nom puis prenom listPartContainer.sort(new String[] { "nom", "prenom" }, new boolean[] { true, true }); // Bind it to a component beanTable = createTable(listPartContainer); // Gestion de la liste des colonnes visibles beanTable.setVisibleColumns("nom", "prenom", "email", "date", "agent", "dbName"); beanTable.setColumnHeader("nom", "Nom"); beanTable.setColumnHeader("prenom", "Prnom"); beanTable.setColumnHeader("email", "E mail"); beanTable.setColumnHeader("date", "Date connexion"); beanTable.setColumnHeader("agent", "Browser"); beanTable.setColumnHeader("dbName", "Nom de la base"); beanTable.setConverter("date", new DateTimeToStringConverter()); beanTable.setSelectable(true); beanTable.setImmediate(true); beanTable.setSizeFull(); beanTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { beanTable.select(event.getItemId()); } } }); HorizontalLayout toolbar = new HorizontalLayout(); Button sendMsg = new Button("Envoyer un message tous"); sendMsg.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { FormPopup.open(new PopupSaisieMessage()); } }); Button resfresh = new Button("Rafraichir"); resfresh.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { refresh(); } }); toolbar.addComponent(sendMsg); toolbar.addComponent(resfresh); Label title = new Label("Liste des personnes connectes"); title.setSizeUndefined(); title.addStyleName("stdlistpart-text-title"); searchField = new TextField(); searchField.setInputPrompt("Rechercher par le nom ou l'email"); searchField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { textFilter = event.getText(); updateFilters(); } }); searchField.addStyleName(ChameleonTheme.TEXTFIELD_BIG); searchField.setWidth("50%"); toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); addComponent(title); addComponent(toolbar); addComponent(beanTable); setExpandRatio(beanTable, 1); refresh(); }
From source file:fr.amapj.view.views.tableaudebord.TableauDeBordView.java
License:Open Source License
private Label addLabel(VerticalLayout layout, String str) { Label tf = new Label(str); tf.addStyleName("h1"); layout.addComponent(tf);/* ww w . ja v a 2 s.c o m*/ return tf; }