List of usage examples for com.vaadin.ui TextField TextField
public TextField()
TextField
with no caption. From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPostAdd.java
/** * Constructor/*from w w w . j ava 2 s .co m*/ */ public ComponentPostAdd() { this.setSpacing(true); message.setWidth(100, Unit.PERCENTAGE); message.setHeight(100, Unit.PIXELS); message.setMaxLength(1000); tags = new HorizontalLayout(); tags.setSpacing(true); tags.setSizeUndefined(); newTag = new TextField(); newTag.setImmediate(true); OnEnterKeyHandler onEnterHandler = new OnEnterKeyHandler() { @Override public void onEnterKeyPressed() { CustomLayout tag = new CustomLayout("tag"); Button tagsButton = new Button(newTag.getValue()); taglist.add(tagsButton); newTag.setValue(""); newTag.focus(); tagsButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tags.removeComponent(event.getButton().getParent()); taglist.remove(event.getButton()); } }); tag.addComponent(tagsButton, "button"); tags.addComponent(tag); } }; onEnterHandler.installOn(newTag); }
From source file:de.catma.ui.analyzer.AnalyzerView.java
License:Open Source License
private Component createSearchPanel() { HorizontalLayout searchPanel = new HorizontalLayout(); searchPanel.setSpacing(true);//from ww w .j a va 2s. c o m searchPanel.setWidth("100%"); searchInput = new TextField(); searchInput.setCaption("Query"); searchInput.setWidth("100%"); searchInput.setImmediate(true); searchPanel.addComponent(searchInput); searchPanel.setExpandRatio(searchInput, 1.0f); btExecSearch = new Button("Execute Query"); searchPanel.addComponent(btExecSearch); searchPanel.setComponentAlignment(btExecSearch, Alignment.BOTTOM_CENTER); return searchPanel; }
From source file:de.catma.ui.analyzer.querybuilder.CollocPanel.java
License:Open Source License
private Component createSearchPanel() { VerticalLayout searchPanel = new VerticalLayout(); searchPanel.setSpacing(true);// w w w . ja va2 s.co m wordInput = new TextField(); wordInput.addValidator(new NonEmptySequenceValidator("This value cannot be empty!")); wordInput.setRequired(true); wordInput.setInvalidAllowed(false); searchPanel.addComponent(wordInput); collocInput = new TextField("that appear near"); collocInput.addValidator(new NonEmptySequenceValidator("This value cannot be empty!")); collocInput.setRequired(true); collocInput.setInvalidAllowed(false); searchPanel.addComponent(collocInput); spanSizeInput = new TextField("within a span of", "5"); spanSizeInput.addValidator(new IntegerValueValidator(false, false)); spanSizeInput.setRequired(true); spanSizeInput.setInvalidAllowed(false); searchPanel.addComponent(spanSizeInput); return searchPanel; }
From source file:de.catma.ui.analyzer.querybuilder.FreqPanel.java
License:Open Source License
private Component createSearchPanel() { HorizontalLayout searchPanel = new HorizontalLayout(); searchPanel.setMargin(true, false, false, false); searchPanel.setSpacing(true);/* w w w . ja v a2 s .co m*/ List<FreqComparator> freqComparators = new ArrayList<FreqComparator>(); exactlyFreqComp = new FreqComparator("exactly", "="); freqComparators.add(exactlyFreqComp); freqComparators.add(new FreqComparator("greaterThan", ">")); freqComparators.add(new FreqComparator("lessThan", ">")); freqComparators.add(new FreqComparator("greaterOrEqualThan", ">=")); freqComparators.add(new FreqComparator("lessOrEqualThan", "<=")); freqComparators.add(new FreqComparator("between", "=", true)); searchPanel.addComponent(new Label("The word shall appear")); freqComparatorCombo = new ComboBox(null, freqComparators); freqComparatorCombo.setImmediate(true); freqComparatorCombo.setNewItemsAllowed(false); freqComparatorCombo.setNullSelectionAllowed(false); freqComparatorCombo.setInvalidAllowed(false); searchPanel.addComponent(freqComparatorCombo); freq1Input = new TextField(); freq1Input.setImmediate(true); freq1Input.addValidator(new IntegerValueValidator(true, false)); freq1Input.setInvalidAllowed(false); freq1Input.setRequired(true); searchPanel.addComponent(freq1Input); searchPanel.setExpandRatio(freq1Input, 0.5f); andLabel = new Label("and"); searchPanel.addComponent(andLabel); freq2Input = new TextField(); freq2Input.setImmediate(true); freq2Input.addValidator(new IntegerValueValidator(false, false)); freq2Input.setInvalidAllowed(false); searchPanel.addComponent(freq2Input); searchPanel.setExpandRatio(freq2Input, 0.5f); searchPanel.addComponent(new Label("times.")); return searchPanel; }
From source file:de.catma.ui.analyzer.querybuilder.ResultPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);//from www.ja v a 2s. co m setMargin(true, false, false, false); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); btShowInPreview = new Button("Show in preview"); buttonPanel.addComponent(btShowInPreview); Label maxTotalFrequencyLabel = new Label("with a maximum total frequency of"); buttonPanel.addComponent(maxTotalFrequencyLabel); buttonPanel.setComponentAlignment(maxTotalFrequencyLabel, Alignment.MIDDLE_CENTER); maxTotalFrequencyField = new TextField(); maxTotalFrequencyField.setValue("50"); maxTotalFrequencyField.addValidator(new Validator() { public boolean isValid(Object value) { try { Integer.valueOf((String) value); return true; } catch (NumberFormatException nfe) { return false; } } public void validate(Object value) throws InvalidValueException { try { Integer.valueOf((String) value); } catch (NumberFormatException nfe) { throw new InvalidValueException("Value must be an integer number!"); } } }); maxTotalFrequencyField.setInvalidAllowed(false); buttonPanel.addComponent(maxTotalFrequencyField); addComponent(buttonPanel); HorizontalLayout headerPanel = new HorizontalLayout(); headerPanel.setSpacing(true); headerPanel.setWidth("100%"); addComponent(headerPanel); Label yourSearchLabel = new Label("Your search"); headerPanel.addComponent(yourSearchLabel); headerPanel.setExpandRatio(yourSearchLabel, 0.1f); queryLabel = new Label("nothing entered yet"); queryLabel.addStyleName("centered-bold-text"); headerPanel.addComponent(queryLabel); headerPanel.setExpandRatio(queryLabel, 0.2f); Label willMatch = new Label("will match for example:"); headerPanel.addComponent(willMatch); headerPanel.setExpandRatio(willMatch, 0.2f); pi = new ProgressIndicator(); pi.setEnabled(false); pi.setIndeterminate(true); headerPanel.addComponent(pi); headerPanel.setComponentAlignment(pi, Alignment.MIDDLE_RIGHT); headerPanel.setExpandRatio(pi, 0.5f); resultTable = new TreeTable(); resultTable.setSizeFull(); resultTable.setSelectable(true); HierarchicalContainer container = new HierarchicalContainer(); container.setItemSorter(new PropertyDependentItemSorter(TreePropertyName.caption, new PropertyToTrimmedStringCIComparator())); resultTable.setContainerDataSource(container); resultTable.addContainerProperty(TreePropertyName.caption, String.class, null); resultTable.setColumnHeader(TreePropertyName.caption, "Phrase"); resultTable.addContainerProperty(TreePropertyName.frequency, Integer.class, null); resultTable.setColumnHeader(TreePropertyName.frequency, "Frequency"); addComponent(resultTable); }
From source file:de.catma.ui.analyzer.querybuilder.SimilPanel.java
License:Open Source License
private Component createSearchPanel() { HorizontalLayout searchPanel = new HorizontalLayout(); searchPanel.setWidth("100%"); searchPanel.setSpacing(true);//from w ww .j a v a 2 s . c o m inputField = new TextField(); inputField.setWidth("100%"); searchPanel.addComponent(inputField); searchPanel.setExpandRatio(inputField, 0.7f); inputField.setImmediate(true); inputField.setRequired(true); inputField.setInvalidAllowed(false); inputField.addValidator(new NonEmptySequenceValidator("This value may not be empty!")); gradeSlider = new Slider("Grade of similarity", 0, 100); gradeSlider.setResolution(0); gradeSlider.setSizeFull(); try { gradeSlider.setValue(80.0); } catch (ValueOutOfBoundsException toBeIgnored) { } searchPanel.addComponent(gradeSlider); searchPanel.setExpandRatio(gradeSlider, 0.3f); return searchPanel; }
From source file:de.catma.ui.analyzer.querybuilder.WordPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);/*from ww w .j ava2s. co m*/ setMargin(true); setSizeFull(); String next = " first "; if (withPositionBox) { next = " next "; } Label startsWithLabel = new Label("The" + next + "word starts with"); addComponent(startsWithLabel, 0, 0); startsWithField = new TextField(); startsWithField.setImmediate(true); addComponent(startsWithField, 1, 0); Label containsLabel = new Label("The" + next + "word contains"); addComponent(containsLabel, 0, 1); containsField = new TextField(); containsField.setImmediate(true); addComponent(containsField, 1, 1); Label endsWithLabel = new Label("The" + next + "word ends with"); addComponent(endsWithLabel, 0, 2); endsWithField = new TextField(); endsWithField.setImmediate(true); addComponent(endsWithField, 1, 2); Label exactLabel = new Label("The" + next + "word is exactly"); addComponent(exactLabel, 0, 3); exactField = new TextField(); exactField.setImmediate(true); addComponent(exactField, 1, 3); if (withPositionBox) { List<PositionItem> options = new ArrayList<PositionItem>(); for (int i = 1; i <= 10; i++) { options.add(new PositionItem(i, i + " word" + (i == 1 ? "" : "s") + " after the previous word")); } Label positionLabel = new Label("The position of this word is"); addComponent(positionLabel, 0, 4); positionBox = new ComboBox("", options); positionBox.setImmediate(true); addComponent(positionBox, 1, 4); positionBox.setNullSelectionAllowed(false); positionBox.setNewItemsAllowed(false); positionBox.setValue(options.get(0)); btRemove = new Button("Remove"); addComponent(btRemove, 0, 5, 1, 5); setComponentAlignment(btRemove, Alignment.MIDDLE_CENTER); } }
From source file:de.catma.ui.repository.wizard.IndexerOptionsPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);// w w w . j a v a 2 s.co m setSizeFull(); Label infoLabel = new Label(); infoLabel.setContentMode(Label.CONTENT_XHTML); infoLabel.setValue("<p>This section allows you to finetune the creation " + "of the word list of your Source Document.</p>" + "<p>If you are unsure what to do, just select the language " + "and leave everything else unmodified.</p>"); addComponent(infoLabel, 0, 0, 2, 0); cbUseApostrophe = new CheckBox("always use the apostrophe as a word separator"); addComponent(cbUseApostrophe, 0, 1, 2, 1); Locale[] all = Locale.getAvailableLocales(); sortedLangs = new TreeSet<LanguageItem>(); for (Locale locale : all) { sortedLangs.add(new LanguageItem(locale)); } languagesListSelect = new ListSelect("Please select the predominant language of the Source Document:", sortedLangs); languagesListSelect.setNullSelectionAllowed(false); languagesListSelect.setSizeFull(); languagesListSelect.setImmediate(true); addComponent(languagesListSelect, 0, 2, 0, 3); unseparableCharacterSequencesListSelect = new ListSelect("Unseparable character sequences:"); unseparableCharacterSequencesListSelect.setNullSelectionAllowed(false); unseparableCharacterSequencesListSelect.setSizeFull(); unseparableCharacterSequencesListSelect.setImmediate(true); addComponent(unseparableCharacterSequencesListSelect, 1, 2, 1, 3); HorizontalLayout ucsAddRemoveLayout = new HorizontalLayout(); Panel ucsAddRemovePanel = new Panel(ucsAddRemoveLayout); ucsAddRemovePanel.setStyleName(Reindeer.PANEL_LIGHT); ucsAddRemoveLayout.setSpacing(true); ucsAddRemoveLayout.setSizeFull(); btAddUcs = new Button("Add entry"); btAddUcs.setEnabled(false); ucsAddRemovePanel.addComponent(btAddUcs); tfUcs = new TextField(); tfUcs.setInputPrompt("Add things like 'e.g.' as you see fit."); tfUcs.setImmediate(true); tfUcs.setTextChangeEventMode(TextChangeEventMode.EAGER); tfUcs.setWidth("100%"); ucsAddRemovePanel.addComponent(tfUcs); ucsAddRemoveLayout.setExpandRatio(tfUcs, 2); btRemoveUcs = new Button("Remove entry"); btRemoveUcs.setEnabled(false); ucsAddRemovePanel.addComponent(btRemoveUcs); addComponent(ucsAddRemovePanel, 1, 4); VerticalLayout loadSavePanel = new VerticalLayout(); loadSavePanel.setSpacing(true); loadSavePanel.setWidth("80px"); btLoadUcsList = new Button("Load list"); loadSavePanel.addComponent(btLoadUcsList); btSaveUcsList = new Button("Save list"); loadSavePanel.addComponent(btSaveUcsList); addComponent(loadSavePanel, 2, 2); setColumnExpandRatio(0, 2); setColumnExpandRatio(1, 2); setRowExpandRatio(2, 2); setRowExpandRatio(3, 2); }
From source file:de.catma.ui.repository.wizard.LocationPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);/* www .j a va 2 s.c o m*/ setMargin(true, false, false, false); setSizeFull(); HorizontalLayout remoteLayout = new HorizontalLayout(); remoteLayout.setMargin(true); remoteLayout.setSpacing(true); remoteLayout.setSizeFull(); remoteURIInputPanel = new Panel(remoteLayout); remoteURIInput = new TextField(); remoteURIInput.setCaption("Enter an URI that is accessible over the internet:"); remoteURIInput.setWidth("100%"); remoteURIInput.setTextChangeEventMode(TextChangeEventMode.EAGER); remoteURIInputPanel.addComponent(remoteURIInput); remoteLayout.setExpandRatio(remoteURIInput, 2); addComponent(remoteURIInputPanel); Label localFileLabel = new Label("or upload a local file from your computer:"); addComponent(localFileLabel); uploadPanel = new UploadPanel(); addComponent(uploadPanel); }
From source file:de.decidr.ui.view.AppointWorkflowAdminComponent.java
License:Apache License
/** * Initializes the components for the {@link AppointWorkflowAdminComponent}. *///from ww w. j av a 2 s . c o m private void init() { TextField appointSelf = null; Long userId = DecidrUI.getCurrent().getCurrentUser().getActorId(); userFacade = new UserFacade(new TenantAdminRole(userId)); userCounter = 1; verticalLayout = new VerticalLayout(); verticalLayout.setSpacing(true); verticalLayout.setSizeFull(); horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeFull(); horizontalLayout.setSpacing(true); appointForm = new Form(); appointForm.setWriteThrough(true); descriptionLabel = new Label("Add new workflow admins by pressing " + "\"Add User\" and entering their username.<br/>" + "You will always be added automatically.", Label.CONTENT_XHTML); appointSelf = new TextField(); appointSelf.setCaption("Username:"); try { appointSelf.setValue(userFacade.getUserProfile(userId).getUserProfile().getUsername()); } catch (ReadOnlyException e) { appointSelf.setValue(""); } catch (ConversionException e) { appointSelf.setValue(""); } catch (TransactionException e) { appointSelf.setValue(""); } appointSelf.setEnabled(false); appointForm.addField("user" + userCounter.toString(), appointSelf); addField = new Button("Add User", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(Button.ClickEvent event) { addUser(); } }); appointUsers = new Button("Appoint Users as Workflow Admins", new AppointWorkflowAdminAction(appointForm, wfmId)); horizontalLayout.addComponent(addField); horizontalLayout.setComponentAlignment(addField, "left middle"); horizontalLayout.addComponent(appointUsers); horizontalLayout.setComponentAlignment(appointUsers, "right middle"); verticalLayout.addComponent(descriptionLabel); verticalLayout.addComponent(horizontalLayout); verticalLayout.addComponent(appointForm); this.setCompositionRoot(verticalLayout); }