List of usage examples for com.vaadin.ui VerticalLayout setExpandRatio
public void setExpandRatio(Component component, float ratio)
This method is used to control how excess space in layout is distributed among components.
From source file:fi.semantum.strategia.widget.NumberTrafficValuation.java
License:Open Source License
@Override public Runnable getEditor(VerticalLayout layout, final Main main, final Meter meter) { Indicator indicator = meter.getPossibleIndicator(main.getDatabase()); String unit = indicator.getUnit(); final ComboBox combo = new ComboBox("Valitse mittarin mritystapa"); combo.addItem(State.INCREASE3); combo.addItem(State.DECREASE3); combo.addItem(State.INCREASE2); combo.addItem(State.DECREASE2); combo.setInvalidAllowed(false);/* w w w. j a va2s .c o m*/ combo.setNullSelectionAllowed(false); combo.setWidth("100%"); combo.addStyleName(ValoTheme.COMBOBOX_TINY); layout.addComponent(combo); layout.setComponentAlignment(combo, Alignment.TOP_CENTER); layout.setExpandRatio(combo, 0.0f); final VerticalLayout vl1 = new VerticalLayout(); vl1.setHeight("50px"); vl1.setWidth("100%"); vl1.setStyleName("redBlock"); layout.addComponent(vl1); layout.setComponentAlignment(vl1, Alignment.TOP_CENTER); layout.setExpandRatio(vl1, 0.0f); final Label l1 = new Label(" > " + df.format(greenLimit.doubleValue()) + " " + unit); l1.setSizeUndefined(); l1.addStyleName(ValoTheme.LABEL_LARGE); vl1.addComponent(l1); vl1.setComponentAlignment(l1, Alignment.MIDDLE_CENTER); HorizontalLayout hl1 = new HorizontalLayout(); hl1.setSpacing(true); layout.addComponent(hl1); layout.setComponentAlignment(hl1, Alignment.TOP_LEFT); final TextField tf1 = new TextField(); tf1.setValue(df.format(greenLimit.doubleValue())); tf1.setWidth("150px"); tf1.setCaption("Suurempi raja-arvo"); tf1.setStyleName(ValoTheme.TEXTFIELD_TINY); tf1.setValidationVisible(true); hl1.addComponent(tf1); Label unit1 = new Label(); unit1.setSizeUndefined(); unit1.setCaption(""); unit1.setValue(unit); hl1.addComponent(unit1); hl1.setComponentAlignment(unit1, Alignment.MIDDLE_LEFT); final VerticalLayout vl2 = new VerticalLayout(); vl2.setHeight("50px"); vl2.setWidth("100%"); vl2.addStyleName("yellowBlock"); layout.addComponent(vl2); layout.setComponentAlignment(vl2, Alignment.TOP_CENTER); layout.setExpandRatio(vl2, 0.0f); final Label l2 = new Label(); l2.setSizeUndefined(); l2.addStyleName(ValoTheme.LABEL_LARGE); vl2.addComponent(l2); vl2.setComponentAlignment(l2, Alignment.MIDDLE_CENTER); HorizontalLayout hl2 = new HorizontalLayout(); hl2.setSpacing(true); layout.addComponent(hl2); layout.setComponentAlignment(hl2, Alignment.TOP_LEFT); final TextField tf2 = new TextField(); tf2.setWidth("150px"); tf2.setCaption("Pienempi raja-arvo"); tf2.setStyleName(ValoTheme.TEXTFIELD_TINY); tf2.setValidationVisible(true); hl2.addComponent(tf2); hl2.setComponentAlignment(tf2, Alignment.TOP_CENTER); Label unit2 = new Label(); unit2.setSizeUndefined(); unit2.setCaption(""); unit2.setValue("" + unit); hl2.addComponent(unit2); hl2.setComponentAlignment(unit2, Alignment.MIDDLE_LEFT); final VerticalLayout vl3 = new VerticalLayout(); vl3.setHeight("50px"); vl3.setWidth("100%"); vl3.addStyleName("greenBlock"); layout.addComponent(vl3); layout.setComponentAlignment(vl3, Alignment.TOP_CENTER); layout.setExpandRatio(vl3, 0.0f); final Label l3 = new Label(); l3.setSizeUndefined(); l3.addStyleName(ValoTheme.LABEL_LARGE); vl3.addComponent(l3); vl3.setComponentAlignment(l3, Alignment.MIDDLE_CENTER); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); combo.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 8396168732300003038L; @Override public void valueChange(ValueChangeEvent event) { if (inApply) return; State currentState = getState(); if (currentState.equals(combo.getValue())) return; if (State.DECREASE3.equals(combo.getValue())) { makeThree = true; if (State.INCREASE3.equals(currentState)) { swap(); } else if (State.INCREASE2.equals(currentState)) { redLimit = greenLimit; greenLimit = null; } } else if (State.INCREASE3.equals(combo.getValue())) { makeThree = true; if (State.DECREASE3.equals(currentState)) { swap(); } else if (State.DECREASE2.equals(currentState)) { greenLimit = redLimit; redLimit = null; } } else if (State.INCREASE2.equals(combo.getValue())) { if (State.DECREASE3.equals(currentState)) { greenLimit = redLimit; } else if (State.DECREASE2.equals(currentState)) { greenLimit = redLimit; } redLimit = null; makeThree = false; } else if (State.DECREASE2.equals(combo.getValue())) { if (State.INCREASE3.equals(currentState)) { redLimit = greenLimit; } else if (State.INCREASE2.equals(currentState)) { redLimit = greenLimit; } greenLimit = null; makeThree = false; } updateMakeThree(); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); } }); tf1.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = -5484608577999300097L; @Override public void valueChange(ValueChangeEvent event) { if (inApply) return; if (State.DECREASE3.equals(combo.getValue())) { if (makeThree) greenLimit = redLimit; redLimit = new BigDecimal(tf1.getValue()); } else if (State.INCREASE3.equals(combo.getValue())) { if (makeThree) redLimit = greenLimit; greenLimit = new BigDecimal(tf1.getValue()); } else if (State.INCREASE2.equals(combo.getValue())) { greenLimit = new BigDecimal(tf1.getValue()); } else if (State.DECREASE2.equals(combo.getValue())) { redLimit = new BigDecimal(tf1.getValue()); } updateMakeThree(); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); } }); tf2.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 5825320869230527588L; @Override public void valueChange(ValueChangeEvent event) { if (inApply) return; // This should not happen! if (State.INCREASE2.equals(combo.getValue()) || State.DECREASE2.equals(combo.getValue())) return; if (State.DECREASE3.equals(combo.getValue())) { greenLimit = new BigDecimal(tf2.getValue()); } else if (State.INCREASE3.equals(combo.getValue())) { redLimit = new BigDecimal(tf2.getValue()); } updateMakeThree(); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); } }); return null; }
From source file:fr.amapj.view.views.cotisation.reception.PopupReceptionMasseCotisation.java
License:Open Source License
@Override protected void createContent(VerticalLayout contentLayout) { listPartContainer = new BeanItemContainer<>(PeriodeCotisationUtilisateurDTO.class); // Bind it to a component beanTable = new Table("", listPartContainer); beanTable.setStyleName("big strong"); beanTable.addGeneratedColumn("etatPaiement", new ColumnGenerator() { @Override//from w w w .j ava2 s . c o m public Object generateCell(final Table source, final Object itemId, Object columnId) { final PeriodeCotisationUtilisateurDTO dto = (PeriodeCotisationUtilisateurDTO) itemId; if (dto.etatPaiementAdhesion == EtatPaiementAdhesion.ENCAISSE) { Label l = new Label("OUI"); return l; } else { CheckBox box = new CheckBox(); box.setValue(false); box.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean b = (Boolean) event.getProperty().getValue(); if (b.booleanValue() == true) { dto.etatPaiementAdhesion = EtatPaiementAdhesion.ENCAISSE; dto.dateReceptionCheque = DateUtils.getDate(); } else { dto.etatPaiementAdhesion = EtatPaiementAdhesion.A_FOURNIR; dto.dateReceptionCheque = null; } } }); return box; } } }); // Gestion de la liste des colonnes visibles beanTable.setVisibleColumns("nomUtilisateur", "prenomUtilisateur", "montantAdhesion", "etatPaiement", "typePaiementAdhesion"); beanTable.setColumnHeader("nomUtilisateur", "Nom"); beanTable.setColumnHeader("prenomUtilisateur", "Prnom"); beanTable.setColumnHeader("montantAdhesion", "Montant en "); beanTable.setColumnAlignment("montantAdhesion", Align.RIGHT); beanTable.setColumnHeader("etatPaiement", "Rceptionn"); beanTable.setColumnAlignment("montantAdhesion", Align.CENTER); beanTable.setColumnHeader("typePaiementAdhesion", "Type"); beanTable.setConverter("montantAdhesion", new CurrencyTextFieldConverter()); beanTable.setSelectable(true); beanTable.setImmediate(true); beanTable.setSizeFull(); contentLayout.addComponent(beanTable); contentLayout.setExpandRatio(beanTable, 1); listPartContainer.addAll(dtos); }
From source file:fr.amapj.view.views.login.LoginPart.java
License:Open Source License
public void buildLoginView(ValoMenuLayout root, AmapUI ui, String loginFromUrl, String passwordFromUrl, String sudo) {/*from ww w .j av a 2s. c o m*/ this.ui = ui; CssLayout loginAera = root.prepareForLoginPage(); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeFull(); loginAera.setStyleName("login-backgroundimage"); loginAera.addComponent(loginLayout); // Recuperation des parametres String nomAmap = new ParametresService().getParametres().nomAmap; ui.getPage().setTitle(nomAmap); // Zone de saisie login/password MyLoginForm myLoginForm = new MyLoginForm(loginFromUrl, passwordFromUrl, sudo, nomAmap); myLoginForm.addStyleName("login-layout"); loginLayout.addComponent(myLoginForm); loginLayout.setComponentAlignment(myLoginForm, Alignment.MIDDLE_CENTER); loginLayout.setExpandRatio(myLoginForm, 10); Label l1 = new Label("Application fonctionnant avec AmapJ - "); Link link = new Link("Plus d'infos", new ExternalResource("http://amapj.fr")); link.setTargetName("_blank"); HorizontalLayout hL = new HorizontalLayout(); hL.addComponent(l1); hL.setComponentAlignment(l1, Alignment.MIDDLE_CENTER); hL.addComponent(link); hL.setComponentAlignment(link, Alignment.MIDDLE_CENTER); hL.setMargin(true); loginLayout.addComponent(hL); loginLayout.setComponentAlignment(hL, Alignment.BOTTOM_CENTER); loginLayout.setExpandRatio(hL, 1); // Si les deux champs ont t remplis on tente une validation automatique if ((passwordFromUrl != null) && (loginFromUrl != null)) { myLoginForm.login(loginFromUrl, passwordFromUrl); } }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsView.java
License:Apache License
private void displayTrombinoscope() { List<Inscrit> linscrits = MainUI.getCurrent().getListeInscrits(); if (trombiLayout != null) { trombiLayout.removeAllComponents(); } else {/*from w w w .j a va 2 s . co m*/ trombiLayout = new GridLayout(); trombiLayout.setColumns(5); trombiLayout.setWidth("100%"); trombiLayout.setHeight(null); trombiLayout.setSpacing(true); } for (Inscrit inscrit : linscrits) { if (listecodind.contains(inscrit.getCod_ind())) { VerticalLayout photoLayout = new VerticalLayout(); photoLayout.setId(inscrit.getCod_ind()); photoLayout.setHeight("100%"); if (inscrit.getUrlphoto() != null) { //Button fotoEtu=new Button(); Image fotoEtudiant = new Image(null, new ExternalResource(inscrit.getUrlphoto())); fotoEtudiant.setWidth("120px"); fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK); fotoEtudiant.addClickListener(e -> { rechercheController.accessToDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, null); }); photoLayout.addComponent(fotoEtudiant); //photoLayout.addComponent(fotoEtu); photoLayout.setComponentAlignment(fotoEtudiant, Alignment.MIDDLE_CENTER); photoLayout.setExpandRatio(fotoEtudiant, 1); } VerticalLayout nomCodeLayout = new VerticalLayout(); nomCodeLayout.setSizeFull(); nomCodeLayout.setSpacing(false); Button btnNomEtudiant = new Button(inscrit.getPrenom() + " " + inscrit.getNom()); btnNomEtudiant.setSizeFull(); btnNomEtudiant.setStyleName(ValoTheme.BUTTON_BORDERLESS); btnNomEtudiant.addStyleName("link"); btnNomEtudiant.addStyleName("v-link"); nomCodeLayout.addComponent(btnNomEtudiant); btnNomEtudiant.addClickListener(e -> { rechercheController.accessToDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, null); }); nomCodeLayout.setComponentAlignment(btnNomEtudiant, Alignment.MIDDLE_CENTER); //nomCodeLayout.setExpandRatio(btnNomEtudiant, 1); Label codetuLabel = new Label(inscrit.getCod_etu()); codetuLabel.setSizeFull(); codetuLabel.setStyleName(ValoTheme.LABEL_TINY); codetuLabel.addStyleName("label-centre"); nomCodeLayout.addComponent(codetuLabel); nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.TOP_CENTER); photoLayout.addComponent(nomCodeLayout); trombiLayout.addComponent(photoLayout); trombiLayout.setComponentAlignment(photoLayout, Alignment.MIDDLE_CENTER); } } }
From source file:fr.univlorraine.mondossierweb.views.NotesDetailMobileView.java
License:Apache License
@SuppressWarnings("deprecation") public void refresh(Etape etapeToDisplay, String codetuToDisplay) { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && (userController.isEnseignant() || userController.isEtudiant()) && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) { //On repassera dans la cration que si on n'a pas dej cr la vue if (codetu == null || !codetuToDisplay.equals(codetu)) { codetu = null;//from www.j a v a 2s .com } //On repassera dans la cration que si on n'a pas dej cr la vue if (etape == null || !etapeToDisplay.getAnnee().equals(etape.getAnnee()) || !etapeToDisplay.getCode().equals(etape.getCode()) || !etapeToDisplay.getVersion().equals(etape.getVersion())) { etape = null; } //On repassera dans la cration que si on n'a pas dej cr la vue if (codetu == null || etape == null) { compteurElp = 0; removeAllComponents(); /* Style */ setMargin(false); setSpacing(false); setSizeFull(); //Test si user enseignant if (userController.isEnseignant()) { //On recupere les notes pour un enseignant etudiantController.renseigneDetailNotesEtResultatsEnseignant(etapeToDisplay); } else { //On rcupre les notes pour un tudiant etudiantController.renseigneDetailNotesEtResultats(etapeToDisplay); } //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(ValoTheme.BUTTON_ICON_ONLY); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { MdwTouchkitUI.getCurrent().navigateToResumeNotes(); }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); //Titre Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelNavBar.setStyleName("v-label-navbar"); navbar.addComponent(labelNavBar); navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER); navbar.setExpandRatio(labelNavBar, 1); //Significations if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { significationButton = new Button(); significationButton.setIcon(FontAwesome.INFO_CIRCLE); significationButton.setStyleName("v-nav-button"); significationButton.addClickListener(e -> { //afficher les significations SignificationsMobileWindow w = new SignificationsMobileWindow(true); UI.getCurrent().addWindow(w); }); navbar.addComponent(significationButton); navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT); } addComponent(navbar); layoutList = new HashMap<String, LinkedList<HorizontalLayout>>(); etape = etapeToDisplay; codetu = codetuToDisplay; /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); layout.setStyleName("v-scrollableelement"); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); List<ElementPedagogique> lelp = MdwTouchkitUI.getCurrent().getEtudiant().getElementsPedagogiques(); if (lelp != null && lelp.size() > 0) { //Panel notesPanel = new Panel(); //notesPanel.setSizeFull(); VerticalLayout notesLayout = new VerticalLayout(); //notesLayout.setSpacing(true); HorizontalLayout libSessionLayout = new HorizontalLayout(); libSessionLayout.setSizeFull(); libSessionLayout.addComponent(new Label()); HorizontalLayout sessionLayout = new HorizontalLayout(); sessionLayout.setSizeFull(); Label session1 = new Label("Session1"); session1.setStyleName("label-bold-with-bottom"); sessionLayout.addComponent(session1); Label session2 = new Label("Session2"); session2.setStyleName("label-bold-with-bottom"); sessionLayout.addComponent(session2); libSessionLayout.addComponent(sessionLayout); notesLayout.addComponent(libSessionLayout); boolean blueLevel = false; compteurElp = 0; elpPere = ""; HorizontalLayout layoutPere = null; int nbFils = 0; for (ElementPedagogique elp : lelp) { compteurElp++; //Si on est sur un element de niveau 1, diffrent du premier element de la liste (qui est un rappel de l'etape) if (elp.getLevel() == 1 && compteurElp > 1) { blueLevel = !blueLevel; } HorizontalLayout libElpLayout = new HorizontalLayout(); if (compteurElp > 1) { if (elp.getLevel() == 1) { //Si le pere prcdent n'avait aucun fils if (layoutPere != null && nbFils == 0) { layoutPere.setStyleName("layout-bottom-line-separator"); } layoutPere = libElpLayout; nbFils = 0; //Sur un elp de niveau 1, il est sur fond sombre libElpLayout.addStyleName("main-layout-bottom-line-separator"); //ajout dans la hashMap layoutList.put(elp.getCode(), new LinkedList<HorizontalLayout>()); elpPere = elp.getCode(); libElpLayout.setId("layout_pere_" + elp.getCode()); } else { nbFils++; libElpLayout.addStyleName("layout-bottom-line-separator"); libElpLayout.setId(compteurElp + "_" + elp.getCode() + "_layout_fils_" + elpPere); //ajout dans la hashMap layoutList.get(elpPere).add(libElpLayout); } } else { //on affiche la racine (qui est un rappel de l'etape) en blanc sur un fond trs sombre libElpLayout.addStyleName("root-layout-bottom-line-separator"); } libElpLayout.setSizeFull(); libElpLayout.setHeight("100%"); VerticalLayout libVerticalLayout = new VerticalLayout(); Label libElpLabel = new Label(elp.getLibelle()); if (elp.isEpreuve()) { libElpLabel.setStyleName("bold-italic-label"); } else { libElpLabel.setStyleName("bold-label"); } libVerticalLayout.addComponent(libElpLabel); //Si on n'est pas sur le premier elp de la liste (rappel de l'tape) on affiche un indicateur de niveau if (compteurElp > 1) { HorizontalLayout levelMainLayout = new HorizontalLayout(); levelMainLayout.setSizeFull(); levelMainLayout.setSpacing(true); levelMainLayout.setStyleName("level-indicator-layout"); int k = 0; for (int i = 0; i < elp.getLevel(); i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); if (blueLevel) { libLevelLayout.setStyleName("layout-level-blue-indicator"); } else { libLevelLayout.setStyleName("layout-level-green-indicator"); } levelMainLayout.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout.addComponent(libLevelSpaceLayout); } libVerticalLayout.addComponent(levelMainLayout); } libElpLayout.addComponent(libVerticalLayout); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); VerticalLayout vlsession1 = new VerticalLayout(); Label note1 = new Label(elp.getNote1()); if (!StringUtils.hasText(elp.getNote2())) { if (elp.isEpreuve()) { note1.setStyleName("bold-italic-label"); } else { note1.setStyleName("bold-label"); } } vlsession1.addComponent(note1); if (StringUtils.hasText(elp.getRes1())) { Label adm1 = new Label(elp.getRes1()); if (!StringUtils.hasText(elp.getRes2())) { if (elp.isEpreuve()) { adm1.setStyleName("bold-italic-label"); } else { adm1.setStyleName("bold-label"); } } vlsession1.addComponent(adm1); } noteLayout.addComponent(vlsession1); VerticalLayout vlsession2 = new VerticalLayout(); Label note2 = new Label(elp.getNote2()); if (StringUtils.hasText(elp.getNote2())) { if (elp.isEpreuve()) { note2.setStyleName("bold-italic-label"); } else { note2.setStyleName("bold-label"); } } vlsession2.addComponent(note2); if (StringUtils.hasText(elp.getRes2())) { Label adm2 = new Label(elp.getRes2()); if (StringUtils.hasText(elp.getRes2())) { if (elp.isEpreuve()) { adm2.setStyleName("bold-italic-label"); } else { adm2.setStyleName("bold-label"); } } vlsession2.addComponent(adm2); } noteLayout.addComponent(vlsession2); libElpLayout.addComponent(noteLayout); notesLayout.addComponent(libElpLayout); //Au dpart, on cache les lments de niveau suprieur 1 if (compteurElp > 1 && elp.getLevel() > 1) { //libElpLayout.setVisible(false); Page.getCurrent().getJavaScript().execute("document.getElementById('" + libElpLayout.getId() + "').style.display=\"none\";"); } } //Cas o le dernier lment tait un lment le pere qui n'avait aucun fils if (layoutPere != null && nbFils == 0) { layoutPere.setStyleName("layout-bottom-line-separator"); } //Ajout du javascript for (Entry<String, LinkedList<HorizontalLayout>> entry : layoutList.entrySet()) { String pere = entry.getKey(); LinkedList<HorizontalLayout> listeLayoutFils = entry.getValue(); // traitements if (listeLayoutFils != null && listeLayoutFils.size() > 0) { String affichagejavascriptfils = ""; for (HorizontalLayout hl : listeLayoutFils) { affichagejavascriptfils += "if(document.getElementById('" + hl.getId() + "').style.display==\"none\"){document.getElementById('" + hl.getId() + "').style.display = \"block\";}else{document.getElementById('" + hl.getId() + "').style.display = \"none\";}"; } //sur le clic du layout pere, on affiche les fils Page.getCurrent().getJavaScript().execute("document.getElementById('" + "layout_pere_" + pere + "').onclick=function(){ " + affichagejavascriptfils + "};"); } } layout.addComponent(notesLayout); layout.setExpandRatio(notesLayout, 1); } else { setHeight(30, Unit.PERCENTAGE); HorizontalLayout messageLayout = new HorizontalLayout(); messageLayout.setSpacing(true); messageLayout.setMargin(true); Label labelAucunResultat = new Label( applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale())); labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD); messageLayout.addComponent(labelAucunResultat); layout.addComponent(messageLayout); } addComponent(layout); setExpandRatio(layout, 1); } else { refreshJavascript(); } } }
From source file:fr.univlorraine.mondossierweb.views.RechercheArborescenteView.java
License:Apache License
/** * Initialise la vue/* ww w.ja va 2s . c o m*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (userController.isEnseignant()) { /* Style */ setMargin(false); setSpacing(false); setSizeFull(); if (listeBoutonFavoris != null) { listeBoutonFavoris.clear(); } else { listeBoutonFavoris = new LinkedList<ReferencedButton>(); } liste_types_favoris = new LinkedList<String>(); liste_types_favoris.add(Utils.CMP); liste_types_favoris.add(Utils.ELP); liste_types_favoris.add(Utils.VET); liste_types_inscrits = new LinkedList<String>(); liste_types_inscrits.add(Utils.ELP); liste_types_inscrits.add(Utils.VET); liste_types_deplier = new LinkedList<String>(); liste_types_deplier.add(Utils.ELP); liste_types_deplier.add(Utils.VET); recuperationDesfavoris(); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setMargin(false); btnLayout.setSpacing(false); btnLayout.setWidth("100%"); comboBoxAnneeUniv = new ComboBox(applicationContext.getMessage(NAME + ".anneeuniv", null, getLocale())); comboBoxAnneeUniv.setPageLength(5); comboBoxAnneeUniv.setTextInputAllowed(false); comboBoxAnneeUniv.setNullSelectionAllowed(false); //Initialisation de la liste des annes List<String> lanneeUniv = rechercheArborescenteController.recupererLesDernieresAnneeUniversitaire(); if (lanneeUniv != null && lanneeUniv.size() > 0) { for (String anneeUniv : lanneeUniv) { comboBoxAnneeUniv.addItem(anneeUniv); int anneenplusun = Integer.parseInt(anneeUniv) + 1; comboBoxAnneeUniv.setItemCaption(anneeUniv, anneeUniv + "/" + anneenplusun); } if (annee == null) { annee = etudiantController.getAnneeUnivEnCours(MainUI.getCurrent()); //annee = lanneeUniv.get(0); } } comboBoxAnneeUniv.setValue(annee); comboBoxAnneeUniv.setStyleName(ValoTheme.COMBOBOX_SMALL); comboBoxAnneeUniv.addValueChangeListener(e -> changerAnnee((String) comboBoxAnneeUniv.getValue())); reinitButton = new Button(); reinitButton.setDescription( applicationContext.getMessage(NAME + ".reinitbutton.description", null, getLocale())); reinitButton.addClickListener(e -> { initFromScratch(); }); reinitButton.setStyleName(ValoTheme.BUTTON_DANGER); reinitButton.setIcon(FontAwesome.TIMES); if (!StringUtils.hasText(code)) { reinitButton.setVisible(false); } labelLigneSelectionneeLabel = new Label(); labelLigneSelectionneeLabel .setValue(applicationContext.getMessage(NAME + ".ligneselectionnee", null, getLocale())); labelLigneSelectionneeLabel.addStyleName("label-align-right"); labelLigneSelectionneeLabel.setVisible(false); HorizontalLayout btnLeftLayout = new HorizontalLayout(); btnLeftLayout.setWidth("100%"); btnLeftLayout.setMargin(true); btnLeftLayout.addComponent(comboBoxAnneeUniv); btnLeftLayout.setComponentAlignment(comboBoxAnneeUniv, Alignment.MIDDLE_LEFT); /*btnLeftLayout.addComponent(reinitButton); btnLeftLayout.setComponentAlignment(reinitButton, Alignment.BOTTOM_RIGHT);*/ btnLeftLayout.addComponent(labelLigneSelectionneeLabel); btnLeftLayout.setComponentAlignment(labelLigneSelectionneeLabel, Alignment.MIDDLE_CENTER); btnLayout.addComponent(btnLeftLayout); ligneSelectionneeLabel = new Label(); //ligneSelectionneeLabel.setCaption(applicationContext.getMessage(NAME+".ligneselectionnee", null, getLocale())); ligneSelectionneeLabel.setVisible(false); elpLayout = new FormLayout(); elpLayout.setMargin(false); vetElpSelectionneLabel = new Label(); vetElpSelectionneLabel.setVisible(false); elpLayout.addComponent(vetElpSelectionneLabel); elpLayout.setVisible(false); VerticalLayout ligneLayout = new VerticalLayout(); ligneLayout.addComponent(ligneSelectionneeLabel); ligneLayout.addComponent(elpLayout); HorizontalLayout rightLayout = new HorizontalLayout(); rightLayout.setSizeFull(); rightLayout.setSpacing(true); rightLayout.setMargin(true); rightLayout.addComponent(ligneLayout); rightLayout.setComponentAlignment(ligneLayout, Alignment.MIDDLE_LEFT); rightLayout.addComponent(reinitButton); rightLayout.setComponentAlignment(reinitButton, Alignment.MIDDLE_RIGHT); rightLayout.setExpandRatio(ligneLayout, 1); btnLayout.addComponent(rightLayout); btnLayout.setComponentAlignment(rightLayout, Alignment.MIDDLE_LEFT); addComponent(btnLayout); if (code != null && type != null) { Label elementRecherche = new Label(code + " " + type); elementRecherche.addStyleName(ValoTheme.LABEL_H1); //addComponent(elementRecherche); } table = new TreeTable(); table.setSizeFull(); table.setStyleName("scrollabletable"); table.setSelectable(true); initComposantes(); //gestion du style pour les lignes en favori table.setCellStyleGenerator(new CellStyleGenerator() { @Override public String getStyle(final Table source, final Object itemId, final Object propertyId) { String style = null; if (propertyId == null && markedRows.contains(itemId)) { style = "marked"; } return style; } }); table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { selectionnerLigne(event.getItemId()); } }); //gestion du clic sur la fleche pour dplier une entre table.addExpandListener(new ExpandListener() { private static final long serialVersionUID = 8532342540008245348L; @Override public void nodeExpand(ExpandEvent event) { if (event != null && event.getItemId() != null && hc != null && hc.getItem(event.getItemId()) != null && hc.getItem(event.getItemId()).getItemProperty(TYPE_PROPERTY) != null) { selectionnerLigne(event.getItemId()); deplierNoeud((String) event.getItemId(), true); } } }); VerticalLayout tableVerticalLayout = new VerticalLayout(); tableVerticalLayout.setMargin(new MarginInfo(false, true, true, true)); tableVerticalLayout.setSizeFull(); tableVerticalLayout.addComponent(table); tableVerticalLayout.setExpandRatio(table, 1); addComponent(tableVerticalLayout); setExpandRatio(tableVerticalLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.windows.DetailGroupesWindow.java
License:Apache License
private void init() { /* Style *///w w w . j a va2 s . c o m setWidth(80, Unit.PERCENTAGE); setHeight(95, Unit.PERCENTAGE); setModal(true); setResizable(false); /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); //Sous titre avec l'anne HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setSizeFull(); titleLayout.setHeight("20px"); Label labelAnneeUniv = new Label(); labelAnneeUniv.setValue(applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>" + annee + "</b>"); labelAnneeUniv.setContentMode(ContentMode.HTML); titleLayout.addComponent(labelAnneeUniv); titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_LEFT); if (StringUtils.hasText(vetLibelle)) { Label labelEtape = new Label(); labelEtape.setValue(applicationContext.getMessage(NAME + ".label.vet", null, getLocale()) + " : <b>" + vetLibelle + "</b>"); labelEtape.setContentMode(ContentMode.HTML); titleLayout.addComponent(labelEtape); titleLayout.setComponentAlignment(labelEtape, Alignment.MIDDLE_RIGHT); } layout.addComponent(titleLayout); Panel panelDetailGroupes = new Panel(elpLibelle); panelDetailGroupes.setSizeFull(); if (lgroupes != null && lgroupes.size() > 0) { TreeTable detailGroupesTable = new TreeTable(); detailGroupesTable.setSizeFull(); HierarchicalContainer hc = new HierarchicalContainer(); hc.addContainerProperty(ID_PROPERTY, String.class, ""); hc.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, ""); hc.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, ""); hc.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, ""); hc.addContainerProperty(CAP_MAX_PROPERTY, String.class, ""); hc.addContainerProperty(CAP_INT_PROPERTY, String.class, ""); hc.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, ""); detailGroupesTable.setContainerDataSource(hc); int id = 0; for (ElpDeCollection edc : lgroupes) { id++; for (CollectionDeGroupes cdg : edc.getListeCollection()) { id++; ObjetBaseCollectionGroupe obj = new ObjetBaseCollectionGroupe(); obj.setId("" + id); obj.setCod_coll(cdg.getCodCollection()); obj.setCap_max(""); obj.setCap_int(""); obj.setNb_inscrits(""); Item itemCollection = hc.addItem(obj.getId()); renseignerItem(itemCollection, obj); for (Groupe gpe : cdg.getListeGroupes()) { id++; ObjetBaseCollectionGroupe objgpe = new ObjetBaseCollectionGroupe(); objgpe.setId("" + id); objgpe.setCod_gpe(gpe.getCodGroupe()); objgpe.setLib_gpe(gpe.getLibGroupe()); objgpe.setCap_max("" + gpe.getCapMaxGpe()); objgpe.setCap_int("" + gpe.getCapIntGpe()); objgpe.setNb_inscrits("" + gpe.getNbInscrits()); Item i = hc.addItem(objgpe.getId()); renseignerItem(i, objgpe); detailGroupesTable.setParent(objgpe.getId(), obj.getId()); detailGroupesTable.setChildrenAllowed(objgpe.getId(), false); } detailGroupesTable.setCollapsed(obj.getId(), false); } } detailGroupesTable.addContainerProperty(ID_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CAP_MAX_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CAP_INT_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, ""); detailGroupesTable.setVisibleColumns(DETAIL_FIELDS_ORDER); detailGroupesTable.setColumnHeader(CODE_COLLECTION_PROPERTY, applicationContext.getMessage(NAME + ".table.codecollection", null, getLocale())); detailGroupesTable.setColumnHeader(CODE_GROUPE_PROPERTY, applicationContext.getMessage(NAME + ".table.codegroupe", null, getLocale())); detailGroupesTable.setColumnHeader(LIBELLE_GROUPE_PROPERTY, applicationContext.getMessage(NAME + ".table.libgroupe", null, getLocale())); detailGroupesTable.setColumnHeader(CAP_MAX_PROPERTY, applicationContext.getMessage(NAME + ".table.capmax", null, getLocale())); detailGroupesTable.setColumnHeader(CAP_INT_PROPERTY, applicationContext.getMessage(NAME + ".table.capint", null, getLocale())); detailGroupesTable.setColumnHeader(NB_INSCRITS_PROPERTY, applicationContext.getMessage(NAME + ".table.nbinscrits", null, getLocale())); detailGroupesTable.setColumnCollapsingAllowed(true); detailGroupesTable.setColumnReorderingAllowed(false); detailGroupesTable.setSelectable(false); detailGroupesTable.setImmediate(true); detailGroupesTable.addStyleName("scrollabletable"); panelDetailGroupes.setContent(detailGroupesTable); } layout.addComponent(panelDetailGroupes); Panel panelCollectionInfo = new Panel( applicationContext.getMessage(NAME + ".info.title", null, getLocale())); panelCollectionInfo.setIcon(FontAwesome.INFO_CIRCLE); panelCollectionInfo.addStyleName("significationpanel"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setMargin(true); significationLayout.setSpacing(true); Label mapSignificationLabel = new Label( applicationContext.getMessage(NAME + ".collection.info", null, getLocale())); mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL); mapSignificationLabel.setContentMode(ContentMode.HTML); significationLayout.addComponent(mapSignificationLabel); panelCollectionInfo.setContent(significationLayout); layout.addComponent(panelCollectionInfo); layout.setExpandRatio(panelDetailGroupes, 1); setContent(layout); /* Centre la fentre */ center(); }
From source file:fr.univlorraine.mondossierweb.views.windows.DetailInscriptionWindow.java
License:Apache License
private void init() { //On vrifie le droit d'accder la vue if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { /* Style */ setWidth(80, Unit.PERCENTAGE);/*from w w w . j a v a 2s. c om*/ setHeight(95, Unit.PERCENTAGE); setModal(true); setResizable(false); //Test si user enseignant et en vue Enseignant if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { //On recupere les notes pour un enseignant etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape); } else { //On rcupre les notes pour un tudiant etudiantController.renseigneDetailNotesEtResultats(etape); } /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); //Sous titre avec l'anne HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setSizeFull(); titleLayout.setHeight("20px"); Label labelAnneeUniv = new Label( applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>" + etape.getAnnee() + "</b>"); labelAnneeUniv.setContentMode(ContentMode.HTML); titleLayout.addComponent(labelAnneeUniv); titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_CENTER); layout.addComponent(titleLayout); Panel panelDetailInscription = new Panel(etape.getLibelle()); panelDetailInscription.setSizeFull(); panelDetailInscription.addStyleName("small-font-element"); List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques(); if (lelp != null && lelp.size() > 0) { Table detailInscriptionTable = new Table(null, new BeanItemContainer<>(ElementPedagogique.class, lelp)); detailInscriptionTable.setSizeFull(); detailInscriptionTable.setVisibleColumns(new String[0]); detailInscriptionTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()), new CodeElpColumnGenerator()); detailInscriptionTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()), new LibelleElpColumnGenerator()); if (configController.isAffECTSEtudiant()) { detailInscriptionTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()), new ECTSColumnGenerator()); } detailInscriptionTable.setColumnCollapsingAllowed(true); detailInscriptionTable.setColumnReorderingAllowed(false); detailInscriptionTable.setSelectable(false); detailInscriptionTable.setImmediate(true); detailInscriptionTable.addStyleName("scrollabletable"); panelDetailInscription.setContent(detailInscriptionTable); } else { setHeight(30, Unit.PERCENTAGE); HorizontalLayout messageLayout = new HorizontalLayout(); messageLayout.setSpacing(true); messageLayout.setMargin(true); Label labelAucuneIp = new Label( applicationContext.getMessage(NAME + ".message.aucuneip", null, getLocale())); labelAucuneIp.setStyleName(ValoTheme.LABEL_BOLD); messageLayout.addComponent(labelAucuneIp); panelDetailInscription.setContent(messageLayout); } layout.addComponent(panelDetailInscription); layout.setExpandRatio(panelDetailInscription, 1); setContent(layout); /* Centre la fentre */ center(); } }
From source file:fr.univlorraine.mondossierweb.views.windows.DetailNotesWindow.java
License:Apache License
private void init() { //On vrifie le droit d'accder la vue if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { /* Style */ setWidth(80, Unit.PERCENTAGE);//from ww w . j a v a 2 s . co m setHeight(95, Unit.PERCENTAGE); setModal(true); setResizable(false); //Test si user enseignant et en vue Enseignant if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { //On recupere les notes pour un enseignant etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape); } else { //On rcupre les notes pour un tudiant etudiantController.renseigneDetailNotesEtResultats(etape); } /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques(); //Sous titre avec l'anne HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setSizeFull(); titleLayout.setHeight("20px"); Label messageLabel = new Label( applicationContext.getMessage(NAME + ".label.messageinfo", null, getLocale())); messageLabel.setContentMode(ContentMode.HTML); messageLabel.setStyleName(ValoTheme.LABEL_SMALL); titleLayout.addComponent(messageLabel); titleLayout.setExpandRatio(messageLabel, 1); titleLayout.setComponentAlignment(messageLabel, Alignment.MIDDLE_LEFT); //Test si user enseignant if (userController.isEnseignant() && lelp != null && lelp.size() > 0) { //Bouton pour afficher les filtres btnDisplayFiltres = new Button(); btnDisplayFiltres.setWidth("52px"); btnDisplayFiltres.setHeight("32px"); btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_PRIMARY); if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY); } btnDisplayFiltres.setIcon(FontAwesome.FILTER); btnDisplayFiltres.setDescription( applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale())); btnDisplayFiltres.addClickListener(e -> { btnDisplayFiltres.setVisible(false); panelVue.setVisible(true); }); titleLayout.addComponent(btnDisplayFiltres); titleLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT); //titleLayout.setExpandRatio(btnDisplayFiltres, 1); btnDisplayFiltres.setVisible(true); } if (lelp != null && lelp.size() > 0 && configController.isPdfNotesActive()) { Button pdfButton = new Button(); pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); pdfButton.addStyleName("button-icon"); pdfButton.addStyleName("red-button-icon"); pdfButton.setIcon(FontAwesome.FILE_PDF_O); pdfButton.setDescription( applicationContext.getMessage(NAME + ".btn.pdf.description", null, getLocale())); if (PropertyUtils.isPushEnabled()) { MyFileDownloader fd = new MyFileDownloader(noteController.exportPdfDetail(etape)); fd.extend(pdfButton); } else { FileDownloader fd = new FileDownloader(noteController.exportPdfDetail(etape)); fd.extend(pdfButton); } titleLayout.addComponent(pdfButton); titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT); } layout.addComponent(titleLayout); //Test si user enseignant if (userController.isEnseignant() && lelp != null && lelp.size() > 0) { panelVue = new Panel(); HorizontalLayout vueLayout = new HorizontalLayout(); vueLayout.setMargin(true); vueLayout.setSpacing(true); vueLayout.setSizeFull(); Button changerVueButton = new Button( applicationContext.getMessage(NAME + ".button.vueEnseignant", null, getLocale())); changerVueButton.setStyleName(ValoTheme.BUTTON_PRIMARY); if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { changerVueButton.setStyleName(ValoTheme.BUTTON_FRIENDLY); changerVueButton.setCaption( applicationContext.getMessage(NAME + ".button.vueEtudiant", null, getLocale())); } //On change la variable vueEnseignantNotesEtResultats et on recr la vue en cours changerVueButton.addClickListener(e -> { etudiantController.changerVueNotesEtResultats(); init(); }); Label vueLabel = new Label( applicationContext.getMessage(NAME + ".label.vueEtudiant", null, getLocale())); if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { vueLabel.setValue( applicationContext.getMessage(NAME + ".label.vueEnseignant", null, getLocale())); } vueLabel.setContentMode(ContentMode.HTML); vueLabel.setStyleName(ValoTheme.LABEL_SMALL); vueLayout.addComponent(changerVueButton); vueLayout.setComponentAlignment(changerVueButton, Alignment.MIDDLE_CENTER); vueLayout.addComponent(vueLabel); vueLayout.setExpandRatio(vueLabel, 1); panelVue.setContent(vueLayout); layout.addComponent(panelVue); panelVue.setVisible(false); } Panel panelDetailNotes = new Panel(etape.getLibelle() + " - " + applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " " + etape.getAnnee()); panelDetailNotes.addStyleName("small-font-element"); panelDetailNotes.setSizeFull(); if (lelp != null && lelp.size() > 0) { Table detailNotesTable = new Table(null, new BeanItemContainer<>(ElementPedagogique.class, lelp)); detailNotesTable.setSizeFull(); detailNotesTable.setVisibleColumns(new String[0]); if (contientElpObtenusPrecedemment(lelp)) { detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.annee", null, getLocale()), new AnneeColumnGenerator()); } detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()), new CodeElpColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()), new LibelleElpColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.notesession1", null, getLocale()), new Session1ColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.resultatsession1", null, getLocale()), new ResultatSession1ColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.notesession2", null, getLocale()), new Session2ColumnGenerator()); detailNotesTable.addGeneratedColumn("resultatsession2", new ResultatSession2ColumnGenerator()); detailNotesTable.setColumnHeader("resultatsession2", applicationContext.getMessage(NAME + ".table.elp.resultatsession2", null, getLocale())); if (configController.isAffRangEtudiant() || etudiantController.isAfficherRangElpEpr()) { detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.rang", null, getLocale()), new RangColumnGenerator()); } if (configController.isAffECTSEtudiant()) { detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()), new ECTSColumnGenerator()); } detailNotesTable.setColumnCollapsingAllowed(true); detailNotesTable.setColumnReorderingAllowed(false); detailNotesTable.setSelectable(false); detailNotesTable.setImmediate(true); detailNotesTable.addStyleName("scrollabletable"); panelDetailNotes.setContent(detailNotesTable); } else { setHeight(30, Unit.PERCENTAGE); HorizontalLayout messageLayout = new HorizontalLayout(); messageLayout.setSpacing(true); messageLayout.setMargin(true); Label labelAucunResultat = new Label( applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale())); labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD); messageLayout.addComponent(labelAucunResultat); panelDetailNotes.setContent(messageLayout); } layout.addComponent(panelDetailNotes); if (lelp != null && lelp.size() > 0 && MainUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { Panel panelSignificationResultats = new Panel( applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale())); panelSignificationResultats.addStyleName("significationpanel"); panelSignificationResultats.addStyleName("small-font-element"); panelSignificationResultats.setIcon(FontAwesome.INFO_CIRCLE); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setMargin(true); significationLayout.setSpacing(true); String grilleSignficationResultats = ""; //grilleSignficationResultats = significationResultats.toString().substring(1,significationResultats.toString().length()-1); Set<String> ss = MainUI.getCurrent().getEtudiant().getSignificationResultats().keySet(); for (String k : ss) { if (k != null && !k.equals("") && !k.equals(" ")) { grilleSignficationResultats = grilleSignficationResultats + "<b>" + k + "</b> : " + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k); grilleSignficationResultats = grilleSignficationResultats + "   "; } } Label mapSignificationLabel = new Label(grilleSignficationResultats); mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL); mapSignificationLabel.setContentMode(ContentMode.HTML); significationLayout.addComponent(mapSignificationLabel); panelSignificationResultats.setContent(significationLayout); layout.addComponent(panelSignificationResultats); } layout.setExpandRatio(panelDetailNotes, 1); setContent(layout); /* Centre la fentre */ center(); } }
From source file:fr.univlorraine.mondossierweb.views.windows.SignificationsMobileWindow.java
License:Apache License
/** * Cre une fentre/*from www . java 2 s . 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); }