List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
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();//from www .ja va 2 s . co 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);/* ww w.j ava 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.detailperiode.grille.ModifierInscriptionGrillePart.java
License:Open Source License
@Override protected Layout addSpecificButton(PeriodePermanenceDateDTO date) { HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("400px"); hl.setHeight("45px"); Button b = new Button("Modifier inscrits"); b.addStyleName("primary"); b.addClickListener(e -> click(date)); hl.addComponent(b);/*from w ww .j ava 2 s. c o m*/ hl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); return hl; }
From source file:fr.amapj.view.views.permanence.mespermanences.grille.GrilleInscriptionPermanence.java
License:Open Source License
/** * Dessin des boutons dans le cas ou l'utilisateur peut s'inscrire une seule fois sur une date *///from www .j a v a 2 s .c om private Layout specificButtonInscriptionUniqueParDate(HorizontalLayout hl, boolean isInscrit, boolean isComplet, PeriodePermanenceDateDTO date) { // Si l'utilisateur est inscrit pour cette date if (isInscrit) { Button b = new Button("Je ne souhaite plus venir cette date."); b.addStyleName("suppress-inscrire"); b.addClickListener(e -> handleSuppressionInscription(date)); hl.addComponent(b); hl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); return hl; } // Si pas de place disponible if (isComplet == true) { return null; } // Cas standard : on peut s'inscrire Button b = new Button("Je m'inscris cette date"); b.addStyleName("inscrire"); b.addClickListener(e -> handleInscription(date)); hl.addComponent(b); hl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); return hl; }
From source file:fr.amapj.view.views.permanence.mespermanences.grille.GrilleInscriptionPermanence.java
License:Open Source License
/** * Dessin des boutons dans le cas ou l'utilisateur peut s'inscrire plusieurs fois sur une date *//*from w w w.jav a 2 s .c o m*/ private Layout specificButtonInscriptionMultipleParDate(HorizontalLayout hl, boolean isInscrit, boolean isComplet, PeriodePermanenceDateDTO date) { // Si l'utilisateur est inscrit pour cette date if (isInscrit) { Button b = new Button("Je change mon choix pour cette date."); b.addStyleName("suppress-inscrire"); b.addClickListener(e -> handleMultipleInscription(date)); hl.addComponent(b); hl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); return hl; } // Si pas de place disponible if (isComplet == true) { return null; } // Cas standard : on peut s'inscrire Button b = new Button("Je m'inscris cette date"); b.addStyleName("inscrire"); b.addClickListener(e -> handleMultipleInscription(date)); hl.addComponent(b); hl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); return hl; }
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 .ja v a 2 s . co 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.periode.grille.ModifierPeriodePermanenceGrillePart.java
License:Open Source License
@Override protected Layout addSpecificButton(PeriodePermanenceDateDTO date) { HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("400px"); hl.setHeight("45px"); Button b = new Button("Modifier"); b.addStyleName("primary"); b.addClickListener(e -> click(date)); hl.addComponent(b);/*w w w. j a v a 2s . c om*/ hl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); return hl; }
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 .c o 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 a v a2 s .co 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(); }