List of usage examples for com.vaadin.ui PasswordField PasswordField
public PasswordField(ValueChangeListener<String> valueChangeListener)
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);/*w w w . java 2 s. 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.ds4p.ds4pmobileportal.ui.SettingsView.java
License:Open Source License
private void buildView() { CssLayout content = new CssLayout(); content.setWidth("100%"); setCaption("Settings"); VerticalComponentGroup vGroup = new VerticalComponentGroup(); TextField username = new TextField("Username"); PasswordField password = new PasswordField("Password"); vGroup.addComponent(username);// w ww. j av a2s . c o m vGroup.addComponent(password); content.addComponent(vGroup); 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 w ww. j a va 2 s .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); }
From source file:gq.vaccum121.ui.LoginScreen.java
License:Apache License
private void initLayout() { FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();/* ww w . java 2 s . c o m*/ userName = new TextField("Username"); passwordField = new PasswordField("Password"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeUndefined(); loginFailedLabel = new Label(); loginLayout.addComponent(loginFailedLabel); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loggedOutLabel = new Label("Good bye!"); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); loggedOutLabel.setSizeUndefined(); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(rootLayout); setSizeFull(); }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * are el dilogo para autenticarse//from w ww. j a v a 2 s .com */ private void openLoginDialog(boolean gohome) { // Create a sub-window and set the content Window subWindow = new Window("Login"); subWindow.setWidth("375px"); FormLayout f = new FormLayout(); f.setMargin(true); TextField l; f.addComponent(l = new TextField("Username")); PasswordField p; f.addComponent(p = new PasswordField("Password")); Label e; f.addComponent(e = new Label()); VerticalLayout v = new VerticalLayout(); v.addComponent(f); HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); Label footerText = new Label(""); footerText.setSizeUndefined(); Button forgot = new Button("Forgot password", new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { e.setValue("Asking for email..."); io.mateu.ui.core.client.app.MateuUI.getBaseService().forgotPassword(l.getValue(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { e.setValue("" + caught.getClass().getName() + ": " + caught.getMessage()); } @Override public void onSuccess(Void result) { e.setValue("Email sent. Please check your inbox"); } }); } }); //forgot.addStyleName(ValoTheme.BUTTON_); Button ok = new Button("Login", new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { e.setValue("Authenticating..."); io.mateu.ui.core.client.app.MateuUI.getBaseService().authenticate(l.getValue(), p.getValue(), new AsyncCallback<UserData>() { @Override public void onFailure(Throwable caught) { e.setValue("" + caught.getClass().getName() + ": " + caught.getMessage()); } @Override public void onSuccess(UserData result) { e.setValue("OK!"); getApp().setUserData(result); VaadinSession.getCurrent().setAttribute("usuario", "admin"); subWindow.close(); if (MateuUI.getApp().isFavouritesAvailable()) linkFavoritos.setVisible(true); if (MateuUI.getApp().isLastEditedAvailable()) linkUltimosRegistros.setVisible(true); if (MateuUI.getApp().isFavouritesAvailable()) linkNuevoFavorito.setVisible(true); refreshSettings(); refreshMenu(null, null); System.out.println("STATE:" + navigator.getState()); System.out.println("URIFRAGMENT:" + Page.getCurrent().getUriFragment()); navigator.navigateTo((gohome) ? "" : navigator.getState()); } }); } }); ok.addStyleName(ValoTheme.BUTTON_PRIMARY); ok.setClickShortcut(ShortcutAction.KeyCode.ENTER); Button cancel = new Button("Cancel"); footer.addComponents(footerText, forgot, ok); //, cancel); footer.setExpandRatio(footerText, 1); v.addComponent(footer); subWindow.setContent(v); // Center it in the browser window subWindow.center(); subWindow.setModal(true); // Open it in the UI UI.getCurrent().addWindow(subWindow); l.focus(); }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * abre el dilogo para cambiar el password * *///w w w. j ava 2 s.co m private void changePassword() { // Create a sub-window and set the content Window subWindow = new Window("Change password"); subWindow.setWidth("375px"); FormLayout f = new FormLayout(); f.setMargin(true); PasswordField l; f.addComponent(l = new PasswordField("Current password")); PasswordField p; f.addComponent(p = new PasswordField("New password")); PasswordField p2; f.addComponent(p2 = new PasswordField("Repeat password")); Label e; f.addComponent(e = new Label()); VerticalLayout v = new VerticalLayout(); v.addComponent(f); HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); Label footerText = new Label(""); footerText.setSizeUndefined(); Button ok = new Button("Change it!", new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { if (l.getValue() == null || "".equals(l.getValue().trim())) e.setValue("Old password is required"); else if (p.getValue() == null || "".equals(p.getValue().trim())) e.setValue("New password is required"); else if (p2.getValue() == null || "".equals(p2.getValue().trim())) e.setValue("New password repeated is required"); else if (!p.getValue().equals(p2.getValue())) e.setValue("New password and new password repeated must be equal"); else { e.setValue("Changing password..."); io.mateu.ui.core.client.app.MateuUI.getBaseService().changePassword( getApp().getUserData().getLogin(), l.getValue(), p.getValue(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { e.setValue("" + caught.getClass().getName() + ": " + caught.getMessage()); } @Override public void onSuccess(Void result) { e.setValue("OK!"); subWindow.close(); } }); } } }); ok.addStyleName(ValoTheme.BUTTON_PRIMARY); ok.setClickShortcut(ShortcutAction.KeyCode.ENTER); Button cancel = new Button("Cancel"); footer.addComponents(footerText, ok); //, cancel); footer.setExpandRatio(footerText, 1); v.addComponent(footer); subWindow.setContent(v); // Center it in the browser window subWindow.center(); subWindow.setModal(true); // Open it in the UI UI.getCurrent().addWindow(subWindow); l.focus(); }
From source file:kn.uni.gis.ui.AdminWindow.java
License:Apache License
private Component loginComponent() { final VerticalLayout layout = new VerticalLayout(); final PasswordField passwordField = new PasswordField("Old Hunters Age"); passwordField.setWidth("-1px"); passwordField.setHeight("-1px"); passwordField.focus();//from w w w .ja v a2s .c o m Button button_2 = new Button(); button_2.setCaption("Login"); button_2.setImmediate(false); button_2.setWidth("-1px"); button_2.setHeight("-1px"); button_2.addListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (password.equals(passwordField.getValue())) { AdminWindow.this.removeComponent(layout); AdminWindow.this.addComponent(createTable()); } else { AdminWindow.this.showNotification("Wrong age!"); } } }); layout.addComponent(passwordField); layout.addComponent(button_2); layout.setComponentAlignment(passwordField, Alignment.TOP_CENTER); layout.setComponentAlignment(button_2, Alignment.BOTTOM_CENTER); return layout; }
From source file:lifetime.component.welcome.register.RegistrationForm.java
License:Apache License
public RegistrationForm(String language) { super();/* w w w . ja v a 2 s . co m*/ setSizeUndefined(); setMargin(true); setSpacing(true); Label text = new Label("Register"); setSpacing(true); text.setStyleName("login"); defaultLanguage = new LocalesComboBox(language); /* Creates the firstname text field and registers a validator */ firstname = new LifetimeTextField("Firstname"); // Creates text field firstname.addValidator(new NameValidator()); // Register Validator firstname.setValidationVisible(true); // Automatic validation firstname.setId(StyleClassName.REGISTRATION_FORM_FIRSTNAME.getId()); /* Creates lastnames text field and registers a validator */ lastname = new LifetimeTextField("Lastname"); lastname.addValidator(new NameValidator()); lastname.setValidationVisible(true); lastname.setRequired(true); lastname.setId(StyleClassName.REGISTRATION_FORM_LASTNAME.getId()); /* Creates email text field and registers a validator */ email = new LifetimeTextField("Email / Username"); email.addValidator(new EmailValidator("Invalid email address")); email.setValidationVisible(true); email.setId(StyleClassName.REGISTRATION_FORM_EMAIL.getId()); /* Creates password text field and registers a validator */ password = new PasswordField("Password"); password.addValidator(new PasswordValidator()); password.setId(StyleClassName.REGISTRATION_FORM_ENCRYPTED.getId()); passwordRepeat = new PasswordField("Repeat password"); passwordRepeat.setId(StyleClassName.REGISTRATION_FORM_ENCRYPTED_REPEAT.getId()); birthDate = new DateField("Birthdate"); birthDate.setLocale(new Locale(language)); birthDate.setId(StyleClassName.REGISTRATION_FORM_BIRTHDATE.getId()); // birthPlace = new LifetimeTextField("Birth place"); birthPlace.setId(StyleClassName.REGISTRATION_FORM_BIRTHPLACE.getId()); VerticalLayout personalData = new VerticalLayout(defaultLanguage, firstname, lastname, email, password, passwordRepeat); VerticalLayout birthData = new VerticalLayout(birthDate, birthPlace); birthData.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); addComponents(personalData, birthData); setStyleName(StyleClassName.REGISTRATION_FORM.getStyleName()); setId(StyleClassName.REGISTRATION_FORM.getId()); }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminLoginView.java
License:Open Source License
public AdminLoginView() { actAdmin.setActorUI(UI.getCurrent()); env.setActAdministrator(actAdmin.getName(), actAdmin); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctAdmin, actAdmin); log.debug("CHECK: ADMIN UI is " + actAdmin.getActorUI()); welcomeText = new Label("Please login to access iCrash Administrator Console"); hintText = new Label("(icrashadmin/7WXC1359)"); welcomeText.setSizeUndefined();//from w w w . j a va 2 s . c o m hintText.setSizeUndefined(); // create the username input field username = new TextField("Login:"); username.setWidth("120px"); username.setInputPrompt("Admin login"); username.setImmediate(true); // create the password input field password = new PasswordField("Password:"); password.setWidth("120px"); password.setValue(""); password.setNullRepresentation(""); password.setImmediate(true); // create the login button loginButton = new Button("Login", this); loginButton.setClickShortcut(KeyCode.ENTER); loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY); loginButton.setImmediate(true); /*********************************************************************************************/ Table adminMessagesTable = new Table(); adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource()); adminMessagesTable.setCaption("Administrator messages"); // adminMessagesTable.setVisibleColumns("inputEvent", "message"); /*********************************************************************************************/ FormLayout FL = new FormLayout(username, password, loginButton); VerticalLayout welcomeLayout = new VerticalLayout(welcomeText, /*hintText,*/ FL); VerticalLayout leftVL = new VerticalLayout(welcomeLayout); VerticalLayout rightVL = new VerticalLayout(adminMessagesTable); welcomeLayout.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER); // welcomeLayout.setComponentAlignment(hintText, Alignment.MIDDLE_CENTER); welcomeLayout.setComponentAlignment(FL, Alignment.MIDDLE_CENTER); setSizeFull(); FL.setSizeUndefined(); welcomeLayout.setSizeUndefined(); leftVL.setSizeFull(); rightVL.setSizeFull(); leftVL.setComponentAlignment(welcomeLayout, Alignment.MIDDLE_CENTER); rightVL.setComponentAlignment(adminMessagesTable, Alignment.MIDDLE_CENTER); addComponent(leftVL); addComponent(rightVL); setMargin(true); setExpandRatio(leftVL, 6); setExpandRatio(rightVL, 4); }
From source file:management.limbr.ui.entity.EntityEditorViewImpl.java
License:Open Source License
private Field<?> getUIField(java.lang.reflect.Field field) { String label = messages.get(field.getName() + "FieldLabel"); Password passwordAnnotation = field.getAnnotation(Password.class); if (passwordAnnotation != null) { return new PasswordField(label); } else if (field.getType().isEnum()) { ComboBox comboBox = new ComboBox(label); comboBox.setTextInputAllowed(false); comboBox.addItems(field.getType().getEnumConstants()); return comboBox; }//www . ja va2 s . co m return new TextField(label); }