List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:fr.univlorraine.mondossierweb.views.RechercheMobileView.java
License:Apache License
/** * Initialise la vue//from w ww . j av a 2 s. c om */ @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.RechercheRapideView.java
License:Apache License
/** * Initialise la vue//ww w. ja v a 2s. c o m */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (userController.isEnseignant()) { /* Style */ setMargin(true); setSpacing(true); mainVerticalLayout = new VerticalLayout(); champRechercheLayout = new HorizontalLayout(); mainVerticalLayout.setImmediate(true); mainVerticalLayout.setSizeFull(); //BOUTON DE RECHERCHE btnRecherche = new Button( applicationContext.getMessage("buttonChercher.label", null, Locale.getDefault())); btnRecherche.setIcon(FontAwesome.SEARCH); btnRecherche.setEnabled(true); btnRecherche.addClickListener(e -> search(false)); //Init connexion ES, pour gain perf au premiere lettre tapes if (ElasticSearchService.initConnexion(true)) { //CHAMP DE RECHERCHE champRecherche = new AutoComplete(); champRecherche.setWidth(700, Unit.PIXELS); //540 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, false); } }); 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 != null && champRecherche.getChoices() != null && 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); } } } } }); //champRecherche.addBlurListener(e -> champRecherche.getChoicesPopup().setVisible(false)); HorizontalLayout layoutBordure = new HorizontalLayout(); layoutBordure.setWidth("100px"); champRechercheLayout.addComponent(layoutBordure); champRechercheLayout.setComponentAlignment(layoutBordure, Alignment.MIDDLE_LEFT); /*champRechercheLayout.addComponent(search1); champRechercheLayout.setComponentAlignment(search1, Alignment.MIDDLE_LEFT);*/ 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("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); casesAcocherComposantes = new CheckBox("Composantes"); casesAcocherComposantes.setValue(true); casesAcocherComposantes.setStyleName(ValoTheme.CHECKBOX_SMALL); casesAcocherComposantes.addValueChangeListener(e -> tuneSearch()); casesAcocherVet = new CheckBox("Etapes"); casesAcocherVet.setValue(true); casesAcocherVet.setStyleName(ValoTheme.CHECKBOX_SMALL); casesAcocherVet.addValueChangeListener(e -> tuneSearch()); casesAcocherElp = new CheckBox("Elments pdagogiques"); casesAcocherElp.setValue(true); casesAcocherElp.setStyleName(ValoTheme.CHECKBOX_SMALL); casesAcocherElp.addValueChangeListener(e -> tuneSearch()); casesAcocherEtudiant = new CheckBox("Etudiants"); casesAcocherEtudiant.setValue(true); casesAcocherEtudiant.setStyleName(ValoTheme.CHECKBOX_SMALL); casesAcocherEtudiant.addValueChangeListener(e -> tuneSearch()); HorizontalLayout checkBoxLayout = new HorizontalLayout(); checkBoxLayout.setMargin(true); checkBoxLayout.setSpacing(true); checkBoxLayout.addComponent(casesAcocherComposantes); checkBoxLayout.addComponent(casesAcocherVet); checkBoxLayout.addComponent(casesAcocherElp); checkBoxLayout.addComponent(casesAcocherEtudiant); mainVerticalLayout.addComponent(checkBoxLayout); //TABLE DE RESULTATS rrContainer = new HierarchicalContainer(); rrContainer.addContainerProperty("lib", String.class, ""); rrContainer.addContainerProperty("code", String.class, ""); rrContainer.addContainerProperty("info", String.class, ""); rrContainer.addContainerProperty("type", String.class, ""); tableResultats = new TreeTable(); tableResultats.setSizeFull(); 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("lib", new DisplayNameColumnGenerator()); tableResultats.addGeneratedColumn("type", new DisplayTypeColumnGenerator()); tableResultats.setContainerDataSource(rrContainer); tableResultats.setVisibleColumns(FIELDS_ORDER); tableResultats.setColumnHeaders(columnHeaders); /*mainVerticalLayout.addComponent(searchBoxFilter); mainVerticalLayout.setComponentAlignment(searchBoxFilter, Alignment.MIDDLE_RIGHT);*/ VerticalLayout tableVerticalLayout = new VerticalLayout(); tableVerticalLayout.setMargin(new MarginInfo(false, true, true, true)); tableVerticalLayout.setSizeFull(); tableVerticalLayout.addComponent(tableResultats); mainVerticalLayout.addComponent(tableVerticalLayout); mainVerticalLayout.setExpandRatio(tableVerticalLayout, 1); tableResultats.setVisible(false); addComponent(mainVerticalLayout); setSizeFull(); } 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// w w w . ja v a 2 s . co 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); }