List of usage examples for com.vaadin.ui ComboBox ComboBox
protected ComboBox(DataCommunicator<T> dataCommunicator)
From source file:adminviews.MCCView.java
License:Open Source License
public MCCView(IOpenBisClient openbis, OpenbisCreationController creationController, String user) { this.openbis = openbis; this.creator = creationController; this.user = user; this.cases = new HashSet<String>(); this.patients = new ArrayList<String>(); mccProjects = new ComboBox("Source Project"); List<String> projects = new ArrayList<String>(); for (Project p : openbis.getProjectsOfSpace(mccSpace)) projects.add(p.getCode());/*from w ww.j a v a2 s . c o m*/ mccProjects.addStyleName(Styles.boxTheme); mccProjects.addItems(projects); mccProjects.setImmediate(true); newProject = new StandardTextField("New Project"); newProject.setImmediate(true); newProject.setWidth("80px"); HorizontalLayout projectTab = new HorizontalLayout(); projectTab.setSpacing(true); projectTab.addComponent(mccProjects); projectTab.addComponent(newProject); treatment = new StandardTextField("Treatment"); timepoint = new StandardTextField("Timepoint"); timepoint.setWidth("40px"); patient = new StandardTextField("Patient #"); patient.setWidth("50px"); HorizontalLayout paramTab = new HorizontalLayout(); paramTab.setSpacing(true); paramTab.addComponent(treatment); paramTab.addComponent(patient); paramTab.addComponent(timepoint); existingPatients = new Table("Existing Patients"); existingPatients.setStyleName(Styles.tableTheme); existingPatients.setPageLength(1); editView = new TabSheet(); editView.addStyleName(ValoTheme.TABSHEET_FRAMED); samples = new Table("Samples"); samples.setStyleName(Styles.tableTheme); samples.setPageLength(1); metaData = new Table(); metaData.setEditable(true); metaData.setStyleName(Styles.tableTheme); editView.addTab(samples, "Overview"); editView.addTab(metaData, "Change Metadata"); editView.setVisible(false); registerInfo = new Label(); bar = new ProgressBar(); addSamples = new Button("Add Samples"); addSamples.setEnabled(false); initMCCListeners(); addComponent(Styles.questionize(projectTab, "Samples can only be added if Timepoint, Treatment, Project and Patient Number " + "are filled in and they don't already exist in the current project. E.g. you can add a new timepoint for the same patient and " + "treatment but not the same timepoint.", "Adding new Samples")); addComponent(paramTab); addComponent(existingPatients); addComponent(editView); addComponent(registerInfo); addComponent(bar); addComponent(addSamples); }
From source file:annis.gui.controlpanel.ExportPanel.java
License:Apache License
public ExportPanel(QueryPanel queryPanel, CorpusListPanel corpusListPanel) { this.queryPanel = queryPanel; this.corpusListPanel = corpusListPanel; setWidth("99%"); setHeight("-1px"); addStyleName("contextsensible-formlayout"); initHelpMessages();//from www . j a v a2 s . c o m cbExporter = new ComboBox("Exporter"); cbExporter.setNewItemsAllowed(false); cbExporter.setNullSelectionAllowed(false); cbExporter.setImmediate(true); exporterMap = new HashMap<String, Exporter>(); for (Exporter e : EXPORTER) { String name = e.getClass().getSimpleName(); exporterMap.put(name, e); cbExporter.addItem(name); } cbExporter.setValue(EXPORTER[0].getClass().getSimpleName()); cbExporter.addListener(new ExporterSelectionHelpListener()); cbExporter.setDescription(help4Exporter.get((String) cbExporter.getValue())); addComponent(new HelpButton(cbExporter)); cbLeftContext = new ComboBox("Left Context"); cbRightContext = new ComboBox("Right Context"); cbLeftContext.setNullSelectionAllowed(false); cbRightContext.setNullSelectionAllowed(false); cbLeftContext.setNewItemsAllowed(true); cbRightContext.setNewItemsAllowed(true); cbLeftContext.addValidator(new IntegerValidator("must be a number")); cbRightContext.addValidator(new IntegerValidator("must be a number")); for (String s : SearchOptionsPanel.PREDEFINED_CONTEXTS) { cbLeftContext.addItem(s); cbRightContext.addItem(s); } cbLeftContext.setValue("5"); cbRightContext.setValue("5"); addComponent(cbLeftContext); addComponent(cbRightContext); txtParameters = new TextField("Parameters"); txtParameters.setDescription( "You can input special parameters " + "for certain exporters. See the description of each exporter " + "(? button above) for specific parameter settings."); addComponent(new HelpButton(txtParameters)); btExport = new Button("Perform Export"); btExport.setIcon(new ThemeResource("tango-icons/16x16/media-playback-start.png")); btExport.setDisableOnClick(true); btExport.addClickListener((Button.ClickListener) this); btDownload = new Button("Download"); btDownload.setDescription("Click here to start the actual download."); btDownload.setIcon(new ThemeResource("tango-icons/16x16/document-save.png")); btDownload.setDisableOnClick(true); btDownload.setEnabled(false); HorizontalLayout layoutExportButtons = new HorizontalLayout(btExport, btDownload); addComponent(layoutExportButtons); progressIndicator = new ProgressIndicator(); progressIndicator.setEnabled(false); progressIndicator.setIndeterminate(true); addComponent(progressIndicator); }
From source file:annis.gui.ExportPanel.java
License:Apache License
public ExportPanel(QueryPanel queryPanel, QueryController controller, QueryUIState state) { super(2, 3);//w w w. jav a 2 s . c o m this.queryPanel = queryPanel; this.controller = controller; this.state = state; this.eventBus = new EventBus(); this.eventBus.register(ExportPanel.this); this.formLayout = new FormLayout(); formLayout.setWidth("-1px"); setWidth("99%"); setHeight("-1px"); initHelpMessages(); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 1.0f); cbExporter = new ComboBox("Exporter"); cbExporter.setNewItemsAllowed(false); cbExporter.setNullSelectionAllowed(false); cbExporter.setImmediate(true); for (Exporter e : SearchView.EXPORTER) { cbExporter.addItem(e.getClass().getSimpleName()); } cbExporter.setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); cbExporter.addValueChangeListener(new ExporterSelectionHelpListener()); formLayout.addComponent(cbExporter); addComponent(formLayout, 0, 0); lblHelp = new Label(help4Exporter.get((String) cbExporter.getValue())); lblHelp.setContentMode(ContentMode.HTML); addComponent(lblHelp, 1, 0); cbLeftContext = new ComboBox("Left Context"); cbRightContext = new ComboBox("Right Context"); cbLeftContext.setNullSelectionAllowed(false); cbRightContext.setNullSelectionAllowed(false); cbLeftContext.setNewItemsAllowed(true); cbRightContext.setNewItemsAllowed(true); cbLeftContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); cbRightContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); for (Integer i : SearchOptionsPanel.PREDEFINED_CONTEXTS) { cbLeftContext.addItem(i); cbRightContext.addItem(i); } cbLeftContext.setValue(5); cbRightContext.setValue(5); formLayout.addComponent(cbLeftContext); formLayout.addComponent(cbRightContext); txtAnnotationKeys = new TextField("Annotation Keys"); txtAnnotationKeys.setDescription("Some exporters will use this comma " + "seperated list of annotation keys to limit the exported data to these " + "annotations."); formLayout.addComponent(new HelpButton(txtAnnotationKeys)); txtParameters = new TextField("Parameters"); txtParameters.setDescription( "You can input special parameters " + "for certain exporters. See the description of each exporter " + "(? button above) for specific parameter settings."); formLayout.addComponent(new HelpButton(txtParameters)); btExport = new Button("Perform Export"); btExport.setIcon(FontAwesome.PLAY); btExport.setDisableOnClick(true); btExport.addClickListener(new ExportButtonListener()); btCancel = new Button("Cancel Export"); btCancel.setIcon(FontAwesome.TIMES_CIRCLE); btCancel.setEnabled(false); btCancel.addClickListener(new CancelButtonListener()); btCancel.setVisible(SearchView.EXPORTER[0].isCancelable()); btDownload = new Button("Download"); btDownload.setDescription("Click here to start the actual download."); btDownload.setIcon(FontAwesome.DOWNLOAD); btDownload.setDisableOnClick(true); btDownload.setEnabled(false); HorizontalLayout layoutExportButtons = new HorizontalLayout(btExport, btCancel, btDownload); addComponent(layoutExportButtons, 0, 1, 1, 1); VerticalLayout vLayout = new VerticalLayout(); addComponent(vLayout, 0, 2, 1, 2); progressBar = new ProgressBar(); progressBar.setVisible(false); progressBar.setIndeterminate(true); vLayout.addComponent(progressBar); progressLabel = new Label(); vLayout.addComponent(progressLabel); if (state != null) { cbLeftContext.setPropertyDataSource(state.getLeftContext()); cbRightContext.setPropertyDataSource(state.getRightContext()); cbExporter.setPropertyDataSource(state.getExporterName()); state.getExporterName().setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); txtAnnotationKeys.setConverter(new CommaSeperatedStringConverterList()); txtAnnotationKeys.setPropertyDataSource(state.getExportAnnotationKeys()); txtParameters.setPropertyDataSource(state.getExportParameters()); } }
From source file:at.jku.ce.adaptivetesting.topic.accounting.ProfitQuestion.java
License:LGPL
public ProfitQuestion(ProfitDataStorage solution, ProfitDataStorage prefilled, float difficulty, String questionText, String id) { // super(1, 2); this.difficulty = difficulty; this.id = id; answerSelector = new ComboBox("Whlen Sie die richtige Antwort:"); answerSelector.addItems((Object[]) ProfitPossibleAnswers.values()); answerSelector.setSizeFull();//from ww w .j ava2 s . co m answerSelector.setValue(prefilled.getValue()); answerSelector.setEnabled(prefilled.getValue() == null); question = new HtmlLabel(); setQuestionText(questionText); this.solution = solution; addComponent(question); addComponent(answerSelector); setSpacing(true); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
@Override public void startQuiz(StudentData student) { // Remove everything from the layout, save it for displaying after // clicking OK final Component[] components = new Component[getComponentCount()]; for (int i = 0; i < components.length; i++) { components[i] = getComponent(i); }//from www . j a v a 2s .c om removeAllComponents(); // Create first page VerticalLayout layout = new VerticalLayout(); addComponent(layout); ComboBox gender = new ComboBox("Geschlecht"); String[] genderItems = { "mnnlich", "weiblich" }; gender.addItems(genderItems); //gender.setSizeFull(); gender.setEnabled(true); Label gradeLastYear = new Label("<p/>Welche Note hattest du im letzten Zeugnis in ...", ContentMode.HTML); TextField gradeLastYearRW = new TextField("Rechungswesen"); TextField gradeLastYearBWL = new TextField("BWL/BVW"); TextField gradeLastYearD = new TextField("Deutsch"); TextField gradeLastYearE = new TextField("Englisch"); TextField gradeLastYearM = new TextField("Mathematik"); Label gradeLastTest = new Label("<p/>Welche Note hattest du auf die letzte Schularbeit aus ...", ContentMode.HTML); TextField gradeLastTestRW = new TextField("Rechungswesen"); TextField gradeLastTestBWL = new TextField("BWL/BVW"); TextField gradeLastTestD = new TextField("Deutsch"); TextField gradeLastTestE = new TextField("Englisch"); TextField gradeLastTestM = new TextField("Mathematik"); Label classNameLabel = new Label("<p/>Welche Klasse besuchst du?", ContentMode.HTML); TextField className = new TextField("(z.B. 4A)"); Label studentCode = new Label( "<p/>Damit deine Antworten mit spteren Fragebogenergebnissen verknpft werden knnen, ist es notwendig, einen anonymen Benutzernamen anzulegen. Erstelle deinen persnlichen Code nach folgendem Muster:", ContentMode.HTML); TextField studentCodeC1 = new TextField( "Tag und Monat der Geburt (DDMM), z.B. \"1008\" fr Geburtstag am 10. August"); TextField studentCodeC2 = new TextField( "Zwei Anfangsbuchstaben des Vornamens, z.B. \"St\" fr \"Stefan\""); TextField studentCodeC3 = new TextField( "Zwei Anfangsbuchstaben des Vornamens der Mutter,, z.B. \"Jo\" fr \"Johanna\""); Label thankYou = new Label("<p/>Danke fr die Angaben.<p/>", ContentMode.HTML); Button cont = new Button("Weiter", e -> { removeAllComponents(); studentIDCode = new String( studentCodeC1.getValue() + studentCodeC2.getValue() + studentCodeC3.getValue()); studentGender = (gender.getValue() == null) ? new String("undefined") : gender.getValue().toString(); studentClass = className.getValue(); studentGradesLastYear = new HashMap(); studentGradesLastYear.put("RW", gradeLastYearRW.getValue()); studentGradesLastYear.put("BWL", gradeLastYearBWL.getValue()); studentGradesLastYear.put("D", gradeLastYearD.getValue()); studentGradesLastYear.put("E", gradeLastYearE.getValue()); studentGradesLastYear.put("M", gradeLastYearM.getValue()); studentGradesLastTest = new HashMap(); studentGradesLastTest.put("RW", gradeLastTestRW.getValue()); studentGradesLastTest.put("BWL", gradeLastTestBWL.getValue()); studentGradesLastTest.put("D", gradeLastTestD.getValue()); studentGradesLastTest.put("E", gradeLastTestE.getValue()); studentGradesLastTest.put("M", gradeLastTestM.getValue()); this.student = new StudentData(studentIDCode, studentGender, studentClass, studentGradesLastYear, studentGradesLastTest); LogHelper.logInfo("StudentData: " + this.student.toString()); displayCompanyInfo(components); }); layout.addComponent(HtmlLabel.getCenteredLabel("h1", "Fragen zu deiner Person"));// Title of the quiz layout.addComponent(gender); layout.addComponent(gradeLastYear); layout.addComponent(gradeLastYearRW); layout.addComponent(gradeLastYearBWL); layout.addComponent(gradeLastYearD); layout.addComponent(gradeLastYearE); layout.addComponent(gradeLastYearM); layout.addComponent(gradeLastTest); layout.addComponent(gradeLastTestRW); layout.addComponent(gradeLastTestBWL); layout.addComponent(gradeLastTestD); layout.addComponent(gradeLastTestE); layout.addComponent(gradeLastTestM); layout.addComponent(classNameLabel); layout.addComponent(className); layout.addComponent(studentCode); layout.addComponent(studentCodeC1); layout.addComponent(studentCodeC2); layout.addComponent(studentCodeC3); layout.addComponent(thankYou); layout.addComponent(cont); layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingRecordInputFields.java
License:LGPL
public AccountingRecordInputFields(AccountRecordData data) { super(3, 1);/*from w w w.j a va 2 s . co m*/ AccountingDataProvider dataProvider = AccountingDataProvider.getInstance(); setSpacing(true); // Add AccountNumber accountNumberInputField = new AccountNumberInputField(); accountNumberInputField.setCaption("Erste zwei Stellen:"); accountNumberInputField.setWidth("3em"); addComponent(accountNumberInputField, 0, 0); // Add DD AccountNames ddAccountNames = new ComboBox("Kontenname:"); ddAccountNames.addItems((Object[]) AccountingDataProvider.getInstance().getAllAccountNames()); ddAccountNames.setWidth("20em"); addComponent(ddAccountNames, 1, 0); // Add Curreny field currencyTextBox = new CurrencyTextBox(); currencyTextBox.setCaption("Betrag ():"); currencyTextBox.setWidth("8em"); addComponent(currencyTextBox, 2, 0); // set default values from AccountRecordData if (data.accountName != null) { if (!dataProvider.containsString(data.accountName)) { Notification.show('"' + data.accountName + "\" ist kein zulssiger Kontenname", Type.WARNING_MESSAGE); } ddAccountNames.setValue(data.accountName); ddAccountNames.setEnabled(data.accountName == null || data.accountName.length() == 0); } if (data.accountNumber > 0) { if (!dataProvider.containsNumber(data.accountNumber)) { Notification.show('"' + data.accountNumber + "\" ist keine zulssige Kontennummer", Type.WARNING_MESSAGE); } accountNumberInputField.setValue(Integer.toString(data.accountNumber)); accountNumberInputField.setEnabled(false); } if (data.value >= 0.01f) { currencyTextBox.setValue(Float.toString(data.value)); currencyTextBox.setEnabled(false); } }
From source file:at.reisisoft.jku.ce.adaptivelearning.topic.accounting.ProfitQuestion.java
License:LGPL
public ProfitQuestion(ProfitDataStorage solution, ProfitDataStorage prefilled, float difficulty, String questionText) {//from w w w . j av a 2s . co m // super(1, 2); this.difficulty = difficulty; answerSelector = new ComboBox("Choose the right answer:"); answerSelector.addItems((Object[]) ProfitPossibleAnswers.values()); answerSelector.setSizeFull(); answerSelector.setValue(prefilled.getValue()); answerSelector.setEnabled(prefilled.getValue() == null); question = new HtmlLabel(); setQuestionText(questionText); this.solution = solution; addComponent(question); addComponent(answerSelector); setSpacing(true); }
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.topic.accounting.AccountingRecordInputFields.java
License:LGPL
public AccountingRecordInputFields(AccountRecordData data) { super(3, 1);// w w w . j av a 2 s .c om AccountingDataProvider dataProvider = AccountingDataProvider.getInstance(); setSpacing(true); // Add AccountNumber accountNumberInputField = new AccountNumberInputField(); accountNumberInputField.setCaption("First 2 digits:"); accountNumberInputField.setWidth("3em"); addComponent(accountNumberInputField, 0, 0); // Add DD AccountNames ddAccountNames = new ComboBox("Account name:"); ddAccountNames.addItems((Object[]) AccountingDataProvider.getInstance().getAllAccountNames()); ddAccountNames.setWidth("20em"); addComponent(ddAccountNames, 1, 0); // Add Curreny field currencyTextBox = new CurrencyTextBox(); currencyTextBox.setCaption("Figure ():"); currencyTextBox.setWidth("8em"); addComponent(currencyTextBox, 2, 0); // set default values from AccountRecordData if (data.accountName != null) { if (!dataProvider.containsString(data.accountName)) { Notification.show('"' + data.accountName + "\" is not a known account name", Type.WARNING_MESSAGE); } ddAccountNames.setValue(data.accountName); ddAccountNames.setEnabled(data.accountName == null || data.accountName.length() == 0); } if (data.accountNumber > 0) { if (!dataProvider.containsNumber(data.accountNumber)) { Notification.show('"' + data.accountNumber + "\" is not a known account number", Type.WARNING_MESSAGE); } accountNumberInputField.setValue(Integer.toString(data.accountNumber)); accountNumberInputField.setEnabled(false); } if (data.value >= 0.01f) { currencyTextBox.setValue(Float.toString(data.value)); currencyTextBox.setEnabled(false); } }
From source file:be.rvponp.build.CommitViewerUI.java
License:Apache License
private HorizontalLayout createFiltersLayout(Table table, VerticalLayout files, VerticalLayout filesLayout) { HorizontalLayout filtersLayout = new HorizontalLayout(); FormLayout formReleaseLayout = new FormLayout(); fromVersion = new ComboBox("From release"); toVersion = new ComboBox("To release"); filtersLayout.addComponent(formReleaseLayout); formReleaseLayout.setDescription("formReleaseLayout"); formReleaseLayout.addComponent(fromVersion); formReleaseLayout.addComponent(toVersion); formReleaseLayout.setSizeUndefined(); // FormLayout jiraTreeLayout = new FormLayout(); final Tree tree = createTreeComponent(); // jiraTreeLayout.addComponent(tree); filtersLayout.addComponent(tree);// w ww . j a v a 2s .com CheckBox jiraParsing = new CheckBox("Jira Parsing"); jiraParsing.setValue(true); // filtersLayout.addComponent(jiraParsing); FormLayout buttonsLayout = new FormLayout(); CompareButton compareButton = new CompareButton(fromVersion, toVersion, table, files, jiraParsing, tree, filesLayout); RefreshButton refreshButton = new RefreshButton(this, fromVersion, toVersion); // refreshButton.buttonClick(null); // compareButton.buttonClick(null); buttonsLayout.addComponent(refreshButton); buttonsLayout.addComponent(compareButton); buttonsLayout.setSizeUndefined(); filtersLayout.addComponent(buttonsLayout); filtersLayout.setSizeUndefined(); return filtersLayout; }
From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java
License:Open Source License
private ComboBox getComboBox(String caption, String bindName, Container container, boolean editable) { ComboBox comboBox = new ComboBox(caption); comboBox.setItemCaptionMode(ItemCaptionMode.PROPERTY); comboBox.setItemCaptionPropertyId("name"); comboBox.setContainerDataSource(container); comboBox.setImmediate(true);// ww w. ja v a 2s. c o m comboBox.setValidationVisible(false); comboBox.setNewItemsAllowed(false); comboBox.setFilteringMode(FilteringMode.CONTAINS); comboBox.setNullSelectionAllowed(false); fieldGroup.bind(comboBox, bindName); comboBox.setTextInputAllowed(editable); comboBox.setWidth("300px"); comboBox.select(container.getItemIds().iterator().next()); return comboBox; }