List of usage examples for com.vaadin.ui TextField setValue
@Override public void setValue(String value)
From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java
License:Open Source License
private TextField createTextField(String value, int taille) { TextField tf = new TextField(); tf.setValue(value); tf.setWidth(taille + "px"); tf.setNullRepresentation(""); tf.setImmediate(true);/*from ww w . j av a 2 s . c om*/ return tf; }
From source file:fr.amapj.view.engine.tools.TableBuilder.java
License:Open Source License
public TextField createTextField(String value, int taille) { TextField tf = new TextField(); tf.setValue(value); tf.setWidth(taille + "px"); tf.setNullRepresentation(""); tf.setImmediate(true);// www .ja va 2 s . c o m return tf; }
From source file:fr.amapj.view.views.advanced.devtools.DevToolsSelectionTable.java
License:Open Source License
private void addTest2() { // Titre/*w ww . j a va 2 s. c om*/ 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// w ww. ja v a 2 s .c om 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//ww w . j a va2 s . co 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.compte.MonCompteView.java
License:Open Source License
private void setValue(TextField tf, String val) { tf.setReadOnly(false);// w w w. j a va 2 s . co m tf.setValue(val); tf.setReadOnly(true); }
From source file:fr.amapj.view.views.sendmail.SendMailView.java
License:Open Source License
/** * //from w w w .j a va 2 s. com */ @Override public void enterIn(ViewChangeEvent event) { ParametresDTO param = new ParametresService().getParametres(); VerticalLayout layout = this; addLabel(layout, "Cet outil permet d'envoyer un mail une personne, ou tous les utilisateurs actifs."); addLabel(layout, "Cet outil permet de tester le bon fonctionnement de l'envoi des mails"); addLabel(layout, "Cet outil ne devrait pas tre utilis pour une communication rgulire avec les amapiens."); addEmptyLine(layout); TextField expediteur = addTextField(layout, "Expditeur du mail"); expediteur.setEnabled(false); expediteur.setValue(param.sendingMailUsername); titre = addTextField(layout, "Titre du mail"); destinataires = addTextField(layout, "Destinataire du mail"); zoneTexte = new RichTextArea("Message"); zoneTexte.setWidth("100%"); zoneTexte.setHeight("500px"); layout.addComponent(zoneTexte); addButton(layout, "Envoyer", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { handleEnvoyerMail(); } }); }
From source file:fr.ortec.dsi.pointage.presentation.ihm.view.TextFields.java
License:Apache License
public TextFields() { setMargin(true);/*from www . ja v a2 s . c om*/ setSpacing(true); Label h1 = new Label("Text Fields"); h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(row); TextField tf = new TextField("Normal"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Custom color"); tf.addStyleName("color1"); row.addComponent(tf); tf = new TextField("User Color"); tf.addStyleName("color2"); row.addComponent(tf); tf = new TextField("Themed"); tf.addStyleName("color3"); row.addComponent(tf); tf = new TextField("Error"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); row.addComponent(tf); tf = new TextField("Error, borderless"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); row.addComponent(tf); tf = new TextField("Small"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_SMALL); row.addComponent(tf); tf = new TextField("Large"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_LARGE); tf.setIcon(testIcon.get(true)); row.addComponent(tf); tf = new TextField(); tf.setValue("Font, no caption"); tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField(); tf.setValue("Image, no caption"); tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); CssLayout group = new CssLayout(); group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); row.addComponent(group); Button button = new Button("Do It"); // button.addStyleName(ValoTheme.BUTTON_PRIMARY); group.addComponent(button); tf = new TextField("Right-aligned"); tf.setValue("1,234"); tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT); row.addComponent(tf); tf = new TextField("Tiny"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_TINY); row.addComponent(tf); tf = new TextField("Huge"); tf.setValue("Field value"); tf.addStyleName(ValoTheme.TEXTFIELD_HUGE); row.addComponent(tf); h1 = new Label("Text Areas"); h1.addStyleName(ValoTheme.LABEL_H1); addComponent(h1); row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(row); RichTextArea rta = new RichTextArea(); rta.setValue("<b>Some</b> <i>rich</i> content"); row.addComponent(rta); rta = new RichTextArea("Read-only"); rta.setValue("<b>Some</b> <i>rich</i> content"); rta.setReadOnly(true); row.addComponent(rta); }
From source file:gov.va.ds4p.ds4pmobileportal.ui.ProfileView.java
License:Open Source License
private void buildView() { CssLayout content = new CssLayout(); content.setWidth("100%"); setCaption("Profile View"); VerticalComponentGroup vGroup = new VerticalComponentGroup(); profileAction = new Label( "<div style='color:#333;'><p>This screen allows the user to modify their <b>Data Segmentation for Privacy</b> " + "resource, sensitivity, purpose of use, and other privileges for test, and demonstration purposes.</d></div>", Label.CONTENT_XHTML); vGroup.addComponent(profileAction);//from ww w . ja v a2s . c o m //Label identityLBL = new Label("<b>Identity</b>", Label.CONTENT_XHTML); TextField providerIdFLD = new TextField("Provider ID/Email Address"); providerIdFLD.setEnabled(false); TextField userIdFLD = new TextField("User ID"); userIdFLD.setEnabled(false); PasswordField userpassFLD = new PasswordField("Password"); userpassFLD.setEnabled(false); providerIdFLD.setValue(AdminContext.getSessionAttributes().getProviderId()); userIdFLD.setValue(AdminContext.getSessionAttributes().getUserId()); userpassFLD.setValue("ds4p"); providerIdFLD.setWidth("400px"); userIdFLD.setWidth("400px"); userpassFLD.setWidth("400px"); VerticalComponentGroup vGroup2 = new VerticalComponentGroup(); vGroup2.setCaption("Identity"); //vGroup.addComponent(identityLBL); vGroup2.addComponent(providerIdFLD); vGroup2.addComponent(userIdFLD); vGroup2.addComponent(userpassFLD); //Label permissionsLBL = new Label("<b>Access Control Setting and Permissions</b>", Label.CONTENT_XHTML); pouCBX = new ComboBox("Current Purpose of Use"); NavigationButton resourceNavBTN = new NavigationButton("Resource Privileges"); confCBX = new ComboBox("Security Level"); NavigationButton sensitivityNavBTN = new NavigationButton("Sensitivity Privileges"); pouCBX.setWidth("400px"); confCBX.setWidth("400px"); pouCBX.setTextInputAllowed(false); confCBX.setTextInputAllowed(false); populateConfCBX(); populatePouCBX(); confCBX.setEnabled(false); VerticalComponentGroup vGroup3 = new VerticalComponentGroup(); vGroup3.setCaption("Use and Permission Settings"); //vGroup.addComponent(permissionsLBL); vGroup3.addComponent(pouCBX); vGroup3.addComponent(resourceNavBTN); vGroup3.addComponent(confCBX); vGroup3.addComponent(sensitivityNavBTN); pouCBX.setValue(AdminContext.getSessionAttributes().getPurposeOfUse()); confCBX.setValue(AdminContext.getSessionAttributes().getSecurityLevel()); //Label organizationLBL = new Label("<b>Organization Info</b>", Label.CONTENT_XHTML); TextField organizationFLD = new TextField("Organization"); TextField organizationUnitFLD = new TextField("Facility"); TextField organizationIdFLD = new TextField("Home Community"); organizationFLD.setValue("Dept. of Veterans Affairs"); organizationUnitFLD.setValue("Ft. Harrison VAMC"); organizationIdFLD.setValue("2.16.840.1.113883.4.349"); organizationFLD.setEnabled(false); organizationUnitFLD.setEnabled(false); organizationIdFLD.setEnabled(false); organizationFLD.setWidth("400px"); organizationUnitFLD.setWidth("400px"); organizationIdFLD.setWidth("400px"); VerticalComponentGroup vGroup4 = new VerticalComponentGroup(); vGroup4.setCaption("Organization Info"); //vGroup.addComponent(organizationLBL); vGroup4.addComponent(organizationFLD); vGroup4.addComponent(organizationUnitFLD); vGroup4.addComponent(organizationIdFLD); //Label locationLBL = new Label("<b>Location</b>", Label.CONTENT_XHTML); TextField cityFLD = new TextField("City"); TextField stateFLD = new TextField("State"); TextField zipFLD = new TextField("Zip Code"); TextField countryFLD = new TextField("Country"); //set defaults and disable cityFLD.setValue("Helena"); stateFLD.setValue("MT"); zipFLD.setValue("59601"); countryFLD.setValue("U.S.A"); cityFLD.setEnabled(false); stateFLD.setEnabled(false); zipFLD.setEnabled(false); countryFLD.setEnabled(false); cityFLD.setWidth("400px"); stateFLD.setWidth("400px"); zipFLD.setWidth("400px"); countryFLD.setWidth("400px"); VerticalComponentGroup vGroup5 = new VerticalComponentGroup(); vGroup5.setCaption("Location Info"); //vGroup.addComponent(locationLBL); vGroup5.addComponent(cityFLD); vGroup5.addComponent(stateFLD); vGroup5.addComponent(zipFLD); vGroup5.addComponent(countryFLD); pouCBX.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String val = (String) pouCBX.getValue(); AdminContext.getSessionAttributes().setPurposeOfUse(val); } }); confCBX.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String val = (String) confCBX.getValue(); AdminContext.getSessionAttributes().setSecurityLevel(val); } }); pouCBX.setImmediate(true); confCBX.setImmediate(true); content.addComponent(vGroup); content.addComponent(vGroup2); content.addComponent(vGroup3); content.addComponent(vGroup4); content.addComponent(vGroup5); setContent(content); }
From source file:gov.va.ehtac.appsonfhir.ui.ProfileView.java
License:Open Source License
private void buildView() { session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes(); CssLayout content = new CssLayout(); content.setWidth("100%"); setCaption("Profile View"); VerticalComponentGroup vGroup = new VerticalComponentGroup(); profileAction = new Label( "<div style='color:#333;'><p>This screen allows the user to modify their <b>Privacy on FHIR</b> " + "Purpose of Use, and Security Level for local Access Control Decisions.</d></div>", Label.CONTENT_XHTML); vGroup.addComponent(profileAction);/*from ww w.j av a2s . co m*/ //Label identityLBL = new Label("<b>Identity</b>", Label.CONTENT_XHTML); TextField providerIdFLD = new TextField("Provider ID/Email Address"); providerIdFLD.setEnabled(false); TextField userIdFLD = new TextField("User ID"); userIdFLD.setEnabled(false); PasswordField userpassFLD = new PasswordField("Password"); userpassFLD.setEnabled(false); providerIdFLD.setValue(session.getProviderId()); userIdFLD.setValue(session.getUserId()); userpassFLD.setValue("ds4p"); providerIdFLD.setWidth("400px"); userIdFLD.setWidth("400px"); userpassFLD.setWidth("400px"); VerticalComponentGroup vGroup2 = new VerticalComponentGroup(); vGroup2.setCaption("Identity"); //vGroup.addComponent(identityLBL); vGroup2.addComponent(providerIdFLD); vGroup2.addComponent(userIdFLD); vGroup2.addComponent(userpassFLD); //Label permissionsLBL = new Label("<b>Access Control Setting and Permissions</b>", Label.CONTENT_XHTML); pouCBX = new ComboBox("Current Purpose of Use"); NavigationButton resourceNavBTN = new NavigationButton("Resource Privileges"); confCBX = new ComboBox("Security Level"); NavigationButton sensitivityNavBTN = new NavigationButton("Sensitivity Privileges"); pouCBX.setWidth("400px"); confCBX.setWidth("400px"); pouCBX.setTextInputAllowed(false); confCBX.setTextInputAllowed(false); populateConfCBX(); populatePouCBX(); confCBX.setEnabled(true); VerticalComponentGroup vGroup3 = new VerticalComponentGroup(); vGroup3.setCaption("Use and Permission Settings"); //vGroup.addComponent(permissionsLBL); vGroup3.addComponent(pouCBX); vGroup3.addComponent(resourceNavBTN); vGroup3.addComponent(confCBX); vGroup3.addComponent(sensitivityNavBTN); pouCBX.setValue(session.getPurposeOfUse()); confCBX.setValue(session.getSecurityLevel()); //Label organizationLBL = new Label("<b>Organization Info</b>", Label.CONTENT_XHTML); TextField organizationFLD = new TextField("Organization"); TextField organizationUnitFLD = new TextField("Facility"); TextField organizationIdFLD = new TextField("Home Community"); organizationFLD.setValue("Military Health Systems"); organizationUnitFLD.setValue("Navy Medical Center San Diego - NMCSD"); organizationIdFLD.setValue("2.16.840.1.113883.4.349"); organizationFLD.setEnabled(false); organizationUnitFLD.setEnabled(false); organizationIdFLD.setEnabled(false); organizationFLD.setWidth("400px"); organizationUnitFLD.setWidth("400px"); organizationIdFLD.setWidth("400px"); VerticalComponentGroup vGroup4 = new VerticalComponentGroup(); vGroup4.setCaption("Organization Info"); //vGroup.addComponent(organizationLBL); vGroup4.addComponent(organizationFLD); vGroup4.addComponent(organizationUnitFLD); vGroup4.addComponent(organizationIdFLD); //Label locationLBL = new Label("<b>Location</b>", Label.CONTENT_XHTML); TextField cityFLD = new TextField("City"); TextField stateFLD = new TextField("State"); TextField zipFLD = new TextField("Zip Code"); TextField countryFLD = new TextField("Country"); //set defaults and disable cityFLD.setValue("San Diego"); stateFLD.setValue("CA"); zipFLD.setValue("92104"); countryFLD.setValue("U.S.A"); cityFLD.setEnabled(false); stateFLD.setEnabled(false); zipFLD.setEnabled(false); countryFLD.setEnabled(false); cityFLD.setWidth("400px"); stateFLD.setWidth("400px"); zipFLD.setWidth("400px"); countryFLD.setWidth("400px"); VerticalComponentGroup vGroup5 = new VerticalComponentGroup(); vGroup5.setCaption("Location Info"); //vGroup.addComponent(locationLBL); vGroup5.addComponent(cityFLD); vGroup5.addComponent(stateFLD); vGroup5.addComponent(zipFLD); vGroup5.addComponent(countryFLD); pouCBX.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String val = (String) pouCBX.getValue(); session.setPurposeOfUse(val); } }); confCBX.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String val = (String) confCBX.getValue(); session.setSecurityLevel(val); } }); pouCBX.setImmediate(true); confCBX.setImmediate(true); content.addComponent(vGroup); content.addComponent(vGroup2); content.addComponent(vGroup3); content.addComponent(vGroup4); content.addComponent(vGroup5); setContent(content); }