Example usage for com.vaadin.ui HorizontalLayout setWidth

List of usage examples for com.vaadin.ui HorizontalLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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);//w  w  w  . ja  v  a  2 s  . com
    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;/*from  www . j  ava2  s .  c om*/
    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();/*from w w  w.  j  av a2  s .  c  om*/

    // 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);//from ww  w  .  j  a v a  2  s.  co  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);/* ww w  . j  a  v  a 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

@Override
protected Layout addSpecificButton(PeriodePermanenceDateDTO date) {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("400px");
    hl.setHeight("45px");

    boolean isInscrit = date.isInscrit(userId);
    boolean isComplet = date.isDateComplete();
    // Indique si il est encore possible de s'inscire ou non pour cette date 
    boolean isModifiable = MesPermanencesUtils.isDateModifiable(periodePermanenceDTO, date);

    ///*from   w w w  .  j  a  v a2  s. c om*/
    if (isModifiable == false) {
        return null;
    }

    switch (periodePermanenceDTO.regleInscription) {
    case UNE_INSCRIPTION_PAR_DATE:
        return specificButtonInscriptionUniqueParDate(hl, isInscrit, isComplet, date);

    case MULTIPLE_INSCRIPTION_SUR_ROLE_DIFFERENT:
    case TOUT_AUTORISE:
        return specificButtonInscriptionMultipleParDate(hl, isInscrit, isComplet, date);

    default:
        throw new AmapjRuntimeException();
    }
}

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  w w . 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.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  av a2  s  .c  o m
    hl.setComponentAlignment(b, Alignment.MIDDLE_CENTER);

    return hl;

}

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();// w w w .ja va 2s. c  o  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);//from  w w  w  .j  av  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();

}