List of usage examples for com.vaadin.ui Label setHeight
@Override public void setHeight(String height)
From source file:fi.semantum.strategia.widget.Meter.java
License:Open Source License
public static void updateMeters(final Main main, boolean canWrite) { if (main.getUIState().currentItem instanceof Strategiakartta) return;/*from w ww.ja v a 2 s. c o m*/ final Database database = main.getDatabase(); final Base base = main.getUIState().currentItem; List<MeterDescription> descs = makeMeterDescriptions(main, base, false); if (!descs.isEmpty() || canWrite) { HorizontalLayout meterHeader = new HorizontalLayout(); meterHeader.setSpacing(true); Label header = new Label("Mittarit"); main.propertyCells.add(Utils.excelRow(header.getValue())); header.setHeight("32px"); header.addStyleName(ValoTheme.LABEL_HUGE); header.addStyleName(ValoTheme.LABEL_BOLD); meterHeader.addComponent(header); meterHeader.setComponentAlignment(header, Alignment.BOTTOM_CENTER); if (canWrite) { final Image editMeters = new Image(null, new ThemeResource("chart_bar_edit.png")); editMeters.setHeight("24px"); editMeters.setWidth("24px"); editMeters.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 2661060702097338722L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.loseFocus(editMeters); manageMeters(main, main.getUIState().currentItem); } }); meterHeader.addComponent(editMeters); meterHeader.setComponentAlignment(editMeters, Alignment.BOTTOM_CENTER); } main.properties.addComponent(meterHeader); main.properties.setComponentAlignment(meterHeader, Alignment.MIDDLE_CENTER); VerticalLayout meters = new VerticalLayout(); boolean showYears = main.getUIState().time.equals(Property.AIKAVALI_KAIKKI); Property time = Property.find(database, Property.AIKAVALI); int index = 0; for (final MeterDescription desc : descs) { ArrayList<String> excelRow = new ArrayList<String>(); final Meter meter = desc.meter; final HorizontalLayout hl = new HorizontalLayout(); hl.addStyleName((((index++) & 1) == 0) ? "evenProperty" : "oddProperty"); hl.setSpacing(true); Label l = new Label(desc.caption); excelRow.add(l.getValue().replace("%nbsp", "")); l.setContentMode(ContentMode.HTML); l.setWidth("450px"); l.addStyleName("propertyName"); l.setData(desc); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.MIDDLE_LEFT); String value = updateMeterValue(main, hl, base, meter, canWrite); excelRow.add(value); String shortComment = ""; Indicator indicator = meter.getPossibleIndicator(database); if (indicator != null) shortComment = indicator.getValueShortComment(); Label comment = new Label(shortComment); comment.setWidth("150px"); hl.addComponent(comment); hl.setComponentAlignment(comment, Alignment.MIDDLE_LEFT); excelRow.add(comment.getValue()); if (showYears) { HorizontalLayout hl2 = new HorizontalLayout(); hl2.setWidth("70px"); hl2.setHeight("100%"); hl.addComponent(hl2); hl.setComponentAlignment(hl2, Alignment.MIDDLE_LEFT); String years = time.getPropertyValue(meter); if (years == null) years = Property.AIKAVALI_KAIKKI; final Label region = new Label(years); region.setWidthUndefined(); excelRow.add(region.getValue()); hl2.addComponent(region); hl2.setComponentAlignment(region, Alignment.MIDDLE_CENTER); } AbsoluteLayout image = new AbsoluteLayout(); image.setWidth("32px"); image.setHeight("32px"); image.addStyleName("meterColor" + index); String color = meter.getTrafficColor(database); Styles styles = Page.getCurrent().getStyles(); styles.add( ".fi_semantum_strategia div." + "meterColor" + index + " { background: " + color + "; }"); hl.addComponent(image); hl.setComponentAlignment(image, Alignment.MIDDLE_CENTER); hl.setExpandRatio(image, 0.0f); meters.addComponent(hl); meters.setComponentAlignment(hl, Alignment.MIDDLE_CENTER); ThemeResource res = desc.meter.showInMap ? new ThemeResource("zoom.png") : new ThemeResource("zoom_out.png"); final Image show = new Image(); show.setSource(res); show.setHeight("24px"); show.setWidth("24px"); if (canWrite) { show.setDescription("Klikkaamalla voit valita, nytetnk mittaria strategiakartassa"); show.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 7156984656942915939L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { desc.meter.setShowInMap(!desc.meter.showInMap); Updates.update(main, true); } }); } hl.addComponent(show); hl.setComponentAlignment(show, Alignment.MIDDLE_CENTER); final Image wiki = new Image(); wiki.setSource(new ThemeResource("table_edit.png")); wiki.setHeight("24px"); wiki.setWidth("24px"); wiki.setDescription("Klikkaamalla voit siirty tausta-asiakirjaan"); wiki.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 7156984656942915939L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Wiki.openWiki(main, desc.meter); } }); hl.addComponent(wiki); hl.setComponentAlignment(wiki, Alignment.MIDDLE_CENTER); if (canWrite) { final Button principalButton = new Button(); if (meter.isPrincipal) { principalButton.setCaption("Poista kokonaisarvio"); } else { principalButton.setCaption("Aseta kokonaisarvioksi"); } principalButton.setStyleName(ValoTheme.BUTTON_TINY); principalButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 8247560202892661226L; @Override public void buttonClick(ClickEvent event) { if (meter.isPrincipal) { meter.isPrincipal = false; } else { for (Meter m : base.getMeters(database)) m.isPrincipal = false; meter.isPrincipal = true; } Updates.update(main, true); } }); hl.addComponent(principalButton); hl.setComponentAlignment(principalButton, Alignment.MIDDLE_CENTER); } main.propertyCells.add(excelRow); } meters.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 3295743025581923380L; private String extractData(Component c) { if (c instanceof AbstractComponent) { Object data = ((AbstractComponent) c).getData(); if (data instanceof MeterDescription) { MeterDescription desc = (MeterDescription) data; return desc.meter.getDescription(database); } } return null; } @Override public void layoutClick(LayoutClickEvent event) { String desc = extractData(event.getClickedComponent()); if (desc == null) return; String content = "<div style=\"width: 700px; border: 2px solid; padding: 5px\">"; content += "<div style=\"text-align: center; white-space:normal; font-size: 36px; padding: 10px\">" + desc + "</div>"; content += "</div>"; Notification n = new Notification(content, Notification.Type.HUMANIZED_MESSAGE); n.setHtmlContentAllowed(true); n.show(Page.getCurrent()); } }); main.properties.addComponent(meters); main.properties.setComponentAlignment(meters, Alignment.MIDDLE_CENTER); } }
From source file:fi.semantum.strategia.widget.Tag.java
License:Open Source License
public static void updateRelatedTags(final Main main, boolean canWrite) { final Database database = main.getDatabase(); final Base base = main.getUIState().currentItem; Collection<Tag> tags = base.getRelatedTags(database); if (!tags.isEmpty() || canWrite) { HorizontalLayout tagHeader = new HorizontalLayout(); tagHeader.setSpacing(true);/*from w w w. j av a 2 s . c o m*/ Label header2 = new Label("Aihetunnisteet"); header2.setHeight("32px"); header2.addStyleName(ValoTheme.LABEL_HUGE); header2.addStyleName(ValoTheme.LABEL_BOLD); tagHeader.addComponent(header2); tagHeader.setComponentAlignment(header2, Alignment.BOTTOM_CENTER); if (canWrite) { final Image editTags = new Image("", new ThemeResource("tag_blue_edit.png")); editTags.setHeight("24px"); editTags.setWidth("24px"); editTags.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = -6140867347404571880L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.loseFocus(editTags); Utils.editTags(main, "Muokkaa aihetunnisteita", main.getUIState().currentItem); } }); tagHeader.addComponent(editTags); tagHeader.setComponentAlignment(editTags, Alignment.BOTTOM_CENTER); } main.properties.addComponent(tagHeader); main.properties.setComponentAlignment(tagHeader, Alignment.MIDDLE_CENTER); HorizontalLayout divider = new HorizontalLayout(); main.properties.addComponent(divider); main.properties.setComponentAlignment(divider, Alignment.MIDDLE_CENTER); VerticalLayout left = new VerticalLayout(); left.setSpacing(true); left.setWidth("400px"); left.setMargin(true); divider.addComponent(left); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setWidth("400px"); right.setMargin(true); divider.addComponent(right); Set<Tag> monitoredTags = getMonitoredTags(database, base); int i = 0; for (final Tag tag : tags) { final boolean monitor = base.hasMonitorTag(database, tag); String tagId = tag.getId(database); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setHeight("37px"); Button tagButton = Utils.tagButton(database, "list", tagId, i++); left.addComponent(tagButton); left.setComponentAlignment(tagButton, Alignment.MIDDLE_RIGHT); if (canWrite) { Button b = new Button(); b.addStyleName(ValoTheme.BUTTON_BORDERLESS); b.setIcon(FontAwesome.TIMES_CIRCLE); b.addClickListener(new ClickListener() { private static final long serialVersionUID = -4473258383318654850L; @Override public void buttonClick(ClickEvent event) { base.removeRelatedTags(database, tag); Utils.loseFocus(main.properties); Updates.update(main, true); } }); hl.addComponent(b); hl.setComponentAlignment(b, Alignment.MIDDLE_LEFT); } if (base instanceof Strategiakartta) { Button tagButton2 = new Button(); tagButton2.setCaption(monitor ? "Seurataan toteutuksessa" : "Ei seurata toteutuksessa"); tagButton2.addStyleName(monitor ? "greenButton" : "redButton"); tagButton2.addStyleName(ValoTheme.BUTTON_SMALL); tagButton2.setWidth("200px"); if (canWrite) { tagButton2.addClickListener(new ClickListener() { private static final long serialVersionUID = -1769769368034323594L; @Override public void buttonClick(ClickEvent event) { if (monitor) { base.removeMonitorTags(database, tag); } else { base.assertMonitorTags(database, tag); } Utils.loseFocus(main.properties); Updates.update(main, true); } }); tagButton2.setEnabled(true); } else { tagButton2.setEnabled(false); } hl.addComponent(tagButton2); hl.setComponentAlignment(tagButton2, Alignment.MIDDLE_LEFT); } else { if (monitoredTags.contains(tag)) { Label l = new Label(" toteuttaa seurattavaa aihetta "); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.MIDDLE_LEFT); } } right.addComponent(hl); right.setComponentAlignment(hl, Alignment.MIDDLE_LEFT); } } }
From source file:fi.semantum.strategia.widget.Tag.java
License:Open Source License
public static void updateMonitoredTags(final Main main, boolean canWrite) { final Database database = main.getDatabase(); final Base base = main.getUIState().currentItem; if (!(base instanceof Tavoite || base instanceof Painopiste)) return;//from w w w . ja va 2 s . c o m Set<Tag> monitoredTags = getMonitoredTags(database, base); monitoredTags.removeAll(base.getRelatedTags(database)); Map<String, Base> implementors = new HashMap<String, Base>(); for (Base impl : Utils.getImplementationSet(database, base)) { for (Tag i : impl.getRelatedTags(database)) { if (monitoredTags.contains(i)) { implementors.put(i.uuid, impl); } } } if (!monitoredTags.isEmpty() || canWrite) { HorizontalLayout tagHeader = new HorizontalLayout(); tagHeader.setSpacing(true); Label header2 = new Label("Seurattavat aihetunnisteet"); header2.setHeight("32px"); header2.addStyleName(ValoTheme.LABEL_HUGE); header2.addStyleName(ValoTheme.LABEL_BOLD); tagHeader.addComponent(header2); tagHeader.setComponentAlignment(header2, Alignment.BOTTOM_CENTER); main.properties.addComponent(tagHeader); main.properties.setComponentAlignment(tagHeader, Alignment.MIDDLE_CENTER); HorizontalLayout divider = new HorizontalLayout(); main.properties.addComponent(divider); main.properties.setComponentAlignment(divider, Alignment.MIDDLE_CENTER); VerticalLayout left = new VerticalLayout(); left.setSpacing(true); left.setWidth("400px"); left.setMargin(true); divider.addComponent(left); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setWidth("400px"); right.setMargin(true); divider.addComponent(right); int i = 0; for (final Tag tag : monitoredTags) { String tagId = tag.getId(database); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setHeight("37px"); Button tagButton = Utils.tagButton(database, "inferred", tagId, i++); left.addComponent(tagButton); left.setComponentAlignment(tagButton, Alignment.MIDDLE_RIGHT); Base implementor = implementors.get(tag.uuid); if (implementor != null) { String desc = implementor.getId(database); if (desc.isEmpty()) desc = implementor.getText(database); Label tagLabel = new Label("Toteutetaan ylemmll tasolla: " + desc); hl.addComponent(tagLabel); hl.setComponentAlignment(tagLabel, Alignment.MIDDLE_LEFT); } else { Button tagButton2 = new Button(); tagButton2.setCaption("Merkitse toteuttajaksi"); tagButton2.addStyleName("redButton"); tagButton2.addStyleName(ValoTheme.BUTTON_SMALL); tagButton2.setWidth("200px"); if (canWrite) { tagButton2.addClickListener(new ClickListener() { private static final long serialVersionUID = -1769769368034323594L; @Override public void buttonClick(ClickEvent event) { base.assertRelatedTags(database, tag); Utils.loseFocus(main.properties); Updates.update(main, true); } }); tagButton2.setEnabled(true); } else { tagButton2.setEnabled(false); } hl.addComponent(tagButton2); hl.setComponentAlignment(tagButton2, Alignment.MIDDLE_LEFT); } right.addComponent(hl); right.setComponentAlignment(hl, Alignment.MIDDLE_LEFT); } } }
From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java
License:Open Source License
private void addHeaderBox(String msg, int taille) { Label hLabel = new Label(msg); hLabel.setWidth((taille + 13) + "px"); hLabel.setHeight(height + "px"); hLabel.addStyleName(styleName);/*from w w w .java 2 s. c o m*/ header1.addComponent(hLabel); }
From source file:fr.amapj.view.engine.tools.TableBuilder.java
License:Open Source License
public void addHeaderBox(String msg, int taille) { Label hLabel = new Label(msg); hLabel.setWidth((taille + 13) + "px"); hLabel.setHeight(height + "px"); hLabel.addStyleName(styleName);//from w ww .j ava 2 s . c om header1.addComponent(hLabel); }
From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupRoleDifferent.java
License:Open Source License
/** * Permet de dessiner le tableau /*from ww w .j a v a 2 s . c om*/ */ public void drawTab(Tab tab) { GridLayout gl = new GridLayout(4, 1 + tab.lines.size()); gl.setWidth("800px"); gl.setSpacing(false); contentLayout.addComponent(gl); // Construction du titre Label l = new Label(tab.titre); l.addStyleName(tab.styleTitre); l.setWidth("100%"); gl.addComponent(l, 0, 0, 3, 0); List<TabLine> lines = tab.lines; for (int i = 0; i < lines.size(); i++) { TabLine line = lines.get(i); int height = computeHeight(line); // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire height = Math.max(height, 36); Label l1 = new Label(line.col1); l1.addStyleName(line.styleCol1); l1.setWidth("100%"); l1.setHeight(height + "px"); gl.addComponent(l1, 0, i + 1); Label l2 = new Label(line.col2); l2.addStyleName(line.styleCol2); l2.setWidth("100%"); l2.setHeight(height + "px"); gl.addComponent(l2, 1, i + 1); Label l3 = new Label(line.col3); l3.addStyleName(line.styleCol3); l3.setWidth("100%"); l3.setHeight(height + "px"); gl.addComponent(l3, 2, i + 1); if (line.col4 != null) { Button b = new Button(line.col4); b.addStyleName(line.styleCol4); b.addClickListener(e -> handleButton(line.role)); b.setWidth("100%"); gl.addComponent(b, 3, i + 1); gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); } else { Label l4 = new Label(""); l4.addStyleName(line.styleCol4); l4.setWidth("100%"); l4.setHeight(height + "px"); gl.addComponent(l4, 3, i + 1); } } }
From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupToutAutorise.java
License:Open Source License
/** * Permet de dessiner le tableau // w w w. j av a 2 s . c o m */ public void drawTab(Tab tab) { GridLayout gl = new GridLayout(3, 1 + tab.lines.size()); gl.setWidth("600px"); gl.setSpacing(false); contentLayout.addComponent(gl); // Construction du titre Label l = new Label(tab.titre); l.addStyleName(tab.styleTitre); l.setWidth("100%"); gl.addComponent(l, 0, 0, 2, 0); List<TabLine> lines = tab.lines; for (int i = 0; i < lines.size(); i++) { TabLine line = lines.get(i); int height = computeHeight(line); // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire height = Math.max(height, 36); Label l1 = new Label(line.col1); l1.addStyleName(line.styleCol1); l1.setWidth("100%"); l1.setHeight(height + "px"); gl.addComponent(l1, 0, i + 1); Label l2 = new Label(line.col2); l2.addStyleName(line.styleCol2); l2.setWidth("100%"); l2.setHeight(height + "px"); gl.addComponent(l2, 1, i + 1); if (line.col3 != null) { Button b = new Button(line.col3); b.addStyleName(line.styleCol3); b.addClickListener(e -> handleButton(line.cell)); b.setWidth("100%"); gl.addComponent(b, 2, i + 1); gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER); } else { Label l3 = new Label(""); l3.addStyleName(line.styleCol3); l3.setWidth("100%"); l3.setHeight(height + "px"); gl.addComponent(l3, 2, i + 1); } } }
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 ww w .j a v 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:fr.univlorraine.mondossierweb.views.NotesMobileView.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 a v a 2s . 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(); } if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } }); 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(false); UI.getCurrent().addWindow(w); }); navbar.addComponent(significationButton); navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT); } addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); //globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); globalLayout.setStyleName("v-scrollableelement"); List<Diplome> ldiplomes = MdwTouchkitUI.getCurrent().getEtudiant().getDiplomes(); if (ldiplomes != null && ldiplomes.size() > 0) { Panel diplomesPanel = new Panel( applicationContext.getMessage(NAME + ".table.diplomes", null, getLocale())); diplomesPanel.setStyleName("centertitle-panel"); diplomesPanel.addStyleName("v-colored-panel-caption"); VerticalLayout diplomesLayout = new VerticalLayout(); for (Diplome diplome : ldiplomes) { Panel panelEnCours = null; panelEnCours = new Panel(diplome.getAnnee()); panelEnCours.setStyleName("v-panel-caption-centertitle-panel"); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); noteLayout.setSpacing(true); VerticalLayout libelleLayout = new VerticalLayout(); libelleLayout.setSizeFull(); Label libelleButton = new Label(diplome.getLib_web_vdi()); libelleButton.setHeight("100%"); libelleButton.setWidth("100%"); libelleButton.addStyleName("label-centre"); //Appel de la window contenant le dtail des notes if (diplome.getResultats() != null && diplome.getResultats().size() > 0) { libelleLayout.addComponent(new Label("")); } libelleLayout.addComponent(libelleButton); libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER); HorizontalLayout notesessionLayout = new HorizontalLayout(); notesessionLayout.setSizeFull(); notesessionLayout.setSpacing(true); if (diplome.getResultats() != null && diplome.getResultats().size() > 0) { int i = 0; for (Resultat r : diplome.getResultats()) { i++; VerticalLayout resultatLayout = new VerticalLayout(); resultatLayout.setSizeFull(); Label session = new Label(r.getSession()); session.setStyleName("label-bold-with-bottom"); resultatLayout.addComponent(session); Label note = new Label(r.getNote()); resultatLayout.addComponent(note); Label resultat = new Label(r.getAdmission()); resultatLayout.addComponent(resultat); //Si c'est la dernire session if (i == diplome.getResultats().size()) { //On affiche les infos en gras note.setStyleName(ValoTheme.LABEL_BOLD); resultat.setStyleName(ValoTheme.LABEL_BOLD); } notesessionLayout.addComponent(resultatLayout); } } else { Label resultat = new Label("Aucun rsultat"); resultat.setStyleName(ValoTheme.LABEL_SMALL); notesessionLayout.addComponent(resultat); } noteLayout.addComponent(libelleLayout); noteLayout.addComponent(notesessionLayout); panelEnCours.setContent(noteLayout); diplomesLayout.addComponent(panelEnCours); } diplomesPanel.setContent(diplomesLayout); globalLayout.addComponent(diplomesPanel); } List<Etape> letapes = MdwTouchkitUI.getCurrent().getEtudiant().getEtapes(); if (letapes != null && letapes.size() > 0) { Panel elpsPanel = new Panel( applicationContext.getMessage(NAME + ".table.etapes", null, getLocale())); elpsPanel.setStyleName("centertitle-panel"); elpsPanel.addStyleName("v-colored-panel-caption"); VerticalLayout elpsLayout = new VerticalLayout(); for (Etape etape : letapes) { Panel panelEnCours = null; panelEnCours = new Panel(etape.getAnnee()); panelEnCours.setStyleName("v-panel-caption-centertitle-panel"); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); noteLayout.setSpacing(true); VerticalLayout libelleLayout = new VerticalLayout(); libelleLayout.setSizeFull(); Button libelleButton = new Button(etape.getLibelle()); Utils.setButtonStyle(libelleButton); libelleButton.setHeight("100%"); libelleButton.setWidth("100%"); //Appel de la window contenant le dtail des notes prepareBoutonAppelDetailDesNotes(libelleButton, etape); if (etape.getResultats() != null && etape.getResultats().size() > 0) { libelleLayout.addComponent(new Label("")); } libelleLayout.addComponent(libelleButton); libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER); HorizontalLayout notesessionLayout = new HorizontalLayout(); notesessionLayout.setSizeFull(); notesessionLayout.setSpacing(true); if (etape.getResultats() != null && etape.getResultats().size() > 0) { int i = 0; for (Resultat r : etape.getResultats()) { i++; VerticalLayout resultatLayout = new VerticalLayout(); resultatLayout.setSizeFull(); Label session = new Label(r.getSession()); session.setStyleName("label-bold-with-bottom"); resultatLayout.addComponent(session); Label note = new Label(r.getNote()); resultatLayout.addComponent(note); Label resultat = new Label(r.getAdmission()); resultatLayout.addComponent(resultat); //Si c'est la dernire session if (i == etape.getResultats().size()) { //On affiche les infos en gras note.setStyleName(ValoTheme.LABEL_BOLD); resultat.setStyleName(ValoTheme.LABEL_BOLD); } notesessionLayout.addComponent(resultatLayout); } } else { Label resultat = new Label("Aucun rsultat"); resultat.setStyleName(ValoTheme.LABEL_SMALL); notesessionLayout.addComponent(resultat); } noteLayout.addComponent(libelleLayout); noteLayout.addComponent(notesessionLayout); panelEnCours.setContent(noteLayout); elpsLayout.addComponent(panelEnCours); } elpsPanel.setContent(elpsLayout); globalLayout.addComponent(elpsPanel); } addComponent(globalLayout); setExpandRatio(globalLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.windows.SignificationsMobileWindow.java
License:Apache License
/** * Cre une fentre//from ww w . j av a2 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); }