List of usage examples for com.vaadin.ui ComboBox ComboBox
protected ComboBox(DataCommunicator<T> dataCommunicator)
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 www. j av a 2 s. c om*/ //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.DestinationControl.java
public DestinationControl() { setCaption("Push Patient Resources to other Entities"); session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes(); final VerticalComponentGroup content = new VerticalComponentGroup(); final ComboBox baseURLCBX = new ComboBox("Destination"); baseURLCBX.addItem("42CFRPart2"); baseURLCBX.addItem("Military Health Systems"); baseURLCBX.addItem("Tricare"); baseURLCBX.addItem("Dept. of Veterans Affairs"); baseURLCBX.addItem("HHS ONC - Health Infomation Exchange(HIE)"); baseURLCBX.addItem("FHIR/VA - Health Information Exchange (HIE)"); baseURLCBX.setTextInputAllowed(false); baseURLCBX.addValueChangeListener(new ComboBox.ValueChangeListener() { @Override/* w ww . j ava 2 s . c om*/ public void valueChange(Property.ValueChangeEvent event) { String caption = (String) baseURLCBX.getValue(); String newURL = getEndpoint(caption); session.setTransmitURL(newURL); setTabDisplayName(caption); System.out.println("BASEURL: " + newURL); } }); baseURLCBX.setImmediate(true); content.addComponent(baseURLCBX); final Button submitButton = new Button("Transmit Immunizations"); submitButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (session.getTransmitURL().equals(session.getBaseURL())) { Notification.show("Source and Destination Cannot Be Same", Notification.Type.ERROR_MESSAGE); } else { session.getPofPatient().copyToHIE(session.getContext(), session.getTransmitURL()); } } }); submitButton.setImmediate(true); setContent(new CssLayout(content, submitButton)); }
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);// ww w . j a va 2 s . c om //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:gov.va.ehtac.appsonfhir.ui.Settings.java
public Settings() { setCaption("Resource Server Selection"); session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes(); final VerticalComponentGroup content = new VerticalComponentGroup(); final ComboBox baseURLCBX = new ComboBox("Resource Server"); baseURLCBX.addItem("42CFRPart2"); baseURLCBX.addItem("Military Health Systems"); baseURLCBX.addItem("Tricare"); baseURLCBX.addItem("Dept. of Veterans Affairs"); baseURLCBX.addItem("HHS ONC - Health Infomation Exchange(HIE)"); baseURLCBX.addItem("FHIR/VA - Health Information Exchange (HIE)"); baseURLCBX.setTextInputAllowed(false); baseURLCBX.addValueChangeListener(new ComboBox.ValueChangeListener() { @Override/*from w ww . ja v a 2 s.c o m*/ public void valueChange(Property.ValueChangeEvent event) { String caption = (String) baseURLCBX.getValue(); String newURL = getEndpoint(caption); ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes().setBaseURL(newURL); setTabDisplayName(caption); System.out.println("BASEURL: " + newURL); } }); baseURLCBX.setImmediate(true); content.addComponent(baseURLCBX); setContent(new CssLayout(content)); }
From source file:io.subutai.plugin.accumulo.ui.wizard.ConfigurationStep.java
public static ComboBox getCombo(String title) { ComboBox combo = new ComboBox(title); combo.setImmediate(true);//from w ww . ja v a 2 s .co m combo.setTextInputAllowed(false); combo.setRequired(true); combo.setNullSelectionAllowed(false); return combo; }
From source file:it.vige.greenarea.bpm.custom.ui.form.ElencoMissioniFormPropertyRenderer.java
License:Apache License
@SuppressWarnings("unchecked") @Override/* w w w.j a va 2s .c o m*/ public Field getPropertyField(FormProperty formProperty) { ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty)); comboBox.setRequired(formProperty.isRequired()); comboBox.setRequiredError(getMessage(FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); comboBox.setEnabled(formProperty.isWritable()); comboBox.setNullSelectionAllowed(false); Object itemToSelect = null; Map<String, String> values = (Map<String, String>) formProperty.getType().getInformation("values"); String user = ((LoggedInUser) get().getUser()).getId(); if (values != null) { for (Entry<String, String> enumEntry : values.entrySet()) { if (isUser(enumEntry.getKey(), user)) { comboBox.addItem(enumEntry.getKey()); String selectedValue = formProperty.getValue(); if ((selectedValue != null && selectedValue.equals(enumEntry.getKey())) || itemToSelect == null) { itemToSelect = enumEntry.getKey(); // select first // element } if (enumEntry.getValue() != null) { String key = enumEntry.getKey(); comboBox.setItemCaption(key, enumEntry.getValue()); } } } } // Select first element if (itemToSelect != null) { comboBox.select(itemToSelect); } if (formProperty.getId().contains(OPERAZIONE)) comboBox.setVisible(false); return comboBox; }
From source file:it.vige.greenarea.bpm.custom.ui.form.ElencoMissioniStFormPropertyRenderer.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from w ww .j a v a2 s . com public Field getPropertyField(FormProperty formProperty) { ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty)); comboBox.setRequired(formProperty.isRequired()); comboBox.setRequiredError(getMessage(FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); comboBox.setEnabled(formProperty.isWritable()); comboBox.setNullSelectionAllowed(false); Object itemToSelect = null; Map<String, String> values = (Map<String, String>) formProperty.getType().getInformation("values"); String user = ((LoggedInUser) get().getUser()).getId(); if (values != null) { if (!formProperty.isRequired()) { comboBox.addItem(""); comboBox.setItemCaption("", ""); } for (Entry<String, String> enumEntry : values.entrySet()) { if (isUser(enumEntry.getKey(), user)) { comboBox.addItem(enumEntry.getKey()); String selectedValue = formProperty.getValue(); if ((selectedValue != null && selectedValue.equals(enumEntry.getKey())) || itemToSelect == null) { if (!formProperty.isRequired()) itemToSelect = ""; else itemToSelect = enumEntry.getKey(); // select first // element } if (enumEntry.getValue() != null) { String key = enumEntry.getKey(); comboBox.setItemCaption(key, enumEntry.getValue()); } } } } // Select first element if (itemToSelect != null) { comboBox.select(itemToSelect); } if (formProperty.getId().contains(OPERAZIONE)) comboBox.setVisible(false); return comboBox; }
From source file:it.vige.greenarea.bpm.custom.ui.form.EnumFormPropertyRenderer.java
License:Apache License
@SuppressWarnings("unchecked") @Override// w w w . j a va2 s .co m public Field getPropertyField(FormProperty formProperty) { ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty)); comboBox.setRequired(formProperty.isRequired()); comboBox.setRequiredError(getMessage(FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); comboBox.setEnabled(formProperty.isWritable()); comboBox.setNullSelectionAllowed(false); Object itemToSelect = null; Map<String, String> values = (Map<String, String>) formProperty.getType().getInformation("values"); if (values != null) { for (Entry<String, String> enumEntry : values.entrySet()) { // Add value and label (if any) comboBox.addItem(enumEntry.getKey()); String selectedValue = formProperty.getValue(); if ((selectedValue != null && selectedValue.equals(enumEntry.getKey())) || itemToSelect == null) { itemToSelect = enumEntry.getKey(); // select first // element } if (enumEntry.getValue() != null) { comboBox.setItemCaption(enumEntry.getKey(), enumEntry.getValue()); } } } // Select first element if (itemToSelect != null) { comboBox.select(itemToSelect); } if (formProperty.getId().contains(OPERAZIONE)) comboBox.setVisible(false); return comboBox; }
From source file:it.vige.greenarea.bpm.custom.ui.form.OperatoreLogisticoFormPropertyRenderer.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from ww w . j a v a2 s . co m public Field getPropertyField(FormProperty formProperty) { I18nManager i18nManager = get().getI18nManager(); ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty)); comboBox.setRequired(formProperty.isRequired()); comboBox.setRequiredError(getMessage(FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); comboBox.setEnabled(formProperty.isWritable()); comboBox.setNullSelectionAllowed(false); Object itemToSelect = null; Map<String, String> values = (Map<String, String>) formProperty.getType().getInformation("values"); if (values != null) { for (Entry<String, String> enumEntry : values.entrySet()) { // Add value and label (if any) comboBox.addItem(enumEntry.getKey()); String selectedValue = formProperty.getValue(); if ((selectedValue != null && selectedValue.equals(enumEntry.getKey())) || itemToSelect == null) { itemToSelect = enumEntry.getKey(); // select first // element } if (enumEntry.getValue() != null) { String key = enumEntry.getKey(); if (key.equals(Selezione.TUTTI.name())) comboBox.setItemCaption(key, i18nManager.getMessage(TUTTI)); else comboBox.setItemCaption(key, enumEntry.getValue()); } } } // Select first element if (itemToSelect != null) { comboBox.select(itemToSelect); } if (formProperty.getId().contains(OPERAZIONE)) comboBox.setVisible(false); return comboBox; }
From source file:it.vige.greenarea.bpm.custom.ui.form.TargaStFormPropertyRenderer.java
License:Apache License
@SuppressWarnings("unchecked") @Override//w ww. j a va 2s .co m public Field getPropertyField(FormProperty formProperty) { ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty)); comboBox.setRequired(formProperty.isRequired()); comboBox.setRequiredError(getMessage(FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); comboBox.setEnabled(formProperty.isWritable()); comboBox.setNullSelectionAllowed(false); Object itemToSelect = null; Map<Veicolo, String> values = (Map<Veicolo, String>) formProperty.getType().getInformation("values"); String user = ((LoggedInUser) get().getUser()).getId(); if (values != null) { if (!formProperty.isRequired()) comboBox.addItem(""); if (itemToSelect == null) itemToSelect = ""; for (Entry<Veicolo, String> enumEntry : values.entrySet()) { if (isUser(enumEntry.getKey(), user)) { // Add value and label (if any) comboBox.addItem(enumEntry.getKey().getTarga()); String selectedValue = formProperty.getValue(); if ((selectedValue != null && selectedValue.equals(enumEntry.getKey()))) { itemToSelect = enumEntry.getKey().getTarga(); // select // first // element } if (enumEntry.getValue() != null) { Veicolo key = enumEntry.getKey(); comboBox.setItemCaption(key.getTarga(), enumEntry.getValue()); } } } } // Select first element if (itemToSelect != null) { comboBox.select(itemToSelect); } if (formProperty.getId().contains(OPERAZIONE)) comboBox.setVisible(false); return comboBox; }