List of usage examples for com.vaadin.ui HorizontalLayout setId
@Override public void setId(String id)
From source file:com.cerebro.gorgone.landingpage.LandingPage.java
public LandingPage() { logger.info("Creazione della Landing Page"); // Contenitore principale HorizontalLayout root = new HorizontalLayout(); root.setId("landingPage_root"); root.setMargin(true);/* w w w . j av a 2 s .com*/ // Componente di registrazione signIn = new SignIn(); signIn.resetField(); // Componente di login login = new Login(); root.addComponents(signIn, login); this.addComponents(root); }
From source file:com.example.vaadindemo.AddItemPanel.java
public HorizontalLayout draw(BeanItemContainer<ShoppingList> container) { final HorizontalLayout x = new HorizontalLayout(); x.setId("addItemPanel"); Button persistNewItemButton = new Button("Dodaj"); final Item item = new Item(); BeanItem<Item> personBean = new BeanItem<Item>(item); final FormLayout formLayout = new FormLayout(); final FieldGroup form = new FieldGroup(); //new name: form form.setItemDataSource(personBean);/*ww w . j a va 2 s. c o m*/ form.setBuffered(true); Field imieField = form.buildAndBind("Name", "firstName"); imieField.setRequired(true); imieField.addValidator(new StringLengthValidator("bad length", 2, 5, false)); formLayout.addComponent(imieField); //Container final BeanItemContainer<Item> beanContainer = new BeanItemContainer<Item>(Item.class); //beanContainer.addBean(new Item(); //beanContainer.addBean(new Item("Bolek")); //beanContainer.addBean(new Person("Lolek", 1933)); // Put some example data in it container.addItem(new ShoppingList("Mercury", null, null)); //container.addItem(new Planet(2, "Venus")); //container.addItem(new Planet(3, "Earth")); //container.addItem(new Planet(4, "Mars")); // Create a selection component bound to the container final ComboBox select = new ComboBox("Planets", container); // Set the caption mode to read the caption directly // from the 'name' property of the bean select.setItemCaptionMode(ItemCaptionMode.PROPERTY); select.setItemCaptionPropertyId("name"); select.setImmediate(true); final Label ldd = new Label(); x.addComponent(select); x.addComponent(formLayout); x.addComponent(persistNewItemButton); x.addComponent(ldd); persistNewItemButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Label l = new Label("jsdcbsc"); x.addComponent(l); //ldd.setValue(select.getItem(item.firstName).toString()); } }); select.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { ldd.setValue(select.getItemCaption(event.getProperty().getValue())); } }); return x; }
From source file:com.m1kah.ui.TodoComponent.java
License:Open Source License
private void initInputRow() { toggleAllButton = new CheckBox(); toggleAllButton.setId("toggle-all"); inputField = new TextField(); inputField.setInputPrompt("What needs to be done?"); Panel panel = new Panel(inputField); panel.addShortcutListener(new ShortcutListener("", ShortcutAction.KeyCode.ENTER, null) { @Override//from www. j a v a 2 s . c o m public void handleAction(Object o, Object o1) { addNewTodo(); } }); HorizontalLayout inputFieldLayout = new HorizontalLayout(toggleAllButton, panel); inputFieldLayout.setComponentAlignment(toggleAllButton, Alignment.MIDDLE_LEFT); inputFieldLayout.setId("new-todo"); addComponent(inputFieldLayout); }
From source file:fr.univlorraine.mondossierweb.views.InformationsAnnuellesMobileView.java
License:Apache License
public void refresh() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && (userController.isEnseignant() || userController.isEtudiant()) && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) { removeAllComponents();// ww w.j ava2s .c o m /* Style */ setMargin(false); setSpacing(false); setSizeFull(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton retour if (userController.isEnseignant()) { returnButton = new Button(); returnButton.setIcon(FontAwesome.ARROW_LEFT); //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToListeInscrits(); } else { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } } }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); } //Title Label labelTrombi = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelTrombi.setStyleName("v-label-navbar"); navbar.addComponent(labelTrombi); navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER); if (userController.isEnseignant()) { //Si on ne peut pas dj revenir sur la recherche via le bouton 'retour' if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() == null || !MdwTouchkitUI.getCurrent().getDossierEtuFromView().equals(RechercheMobileView.NAME)) { //Bouton Search Button searchButton = new Button(); searchButton.setIcon(FontAwesome.SEARCH); searchButton.setStyleName("v-nav-button"); navbar.addComponent(searchButton); navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); searchButton.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); } } navbar.setExpandRatio(labelTrombi, 1); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); //globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); globalLayout.setStyleName("v-scrollableelement"); VerticalLayout slimLayout = new VerticalLayout(); slimLayout.setSpacing(false); slimLayout.setMargin(false); //slimLayout.setStyleName("v-scrollableelement"); String mail = MdwTouchkitUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { Panel mailPanel = new Panel(); mailPanel.setStyleName("panel-without-bottom-line-separator"); HorizontalLayout mailLayout = new HorizontalLayout(); mailLayout.setSizeFull(); mailLayout.setHeight("25px"); Label mailLabel = new Label(); mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); mailLabel.setSizeFull(); mailLabel.addStyleName("label-centre"); mailLayout.addComponent(mailLabel); mailLayout.setComponentAlignment(mailLabel, Alignment.MIDDLE_CENTER); mailPanel.setContent(mailLayout); slimLayout.addComponent(mailPanel); slimLayout.setComponentAlignment(mailPanel, Alignment.MIDDLE_CENTER); } Panel etuPanel = new Panel(); HorizontalLayout photoLayout = new HorizontalLayout(); photoLayout.setId(MdwTouchkitUI.getCurrent().getEtudiant().getCod_ind()); photoLayout.setSizeFull(); if (MdwTouchkitUI.getCurrent().getEtudiant().getPhoto() != null) { Image fotoEtudiant = new Image(null, new ExternalResource(MdwTouchkitUI.getCurrent().getEtudiant().getPhoto())); fotoEtudiant.setWidth("120px"); fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK); photoLayout.addComponent(fotoEtudiant); } VerticalLayout nomCodeLayout = new VerticalLayout(); //nomCodeLayout.setSizeFull(); nomCodeLayout.setSpacing(false); Label labelNomEtudiant = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelNomEtudiant.setSizeFull(); labelNomEtudiant.setStyleName(ValoTheme.LABEL_BOLD); labelNomEtudiant.addStyleName("label-centre"); nomCodeLayout.addComponent(labelNomEtudiant); nomCodeLayout.setComponentAlignment(labelNomEtudiant, Alignment.MIDDLE_CENTER); //nomCodeLayout.setExpandRatio(labelNomEtudiant, 1); Label codetuLabel = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getCod_etu()); codetuLabel.setSizeFull(); codetuLabel.setStyleName(ValoTheme.LABEL_TINY); codetuLabel.addStyleName("label-centre"); nomCodeLayout.addComponent(codetuLabel); nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER); photoLayout.addComponent(nomCodeLayout); photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER); photoLayout.setExpandRatio(nomCodeLayout, 1); etuPanel.setContent(photoLayout); slimLayout.addComponent(etuPanel); slimLayout.setComponentAlignment(etuPanel, Alignment.MIDDLE_CENTER); globalLayout.addComponent(slimLayout); Panel panelInfos = new Panel(applicationContext.getMessage(NAME + ".infos.title", null, getLocale()) + " " + Utils.getAnneeUniversitaireEnCours( etudiantController.getAnneeUnivEnCours(MdwTouchkitUI.getCurrent()))); panelInfos.setStyleName("centertitle-panel"); panelInfos.addStyleName("v-colored-panel-caption"); //Si l'tudiant est inscrit pour l'anne en cours if (MdwTouchkitUI.getCurrent().getEtudiant().isInscritPourAnneeEnCours()) { FormLayout formInfosLayout = new FormLayout(); formInfosLayout.setSpacing(true); formInfosLayout.setMargin(true); //Numro Anonymat visible que si l'utilisateur est tudiant List<Anonymat> lano = null; if (!userController.isEnseignant() && userController.isEtudiant()) { lano = MdwTouchkitUI.getCurrent().getEtudiant().getNumerosAnonymat(); if (lano != null) { //Si l'tudiant n'a qu'un seul numro d'anonymat if (lano.size() == 1) { String captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymat.title", null, getLocale()); TextField fieldNumAnonymat = new TextField(captionNumAnonymat, MdwTouchkitUI .getCurrent().getEtudiant().getNumerosAnonymat().get(0).getCod_etu_ano()); formatTextField(fieldNumAnonymat); //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE); //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale())); formInfosLayout.addComponent(fieldNumAnonymat); } //Si l'tudiant a plusieurs numros d'anonymat if (lano.size() > 1) { int i = 0; for (Anonymat ano : lano) { String captionNumAnonymat = ""; if (i == 0) { //Pour le premier numro affich on affiche le libell du champ captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymats.title", null, getLocale()); } TextField fieldNumAnonymat = new TextField(captionNumAnonymat, ano.getCod_etu_ano() + " (" + ano.getLib_man() + ")"); formatTextField(fieldNumAnonymat); if (i == 0) { //Pour le premier numro affich on affiche l'info bulle //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE); //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale())); } formInfosLayout.addComponent(fieldNumAnonymat); i++; } } } } String captionBousier = applicationContext.getMessage(NAME + ".boursier.title", null, getLocale()); TextField fieldNumBoursier = new TextField(captionBousier, MdwTouchkitUI.getCurrent().getEtudiant().isBoursier() ? applicationContext.getMessage(NAME + ".boursier.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".boursier.non", null, getLocale())); formatTextField(fieldNumBoursier); formInfosLayout.addComponent(fieldNumBoursier); String captionSalarie = applicationContext.getMessage(NAME + ".salarie.title", null, getLocale()); TextField fieldSalarie = new TextField(captionSalarie, MdwTouchkitUI.getCurrent().getEtudiant().isTemSalarie() == true ? applicationContext.getMessage(NAME + ".salarie.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".salarie.non", null, getLocale())); formatTextField(fieldSalarie); formInfosLayout.addComponent(fieldSalarie); String captionAmenagementEtude = applicationContext.getMessage(NAME + ".amenagementetude.title", null, getLocale()); TextField fieldAmenagementEtude = new TextField(captionAmenagementEtude, MdwTouchkitUI.getCurrent().getEtudiant().isTemAmenagementEtude() == true ? applicationContext.getMessage(NAME + ".amenagementetude.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".amenagementetude.non", null, getLocale())); formatTextField(fieldAmenagementEtude); formInfosLayout.addComponent(fieldAmenagementEtude); panelInfos.setContent(formInfosLayout); } else { HorizontalLayout labelNonInscritLayout = new HorizontalLayout(); labelNonInscritLayout.setMargin(true); labelNonInscritLayout.setSizeFull(); Label labelNonInscrit = new Label( applicationContext.getMessage(NAME + ".inscrit.non", null, getLocale())); labelNonInscrit.setStyleName(ValoTheme.LABEL_COLORED); labelNonInscrit.addStyleName(ValoTheme.LABEL_BOLD); labelNonInscrit.setWidth("100%"); labelNonInscrit.addStyleName("label-centre"); labelNonInscritLayout.addComponent(labelNonInscrit); panelInfos.setContent(labelNonInscritLayout); } globalLayout.addComponent(panelInfos); addComponent(globalLayout); setExpandRatio(globalLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsMobileView.java
License:Apache License
/** * Affichage du trombinoscope/*ww w. j a va2 s .c o m*/ */ private void displayTrombinoscope(boolean completion) { // Rcupration de la liste des inscrits List<Inscrit> linscrits = MdwTouchkitUI.getCurrent().getListeInscrits(); // On rinitialise le layout contenant le trombinoscope if (trombiLayout != null) { //On n'a pas fait 'afficher suivant' if (!completion) { trombiLayout.removeAllComponents(); } } else { trombiLayout = new VerticalLayout(); trombiLayout.setSizeFull(); trombiLayout.setSpacing(true); } int compteurEtu = 0; //Pour chaque inscrit for (Inscrit inscrit : linscrits) { compteurEtu++; //Si on affiche tout sur une page ou si l'tudiant doit tre affich sur cette page if (pageMax == 1 || ((((pageEnCours - 1) * nbEtuParPage) < compteurEtu) && (compteurEtu <= ((pageEnCours) * nbEtuParPage)))) { boolean afficherEtudiant = true; //Si l'tudiant n'est pas dans la VET slectionne, on ne l'affiche pas if (StringUtils.hasText(vetSelectionnee) && (inscrit.getId_etp() == null || !inscrit.getId_etp().contains(vetSelectionnee))) { afficherEtudiant = false; } // Si l'tudiant n'est pas dans le groupe slectionn, on ne l'affiche pas if (StringUtils.hasText(groupeSelectionne) && (inscrit.getCodes_groupes() == null || !inscrit.getCodes_groupes().contains(groupeSelectionne))) { afficherEtudiant = false; } // Si l'tudiant doit tre affich if (afficherEtudiant) { // Panel contenant l'tudiant Panel etuPanel = new Panel(); // Layout du Panel contenant l'tudiant HorizontalLayout photoLayout = new HorizontalLayout(); // Ajout d'un id sur le layout photoLayout.setId(inscrit.getCod_ind()); photoLayout.setSizeFull(); // Si on a une url renseigne vers la photo de l'tudiant if (inscrit.getUrlphoto() != null) { // Image contenant la photo de l'tudiant Image fotoEtudiant = new Image(null, new ExternalResource(inscrit.getUrlphoto())); fotoEtudiant.setWidth("120px"); fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK); // Gestion du clic sur la photo fotoEtudiant.addClickListener(e -> { // Au clic sur la photo on redirige vers le contenu du dossier de l'tudiant dont la photo a t clique rechercheController.accessToMobileDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, false); }); // Ajout de la photo au layout photoLayout.addComponent(fotoEtudiant); } // Layout contenant le nom, prnom et le codetu VerticalLayout nomCodeLayout = new VerticalLayout(); //nomCodeLayout.setSizeFull(); nomCodeLayout.setSpacing(false); // Bouton contenant le nom/prnom Button btnNomEtudiant = new Button(inscrit.getPrenom() + " " + inscrit.getNom()); Utils.setButtonStyle(btnNomEtudiant); // Ajout du bouton au layout nomCodeLayout.addComponent(btnNomEtudiant); //Gestion du clic sur le bouton btnNomEtudiant.addClickListener(e -> { // Au clic sur le bouton on redirige vers le contenu du dossier de l'tudiant dont le nom a t cliqu rechercheController.accessToMobileDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, false); }); nomCodeLayout.setComponentAlignment(btnNomEtudiant, Alignment.MIDDLE_CENTER); //nomCodeLayout.setExpandRatio(btnNomEtudiant, 1); // Label contenant le codetu Label codetuLabel = new Label(inscrit.getCod_etu()); codetuLabel.setSizeFull(); codetuLabel.setStyleName(ValoTheme.LABEL_TINY); codetuLabel.addStyleName("label-centre"); // Ajout du label au layout nomCodeLayout.addComponent(codetuLabel); nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER); // Ajout du layout contenant nom, prnom et codetu au layout de la photo photoLayout.addComponent(nomCodeLayout); photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER); photoLayout.setExpandRatio(nomCodeLayout, 1); // Ajout du layout de la photo comme contenu du panel etuPanel.setContent(photoLayout); trombiLayout.addComponent(etuPanel); trombiLayout.setComponentAlignment(etuPanel, 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;// ww w . jav a 2 s . c o m } //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:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java
License:Open Source License
protected void buildLayout() { final HorizontalLayout dropHintLayout = new HorizontalLayout(); if (hasCountMessage()) { dropHintLayout.addComponent(getCountMessageLabel()); }//from www. j a v a 2 s. com final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setId(UIComponentIdProvider.ACTION_BUTTON_LAYOUT); hLayout.setSpacing(true); hLayout.setSizeUndefined(); if (deleteWrapper != null) { hLayout.addComponent(deleteWrapper); hLayout.setComponentAlignment(deleteWrapper, Alignment.BOTTOM_LEFT); } if (noActionBtn != null) { hLayout.addComponent(noActionBtn); hLayout.setComponentAlignment(noActionBtn, Alignment.BOTTOM_LEFT); } if (bulkUploadStatusButton != null) { hLayout.addComponent(bulkUploadStatusButton); hLayout.setComponentAlignment(bulkUploadStatusButton, Alignment.BOTTOM_LEFT); } if (dropHintLayout.getComponentCount() > 0) { addComponent(dropHintLayout); setComponentAlignment(dropHintLayout, Alignment.BOTTOM_CENTER); } if (hLayout.getComponentCount() > 0) { addComponent(hLayout); setComponentAlignment(hLayout, Alignment.BOTTOM_CENTER); } setStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT); setWidth("100%"); }