Example usage for com.vaadin.ui HorizontalLayout setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:fr.univlorraine.mondossierweb.views.RechercheMobileView.java

License:Apache License

/**
 * Initialise la vue/* ww  w.  j  av  a2  s  .co m*/
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) {
        // On rinitialise la vue
        removeAllComponents();

        // Style
        setSizeFull();
        addStyleName("v-noscrollableelement");

        //NAVBAR
        HorizontalLayout navbar = new HorizontalLayout();
        navbar.setSizeFull();
        navbar.setHeight("40px");
        navbar.setStyleName("navigation-bar");

        //Bouton retour
        returnButton = new Button();
        returnButton.setIcon(FontAwesome.ARROW_LEFT);
        returnButton.setStyleName("v-nav-button");
        returnButton.addClickListener(e -> {
            MdwTouchkitUI.getCurrent().backFromSearch();
        });
        navbar.addComponent(returnButton);
        navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);

        //Title
        Label labelTrombi = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale()));
        labelTrombi.setStyleName("v-label-navbar");
        navbar.addComponent(labelTrombi);
        navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER);

        navbar.setExpandRatio(labelTrombi, 1);
        addComponent(navbar);

        //BOUTON DE RECHERCHE
        btnRecherche = new Button();
        btnRecherche.setIcon(FontAwesome.SEARCH);
        btnRecherche.setStyleName(ValoTheme.BUTTON_PRIMARY);
        btnRecherche.addStyleName("v-popover-button");
        btnRecherche.addStyleName("v-button-without-padding");
        btnRecherche.setEnabled(true);
        btnRecherche.addClickListener(e -> search(false));

        //CHAMP DE RECHERCHE
        champRechercheLayout = new HorizontalLayout();
        champRechercheLayout.setWidth("100%");
        mainVerticalLayout = new VerticalLayout();
        mainVerticalLayout.setImmediate(true);
        mainVerticalLayout.setSizeFull();

        //Init connexion  ES, pour gain perf au premiere lettre tapes
        if (ElasticSearchService.initConnexion(true)) {

            //Cration du champ autoComplete
            champRecherche = new AutoComplete();
            champRecherche.setWidth(100, Unit.PERCENTAGE);
            champRecherche.setEnabled(true);
            champRecherche.setImmediate(true);
            champRecherche.focus();
            champRecherche.setTextChangeEventMode(TextChangeEventMode.EAGER);
            champRecherche.addTextChangeListener(new TextChangeListener() {
                @Override
                public void textChange(TextChangeEvent event) {
                    /*if(event.getText()!=null){
                    resetButton.setIcon(FontAwesome.TIMES);
                    }*/

                    champRecherche.showChoices(quickSearch(event.getText()), mainVerticalLayout, btnRecherche,
                            true);

                }
            });
            champRecherche.setImmediate(true);
            champRecherche.addShortcutListener(
                    new ShortcutListener("Enter Shortcut", ShortcutAction.KeyCode.ENTER, null) {
                        @Override
                        public void handleAction(Object sender, Object target) {
                            if (target == champRecherche) {
                                //Si on tait sur une ligne propose sous le champ de recherche
                                if (champRecherche.getSelectedItem() > 0) {
                                    //On remplie d'abord le champ avec la ligne slectionne
                                    champRecherche.setValue(champRecherche.getChoices()
                                            .getItem(champRecherche.getSelectedItem()).getItemProperty("lib")
                                            .getValue().toString());
                                }
                                search(false);
                            }
                        }
                    });

            champRecherche.addShortcutListener(
                    new ShortcutListener("Bottom Arrow", ShortcutAction.KeyCode.ARROW_DOWN, null) {
                        @Override
                        public void handleAction(Object sender, Object target) {
                            if (target == champRecherche) {
                                if (champRecherche.getChoices().getItemIds() != null) {
                                    champRecherche.getChoicesPopup().setVisible(true);
                                    champRecherche.getChoices().setValue(champRecherche.getNextItem());

                                }
                            }
                        }
                    });

            champRecherche.addShortcutListener(
                    new ShortcutListener("Top Arrow", ShortcutAction.KeyCode.ARROW_UP, null) {
                        @Override
                        public void handleAction(Object sender, Object target) {
                            if (target == champRecherche) {
                                if (champRecherche.getChoices().getItemIds() != null) {
                                    champRecherche.getChoicesPopup().setVisible(true);
                                    Integer champSelectionne = champRecherche.getPreviousItem();
                                    if (champSelectionne > 0) {
                                        champRecherche.getChoices().setValue(champSelectionne);
                                    } else {
                                        champRecherche.getChoices().setValue(null);
                                    }

                                }
                            }
                        }
                    });

            champRechercheLayout.addComponent(champRecherche);
            champRechercheLayout.setComponentAlignment(champRecherche, Alignment.MIDDLE_LEFT);

            //BOUTON RESET
            champRecherche.addStyleName("textfield-resetable");
            resetButton = new Button();
            resetButton.setIcon(FontAwesome.TIMES);
            resetButton.setStyleName(ValoTheme.BUTTON_BORDERLESS);
            resetButton.addStyleName("v-popover-button");
            resetButton.addStyleName("v-button-without-padding");
            resetButton.addStyleName("btn-reset");
            resetButton.addClickListener(e -> {
                champRecherche.setValue("");
                //search1.setValue("");
                resetButton.setIcon(FontAwesome.TIMES);
                champRecherche.focus();
            });
            champRechercheLayout.addComponent(resetButton);
            champRechercheLayout.setComponentAlignment(resetButton, Alignment.MIDDLE_LEFT);

            //Ajout du bouton de recherche au layout
            champRechercheLayout.addComponent(btnRecherche);
            mainVerticalLayout.addComponent(champRechercheLayout);
            mainVerticalLayout.setComponentAlignment(champRechercheLayout, Alignment.MIDDLE_LEFT);
            champRechercheLayout.setMargin(true);
            champRechercheLayout.setExpandRatio(champRecherche, 1);

            HorizontalLayout checkBoxVetLayout = new HorizontalLayout();
            Label etapeLabel = new Label(
                    applicationContext.getMessage(NAME + ".etapes.checkbox", null, getLocale()));
            etapeLabel.setStyleName(ValoTheme.LABEL_SMALL);
            checkBoxVetLayout.addComponent(etapeLabel);

            HorizontalLayout checkBoxElpLayout = new HorizontalLayout();
            Label elpLabel = new Label(
                    applicationContext.getMessage(NAME + ".elps.checkbox", null, getLocale()));
            elpLabel.setStyleName(ValoTheme.LABEL_SMALL);
            checkBoxElpLayout.addComponent(elpLabel);

            HorizontalLayout checkBoxEtuLayout = new HorizontalLayout();
            Label etuLabel = new Label(
                    applicationContext.getMessage(NAME + ".etudiants.checkbox", null, getLocale()));
            etuLabel.setStyleName(ValoTheme.LABEL_SMALL);
            checkBoxEtuLayout.addComponent(etuLabel);

            checkBoxVetLayout.setSizeFull();
            checkBoxElpLayout.setSizeFull();
            checkBoxEtuLayout.setSizeFull();

            if (casesAcocherVet) {
                checkBoxVetLayout.setStyleName("layout-checkbox-checked");
                etapeLabel.setStyleName(ValoTheme.LABEL_SMALL);
            } else {
                checkBoxVetLayout.setStyleName("layout-checkbox-unchecked");
                etapeLabel.addStyleName("label-line-through");
            }

            if (casesAcocherElp) {
                checkBoxElpLayout.setStyleName("layout-checkbox-checked");
                elpLabel.setStyleName(ValoTheme.LABEL_SMALL);
            } else {
                checkBoxElpLayout.setStyleName("layout-checkbox-unchecked");
                elpLabel.addStyleName("label-line-through");
            }

            if (casesAcocherEtudiant) {
                checkBoxEtuLayout.setStyleName("layout-checkbox-checked");
                etuLabel.setStyleName(ValoTheme.LABEL_SMALL);
            } else {
                checkBoxEtuLayout.setStyleName("layout-checkbox-unchecked");
                etuLabel.addStyleName("label-line-through");
            }

            checkBoxVetLayout.addListener(new LayoutClickListener() {
                public void layoutClick(LayoutClickEvent event) {
                    if (casesAcocherVet) {
                        casesAcocherVet = false;
                        checkBoxVetLayout.setStyleName("layout-checkbox-unchecked");
                        etapeLabel.addStyleName("label-line-through");
                    } else {
                        casesAcocherVet = true;
                        checkBoxVetLayout.setStyleName("layout-checkbox-checked");
                        etapeLabel.setStyleName(ValoTheme.LABEL_SMALL);
                    }
                    tuneSearch();
                }
            });

            checkBoxElpLayout.addListener(new LayoutClickListener() {
                public void layoutClick(LayoutClickEvent event) {
                    if (casesAcocherElp) {
                        casesAcocherElp = false;
                        checkBoxElpLayout.setStyleName("layout-checkbox-unchecked");
                        elpLabel.addStyleName("label-line-through");
                    } else {
                        casesAcocherElp = true;
                        checkBoxElpLayout.setStyleName("layout-checkbox-checked");
                        elpLabel.setStyleName(ValoTheme.LABEL_SMALL);
                    }
                    tuneSearch();
                }
            });

            checkBoxEtuLayout.addListener(new LayoutClickListener() {
                public void layoutClick(LayoutClickEvent event) {
                    if (casesAcocherEtudiant) {
                        casesAcocherEtudiant = false;
                        checkBoxEtuLayout.setStyleName("layout-checkbox-unchecked");
                        etuLabel.addStyleName("label-line-through");
                    } else {
                        casesAcocherEtudiant = true;
                        checkBoxEtuLayout.setStyleName("layout-checkbox-checked");
                        etuLabel.setStyleName(ValoTheme.LABEL_SMALL);
                    }
                    tuneSearch();
                }
            });

            HorizontalLayout checkBoxLayout = new HorizontalLayout();
            checkBoxLayout.setWidth("100%");
            checkBoxLayout.setHeight("50px");
            checkBoxLayout.setMargin(true);
            checkBoxLayout.setSpacing(true);
            checkBoxLayout.addComponent(checkBoxVetLayout);
            checkBoxLayout.addComponent(checkBoxElpLayout);
            checkBoxLayout.addComponent(checkBoxEtuLayout);

            mainVerticalLayout.addComponent(checkBoxLayout);

            //TABLE DE RESULTATS
            rrContainer = new HierarchicalContainer();
            rrContainer.addContainerProperty("lib", String.class, "");
            rrContainer.addContainerProperty("code", String.class, "");
            rrContainer.addContainerProperty("type", String.class, "");
            tableResultats = new TreeTable();
            tableResultats.setWidth("100%");
            tableResultats.setSelectable(false);
            tableResultats.setMultiSelect(false);
            tableResultats.setImmediate(true);
            columnHeaders = new String[FIELDS_ORDER.length];
            for (int fieldIndex = 0; fieldIndex < FIELDS_ORDER.length; fieldIndex++) {
                columnHeaders[fieldIndex] = applicationContext
                        .getMessage("result.table." + FIELDS_ORDER[fieldIndex], null, Locale.getDefault());
            }

            tableResultats.addGeneratedColumn("type", new DisplayTypeColumnGenerator());
            tableResultats.addGeneratedColumn("lib", new DisplayNameColumnGenerator());
            tableResultats.setContainerDataSource(rrContainer);
            tableResultats.setVisibleColumns(FIELDS_ORDER);
            tableResultats.setStyleName("nohscrollabletable");
            tableResultats.setColumnHeaders(columnHeaders);
            tableResultats.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
            tableResultats.setColumnWidth("type", 100);

            /*mainVerticalLayout.addComponent(searchBoxFilter);
            mainVerticalLayout.setComponentAlignment(searchBoxFilter, Alignment.MIDDLE_RIGHT);*/
            VerticalLayout tableVerticalLayout = new VerticalLayout();
            tableVerticalLayout.setMargin(true);
            tableVerticalLayout.setSizeFull();
            tableVerticalLayout.addComponent(tableResultats);
            mainVerticalLayout.addComponent(tableVerticalLayout);
            mainVerticalLayout.setExpandRatio(tableVerticalLayout, 1);
            tableResultats.setVisible(false);

            addComponent(mainVerticalLayout);
            setExpandRatio(mainVerticalLayout, 1);
        } else {
            //Message fonctionnalit indisponible
            addComponent(
                    new Label(applicationContext.getMessage(NAME + ".indisponible.message", null, getLocale()),
                            ContentMode.HTML));
        }
    }
}

From source file:fr.univlorraine.mondossierweb.views.windows.SignificationsMobileWindow.java

License:Apache License

/**
 * Cre une fentre/*from  w w  w .  j  a v a2s  . c  o m*/
 */
public SignificationsMobileWindow(boolean afficherSignificationIndicateurProfondeur) {

    setWidth("95%");
    setHeight("95%");

    setCaption(applicationContext.getMessage("significationsWindow.title", null, getLocale()));
    setModal(true);
    setResizable(false);
    setClosable(false);
    setStyleName("v-popover-blank");

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    setContent(layout);

    VerticalLayout panelLayout = new VerticalLayout();
    panelLayout.setWidth("100%");
    panelLayout.setStyleName("v-scrollableelement");
    panelLayout.setSpacing(true);
    panelLayout.setMargin(true);

    if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {

        Panel panelSignificationResultats = new Panel();
        panelSignificationResultats.setCaption(
                applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale()));
        panelSignificationResultats.addStyleName("significationpanel");
        panelSignificationResultats.setWidth("100%");

        VerticalLayout significationLayout = new VerticalLayout();
        significationLayout.setWidth("100%");
        significationLayout.setMargin(true);
        significationLayout.setSpacing(true);

        Set<String> ss = MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().keySet();
        for (String k : ss) {
            if (k != null && !k.equals("") && !k.equals(" ")) {
                HorizontalLayout signLayout = new HorizontalLayout();
                signLayout.setSizeFull();
                signLayout.setMargin(true);
                signLayout.setSpacing(true);
                Label codeLabel = new Label(k);
                codeLabel.setStyleName(ValoTheme.LABEL_BOLD);
                codeLabel.addStyleName("v-label-align-right");
                signLayout.addComponent(codeLabel);
                Label valueLabel = new Label(
                        "" + MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().get(k));
                signLayout.addComponent(valueLabel);
                significationLayout.addComponent(signLayout);
            }
        }

        panelSignificationResultats.setContent(significationLayout);
        panelLayout.addComponent(panelSignificationResultats);

    }

    if (afficherSignificationIndicateurProfondeur) {

        Panel panelSignificationIndicateurs = new Panel();
        panelSignificationIndicateurs.setCaption(
                applicationContext.getMessage(NAME + ".info.significations.indicateurs", null, getLocale()));
        panelSignificationIndicateurs.addStyleName("significationpanel");
        panelSignificationIndicateurs.setWidth("100%");

        VerticalLayout significationLayout = new VerticalLayout();
        significationLayout.setMargin(true);
        significationLayout.setSpacing(true);
        significationLayout.setWidth("100%");

        //1er NIVEAU
        HorizontalLayout levelLayout1 = new HorizontalLayout();
        levelLayout1.setWidth("100%");
        HorizontalLayout levelMainLayout1 = new HorizontalLayout();
        levelMainLayout1.setWidth("100%");
        levelMainLayout1.setSpacing(true);
        levelMainLayout1.setStyleName("level-indicator-layout");
        int k = 0;
        for (int i = 0; i < 1; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout1.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout1.addComponent(libLevelSpaceLayout);
        }

        levelLayout1.addComponent(levelMainLayout1);
        levelLayout1.addComponent(new Label("1er niveau"));
        significationLayout.addComponent(levelLayout1);

        //2em NIVEAU
        HorizontalLayout levelLayout2 = new HorizontalLayout();
        levelLayout2.setSizeFull();
        HorizontalLayout levelMainLayout2 = new HorizontalLayout();
        levelMainLayout2.setSizeFull();
        levelMainLayout2.setSpacing(true);
        levelMainLayout2.setStyleName("level-indicator-layout");
        k = 0;
        for (int i = 0; i < 2; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout2.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout2.addComponent(libLevelSpaceLayout);
        }

        levelLayout2.addComponent(levelMainLayout2);
        levelLayout2.addComponent(new Label("2em niveau"));
        significationLayout.addComponent(levelLayout2);

        //3em NIVEAU
        HorizontalLayout levelLayout3 = new HorizontalLayout();
        levelLayout3.setSizeFull();
        HorizontalLayout levelMainLayout3 = new HorizontalLayout();
        levelMainLayout3.setSizeFull();
        levelMainLayout3.setSpacing(true);
        levelMainLayout3.setStyleName("level-indicator-layout");
        k = 0;
        for (int i = 0; i < 3; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout3.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout3.addComponent(libLevelSpaceLayout);
        }

        levelLayout3.addComponent(levelMainLayout3);
        levelLayout3.addComponent(new Label("3em niveau"));
        significationLayout.addComponent(levelLayout3);

        //4em NIVEAU
        HorizontalLayout levelLayout4 = new HorizontalLayout();
        levelLayout4.setSizeFull();
        HorizontalLayout levelMainLayout4 = new HorizontalLayout();
        levelMainLayout4.setSizeFull();
        levelMainLayout4.setSpacing(true);
        levelMainLayout4.setStyleName("level-indicator-layout");
        k = 0;
        for (int i = 0; i < 4; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout4.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout4.addComponent(libLevelSpaceLayout);
        }

        levelLayout4.addComponent(levelMainLayout4);
        levelLayout4.addComponent(new Label("4em niveau"));
        significationLayout.addComponent(levelLayout4);

        //ETC
        HorizontalLayout levelLayoutEtc = new HorizontalLayout();
        levelLayoutEtc.setSizeFull();

        levelLayoutEtc.addComponent(new Label("..."));
        levelLayoutEtc.addComponent(new Label(""));
        significationLayout.addComponent(levelLayoutEtc);

        panelSignificationIndicateurs.setContent(significationLayout);
        panelLayout.addComponent(panelSignificationIndicateurs);

    }

    layout.addComponent(panelLayout);

    // close button
    HorizontalLayout bLayout = new HorizontalLayout();
    bLayout.setSizeFull();
    bLayout.setHeight("50px");

    Button closeButton = new Button();
    //closeButton.setCaption(applicationContext.getMessage("significationsWindow.btnFermer", null, getLocale()));
    closeButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    closeButton.addStyleName("v-popover-button");
    closeButton.setIcon(FontAwesome.CHECK);
    closeButton.addClickListener(e -> {
        close();

    });

    bLayout.addComponent(closeButton);
    bLayout.setComponentAlignment(closeButton, Alignment.MIDDLE_CENTER);
    layout.addComponent(bLayout);

    layout.setExpandRatio(panelLayout, 1);

}

From source file:it.vige.greenarea.bpm.custom.ui.form.GreenareaPagedTable.java

License:Apache License

@Override
public HorizontalLayout createControls() {
    I18nManager I18nManager = get().getI18nManager();
    final PagedTableContainer container = (PagedTableContainer) getContainerDataSource();
    Label itemsPerPageLabel = new Label(I18nManager.getMessage(PAGINAZIONE_PER_PAGINA));
    final ComboBox itemsPerPageSelect = new ComboBox();

    itemsPerPageSelect.addItem("3");
    itemsPerPageSelect.addItem("10");
    itemsPerPageSelect.addItem("25");
    itemsPerPageSelect.addItem("50");
    itemsPerPageSelect.setImmediate(true);
    itemsPerPageSelect.setNullSelectionAllowed(false);
    itemsPerPageSelect.setWidth("50px");
    itemsPerPageSelect.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            setPageLength(Integer.valueOf(String.valueOf(event.getProperty().getValue())));
        }//w  ww  .  j a va 2s  .  c o  m
    });
    itemsPerPageSelect.select(maxRecords + "");
    Label pageLabel = new Label(I18nManager.getMessage(PAGINAZIONE_PAG) + "&nbsp;", Label.CONTENT_XHTML);
    final TextField currentPageTextField = new TextField();
    currentPageTextField.setValue(String.valueOf(getCurrentPage()));
    currentPageTextField.addValidator(new IntegerValidator(null));
    Label separatorLabel = new Label("&nbsp;/&nbsp;", Label.CONTENT_XHTML);
    final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML);
    currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL);
    currentPageTextField.setImmediate(true);
    currentPageTextField.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) {
                int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue()));
                setCurrentPage(page);
            }
        }
    });
    pageLabel.setWidth(null);
    currentPageTextField.setWidth("20px");
    separatorLabel.setWidth(null);
    totalPagesLabel.setWidth(null);

    HorizontalLayout controlBar = new HorizontalLayout();
    HorizontalLayout pageSize = new HorizontalLayout();
    HorizontalLayout pageManagement = new HorizontalLayout();
    final Button first = new Button("<<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(ClickEvent event) {
            setCurrentPage(0);
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    final Button previous = new Button("<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(ClickEvent event) {
            previousPage();
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    final Button next = new Button(">", new ClickListener() {
        private static final long serialVersionUID = -1927138212640638452L;

        public void buttonClick(ClickEvent event) {
            nextPage();
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    final Button last = new Button(">>", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(ClickEvent event) {
            setCurrentPage(getTotalAmountOfPages());
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    first.setStyleName(Reindeer.BUTTON_LINK);
    previous.setStyleName(Reindeer.BUTTON_LINK);
    next.setStyleName(Reindeer.BUTTON_LINK);
    last.setStyleName(Reindeer.BUTTON_LINK);

    itemsPerPageLabel.addStyleName("pagedtable-itemsperpagecaption");
    itemsPerPageSelect.addStyleName("pagedtable-itemsperpagecombobox");
    pageLabel.addStyleName("pagedtable-pagecaption");
    currentPageTextField.addStyleName("pagedtable-pagefield");
    separatorLabel.addStyleName("pagedtable-separator");
    totalPagesLabel.addStyleName("pagedtable-total");
    first.addStyleName("pagedtable-first");
    previous.addStyleName("pagedtable-previous");
    next.addStyleName("pagedtable-next");
    last.addStyleName("pagedtable-last");

    itemsPerPageLabel.addStyleName("pagedtable-label");
    itemsPerPageSelect.addStyleName("pagedtable-combobox");
    pageLabel.addStyleName("pagedtable-label");
    currentPageTextField.addStyleName("pagedtable-label");
    separatorLabel.addStyleName("pagedtable-label");
    totalPagesLabel.addStyleName("pagedtable-label");
    first.addStyleName("pagedtable-button");
    previous.addStyleName("pagedtable-button");
    next.addStyleName("pagedtable-button");
    last.addStyleName("pagedtable-button");

    pageSize.addComponent(itemsPerPageLabel);
    pageSize.addComponent(itemsPerPageSelect);
    pageSize.setComponentAlignment(itemsPerPageLabel, Alignment.MIDDLE_LEFT);
    pageSize.setComponentAlignment(itemsPerPageSelect, Alignment.MIDDLE_LEFT);
    pageSize.setSpacing(true);
    pageManagement.addComponent(first);
    pageManagement.addComponent(previous);
    pageManagement.addComponent(pageLabel);
    pageManagement.addComponent(currentPageTextField);
    pageManagement.addComponent(separatorLabel);
    pageManagement.addComponent(totalPagesLabel);
    pageManagement.addComponent(next);
    pageManagement.addComponent(last);
    pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT);
    pageManagement.setWidth(null);
    pageManagement.setSpacing(true);
    controlBar.addComponent(pageSize);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER);
    controlBar.setWidth("100%");
    controlBar.setExpandRatio(pageSize, 1);
    addListener(new PageChangeListener() {
        public void pageChanged(PagedTableChangeEvent event) {
            first.setEnabled(container.getStartIndex() > 0);
            previous.setEnabled(container.getStartIndex() > 0);
            next.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength());
            last.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength());
            currentPageTextField.setValue(String.valueOf(getCurrentPage()));
            totalPagesLabel.setValue(getTotalAmountOfPages());
            itemsPerPageSelect.setValue(String.valueOf(getPageLength()));
        }
    });
    controlBar.setStyleName("pagination");
    return controlBar;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Component getVerticalLayout() {
    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);/*from   www .  ja  v  a  2 s  . co m*/
    controls.setStyleName("inline");
    final VerticalLayout main = new VerticalLayout();

    final VerticalLayout vl = new VerticalLayout();
    vl.setSpacing(true);
    vl.setMargin(true);
    vl.setCaption("Layout Caption");
    vl.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    vl.addComponent(createImageFixedHeight());
    vl.addComponent(createImageFixedHeight());
    vl.addComponent(createImageFixedHeight());

    controls.addComponent(
            new StyleController(vl, BennuTheme.LAYOUT_BIG, BennuTheme.LAYOUT_INSET, BennuTheme.LAYOUT_SECTION));
    controls.addComponent(new SpacingController(vl));
    controls.addComponent(new MarginController(vl));

    main.addComponent(controls);
    main.addComponent(vl);

    return main;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Component getHorizontalLayout() {
    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);/*from  www.  j  a  v a  2s  .  com*/
    controls.setStyleName("inline");
    final VerticalLayout main = new VerticalLayout();

    final HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(true);
    hl.setCaption("Layout Caption");
    hl.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    hl.addComponent(createImageFixedHeight());
    hl.addComponent(createImageFixedHeight());
    hl.addComponent(createImageFixedHeight());

    controls.addComponent(
            new StyleController(hl, BennuTheme.LAYOUT_BIG, BennuTheme.LAYOUT_INSET, BennuTheme.LAYOUT_SECTION));
    controls.addComponent(new SpacingController(hl));
    controls.addComponent(new MarginController(hl));

    main.addComponent(controls);
    main.addComponent(hl);

    return main;
}

From source file:nl.kpmg.lcm.ui.view.administration.AuthorizedLcmPanel.java

License:Apache License

private HorizontalLayout initMenubar(RestClientService restClientService1) {

    Button createButton = initCreateButton(restClientService1);
    Button refreshButton = initRefreshButton();

    HorizontalLayout menubar = new HorizontalLayout();
    menubar.setStyleName("v-panel-borderless");
    menubar.addComponent(createButton);/* w  w  w .  j a  v a 2 s.c o  m*/
    menubar.addComponent(refreshButton);

    return menubar;
}

From source file:nl.kpmg.lcm.ui.view.administration.RemoteLcmPanel.java

License:Apache License

private HorizontalLayout initMenuBar(RestClientService restClientService1) {
    Button refreshButton = initRefreshButton();
    Button createButton = initCreateButton(restClientService1);

    HorizontalLayout menubar = new HorizontalLayout();
    menubar.setStyleName("v-panel-borderless");
    menubar.addComponent(createButton);/*from ww w  .j  a  v a  2  s  .c  o m*/
    menubar.addComponent(refreshButton);
    return menubar;
}

From source file:org.eclipse.hawkbit.ui.common.grid.AbstractGridLayout.java

License:Open Source License

private HorizontalLayout createCountMessageComponent() {
    final HorizontalLayout rolloutGroupTargetsCountLayout = new HorizontalLayout();
    final Label countMessageLabel = getCountMessageLabel();
    countMessageLabel.setId(UIComponentIdProvider.ROLLOUT_GROUP_TARGET_LABEL);
    rolloutGroupTargetsCountLayout.addComponent(getCountMessageLabel());
    rolloutGroupTargetsCountLayout.setStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
    rolloutGroupTargetsCountLayout.setWidth("100%");
    return rolloutGroupTargetsCountLayout;

}

From source file:org.eclipse.hawkbit.ui.login.HawkbitLoginUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest request) {
    SpringContextHelper.setContext(context);

    final VerticalLayout rootLayout = new VerticalLayout();
    final Component header = buildHeader();

    rootLayout.addComponent(header);/* w w  w  .  j  av  a2s .c  o m*/
    rootLayout.setSizeFull();

    final HorizontalLayout content = new HorizontalLayout();
    rootLayout.addComponent(content);
    content.setStyleName("view-content");
    content.setSizeFull();
    rootLayout.setStyleName("main-content");

    rootLayout.setExpandRatio(header, 1.0F);
    rootLayout.setExpandRatio(content, 2.0F);
    final Resource resource = context
            .getResource("classpath:/VAADIN/themes/" + UI.getCurrent().getTheme() + "/layouts/footer.html");

    try (InputStream resourceStream = resource.getInputStream()) {
        final CustomLayout customLayout = new CustomLayout(resourceStream);
        customLayout.setSizeUndefined();
        rootLayout.addComponent(customLayout);
    } catch (final IOException ex) {
        LOG.error("Footer file cannot be loaded", ex);
    }
    setContent(rootLayout);

    final Navigator navigator = new Navigator(this, content);
    navigator.addProvider(viewProvider);
    setNavigator(navigator);
}

From source file:org.eclipse.hawkbit.ui.management.targettag.filter.FilterByStatusLayout.java

License:Open Source License

private void getFilterTargetsStatusLayout() {

    getTargetFilterStatuses();/*  w  w w .jav a2  s.c  om*/

    addStyleName("target-status-filters");
    setMargin(false);

    final Label targetFilterStatusLabel = new LabelBuilder().name(i18n.getMessage("label.filter.by.status"))
            .buildLabel();

    targetFilterStatusLabel.addStyleName("target-status-filters-title");

    addComponent(targetFilterStatusLabel);
    setComponentAlignment(targetFilterStatusLabel, Alignment.MIDDLE_CENTER);
    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setStyleName("status-button-layout");
    buttonLayout.addComponent(unknown);
    buttonLayout.setComponentAlignment(unknown, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(inSync);
    buttonLayout.setComponentAlignment(inSync, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(pending);
    buttonLayout.setComponentAlignment(pending, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(error);
    buttonLayout.setComponentAlignment(error, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(registered);
    buttonLayout.setComponentAlignment(registered, Alignment.MIDDLE_CENTER);
    addComponent(buttonLayout);
    setComponentAlignment(buttonLayout, Alignment.MIDDLE_LEFT);

    final HorizontalLayout overdueLayout = new HorizontalLayout();
    final Label overdueLabel = new LabelBuilder().name(i18n.getMessage("label.filter.by.overdue")).buildLabel();
    overdueLayout.setStyleName("overdue-button-layout");
    overdueLayout.addComponent(overdue);
    overdueLayout.setComponentAlignment(overdue, Alignment.MIDDLE_LEFT);
    overdueLayout.addComponent(overdueLabel);
    overdueLayout.setComponentAlignment(overdueLabel, Alignment.MIDDLE_LEFT);
    addComponent(overdueLayout);
    setComponentAlignment(overdueLayout, Alignment.MIDDLE_LEFT);

}