List of usage examples for com.vaadin.ui Panel Panel
public Panel()
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsMobileView.java
License:Apache License
/** * Affichage du trombinoscope//from w w w.ja v a2 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.NotesView.java
License:Apache License
/** * Initialise la vue// w w w . j a v a2 s . c o m */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { LOG.debug(userController.getCurrentUserName() + " NotesView"); removeAllComponents(); /* Style */ setMargin(true); setSpacing(true); //Test si user enseignant et en vue Enseignant if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { //On recupere les notes pour un enseignant etudiantController.renseigneNotesEtResultatsVueEnseignant(MainUI.getCurrent().getEtudiant()); } else { //On rcupre les notes pour un tudiant etudiantController.renseigneNotesEtResultats(MainUI.getCurrent().getEtudiant()); } /* Titre */ HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setWidth("100%"); Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); titleLayout.addComponent(title); titleLayout.setComponentAlignment(title, Alignment.MIDDLE_LEFT); //Test si on a des diplomes ou des etapes if ((MainUI.getCurrent().getEtudiant().getDiplomes() != null && MainUI.getCurrent().getEtudiant().getDiplomes().size() > 0) || (MainUI.getCurrent().getEtudiant().getEtapes() != null && MainUI.getCurrent().getEtudiant().getEtapes().size() > 0)) { Button pdfButton = new Button(); pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); pdfButton.addStyleName("button-big-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.exportPdfResume()); fd.extend(pdfButton); } else { FileDownloader fd = new FileDownloader(noteController.exportPdfResume()); fd.setOverrideContentType(false); fd.extend(pdfButton); } titleLayout.addComponent(pdfButton); titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT); } addComponent(titleLayout); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Test si user enseignant if (userController.isEnseignant()) { Panel 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); globalLayout.addComponent(panelVue); } Panel panelNotesDiplomes = new Panel( applicationContext.getMessage(NAME + ".table.diplomes", null, getLocale())); //panelNotesDiplomes.addStyleName("small-font-element"); Table notesDiplomesTable = new Table(null, new BeanItemContainer<>(Diplome.class, MainUI.getCurrent().getEtudiant().getDiplomes())); notesDiplomesTable.setWidth("100%"); notesDiplomesTable.setVisibleColumns((Object[]) DIPLOMES_FIELDS_ORDER); for (String fieldName : DIPLOMES_FIELDS_ORDER) { notesDiplomesTable.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".table.diplomes." + fieldName, null, getLocale())); } notesDiplomesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.diplomes.session", null, getLocale()), new SessionColumnGenerator()); notesDiplomesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.diplomes.note", null, getLocale()), new NoteColumnGenerator()); notesDiplomesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.diplomes.resultat", null, getLocale()), new ResultatColumnGenerator()); if (MainUI.getCurrent().getEtudiant().isAfficherRang()) { notesDiplomesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.diplomes.mention", null, getLocale()), new MentionColumnGenerator()); } if (configController.isAffMentionEtudiant()) { notesDiplomesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.diplomes.rang", null, getLocale()), new RangColumnGenerator()); } notesDiplomesTable.setColumnCollapsingAllowed(true); notesDiplomesTable.setColumnReorderingAllowed(false); notesDiplomesTable.setSelectable(false); notesDiplomesTable.setImmediate(true); notesDiplomesTable.setStyleName("noscrollabletable"); notesDiplomesTable.setPageLength(notesDiplomesTable.getItemIds().size()); panelNotesDiplomes.setContent(notesDiplomesTable); globalLayout.addComponent(panelNotesDiplomes); Panel panelNotesEtapes = new Panel( applicationContext.getMessage(NAME + ".table.etapes", null, getLocale())); //panelNotesEtapes.addStyleName("small-font-element"); Table notesEtapesTable = new Table(null, new BeanItemContainer<>(Etape.class, MainUI.getCurrent().getEtudiant().getEtapes())); notesEtapesTable.setWidth("100%"); notesEtapesTable.setVisibleColumns((Object[]) ETAPES_FIELDS_ORDER); for (String fieldName : ETAPES_FIELDS_ORDER) { notesEtapesTable.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".table.etapes." + fieldName, null, getLocale())); } notesEtapesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.etapes.codevers", null, getLocale()), new CodeEtapeColumnGenerator()); notesEtapesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.etapes.libelle", null, getLocale()), new LibelleEtapeColumnGenerator()); notesEtapesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.etapes.session", null, getLocale()), new SessionColumnGenerator()); notesEtapesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.etapes.note", null, getLocale()), new NoteColumnGenerator()); notesEtapesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.etapes.resultat", null, getLocale()), new ResultatColumnGenerator()); if (MainUI.getCurrent().getEtudiant().isAfficherRang()) { notesEtapesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.etapes.mention", null, getLocale()), new MentionColumnGenerator()); } if (configController.isAffMentionEtudiant()) { notesEtapesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.etapes.rang", null, getLocale()), new RangColumnGenerator()); } notesEtapesTable.setColumnCollapsingAllowed(true); notesEtapesTable.setColumnReorderingAllowed(false); notesEtapesTable.setSelectable(false); notesEtapesTable.setImmediate(true); notesEtapesTable.setStyleName("noscrollabletable"); notesEtapesTable.setPageLength(notesEtapesTable.getItemIds().size()); panelNotesEtapes.setContent(notesEtapesTable); globalLayout.addComponent(panelNotesEtapes); if (MainUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { Panel panelSignificationResultats = new Panel( applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale())); panelSignificationResultats.addStyleName("significationpanel"); 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.setContentMode(ContentMode.HTML); mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL); significationLayout.addComponent(mapSignificationLabel); panelSignificationResultats.setContent(significationLayout); globalLayout.addComponent(panelSignificationResultats); } addComponent(globalLayout); } }
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 w w w . j a v a 2s . c o 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// www. ja va 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); }
From source file:gms.demo.service.presentation.ui.MainUI.java
License:Open Source License
private void initLoginContent() { loginForm.setCaption("Login:"); loginForm.setDescription("<br/>This application does not use your SSO or LDAP " + "passwords. So don't go giving me all your " + "login info."); loginForm.addField("user", new TextField("User:")); loginForm.addField("pass", new PasswordField("Password:")); loginForm.getFooter().addComponent(loginButton); loginButton.addListener(this); // a panel will make this look a little nicer Panel loginPanel = new Panel(); loginPanel.addComponent(loginForm);// w w w. j a v a2 s . c o m loginPanel.setWidth(24f, Sizeable.UNITS_EM); loginPanel.setHeight(20f, Sizeable.UNITS_EM); // add the components to a root layout and center it loginLayout = new VerticalLayout(); loginLayout.addComponent(loginPanel); // this will keep the form near the top of the page loginLayout.setMargin(true); loginLayout.setComponentAlignment(loginPanel, Alignment.TOP_CENTER); // this would center it on the page // loginLayout.setSizeFull(); // loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java
License:Open Source License
private Panel getDropArea() { Panel p = new Panel(); p.setStyleName(Runo.PANEL_LIGHT);//ww w. jav a 2 s . c o m VerticalLayout v = (VerticalLayout) p.getContent(); v.setHeight("100%"); v.addComponent(getDropPanel()); v.addComponent(label1); v.addComponent(label2); v.addComponent(label3); return p; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java
License:Open Source License
private Panel getDropPanel() { Panel p = new Panel(); VerticalLayout v = (VerticalLayout) p.getContent(); v.setSpacing(true);// ww w .j a v a2 s . co m //v.setHeight("100%"); p.setStyleName(Runo.PANEL_LIGHT); Panel wrapperPanel = new Panel(); VerticalLayout vDPanel = (VerticalLayout) wrapperPanel.getContent(); deleteBTN.setIcon(new ThemeResource("../runo/icons/64/folder-add.png")); deleteBTN.setWidth("64px"); deleteBTN.setHeight("64px"); vDPanel.addComponent(deleteBTN); final DragAndDropWrapper wrapper = new DragAndDropWrapper(wrapperPanel); wrapper.setWidth("100px"); wrapper.setHeight("100px"); wrapperPanel.setStyleName(Runo.PANEL_LIGHT); wrapper.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { // expecting this to be an html5 drag DragAndDropWrapper.WrapperTransferable tr = (DragAndDropWrapper.WrapperTransferable) event .getTransferable(); Html5File[] files = tr.getFiles(); if (files != null) { for (final Html5File html5File : files) { final String fileName = html5File.getFileName(); if (html5File.getFileSize() > FILE_SIZE_LIMIT) { getWindow().showNotification("File rejected. Max 2MB files are accepted by Sampler", Window.Notification.TYPE_WARNING_MESSAGE); } else { final ByteArrayOutputStream bas = new ByteArrayOutputStream(); StreamVariable streamVariable = new StreamVariable() { public OutputStream getOutputStream() { return bas; } public boolean listenProgress() { return false; } public void onProgress(StreamVariable.StreamingProgressEvent event) { } public void streamingStarted(StreamVariable.StreamingStartEvent event) { } public void streamingFinished(StreamVariable.StreamingEndEvent event) { progress.setVisible(false); Boolean res = updateProviderProcessingInbox(bas.toByteArray()); if (res.booleanValue()) { getWindow().showNotification( "Processing Complete: " + fileName + " " + html5File.getType() + " " + html5File.getFileSize(), Window.Notification.TYPE_HUMANIZED_MESSAGE); } else { getWindow().showNotification( "Processing Error: You Do Not Have Necessary Permissions to Receive and Process Files.", Window.Notification.TYPE_TRAY_NOTIFICATION); } } public void streamingFailed(StreamVariable.StreamingErrorEvent event) { progress.setVisible(false); } public boolean isInterrupted() { return false; } }; html5File.setStreamVariable(streamVariable); progress.setVisible(true); } } } else { String text = tr.getText(); if (text != null) { getWindow().showNotification(text, Window.Notification.TYPE_HUMANIZED_MESSAGE); } } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); v.addComponent(wrapper); return p; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java
License:Open Source License
private Panel getResultsTable() { Panel p = new Panel(); p.setStyleName(Runo.PANEL_LIGHT);/*from www . j a v a 2 s. c o m*/ VerticalLayout v = (VerticalLayout) p.getContent(); v.setSpacing(true); table = new Table(); table.setStyleName(Runo.TABLE_SMALL); table.setCaption("Processed XDM Packages"); table.setWidth("100%"); table.setHeight("400px"); table.setMultiSelect(false); table.setSelectable(true); table.setImmediate(true); // react at once when something is selected table.setEditable(false); table.setWriteThrough(false); table.setContainerDataSource(populateTable()); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(false); table.setVisibleColumns(new Object[] { "oDate", "oPatientName", "oSender", "oConfidentiality", "oRefrainPolicy", "oPurposeOfUse" }); table.setColumnHeaders(new String[] { "Date Processed", "Patient Name", "From", "Confidentiality", "Primary Refrain Policy", "Intended Purpose Of Use" }); v.addComponent(table); return p; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java
License:Open Source License
private Panel createHTMLVersionOfC32(String c32) { Panel p = new Panel(); p.setStyleName(Runo.PANEL_LIGHT);/*from w w w . j a v a 2 s.com*/ VerticalLayout v = (VerticalLayout) p.getContent(); v.setSpacing(true); v.setHeight("100%"); v.setWidth("100%"); Label l = new Label(); l.setContentMode(Label.CONTENT_XHTML); l.setValue(getHTMLVersionOfCDA(c32)); v.addComponent(l); return p; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.LoginView.java
License:Open Source License
private Panel getLoginPanel() { Panel p = new Panel(); VerticalLayout v = (VerticalLayout) p.getContent(); v.setSpacing(true);/*from www. j av a 2 s. c o m*/ v.setHeight("300px"); Label sandi = new Label(""); sandi.setIcon(new ThemeResource("onc_s_and_i_logo.png")); v.addComponent(sandi); final TextField username = new TextField("User Name:"); final PasswordField userpass = new PasswordField("Password:"); username.setWidth("500px"); userpass.setWidth("500px"); v.addComponent(username); v.addComponent(userpass); HorizontalLayout h = new HorizontalLayout(); h.setSpacing(true); h.setWidth("500px"); Button okBTN = new Button("Ok"); Label l = new Label(""); l.setIcon(new ThemeResource("header-logo.png")); h.addComponent(okBTN); h.addComponent(l); v.addComponent(h); okBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { userN = (String) username.getValue(); userP = (String) userpass.getValue(); authenticate(); if (userProfile == null) { getWindow().showNotification("Login Error", "Incorrect username or password combination.", Window.Notification.TYPE_WARNING_MESSAGE); } else { AdminContext.getSessionAttributes().setUserProfile(userProfile); ((MyVaadinApplication) getApplication()).loginComplete(); } } }); okBTN.setImmediate(true); return p; }