List of usage examples for com.vaadin.ui ComboBox setTextInputAllowed
public void setTextInputAllowed(boolean textInputAllowed)
From source file:de.kaiserpfalzEdv.vaadin.LayoutHelper.java
License:Apache License
public <T> ComboBox createJpaComboBox(final EntityManager em, final Class<?> clasz, final String displayColumn, final String caption, final int tabIndex, final int startColumn, final int startRow, final int endColumn, final int endRow) { JPAContainer<T> data = createJpaContainer(em, clasz, displayColumn); ComboBox result = new ComboBox(i18n.get(caption), data); result.setInputPrompt(i18n.get(caption + ".prompt")); result.setScrollToSelectedItem(true); result.setItemCaptionPropertyId(displayColumn); result.setTextInputAllowed(true); result.setConverter(new SingleSelectConverter<Long>(result)); addToLayout(result, tabIndex, startColumn, startRow, endColumn, endRow); return result; }
From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java
License:Apache License
protected ComboBox createDropdownSelect(final String i18nBase, final String displayName, final int tabIndex, final Class<? extends BaseEntity> clasz) { ComboBox result = createComboBox(i18nBase, displayName, tabIndex, clasz); result.setTextInputAllowed(false); return result; }
From source file:dhbw.clippinggorilla.userinterface.views.ClippingView.java
public ClippingView(Clipping clipping) { User user = UserUtils.getCurrent();//from w w w . j av a 2s . c om clippingArticlesLayout = new VerticalLayout(); clippingArticlesLayout.setSpacing(true); clippingArticlesLayout.setMargin(false); clippingArticlesLayout.setSizeFull(); HorizontalLayout clippingOptionsLayout = new HorizontalLayout(); clippingOptionsLayout.setSpacing(true); clippingOptionsLayout.setMargin(false); clippingOptionsLayout.setWidth("100%"); ComboBox<SortOptions> comboBoxSortOptions = new ComboBox<>(Language.get(Word.SORT_BY)); Language.setCustom(Word.SORT_BY, s -> { comboBoxSortOptions.setCaption(s); comboBoxSortOptions.getDataProvider().refreshAll(); }); comboBoxSortOptions.setItems(EnumSet.allOf(SortOptions.class)); comboBoxSortOptions.setItemCaptionGenerator(s -> s.getName()); comboBoxSortOptions.setItemIconGenerator(s -> s.getIcon()); comboBoxSortOptions.setValue(SortOptions.BYPROFILE); comboBoxSortOptions.setTextInputAllowed(false); comboBoxSortOptions.setEmptySelectionAllowed(false); comboBoxSortOptions.addStyleName("comboboxsort"); comboBoxSortOptions.addValueChangeListener(e -> { switch (e.getValue()) { case BYDATE: createClippingViewByDate(clipping); break; case BYPROFILE: createClippingViewByProfile(clipping); break; case BYSOURCE: createClippingViewBySource(clipping); break; } }); Button buttonRegenerateClipping = new Button(VaadinIcons.REFRESH); buttonRegenerateClipping.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonRegenerateClipping.addClickListener(ce -> { user.setLastClipping(ClippingUtils.generateClipping(user, false)); ClippingGorillaUI.getCurrent().setMainContent(ClippingView.getCurrent()); }); clippingOptionsLayout.addComponents(comboBoxSortOptions, buttonRegenerateClipping); clippingOptionsLayout.setExpandRatio(comboBoxSortOptions, 5); clippingOptionsLayout.setComponentAlignment(buttonRegenerateClipping, Alignment.BOTTOM_CENTER); addComponents(clippingOptionsLayout, clippingArticlesLayout); createClippingViewByProfile(clipping); if (clipping.getArticles().keySet().isEmpty() && clipping.getArticlesFromGroup().keySet().isEmpty()) { Label labelNoProfile = new Label(); Language.setCustom(Word.NO_PROFILE_PRESENT, s -> labelNoProfile.setValue(s)); labelNoProfile.addStyleName(ValoTheme.LABEL_H2); clippingArticlesLayout.addComponent(labelNoProfile); } }
From source file:dhbw.clippinggorilla.userinterface.views.FooterBar.java
public FooterBar() { setColumns(6);/* ww w . j a v a 2 s .c om*/ setRows(1); addStyleName("menubar"); setWidth("100%"); setHeightUndefined(); setColumnExpandRatio(4, 5); setSpacing(true); setMargin(true); Image logo = new Image(); try { logo.setSource(new FileResource(FileUtils.getFile("images/logo_small.png").toFile())); } catch (FileNotFoundException ex) { Log.error("Could not find logo!", ex); } logo.setHeight("100%"); addComponent(logo); setComponentAlignment(logo, Alignment.MIDDLE_CENTER); Button aboutUs = new Button(); Language.set(Word.ABOUT_US, aboutUs); aboutUs.addClickListener((ce) -> { ClippingGorillaUI.getCurrent().setMainContent(AboutUsView.getCurrent()); }); aboutUs.setIcon(VaadinIcons.USERS); aboutUs.addStyleName(ValoTheme.BUTTON_BORDERLESS); addComponent(aboutUs); setComponentAlignment(aboutUs, Alignment.MIDDLE_CENTER); Button docs = new Button(); Language.set(Word.DOCUMENTS, docs); docs.addClickListener(ce -> { ClippingGorillaUI.getCurrent().setMainContent(DocumentsView.getCurrent()); }); docs.setIcon(VaadinIcons.ARCHIVE); docs.addStyleName(ValoTheme.BUTTON_BORDERLESS); addComponent(docs); setComponentAlignment(docs, Alignment.MIDDLE_CENTER); Button impressum = new Button(); Language.set(Word.IMPRESSUM, impressum); impressum.addClickListener(ce -> { ClippingGorillaUI.getCurrent().setMainContent(ImpressumView.getCurrent()); }); impressum.setIcon(VaadinIcons.SCALE); impressum.addStyleName(ValoTheme.BUTTON_BORDERLESS); addComponent(impressum); setComponentAlignment(impressum, Alignment.MIDDLE_CENTER); Label spacing = new Label(); addComponent(spacing); setComponentAlignment(spacing, Alignment.MIDDLE_CENTER); ComboBox<Locale> languages = new ComboBox<>(null, Language.getAllLanguages().keySet()); languages.setItemCaptionGenerator(loc -> loc.getDisplayLanguage(loc)); if (!Language.getAllLanguages().containsKey(VaadinSession.getCurrent().getLocale())) { languages.setValue(Locale.ENGLISH); } else { languages.setValue(VaadinSession.getCurrent().getLocale()); } languages.setEmptySelectionAllowed(false); languages.setItemIconGenerator(FooterBar::getIcon); languages.addValueChangeListener( (HasValue.ValueChangeEvent<Locale> loc) -> Language.setLanguage(loc.getValue())); languages.setTextInputAllowed(false); addComponent(languages); setComponentAlignment(languages, Alignment.MIDDLE_CENTER); SESSIONS.put(VaadinSession.getCurrent(), this); }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
/** * If no value present, choose a empty string * * @param title/*from w ww . jav a2 s.c o m*/ * @param link * @param description * @param language * @param imageUrl * @return */ private Component getSecondStage(Source s) { Label header = new Label(Language.get(Word.SOURCE)); header.addStyleName(ValoTheme.LABEL_H1); FormLayout forms = new FormLayout(); forms.setSizeFull(); TextField textFieldId = new TextField(Language.get(Word.ID)); textFieldId.setEnabled(false); textFieldId.setValue(s.getId()); textFieldId.setWidth("750px"); TextField textFieldName = new TextField(Language.get(Word.NAME)); textFieldName.setValue(s.getName()); textFieldName.setWidth("750px"); TextField textFieldDescription = new TextField(Language.get(Word.DESCRIPTION)); textFieldDescription.setValue(s.getDescription()); textFieldDescription.setWidth("750px"); TextField textFieldURL = new TextField(Language.get(Word.URL)); if (s.getUrl() != null) { textFieldURL.setValue(s.getUrl().toExternalForm()); } textFieldURL.setWidth("750px"); ComboBox<Category> comboBoxCategories = new ComboBox<>(Language.get(Word.CATEGORY), EnumSet.allOf(Category.class)); comboBoxCategories.setItemCaptionGenerator(c -> c.getName()); comboBoxCategories.setItemIconGenerator(c -> c.getIcon()); comboBoxCategories.setEmptySelectionAllowed(false); comboBoxCategories.setTextInputAllowed(false); comboBoxCategories.setWidth("375px"); if (s.getCategory() != null) { comboBoxCategories.setSelectedItem(s.getCategory()); } ComboBox<Locale> comboBoxLanguage = new ComboBox<>(Language.get(Word.LANGUAGE), getLanguages()); comboBoxLanguage.setItemCaptionGenerator(l -> l.getDisplayLanguage(VaadinSession.getCurrent().getLocale())); comboBoxLanguage.setEmptySelectionAllowed(false); comboBoxLanguage.setWidth("375px"); if (!s.getLanguage().isEmpty()) { Locale selected = new Locale(s.getLanguage()); comboBoxLanguage.setSelectedItem(selected); } Locale loc = VaadinSession.getCurrent().getLocale(); Map<String, Locale> countries = getCountries(); List<Locale> locales = countries.values().parallelStream() .sorted((l1, l2) -> l1.getDisplayCountry(loc).compareTo(l2.getDisplayCountry(loc))) .collect(Collectors.toList()); ComboBox<Locale> comboBoxCountry = new ComboBox<>(Language.get(Word.COUNTRY), locales); comboBoxCountry.setItemCaptionGenerator(l -> l.getDisplayCountry(VaadinSession.getCurrent().getLocale())); comboBoxCountry.setItemIconGenerator(l -> FamFamFlags.fromLocale(l)); comboBoxCountry.setEmptySelectionAllowed(false); comboBoxCountry.setWidth("375px"); if (!s.getCountry().isEmpty()) { comboBoxCountry.setSelectedItem(countries.getOrDefault(s.getCountry(), Locale.ROOT)); } Image imageLogo = new Image(Language.get(Word.LOGO)); TextField textFieldLogo = new TextField(Language.get(Word.LOGO_URL)); if (s.getLogo() != null) { textFieldLogo.setValue(s.getLogo().toExternalForm()); imageLogo.setSource(new ExternalResource(s.getLogo())); } textFieldLogo.addValueChangeListener(ce -> imageLogo.setSource(new ExternalResource(ce.getValue()))); textFieldLogo.setWidth("750px"); if (imageLogo.getHeight() > 125) { imageLogo.setHeight("125px"); } forms.addComponents(textFieldId, textFieldName, textFieldDescription, textFieldURL, comboBoxCategories, comboBoxLanguage, comboBoxCountry, textFieldLogo, imageLogo); Runnable cancel = () -> close(); Runnable next = () -> validateSecondStage(s, textFieldId.getValue(), textFieldName.getValue(), textFieldURL.getValue(), textFieldDescription.getValue(), comboBoxCategories.getSelectedItem().orElse(null), comboBoxLanguage.getSelectedItem().orElse(Locale.ROOT), comboBoxCountry.getSelectedItem().orElse(Locale.ROOT), textFieldLogo.getValue()); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.addComponents(header, forms, getFooter(cancel, next)); windowLayout.setComponentAlignment(header, Alignment.MIDDLE_CENTER); return windowLayout; }
From source file:fi.semantum.strategia.widget.Meter.java
License:Open Source License
public static void manageMeters(final Main main, final Base base) { String currentTime = main.getUIState().time; boolean showYears = currentTime.equals(Property.AIKAVALI_KAIKKI); final Database database = main.getDatabase(); VerticalLayout content = new VerticalLayout(); content.setSizeFull();/*from w w w.jav a2 s . co m*/ content.setSpacing(true); final Table table = new Table(); table.setSelectable(true); table.setMultiSelect(true); table.addStyleName(ValoTheme.TABLE_SMALL); table.addStyleName(ValoTheme.TABLE_COMPACT); table.addContainerProperty("Mittari", Label.class, null); if (showYears) table.addContainerProperty("Vuosi", String.class, null); table.setWidth("100%"); table.setHeight("100%"); table.setNullSelectionAllowed(true); table.setEditable(false); table.setColumnExpandRatio("Mittari", 2.0f); if (showYears) table.setColumnExpandRatio("Vuosi", 0.0f); makeMeterTable(main, base, table); content.addComponent(table); content.setExpandRatio(table, 1.0f); abstract class MeterButtonListener implements Button.ClickListener { private static final long serialVersionUID = -6640950006518632633L; protected Meter getPossibleSelection() { Object selection = table.getValue(); Collection<?> selected = (Collection<?>) selection; if (selected.size() != 1) return null; return (Meter) selected.iterator().next(); } @SuppressWarnings("unchecked") protected Collection<Meter> getSelection() { return (Collection<Meter>) table.getValue(); } protected Map<Base, List<Meter>> getSelectionByParent(Database database) { return metersByParent(database, getSelection()); } } final Button removeMeters = new Button("Poista", new MeterButtonListener() { private static final long serialVersionUID = 2957964892664902859L; public void buttonClick(ClickEvent event) { for (Meter r : getSelection()) { Base owner = r.getOwner(database); if (owner != null) owner.removeMeter(r); } makeMeterTable(main, base, table); Updates.update(main, true); } }); removeMeters.addStyleName(ValoTheme.BUTTON_TINY); final Button moveUp = new Button("Siirr ylemms", new MeterButtonListener() { private static final long serialVersionUID = 8434251773337788784L; public void buttonClick(ClickEvent event) { Map<Base, List<Meter>> sel = getSelectionByParent(database); if (sel == null) return; for (Map.Entry<Base, List<Meter>> entry : sel.entrySet()) { entry.getKey().moveMetersUp(entry.getValue()); } makeMeterTable(main, base, table); Updates.update(main, true); } }); moveUp.addStyleName(ValoTheme.BUTTON_TINY); final Button moveDown = new Button("Siirr alemmas", new MeterButtonListener() { private static final long serialVersionUID = -5382367112305541842L; public void buttonClick(ClickEvent event) { for (Map.Entry<Base, List<Meter>> entry : getSelectionByParent(database).entrySet()) { entry.getKey().moveMetersDown(entry.getValue()); } makeMeterTable(main, base, table); Updates.update(main, true); } }); moveDown.addStyleName(ValoTheme.BUTTON_TINY); final Button modify = new Button("Mrit"); modify.addClickListener(new MeterButtonListener() { private static final long serialVersionUID = -7109999546516429095L; public void buttonClick(ClickEvent event) { Meter meter = getPossibleSelection(); if (meter == null) return; editMeter(main, base, meter); } }); modify.addStyleName(ValoTheme.BUTTON_TINY); final ComboBox indicatorSelect = new ComboBox(); indicatorSelect.setWidth("100%"); indicatorSelect.setNullSelectionAllowed(false); indicatorSelect.addStyleName(ValoTheme.COMBOBOX_TINY); indicatorSelect.setCaption("Mrittj"); final Strategiakartta map = database.getMap(base); // Indikaattorit for (Indicator i : map.getIndicators(database)) { MeterSpec spec = new MeterSpec(database, i); indicatorSelect.addItem(spec); indicatorSelect.select(spec); } // Enumeraatiot for (Datatype enu : Datatype.enumerate(database)) { if (enu instanceof EnumerationDatatype) { MeterSpec spec = new MeterSpec(database, enu); indicatorSelect.addItem(spec); indicatorSelect.select(spec); } } // Sisnrakennetut { MeterSpec spec = new MeterSpec(database, MeterSpec.IMPLEMENTATION); indicatorSelect.addItem(spec); indicatorSelect.select(spec); } indicatorSelect.setTextInputAllowed(false); final Button addMeter = new Button("Lis ptasolle", new Button.ClickListener() { private static final long serialVersionUID = -5178621686299637238L; public void buttonClick(ClickEvent event) { MeterSpec spec = (MeterSpec) indicatorSelect.getValue(); Object source = spec.getSource(); if (source instanceof Indicator) { Indicator ind = (Indicator) source; Meter.addIndicatorMeter(main, base, ind, Property.AIKAVALI_KAIKKI); } else if (source instanceof EnumerationDatatype) { EnumerationDatatype dt = (EnumerationDatatype) source; Indicator ind = Indicator.create(database, "Uusi " + dt.getId(database), dt); ind.update(main, base, dt.getDefaultValue(), false, "", "Alkuarvo"); ind.update(main, base, dt.getDefaultForecast(), true, "", "Alkuarvo"); Meter.addIndicatorMeter(main, base, ind, Property.AIKAVALI_KAIKKI); } makeMeterTable(main, base, table); Updates.update(main, true); } }); addMeter.addStyleName(ValoTheme.BUTTON_TINY); final Button addSubmeter = new Button("Lis valitun alle", new MeterButtonListener() { private static final long serialVersionUID = -1250285092312682737L; public void buttonClick(ClickEvent event) { Meter meter = getPossibleSelection(); if (meter == null) return; MeterSpec spec = (MeterSpec) indicatorSelect.getValue(); Object source = spec.getSource(); if (source instanceof Indicator) { Indicator ind = (Indicator) source; Meter.addIndicatorMeter(main, meter, ind, Property.AIKAVALI_KAIKKI); } else if (source instanceof EnumerationDatatype) { EnumerationDatatype dt = (EnumerationDatatype) source; Indicator ind = Indicator.create(database, "Uusi " + dt.getId(database), dt); ind.update(main, base, dt.getDefaultValue(), false, "", "Alkuarvo"); ind.update(main, base, dt.getDefaultForecast(), true, "", "Alkuarvo"); Meter.addIndicatorMeter(main, meter, ind, Property.AIKAVALI_KAIKKI); } makeMeterTable(main, base, table); Updates.update(main, true); } }); addSubmeter.addStyleName(ValoTheme.BUTTON_TINY); final Runnable setStates = new Runnable() { @Override public void run() { Object selection = table.getValue(); Collection<?> selected = (Collection<?>) selection; if (!selected.isEmpty()) { removeMeters.setEnabled(true); moveUp.setEnabled(true); moveDown.setEnabled(true); if (selected.size() == 1) { modify.setEnabled(true); addSubmeter.setEnabled(true); } else { addSubmeter.setEnabled(false); modify.setEnabled(false); } } else { moveUp.setEnabled(false); moveDown.setEnabled(false); removeMeters.setEnabled(false); addSubmeter.setEnabled(false); modify.setEnabled(false); } } }; table.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 6439090862804667322L; @Override public void valueChange(ValueChangeEvent event) { setStates.run(); } }); setStates.run(); HorizontalLayout hl2 = new HorizontalLayout(); hl2.setSpacing(true); hl2.setWidthUndefined(); hl2.addComponent(modify); hl2.setComponentAlignment(modify, Alignment.TOP_LEFT); hl2.setExpandRatio(modify, 0.0f); hl2.addComponent(removeMeters); hl2.setComponentAlignment(removeMeters, Alignment.TOP_LEFT); hl2.setExpandRatio(removeMeters, 0.0f); hl2.addComponent(moveUp); hl2.setComponentAlignment(moveUp, Alignment.TOP_LEFT); hl2.setExpandRatio(moveUp, 0.0f); hl2.addComponent(moveDown); hl2.setComponentAlignment(moveDown, Alignment.TOP_LEFT); hl2.setExpandRatio(moveDown, 0.0f); HorizontalLayout hl3 = new HorizontalLayout(); hl3.setSpacing(true); hl3.setWidth("100%"); hl3.addComponent(addMeter); hl3.setComponentAlignment(addMeter, Alignment.BOTTOM_LEFT); hl3.setExpandRatio(addMeter, 0.0f); hl3.addComponent(addSubmeter); hl3.setComponentAlignment(addSubmeter, Alignment.BOTTOM_LEFT); hl3.setExpandRatio(addSubmeter, 0.0f); hl3.addComponent(indicatorSelect); hl3.setComponentAlignment(indicatorSelect, Alignment.BOTTOM_LEFT); hl3.setExpandRatio(indicatorSelect, 1.0f); content.addComponent(hl2); content.setComponentAlignment(hl2, Alignment.MIDDLE_CENTER); content.setExpandRatio(hl2, 0.0f); content.addComponent(hl3); content.setComponentAlignment(hl3, Alignment.BOTTOM_LEFT); content.setExpandRatio(hl3, 0.0f); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(false); final Window dialog = Dialogs.makeDialog(main, "450px", "600px", "Hallitse mittareita", "Sulje", content, buttons); }
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/*from w ww . j a v a 2 s . c o m*/ 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.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 w w .ja va 2s. c om*/ 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.manager.AddNodeWindow.java
public AddNodeWindow(final Accumulo accumulo, final ExecutorService executorService, final Tracker tracker, final AccumuloClusterConfig accumuloClusterConfig, Set<EnvironmentContainerHost> nodes, final NodeType nodeType) { super("Add New Node"); setModal(true);/*from w w w . j ava 2 s. c o m*/ setWidth(650, Unit.PIXELS); setHeight(450, Unit.PIXELS); GridLayout content = new GridLayout(1, 3); content.setSizeFull(); content.setMargin(true); content.setSpacing(true); HorizontalLayout topContent = new HorizontalLayout(); topContent.setSpacing(true); content.addComponent(topContent); topContent.addComponent(new Label("Nodes:")); final ComboBox hadoopNodes = new ComboBox(); hadoopNodes.setId("HadoopNodesCb"); hadoopNodes.setImmediate(true); hadoopNodes.setTextInputAllowed(false); hadoopNodes.setNullSelectionAllowed(false); hadoopNodes.setRequired(true); hadoopNodes.setWidth(200, Unit.PIXELS); for (EnvironmentContainerHost node : nodes) { hadoopNodes.addItem(node); hadoopNodes.setItemCaption(node, node.getHostname()); } if (nodes.size() == 0) { return; } hadoopNodes.setValue(nodes.iterator().next()); topContent.addComponent(hadoopNodes); final Button addNodeBtn = new Button("Add"); addNodeBtn.setId("AddSelectedNode"); topContent.addComponent(addNodeBtn); final Button ok = new Button("Ok"); addNodeBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addNodeBtn.setEnabled(false); ok.setEnabled(false); showProgress(); EnvironmentContainerHost containerHost = (EnvironmentContainerHost) hadoopNodes.getValue(); final UUID trackID = accumulo.addNode(accumuloClusterConfig.getClusterName(), containerHost.getHostname(), nodeType); executorService.execute(new Runnable() { public void run() { while (track) { TrackerOperationView po = tracker.getTrackerOperation(AccumuloClusterConfig.PRODUCT_KEY, trackID); if (po != null) { setOutput(po.getDescription() + "\nState: " + po.getState() + "\nLogs:\n" + po.getLog()); if (po.getState() != OperationState.RUNNING) { hideProgress(); ok.setEnabled(true); break; } } else { setOutput("Product operation not found. Check logs"); break; } try { Thread.sleep(1000); } catch (InterruptedException ex) { break; } } } }); } }); outputTxtArea = new TextArea("Operation output"); outputTxtArea.setId("outputTxtArea"); outputTxtArea.setRows(13); outputTxtArea.setColumns(43); outputTxtArea.setImmediate(true); outputTxtArea.setWordwrap(true); content.addComponent(outputTxtArea); indicator = new Label(); indicator.setId("indicator"); indicator.setIcon(new ThemeResource("img/spinner.gif")); indicator.setContentMode(ContentMode.HTML); indicator.setHeight(11, Unit.PIXELS); indicator.setWidth(50, Unit.PIXELS); indicator.setVisible(false); ok.setId("btnOk"); ok.setStyleName("default"); ok.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { //close window track = false; close(); } }); HorizontalLayout bottomContent = new HorizontalLayout(); bottomContent.addComponent(indicator); bottomContent.setComponentAlignment(indicator, Alignment.MIDDLE_RIGHT); bottomContent.addComponent(ok); content.addComponent(bottomContent); content.setComponentAlignment(bottomContent, Alignment.MIDDLE_RIGHT); setContent(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 ww w. ja v a2s . co m combo.setTextInputAllowed(false); combo.setRequired(true); combo.setNullSelectionAllowed(false); return combo; }