List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:fr.amapj.view.engine.grid.currencyvector.PopupCurrencyVector.java
License:Open Source License
private void addRow(int lig) { List<Object> cells = new ArrayList<Object>(); Label dateLabel = new Label(param.leftPartLine.get(lig)); dateLabel.addStyleName("date-saisie"); dateLabel.setWidth(param.largeurCol + "px"); cells.add(dateLabel);/*from ww w.j a v a 2 s . co m*/ int qte = param.montant[lig]; boolean isExcluded = isExcluded(lig); if (param.readOnly) { // String txt; if (isExcluded) { txt = "XXXXXX"; } else if (qte == 0) { txt = ""; } else { txt = "" + new CurrencyTextFieldConverter().convertToString(qte); } Label tf = new Label(txt); tf.addStyleName("cell-voir"); tf.setWidth((param.largeurCol - 10) + "px"); cells.add(tf); } else { if (isExcluded) { TextField tf = new TextField(); tf.setValue("XXXXXX"); tf.setEnabled(false); tf.addStyleName("cell-voir"); tf.setWidth((param.largeurCol - 10) + "px"); cells.add(tf); } else { // // Si derniere ligne : on autorise les nombres ngatifs (sauf si on en mode de saisie de la dernire ligne) boolean allowNegativeNumber = (lig == param.nbLig - 1) && (param.computeLastLine == true); final TextField tf = BaseUiTools.createCurrencyField("", allowNegativeNumber); tf.setData(new GridIJData(lig, 0)); tf.setConvertedValue(new Integer(qte)); tf.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { try { updateModele(); } catch (ErreurSaisieException e) { NotificationHelper.displayNotificationMontant(); } } }); tf.addStyleName("cell-saisie"); tf.setWidth((param.largeurCol - 10) + "px"); shortCutManager.registerTextField(tf); cells.add(tf); // Si derniere ligne : on desactive la saisie , sauf si pas de recalcul if ((lig == param.nbLig - 1) && (param.computeLastLine == true)) { tf.setEnabled(false); lastLineTextField = tf; } } } table.addItem(cells.toArray(), new Integer(lig)); }
From source file:fr.amapj.view.engine.grid.integergrid.PopupIntegerGrid.java
License:Open Source License
private void addRow(int lig) { List<Object> cells = new ArrayList<Object>(); Label dateLabel = new Label(param.leftPartLine.get(lig), ContentMode.HTML); dateLabel.addStyleName(param.leftPartLineStyle); cells.add(dateLabel);/*from w w w. ja v a2 s .c o m*/ for (int j = 0; j < param.nbCol; j++) { int qte = param.qte[lig][j]; boolean isExcluded = isExcluded(lig, j); // En lecture simple if (param.readOnly) { // String txt; if (isExcluded) { txt = "XXXXXX"; } else if (qte == 0) { txt = ""; } else { txt = "" + qte; } Label tf = new Label(txt); tf.addStyleName("cell-voir"); tf.setWidth((param.largeurCol - 10) + "px"); cells.add(tf); } // En mode normal else { // Si la cellule est exclue if (isExcluded) { TextField tf = new TextField(); tf.setValue("XXXXXX"); tf.setEnabled(false); tf.addStyleName("cell-voir"); tf.setWidth((param.largeurCol - 10) + "px"); cells.add(tf); } else { // final TextField tf = BaseUiTools.createQteField(""); tf.setData(new GridIJData(lig, j)); if (qte == 0) { tf.setConvertedValue(null); } else { tf.setConvertedValue(new Integer(qte)); } tf.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { try { GridIJData ij = (GridIJData) tf.getData(); int qte = readValueInCell(tf); param.updateQte(ij.i(), ij.j(), qte); displayMontantTotal(); } catch (ErreurSaisieException e) { NotificationHelper.displayNotificationQte(); } } }); tf.addStyleName("cell-saisie"); tf.setWidth((param.largeurCol - 10) + "px"); shortCutManager.registerTextField(tf); cells.add(tf); } } } table.addItem(cells.toArray(), new Integer(lig)); }
From source file:fr.amapj.view.engine.grid.integergrid.PopupIntegerGrid.java
License:Open Source License
protected void updateFirstCol(int lineNumber, String msg) { Item item = table.getItem(new Integer(lineNumber)); Label label = (Label) item.getItemProperty(new Integer(-1)).getValue(); label.setValue(msg); }
From source file:fr.amapj.view.views.advanced.devtools.DevToolsSelectionTable.java
License:Open Source License
private void addTest1() { // Titre/*w ww .j a v a 2 s . c o m*/ setStepTitle("UNIQUEMENT DES LABELS"); Table table = new Table("La table"); // table.addContainerProperty("col1", Label.class, null); table.addContainerProperty("col2", Label.class, null); // Ligne 1 Label tf1 = new Label(); tf1.setValue("Canopus"); Label tf2 = new Label(); tf2.setValue("0.75"); table.addItem(new Object[] { tf1, tf2 }, 1); // Ligne 2 tf1 = new Label(); tf1.setValue("Actarus"); tf2 = new Label(); tf2.setValue("0.85"); table.addItem(new Object[] { tf1, tf2 }, 2); // Ligne 3 tf1 = new Label(); tf1.setValue("Venus"); tf2 = new Label(); tf2.setValue("1.45"); table.addItem(new Object[] { tf1, tf2 }, 3); // Show exactly the currently contained rows (items) table.setPageLength(table.size()); // Allow selecting items from the table. table.setSelectable(true); table.setSortEnabled(false); // Send changes in selection immediately to server. table.setImmediate(true); // Shows feedback from selection. final Label current = new Label("Selected: -"); // Handle selection change. table.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { current.setValue("Selected: " + table.getValue()); } }); form.addComponent(table); form.addComponent(current); String content = "Dans ce cas, tout fonctionne bien, on peut bien selectionner la ligne comme on veut"; addLabel(content, ContentMode.HTML); }
From source file:fr.amapj.view.views.advanced.devtools.DevToolsSelectionTable.java
License:Open Source License
private void addTest2() { // Titre//from w w w. j a va 2 s . c o m setStepTitle("UNIQUEMENT DES TEXTFIELDS EDITABLES"); final Table table = new Table("La table"); // table.addContainerProperty("col1", TextField.class, null); table.addContainerProperty("col2", TextField.class, null); // Ligne 1 TextField tf1 = new TextField(); tf1.setValue("Canopus"); tf1.addFocusListener(e -> table.select(1)); // IMPORTANT !! TextField tf2 = new TextField(); tf2.setValue("0.75"); tf2.addFocusListener(e -> table.select(1)); // IMPORTANT !! table.addItem(new Object[] { tf1, tf2 }, 1); // Ligne 2 tf1 = new TextField(); tf1.setValue("Actarus"); tf1.addFocusListener(e -> table.select(2)); // IMPORTANT !! tf2 = new TextField(); tf2.setValue("0.85"); tf2.addFocusListener(e -> table.select(2)); // IMPORTANT !! table.addItem(new Object[] { tf1, tf2 }, 2); // Ligne 3 tf1 = new TextField(); tf1.setValue("Venus"); tf1.addFocusListener(e -> table.select(3)); // IMPORTANT !! tf2 = new TextField(); tf2.setValue("1.45"); tf2.addFocusListener(e -> table.select(3)); // IMPORTANT !! table.addItem(new Object[] { tf1, tf2 }, 3); // Show exactly the currently contained rows (items) table.setPageLength(table.size()); // Allow selecting items from the table. table.setSelectable(true); table.setSortEnabled(false); // Send changes in selection immediately to server. table.setImmediate(true); // Shows feedback from selection. final Label current = new Label("Selected: -"); // Handle selection change. table.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { current.setValue("Selected: " + table.getValue()); } }); form.addComponent(table); form.addComponent(current); String content = "Dans ce cas, tout fonctionne bien, on peut bien selectionner la ligne comme on veut, mais il faut avoir ajouter un listener sur chaque textfield "; addLabel(content, ContentMode.HTML); }
From source file:fr.amapj.view.views.advanced.devtools.DevToolsSelectionTable.java
License:Open Source License
private void addTest3() { // Titre//ww w. ja va2s .co m setStepTitle("UNIQUEMENT DES TEXTFIELDS ENABLE = FALSE"); final Table table = new Table("La table"); // table.addContainerProperty("col1", TextField.class, null); table.addContainerProperty("col2", TextField.class, null); // Ligne 1 TextField tf1 = new TextField(); tf1.setValue("Canopus"); tf1.addFocusListener(e -> table.select(1)); // IMPORTANT !! tf1.setEnabled(false); TextField tf2 = new TextField(); tf2.setValue("0.75"); tf2.addFocusListener(e -> table.select(1)); // IMPORTANT !! tf2.setEnabled(false); table.addItem(new Object[] { tf1, tf2 }, 1); // Ligne 2 tf1 = new TextField(); tf1.setValue("Actarus"); tf1.addFocusListener(e -> table.select(2)); // IMPORTANT !! tf1.setEnabled(false); tf2 = new TextField(); tf2.setValue("0.85"); tf2.addFocusListener(e -> table.select(2)); // IMPORTANT !! tf2.setEnabled(false); table.addItem(new Object[] { tf1, tf2 }, 2); // Ligne 3 tf1 = new TextField(); tf1.setValue("Venus"); tf1.addFocusListener(e -> table.select(3)); // IMPORTANT !! tf1.setEnabled(false); tf2 = new TextField(); tf2.setValue("1.45"); tf2.addFocusListener(e -> table.select(3)); // IMPORTANT !! tf2.setEnabled(false); table.addItem(new Object[] { tf1, tf2 }, 3); // Show exactly the currently contained rows (items) table.setPageLength(table.size()); // Allow selecting items from the table. table.setSelectable(true); table.setSortEnabled(false); // Send changes in selection immediately to server. table.setImmediate(true); // Shows feedback from selection. final Label current = new Label("Selected: -"); // Handle selection change. table.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { current.setValue("Selected: " + table.getValue()); } }); form.addComponent(table); form.addComponent(current); String content = "Dans ce cas, impossible de le faire fonctionner. On n'arrive pas selctionner les lignes. Le seul moyen est de cliquer juste au milieu entre les 2 colonnes, mais pas pratique du tout "; addLabel(content, ContentMode.HTML); }
From source file:fr.amapj.view.views.advanced.devtools.DevToolsSelectionTable.java
License:Open Source License
private void addTest4() { // Titre//from w w w. j a va 2 s. c o m setStepTitle("UNIQUEMENT DES TEXTFIELDS READONLY = TRUE "); final Table table = new Table("La table"); // table.addContainerProperty("col1", TextField.class, null); table.addContainerProperty("col2", TextField.class, null); // Ligne 1 TextField tf1 = new TextField(); tf1.setValue("Canopus"); //tf1.addFocusListener(e->table.select(1)); // A NE PAS METTRE - IMPORTANT !! tf1.setReadOnly(true); TextField tf2 = new TextField(); tf2.setValue("0.75"); //tf2.addFocusListener(e->table.select(1)); // A NE PAS METTRE - IMPORTANT !! tf2.setReadOnly(true); table.addItem(new Object[] { tf1, tf2 }, 1); // Ligne 2 tf1 = new TextField(); tf1.setValue("Actarus"); //tf1.addFocusListener(e->table.select(2)); // A NE PAS METTRE - IMPORTANT !! tf1.setReadOnly(true); tf2 = new TextField(); tf2.setValue("0.85"); //tf2.addFocusListener(e->table.select(2)); // A NE PAS METTRE - IMPORTANT !! tf2.setReadOnly(true); table.addItem(new Object[] { tf1, tf2 }, 2); // Ligne 3 tf1 = new TextField(); tf1.setValue("Venus"); //tf1.addFocusListener(e->table.select(3)); // A NE PAS METTRE - IMPORTANT !! tf1.setReadOnly(true); tf2 = new TextField(); tf2.setValue("1.45"); //tf2.addFocusListener(e->table.select(3)); // A NE PAS METTRE - IMPORTANT !! tf2.setReadOnly(true); table.addItem(new Object[] { tf1, tf2 }, 3); // Show exactly the currently contained rows (items) table.setPageLength(table.size()); // Allow selecting items from the table. table.setSelectable(true); table.setSortEnabled(false); // Send changes in selection immediately to server. table.setImmediate(true); // Shows feedback from selection. final Label current = new Label("Selected: -"); // Handle selection change. table.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { current.setValue("Selected: " + table.getValue()); } }); form.addComponent(table); form.addComponent(current); String content = "Dans ce cas, ca fonctionne, mais il est obligatoire DE NE PAS METTRE DE FOCUS LISTENER SUR LES TEXTFIELDS, SINON CA NE MARCHE PAS "; addLabel(content, ContentMode.HTML); }
From source file:fr.amapj.view.views.producteur.livraison.ProducteurLivraisonsView.java
License:Open Source License
public void buttonClick(Label detail, Button b, Long idModeleContratDate) { boolean status = (Boolean) b.getData(); status = !status;/*from www . ja v a 2s . c o m*/ b.setData(status); if (status) { // b.setCaption("Masquer le dtail par amapien"); b.setIcon(FontAwesome.CHEVRON_UP); // String content = new GestionContratService().getDetailContrat(idModeleContratDate); detail.setValue("<br/>" + content); } else { // b.setCaption("Voir le dtail par amapien"); b.setIcon(FontAwesome.CHEVRON_DOWN); // detail.setValue(""); } }
From source file:fr.univlorraine.mondossierweb.views.AdressesView.java
License:Apache License
private void formatLabel(Label label, String caption, String value) { if (StringUtils.hasText(caption)) { label.setCaption(caption);/*from w w w . j av a2s. c o m*/ } if (StringUtils.hasText(value)) { label.setValue("<b>" + value + "</b"); label.setContentMode(ContentMode.HTML); } label.setSizeFull(); }
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
/** * Initialise la vue//from w ww . ja va2s . c om */ @PostConstruct public void init() { LOG.debug(userController.getCurrentUserName() + " EtatCivilView"); //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())) { if (MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { LOG.debug(userController.getCurrentUserName() + " init EtatCivilView"); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); /* Generalites */ FormLayout formGeneralitesLayout = new FormLayout(); formGeneralitesLayout.setSpacing(true); formGeneralitesLayout.setMargin(true); Panel panelGeneralites = new Panel( applicationContext.getMessage(NAME + ".generalites.title", null, getLocale())); String captionNumDossier = applicationContext.getMessage(NAME + ".numdossier.title", null, getLocale()); Label fieldNumDossier = new Label(); formatLabel(fieldNumDossier, captionNumDossier, MainUI.getCurrent().getEtudiant().getCod_etu()); formGeneralitesLayout.addComponent(fieldNumDossier); String captionNNE = applicationContext.getMessage(NAME + ".nne.title", null, getLocale()); Label fieldNNE = new Label(); formatLabel(fieldNNE, captionNNE, MainUI.getCurrent().getEtudiant().getCod_nne()); formGeneralitesLayout.addComponent(fieldNNE); String captionNom = applicationContext.getMessage(NAME + ".nom.title", null, getLocale()); Label fieldNom = new Label(); formatLabel(fieldNom, captionNom, MainUI.getCurrent().getEtudiant().getNom()); formGeneralitesLayout.addComponent(fieldNom); String captionMail = applicationContext.getMessage(NAME + ".mail.title", null, getLocale()); Label mailLabel = new Label(); mailLabel.setCaption(captionMail); String mail = MainUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); } mailLabel.setSizeFull(); formGeneralitesLayout.addComponent(mailLabel); String captionNationalite = applicationContext.getMessage(NAME + ".nationalite.title", null, getLocale()); Label fieldNationalite = new Label(); formatLabel(fieldNationalite, captionNationalite, MainUI.getCurrent().getEtudiant().getNationalite()); formGeneralitesLayout.addComponent(fieldNationalite); String captionDateNaissance = applicationContext.getMessage(NAME + ".naissance.title", null, getLocale()); Label fieldDateNaissance = new Label(); formatLabel(fieldDateNaissance, captionDateNaissance, MainUI.getCurrent().getEtudiant().getDatenaissance()); formGeneralitesLayout.addComponent(fieldDateNaissance); String captionLieuNaissance = applicationContext.getMessage(NAME + ".lieunaissance.title", null, getLocale()); Label fieldLieuNaissance = new Label(); formatLabel(fieldLieuNaissance, captionLieuNaissance, MainUI.getCurrent().getEtudiant().getLieunaissance()); formGeneralitesLayout.addComponent(fieldLieuNaissance); String captionDepNaissance = applicationContext.getMessage(NAME + ".depnaissance.title", null, getLocale()); Label fieldDepNaissance = new Label(); formatLabel(fieldDepNaissance, captionDepNaissance, MainUI.getCurrent().getEtudiant().getDepartementnaissance()); formGeneralitesLayout.addComponent(fieldDepNaissance); panelGeneralites.setContent(formGeneralitesLayout); HorizontalLayout generalitesGlobalLayout = new HorizontalLayout(); generalitesGlobalLayout.setSizeUndefined(); generalitesGlobalLayout.setStyleName("firstitembox"); generalitesGlobalLayout.addComponent(panelGeneralites); generalitesGlobalLayout.setExpandRatio(panelGeneralites, 1); idLayout.addComponent(generalitesGlobalLayout); /* Bac */ Panel panelBac = new Panel(applicationContext.getMessage(NAME + ".bac.title", null, getLocale())); //Si plusieurs bac if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() > 1) { panelBac.setCaption(applicationContext.getMessage(NAME + ".bacs.title", null, getLocale())); TabSheet bacTabSheet = new TabSheet(); VerticalLayout vBacLayout = new VerticalLayout(); vBacLayout.setSizeFull(); bacTabSheet.setSizeFull(); bacTabSheet.addStyleName(ValoTheme.TABSHEET_FRAMED); for (BacEtatCivil bec : MainUI.getCurrent().getEtudiant().getListeBac()) { FormLayout tabBacLayout = new FormLayout(); tabBacLayout.setSizeFull(); tabBacLayout.setMargin(false); ajouterBacToView(tabBacLayout, bec); bacTabSheet.addTab(tabBacLayout, bec.getCod_bac(), FontAwesome.GRADUATION_CAP); } vBacLayout.addComponent(bacTabSheet); panelBac.setContent(vBacLayout); } else { //Si un seul bac FormLayout formBacLayout = new FormLayout(); formBacLayout.setSizeFull(); if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() == 1) { formBacLayout.setSpacing(true); formBacLayout.setMargin(true); ajouterBacToView(formBacLayout, MainUI.getCurrent().getEtudiant().getListeBac().get(0)); } panelBac.setContent(formBacLayout); } HorizontalLayout bacGlobalLayout = new HorizontalLayout(); bacGlobalLayout.setSizeUndefined(); bacGlobalLayout.setStyleName("itembox"); bacGlobalLayout.addComponent(panelBac); bacGlobalLayout.setExpandRatio(panelBac, 1); idLayout.addComponent(bacGlobalLayout); /* Info de contact */ panelContact = new Panel(applicationContext.getMessage(NAME + ".contact.title", null, getLocale())); renseignerPanelContact(); globalLayout.addComponent(panelContact); addComponent(globalLayout); } else { /* Erreur */ addComponent(new BasicErreurMessageLayout(applicationContext)); } } }