List of usage examples for com.vaadin.ui HorizontalLayout setExpandRatio
public void setExpandRatio(Component component, float ratio)
This method is used to control how excess space in layout is distributed among components.
From source file:fr.amapj.view.views.listeadherents.PopupCopyAllMail.java
License:Open Source License
protected void createContent(VerticalLayout contentLayout) { // Construction de la zone de texte explicative String msg = "Pour envoyer un mail tous les amapiens, vous devez :<br/><ul>" + "<li>Faire un copier de toutes les adresses e-mail en faisant Ctrl+C ou en faisant clic droit + Copier sur la zone bleue ci dessous</li>" + "<li>Ouvrir votre outil favori pour l'envoi des mails (Thunderbird, Gmail, Outlook, ...)</li>" + "<li>Faire nouveau message</li>" + "<li>Faire un coller de toutes les adresses e-mail en faisant Ctrl+V ou en faisant clic droit + Coller dans la liste des destinataires du message.</li></ul>"; HorizontalLayout hlTexte = new HorizontalLayout(); hlTexte.setMargin(true);/*from ww w . j av a 2 s.co m*/ hlTexte.setSpacing(true); hlTexte.setWidth("100%"); Label textArea = new Label(msg, ContentMode.HTML); textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG); textArea.setWidth("80%"); hlTexte.addComponent(textArea); hlTexte.setExpandRatio(textArea, 1); hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER); contentLayout.addComponent(hlTexte); // Construction de la zone d'affichage des mails hlTexte = new HorizontalLayout(); hlTexte.setMargin(true); hlTexte.setSpacing(true); hlTexte.setWidth("100%"); TextArea listeMails = new TextArea(""); listeMails.setValue(mails); listeMails.setReadOnly(true); listeMails.selectAll(); listeMails.setWidth("80%"); listeMails.setHeight(5, Unit.CM); hlTexte.addComponent(listeMails); hlTexte.setExpandRatio(listeMails, 1); hlTexte.setComponentAlignment(listeMails, Alignment.MIDDLE_CENTER); contentLayout.addComponent(hlTexte); }
From source file:fr.amapj.view.views.logview.LogView.java
License:Open Source License
protected void addSelectorComponent() { logViewDTO = new LogViewDTO(); logViewDTO.dateMin = DateUtils.getDateWithNoTime(); logViewDTO.status = ChoixOnOff.ON;// w ww . j a va 2 s . co m logViewDTO.typLog = TypLog.USER; infos = new Label(); infos.setWidth("80%"); updateLabelInfo(); Button b = new Button("Parametres"); b.addClickListener(e -> handleParametres()); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); hl.addComponent(infos); hl.addComponent(b); hl.setExpandRatio(infos, 1.0f); addComponent(hl); }
From source file:fr.amapj.view.views.mescontrats.MesContratsView.java
License:Open Source License
public void refresh() { mesContratsDTO = new MesContratsService().getMesContrats(SessionManager.getUserId()); layout = this; layout.removeAllComponents();/*ww w . j a v a 2s . c o m*/ // Information sur le renouvellement de l'adhsion adhesionPart.addAhesionInfo(layout); // Le titre addLabel(layout, "Les nouveaux contrats disponibles"); // la liste des nouveaux contrats List<ContratDTO> newContrats = mesContratsDTO.getNewContrats(); for (ContratDTO c : newContrats) { 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); Button b = addButtonInscription("S'inscrire", 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); } // Le titre addLabel(layout, "Mes contrats existants"); // la liste des contrats existants List<ContratDTO> existingContrats = mesContratsDTO.getExistingContrats(); for (ContratDTO c : existingContrats) { 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, false); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); if (c.isModifiable) { Button b = addButtonInscription("Modifier", c); b.setWidth("100%"); vl2.addComponent(b); } if (c.isSupprimable) { Button b = addButtonSupprimer("Supprimer", c); b.setWidth("100%"); vl2.addComponent(b); } if (c.isJoker) { Button b = addButtonJoker("Grer jokers", c); b.setWidth("100%"); vl2.addComponent(b); } Button v = addButtonVoir("Voir", c); v.addStyleName(BUTTON_PRINCIPAL); v.setWidth("100%"); vl2.addComponent(v); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } // Le bouton pour tlcharger les contrats if (existingContrats.size() > 0) { Button telechargerButton = new Button("Imprimer mes contrats ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); layout.addComponent(telechargerButton); layout.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); } }
From source file:fr.amapj.view.views.mescontrats.MesContratsViewAdhesionPart.java
License:Open Source License
public void addAhesionInfo(VerticalLayout layout) { MesContratsDTO mesContratsDTO = view.mesContratsDTO; // Cas classique de renouvellement de l'adhsion if (mesContratsDTO.adhesionDTO.displayAdhesionTop()) { Label lab = new Label("Renouvellement de votre adhsion l'AMAP"); lab.addStyleName(MesContratsView.LABEL_RUBRIQUE); layout.addComponent(lab);/* w ww .j a v a 2 s . c o m*/ Panel p = new Panel(); p.addStyleName(MesContratsView.PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab1 = new Label("Adhsion pour " + mesContratsDTO.adhesionDTO.periodeCotisationDTO.nom); lab1.addStyleName(MesContratsView.LABEL_TITRECONTRAT); vl.addComponent(lab1); String str = formatLibelleAdhesion(mesContratsDTO.adhesionDTO); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); addLinkImpressionBulletin(mesContratsDTO.adhesionDTO, vl); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); if (mesContratsDTO.adhesionDTO.isCotisant()) { Button b = addButtonAdhesionAdherer("Modifier"); b.setWidth("100%"); vl2.addComponent(b); b = addButtonAdhesionSupprimer("Supprimer"); b.setWidth("100%"); vl2.addComponent(b); Button v = addButtonAdhesionVoir("Voir"); v.setWidth("100%"); v.addStyleName(MesContratsView.BUTTON_PRINCIPAL); vl2.addComponent(v); } else { Button b = addButtonAdhesionAdherer("Adhrer"); b.addStyleName(MesContratsView.BUTTON_PRINCIPAL); b.setWidth("100%"); vl2.addComponent(b); } p.setContent(hl); layout.addComponent(p); } // Cas d'affichage uniquement, pendant 30 jours apres la fin des inscriptions if (mesContratsDTO.adhesionDTO.affichageOnly != null) { AffichageOnly aff = mesContratsDTO.adhesionDTO.affichageOnly; Label lab = new Label("Votre adhsion l'AMAP"); lab.addStyleName(MesContratsView.LABEL_RUBRIQUE); layout.addComponent(lab); Panel p = new Panel(); p.addStyleName(MesContratsView.PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab1 = new Label("Adhsion pour " + aff.nomPeriode); lab1.addStyleName(MesContratsView.LABEL_TITRECONTRAT); vl.addComponent(lab1); String str = "Vous avez renouvel votre adhsion l'AMAP. Montant : " + new CurrencyTextFieldConverter().convertToString(aff.montantAdhesion) + " "; BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); if (shouldDisplayLinkBulletinInAffichageOnly(aff)) { Link l = LinkCreator .createLink(new PGBulletinAdhesion(aff.idPeriode, aff.idPeriodeUtilisateur, null)); l.setCaption("Imprimer mon bulletin d'adhsion"); l.setStyleName("adhesion"); vl.addComponent(l); } hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } }
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();/*from w ww . j a v a 2s . 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
private void constructMultiplePeriode(HorizontalLayout toolbar1) { periodePermanenceBox = new Searcher(SearcherList.PERIODE_PERMANENCE, null); periodePermanenceBox.setImmediate(true); periodePermanenceBox.addValueChangeListener(e -> handleChange()); reinitButton = new Button("Changer de priode"); reinitButton.addClickListener(e -> handleReinit()); toolbar1.addComponent(periodePermanenceBox); toolbar1.addComponent(reinitButton); toolbar1.setExpandRatio(reinitButton, 1); toolbar1.setComponentAlignment(reinitButton, Alignment.TOP_RIGHT); }
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);//from w w w. jav a 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) { //// ww w . j ava 2 s . c o m 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 w w . j ava 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. jav a 2 s.c om*/ // 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(); }