Example usage for com.vaadin.ui Label setSizeUndefined

List of usage examples for com.vaadin.ui Label setSizeUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui Label setSizeUndefined.

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:fr.amapj.view.engine.basicform.BasicFormListPart.java

License:Open Source License

private void buildMainArea() {

    createColumn();/*from   ww  w  .  j  a v a  2 s.co  m*/

    // Create a persistent person container
    listPartContainer = new BeanItemContainer(getClazz());
    onPopupClose();

    // Add a nested property to a many-to-one property
    for (ColumnInfo colInfo : colInfos) {
        if (colInfo.isNested()) {
            listPartContainer.addNestedContainerProperty(colInfo.propertyId);
        }
    }

    // Set up sorting if the natural order is not appropriate
    listPartContainer.sort(orderByInfo, new boolean[] { true, true });

    // Bind it to a component
    beanTable = createTable(listPartContainer);

    // Gestion de la liste des colonnes visibles
    List<String> colNames = new ArrayList<String>();
    for (ColumnInfo colInfo : colInfos) {
        colNames.add(colInfo.propertyId);
    }
    beanTable.setVisibleColumns(colNames.toArray());

    // Gestion des titres de colonnes
    for (ColumnInfo colInfo : colInfos) {
        beanTable.setColumnHeader(colInfo.propertyId, colInfo.title);
    }

    beanTable.setSelectable(true);
    beanTable.setImmediate(true);

    // Activation au desactivation des boutons delete et edit
    beanTable.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            setModificationsEnabled(event.getProperty().getValue() != null);
        }

        private void setModificationsEnabled(boolean b) {
            Long id = IdentifiableUtil.getIdOfSelectedItem(beanTable);
            if ((id != null) && (b == true) && (isAccessAllowed(id) == false)) {
                b = false;
            }

            deleteButton.setEnabled(b);
            editButton.setEnabled(b);
            enableSpecificButton(b);
        }
    });

    beanTable.setSizeFull();

    beanTable.addItemClickListener(new ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                beanTable.select(event.getItemId());
            }
        }
    });

    HorizontalLayout toolbar = new HorizontalLayout();

    Label title = new Label(getListPartTitle());
    title.setSizeUndefined();
    title.addStyleName("stdlistpart-text-title");

    newButton = new Button("Ajouter");
    newButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            handleAjouter();
        }
    });
    newButton.addStyleName(ChameleonTheme.BUTTON_BIG);

    deleteButton = new Button("Supprimer");
    deleteButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            handleSupprimer();

        }
    });
    deleteButton.setEnabled(false);
    deleteButton.addStyleName(ChameleonTheme.BUTTON_BIG);

    editButton = new Button("Editer");
    editButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            handleEditer();

        }
    });
    editButton.setEnabled(false);
    editButton.addStyleName(ChameleonTheme.BUTTON_BIG);

    searchField = new TextField();
    searchField.setInputPrompt(getListPartInputPrompt());
    searchField.addTextChangeListener(new TextChangeListener() {

        @Override
        public void textChange(TextChangeEvent event) {
            textFilter = event.getText();
            updateFilters();
        }
    });
    searchField.addStyleName(ChameleonTheme.TEXTFIELD_BIG);
    searchField.setWidth("50%");

    toolbar.addComponent(newButton);
    toolbar.addComponent(deleteButton);
    toolbar.addComponent(editButton);
    addSpecificButton(toolbar);
    toolbar.addComponent(searchField);
    toolbar.setWidth("100%");
    toolbar.setExpandRatio(searchField, 1);
    toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT);

    setMargin(true);
    setSpacing(true);

    addComponent(title);
    addComponent(toolbar);
    Component c = getExtraComponent();
    if (c != null) {
        addComponent(c);
    }

    addComponent(beanTable);
    setExpandRatio(beanTable, 1);
    setSizeFull();

}

From source file:fr.amapj.view.engine.listpart.StandardListPart.java

License:Open Source License

private void buildMainArea() {
    // Lecture dans la base de donnes
    mcInfos = new BeanItemContainer<T>(beanClazz);

    // Bind it to a component
    cdesTable = createTable(mcInfos);/*from w w  w.  j a  va 2s  .  c o  m*/

    drawTable();

    cdesTable.setSelectable(true);
    cdesTable.setMultiSelect(multiSelect);
    cdesTable.setImmediate(true);

    // Activation ou desactivation des boutons delete et edit
    cdesTable.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            if (multiSelect) {
                Set s = (Set) event.getProperty().getValue();
                buttonBarEditMode(s.size() > 0);
            } else {
                buttonBarEditMode(event.getProperty().getValue() != null);
            }
        }
    });

    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("buttonbar");

    Label title2 = new Label(getTitle());
    title2.setSizeUndefined();
    title2.addStyleName("title");

    drawButton();

    for (ButtonHandler handler : buttons) {
        toolbar.addComponent(handler.button);
    }

    if (searchField != null) {
        toolbar.addComponent(searchField);
        toolbar.setWidth("100%");
        toolbar.setExpandRatio(searchField, 1);
        toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT);
    }

    addComponent(title2);
    addSelectorComponent();
    addComponent(toolbar);
    addExtraComponent();
    addComponent(cdesTable);
    setExpandRatio(cdesTable, 1);

    refreshTable();

}

From source file:fr.amapj.view.engine.menu.MenuPart.java

License:Open Source License

private CssLayout buildMenu(CssLayout menu, CssLayout menuItemsLayout, List<MenuDescription> allMenus,
        Navigator navigator, AmapUI ui) {

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);/*from ww w .  jav  a  2  s  .c o  m*/

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final 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);

    String nomAmap = new ParametresService().getParametres().nomAmap;
    Label title = new Label("<h2>" + nomAmap + "</h2>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");

    SessionParameters p = SessionManager.getSessionParameters();
    MenuItem settingsItem = settings.addItem(p.userPrenom + " " + p.userNom, null, null);
    settingsItem.addItem("Se dconnecter", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            new PasswordManager().disconnect();
            ui.buildLoginView(null, null, null);
        }
    });

    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    boolean first = true;
    String firstEntry = null;
    Button firstButton = null;

    for (MenuDescription menuDescription : allMenus) {
        final String view = menuDescription.getMenuName().name().toLowerCase();
        final String titleView = menuDescription.getMenuName().getTitle();

        if (menuDescription.getCategorie() != null) {
            Label l = new Label(menuDescription.getCategorie(), ContentMode.HTML);
            l.setPrimaryStyleName("valo-menu-subtitle");
            l.addStyleName("h4");
            l.setSizeUndefined();
            menuItemsLayout.addComponent(l);
        }

        final Button b = new Button(titleView, new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                setSelected(event.getButton(), menuItemsLayout);
                navigator.navigateTo("/" + view);
            }
        });

        b.setId("amapj.menu." + view);
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        b.setIcon(menuDescription.getMenuName().getFont());
        menuItemsLayout.addComponent(b);

        viewNameToMenuButton.put("/" + view, b);

        if (first) {
            first = false;
            firstButton = b;
            firstEntry = view;
        }
    }

    // Gestion de l'url
    String f = Page.getCurrent().getUriFragment();
    if (f != null && f.startsWith("!")) {
        f = f.substring(1);
    }
    if (f == null || f.equals("") || f.equals("/")) {
        navigateWithProtect(navigator, "/" + firstEntry);
        setSelected(firstButton, menuItemsLayout);
    } else {
        navigateWithProtect(navigator, f);
        setSelected(viewNameToMenuButton.get(f), menuItemsLayout);
    }

    return menu;
}

From source file:fr.amapj.view.engine.template.BackOfficeLongView.java

License:Open Source License

/**
 * // w  w w.j a v  a 2s  .co  m
 */
@Override
final public void enter(ViewChangeEvent event) {

    // On se positionne en mode back office 
    ValoMenuLayout.setBackOfficeLong();

    enterIn(event);

    // Ceci permet de garantir que l'on sera bien centr et  100% sur la largeur 960 px
    // Je ne comprends pas pourquoi il y a besoin de ca! 
    Label l = new Label();
    l.setSizeUndefined();
    addComponent(l);

    setMargin(false);
    setSpacing(true);
    setSizeUndefined();
    addStyleName("block-center");
    addStyleName(getMainStyleName());
    setResponsive(true);
}

From source file:fr.amapj.view.engine.template.FrontOfficeView.java

License:Open Source License

/**
 * //from ww w  .  j  av  a2s. c om
 */
@Override
final public void enter(ViewChangeEvent event) {
    //
    ValoMenuLayout.setFrontOffice();

    enter();

    // Ceci permet de garantir que l'on sera bien centr et  100% sur la largeur 960 px
    // Je ne comprends pas pourquoi il y a besoin de ca! 
    Label l = new Label();
    l.setSizeUndefined();
    addComponent(l);

    setMargin(false);
    setSpacing(true);
    setSizeUndefined();
    addStyleName("block-center");
    addStyleName(getMainStyleName());
    setResponsive(true);
}

From source file:fr.amapj.view.views.common.contratselector.ContratSelectorPart.java

License:Open Source License

public HorizontalLayout getChoixContratComponent() {
    // Partie choix du contrat
    HorizontalLayout toolbar1 = new HorizontalLayout();
    toolbar1.addStyleName("contrat-selectorpart");

    Label pLabel = new Label("Producteur");
    pLabel.addStyleName("combobox");
    pLabel.setSizeUndefined();

    producteurBox = new Searcher(SearcherList.PRODUCTEUR, null, allowedProducteurs);
    producteurBox.setImmediate(true);//from   w  w w.  jav  a 2 s  .  c  om

    producteurBox.addValueChangeListener(e -> handleProducteurChange());

    Label cLabel = new Label("Contrat");
    cLabel.addStyleName("combobox");
    cLabel.setSizeUndefined();

    contratBox = new ComboBox();

    contratBox.setImmediate(true);
    contratBox.setWidth("300px");

    contratBox.addValueChangeListener(e -> handleContratChange());

    reinitButton = new Button("Changer de contrat");
    reinitButton.addClickListener(e -> handleReinit());

    toolbar1.addComponent(pLabel);
    toolbar1.addComponent(producteurBox);
    toolbar1.addComponent(cLabel);
    toolbar1.addComponent(contratBox);
    if (onlyOneProducteur == false) {
        toolbar1.addComponent(reinitButton);
        toolbar1.setExpandRatio(reinitButton, 1);
        toolbar1.setComponentAlignment(reinitButton, Alignment.TOP_RIGHT);
        contratBox.setEnabled(false);
    } else {
        // Ceci est ncessaire pour conserver un alignement correct  
        Label tf = new Label("");
        toolbar1.addComponent(tf);
        toolbar1.setExpandRatio(tf, 1);
        toolbar1.setComponentAlignment(tf, Alignment.TOP_RIGHT);
    }

    toolbar1.setSpacing(true);
    toolbar1.setWidth("100%");

    return toolbar1;
}

From source file:fr.amapj.view.views.common.utilisateurselector.UtilisateurSelectorPart.java

License:Open Source License

private void constructMultipleUtilisateur(HorizontalLayout toolbar1) {
    if (isCompactMode == false) {
        Label pLabel = new Label("Amapien");
        pLabel.addStyleName("xutilisateurs");
        pLabel.setSizeUndefined();
        toolbar1.addComponent(pLabel);//from   w  w w  .  j av  a 2s .com
    }

    utilisateurBox = new Searcher(SearcherList.UTILISATEUR_ACTIF, null);
    utilisateurBox.setImmediate(true);
    utilisateurBox.addValueChangeListener(e -> handleUtilisateurChange());

    reinitButton = new Button("Changer d'amapien");
    reinitButton.addClickListener(e -> handleReinit());

    toolbar1.addComponent(utilisateurBox);
    toolbar1.addComponent(reinitButton);
    toolbar1.setExpandRatio(reinitButton, 1);
    toolbar1.setComponentAlignment(reinitButton, Alignment.TOP_RIGHT);

}

From source file:fr.amapj.view.views.cotisation.PeriodeCotisationSelectorPart.java

License:Open Source License

public HorizontalLayout getChoixPeriodeComponent() {
    // Partie choix 
    HorizontalLayout toolbar1 = new HorizontalLayout();
    toolbar1.addStyleName("periode-selectorpart");

    Label pLabel = new Label("Priode de cotisation");
    pLabel.addStyleName("periode");
    pLabel.setSizeUndefined();

    toolbar1.addComponent(pLabel);/*from  www . j av a2s .  c  o m*/

    constructMultiplePeriode(toolbar1);

    toolbar1.setSpacing(true);
    toolbar1.setMargin(false);
    toolbar1.setWidth("100%");

    return toolbar1;
}

From source file:fr.amapj.view.views.editionspe.EditionSpeListPart.java

License:Open Source License

@Override
public void enterIn(ViewChangeEvent event) {

    // Lecture dans la base de donnes
    mcInfos = new BeanItemContainer<EditionSpeDTO>(EditionSpeDTO.class);

    // Bind it to a component
    cdesTable = createTable(mcInfos);/* ww  w  . ja v a 2s. co m*/

    // Titre des colonnes
    cdesTable.setVisibleColumns(new String[] { "nom", "typEditionSpecifique" });
    cdesTable.setColumnHeader("nom", "Nom");
    cdesTable.setColumnHeader("typEditionSpecifique", "Type de l'dition");

    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 ditions spcifiques");
    title2.setSizeUndefined();
    title2.addStyleName("stdlistpart-text-title");

    newButton = new Button("Crer une nouvelle dition spcifique");
    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.listeadherents.ListeAdherentsView.java

License:Open Source License

/**
 * // www. j a v a2 s  . com
 */
@Override
public void enterIn(ViewChangeEvent event) {
    // TODO code  factoriser
    PEListeAdherentDTO p = new ParametresService().getPEListeAdherentDTO();

    listPartContainer = new BeanItemContainer<>(Utilisateur.class);
    List<Utilisateur> us = new ListeAdherentsService().getAllUtilisateurs(false);
    listPartContainer.addAll(us);

    // 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
    List<String> cols = new ArrayList<>();
    cols.add("nom");
    cols.add("prenom");

    if (p.canAccessEmail) {
        cols.add("email");
    }
    if (p.canAccessTel1) {
        cols.add("numTel1");
    }
    if (p.canAccessTel2) {
        cols.add("numTel2");
    }

    beanTable.setVisibleColumns(cols.toArray());

    beanTable.setColumnHeader("nom", "Nom");
    beanTable.setColumnHeader("prenom", "Prnom");
    beanTable.setColumnHeader("email", "E mail");
    beanTable.setColumnHeader("numTel1", "Numro Tel 1");
    beanTable.setColumnHeader("numTel2", "Numro Tel 2");

    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();

    Label title = new Label("Liste des adhrents");
    title.setSizeUndefined();
    title.addStyleName("stdlistpart-text-title");

    sendMailButton = new Button("Envoyer un mail  tous ...");
    sendMailButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            handleSendMail();
        }
    });

    searchField = new TextField();
    searchField.setInputPrompt("Rechercher par le nom ou le prnom");
    searchField.addTextChangeListener(new TextChangeListener() {

        @Override
        public void textChange(TextChangeEvent event) {
            textFilter = event.getText();
            updateFilters();
        }
    });
    searchField.addStyleName(ChameleonTheme.TEXTFIELD_BIG);
    searchField.setWidth("50%");

    if (p.canAccessEmail) {
        toolbar.addComponent(sendMailButton);
    }

    // 
    toolbar.addComponent(LinkCreator.createLink(new EGListeAdherent(Type.STD, p)));
    toolbar.addComponent(searchField);
    toolbar.setWidth("100%");
    toolbar.setExpandRatio(searchField, 1);
    toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT);
    toolbar.setSpacing(true);

    addComponent(title);
    addComponent(toolbar);

    addComponent(beanTable);
    setExpandRatio(beanTable, 1);

}