List of usage examples for com.vaadin.ui HorizontalLayout setSpacing
@Override public void setSpacing(boolean spacing)
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); 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);//from w ww .j a va2 s . c o m 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 .j av a2 s.c o 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); inputField = new TextField(); inputField.setWidth("100%"); searchPanel.addComponent(inputField); searchPanel.setExpandRatio(inputField, 0.7f); inputField.setImmediate(true);/*from w w w. j a v a 2 s. c o m*/ 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.TagPanel.java
License:Open Source License
private void initComponents() { contentPanel = new VerticalLayout(); contentPanel.setSizeFull();// w w w. j a v a 2 s.c o m addComponent(contentPanel); if (tagsetDefinitionDictionary.isEmpty()) { tagLibraryPanel = createTagLibraryPanel(); contentPanel.addComponent(tagLibraryPanel); } HorizontalLayout tagSearchPanel = new HorizontalLayout(); tagSearchPanel.setSizeFull(); tagSearchPanel.setSpacing(true); tagsetTree = new TagsetTree(queryOptions.getRepository().getTagManager(), null, false, false, null); tagSearchPanel.addComponent(tagsetTree); tagSearchPanel.setExpandRatio(tagsetTree, 0.8f); tagMatchModeCombo = new ComboBox("Please choose what you consider a match:"); tagMatchModeCombo.setImmediate(true); TagMatchModeItem exactMatchItem = new TagMatchModeItem("exact match", TagMatchMode.EXACT); tagMatchModeCombo.addItem(exactMatchItem); tagMatchModeCombo.addItem(new TagMatchModeItem("boundary match", TagMatchMode.BOUNDARY)); tagMatchModeCombo.addItem(new TagMatchModeItem("overlap match", TagMatchMode.OVERLAP)); tagMatchModeCombo.setNullSelectionAllowed(false); tagMatchModeCombo.setNewItemsAllowed(false); tagMatchModeCombo.setDescription( "The three different match modes influence the way tags refine" + " your search results:" + "<ul>" + "<li>exact match - the tag boundaries have to match exactly to " + "keep a result item in the result set</li>" + "<li>boundary match - result items that should be kept in the " + "result set must start and end within the boundaries of the tag</li>" + "<li>overlap - the result items that should be kept in the result " + "set must overlap with the range of the tag</li>" + "</ul>"); tagMatchModeCombo.setValue(exactMatchItem); tagSearchPanel.addComponent(tagMatchModeCombo); tagSearchPanel.setExpandRatio(tagMatchModeCombo, 0.2f); splitPanel = new VerticalSplitPanel(); contentPanel.addComponent(splitPanel); splitPanel.addComponent(tagSearchPanel); if (tagsetDefinitionDictionary.isEmpty()) { splitPanel.setVisible(false); } else { tagsetTree.addTagsetDefinition(tagsetDefinitionDictionary.values()); } resultPanel = new ResultPanel(queryOptions); splitPanel.addComponent(resultPanel); initSearchPanelComponents(contentPanel); }
From source file:de.catma.ui.analyzer.TagKwicDialog.java
License:Open Source License
private void initComponents() { window = new Window("Select affected User Markup Collections"); window.setModal(true);/*from ww w. j a v a 2s. c o m*/ setSpacing(true); setMargin(true); setSizeFull(); Label tagResultsLabel = new Label( "The selected User Markup Collections will be modfied by this tagging operation. Are sure?"); addComponent(tagResultsLabel); umcTable = new TreeTable("User Markup Collections"); umcTable.addContainerProperty(UmcTableProperty.CAPTION, String.class, null); umcTable.setColumnHeader(UmcTableProperty.CAPTION, "Document/Collection"); umcTable.addContainerProperty(UmcTableProperty.TARGET, Component.class, null); umcTable.setColumnHeader(UmcTableProperty.TARGET, "targeted User Markup Collection"); umcTable.setSizeFull(); addComponent(umcTable); setExpandRatio(umcTable, 1.0f); btOk = new Button("Ok"); btOk.setEnabled(false); btCancel = new Button("Cancel"); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); buttonPanel.addComponent(btOk); buttonPanel.addComponent(btCancel); buttonPanel.setComponentAlignment(btOk, Alignment.MIDDLE_RIGHT); buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT); addComponent(buttonPanel); setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT); window.setContent(this); window.setWidth("50%"); window.setHeight("80%"); }
From source file:de.catma.ui.dialog.FormDialog.java
License:Open Source License
private void initComponents(String caption, final PropertysetItem propertysetItem, FormFieldFactory formFieldFactory) { setSizeFull();//w ww . j a v a 2 s .co m setSpacing(true); dialogWindow = new Window(caption); dialogWindow.setModal(true); form = new Form(); if (formFieldFactory != null) { form.setFormFieldFactory(formFieldFactory); } form.setSizeFull(); form.setWriteThrough(false); form.setInvalidCommitted(false); form.setItemDataSource(propertysetItem); addComponent(form); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); btSave = new Button("Save"); btSave.setClickShortcut(KeyCode.ENTER); btCancel = new Button("Cancel"); buttonPanel.addComponent(btSave); buttonPanel.addComponent(btCancel); addComponent(buttonPanel); this.setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT); dialogWindow.addComponent(this); form.focus(); }
From source file:de.catma.ui.dialog.UploadDialog.java
License:Open Source License
private void initComponents() { setSizeFull();//from w w w. j av a 2 s. c om setSpacing(true); dialogWindow = new Window(caption); dialogWindow.setModal(true); upload = new Upload("Please select a file to upload", new DataReceiver(data)); upload.setButtonCaption("Select file"); upload.setImmediate(true); addComponent(upload); pi = new ProgressIndicator(); pi.setVisible(false); addComponent(pi); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); btCancel = new Button("Cancel"); buttonPanel.addComponent(btCancel); addComponent(buttonPanel); this.setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT); dialogWindow.addComponent(this); upload.focus(); }
From source file:de.catma.ui.repository.AuthenticationDialog.java
License:Open Source License
private void initComponents() { setSizeFull();//from www . jav a 2 s.c o m setSpacing(true); dialogWindow = new Window(caption); dialogWindow.setModal(true); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); btCancel = new Button("Cancel"); buttonPanel.addComponent(btCancel); addComponent(buttonPanel); this.setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT); dialogWindow.addComponent(this); }
From source file:de.catma.ui.repository.CorpusContentSelectionDialog.java
License:Open Source License
private void initComponents() { setSizeFull();//from w w w . j a v a 2s . c o m Panel documentsPanel = new Panel(); documentsPanel.getContent().setSizeUndefined(); documentsPanel.getContent().setWidth("100%"); documentsPanel.setSizeFull(); documentsContainer = new HierarchicalContainer(); documentsTree = new TreeTable("Documents for the analysis", documentsContainer); documentsTree.setWidth("100%"); documentsTree.addContainerProperty(DocumentTreeProperty.caption, String.class, null); documentsTree.addContainerProperty(DocumentTreeProperty.include, AbstractComponent.class, null); documentsTree.setColumnHeader(DocumentTreeProperty.caption, "document/collection"); documentsTree.setColumnHeader(DocumentTreeProperty.include, "include"); documentsTree.addItem(new Object[] { sourceDocument.toString(), createCheckBox(false) }, sourceDocument); documentsTree.setCollapsed(sourceDocument, false); MarkupCollectionItem userMarkupItem = new MarkupCollectionItem(sourceDocument, userMarkupItemDisplayString, true); documentsTree.addItem(new Object[] { userMarkupItemDisplayString, new Label() }, userMarkupItem); documentsTree.setParent(userMarkupItem, sourceDocument); for (UserMarkupCollectionReference umcRef : sourceDocument.getUserMarkupCollectionRefs()) { documentsTree.addItem(new Object[] { umcRef.getName(), createCheckBox(true) }, umcRef); documentsTree.setParent(umcRef, userMarkupItem); documentsTree.setChildrenAllowed(umcRef, false); } documentsTree.setCollapsed(userMarkupItem, false); int pageLength = sourceDocument.getUserMarkupCollectionRefs().size() + 1; if (pageLength < 5) { pageLength = 5; } if (pageLength > 15) { pageLength = 15; } documentsTree.setPageLength(pageLength); documentsPanel.addComponent(documentsTree); addComponent(documentsPanel); setExpandRatio(documentsPanel, 1.0f); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); buttonPanel.setWidth("100%"); btOk = new Button("Ok"); btOk.setClickShortcut(KeyCode.ENTER); btOk.focus(); buttonPanel.addComponent(btOk); buttonPanel.setComponentAlignment(btOk, Alignment.MIDDLE_RIGHT); buttonPanel.setExpandRatio(btOk, 1.0f); btCancel = new Button("Cancel"); buttonPanel.addComponent(btCancel); buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT); addComponent(buttonPanel); dialogWindow = new Window("Selection of relevant documents"); dialogWindow.setContent(this); }
From source file:de.catma.ui.repository.RepositoryView.java
License:Open Source License
private Component createDocumentsLabel() { HorizontalLayout labelLayout = new HorizontalLayout(); labelLayout.setWidth("100%"); labelLayout.setSpacing(true); Label documentsLabel = new Label("Document Manager"); documentsLabel.addStyleName("bold-label"); labelLayout.addComponent(documentsLabel); labelLayout.setExpandRatio(documentsLabel, 1.0f); btAdmin = new Button("Admin"); btAdmin.addStyleName("icon-button"); // for top-margin btAdmin.setVisible(repository.getUser().getRole().equals(Role.ADMIN)); labelLayout.addComponent(btAdmin);/*from www.ja va 2s . c o m*/ labelLayout.setComponentAlignment(btAdmin, Alignment.MIDDLE_RIGHT); btReload = new Button(""); btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication())); btReload.addStyleName("icon-button"); labelLayout.addComponent(btReload); labelLayout.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication())); helpLabel.setWidth("20px"); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>First steps</h4>" + "<h5>Adding a Source Document</h5>" + "You can add a Source Document by clicking the \"Add Source Document\"-button. " + "A Source Document can be a web resource pointed to by the URL or you can upload a document from your computer. " + "<h5>Tagging a Source Document</h5>" + "When you add your first Source Document, CATMA generates a set of example items to get you going: " + "<ul><li>A User Markup Collection to hold your markup</li><li>A Tag Library with an example Tagset that contains an example Tag</li></ul> " + "To start tagging a Source Document, just select the example User Markup Collection from the tree and click the \"Open User Markup Collection\"-button. " + "Then follow the instructions given to you by the Tagger component." + "<h5>Analyze a Source Document</h5>" + "To analyze a Source Document, just select that document from the tree and click \"Analyze Source Document\" in the \"More Actions\"-menu." + "Then follow the instructions given to you by the Analyzer component."); labelLayout.addComponent(helpLabel); labelLayout.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT); return labelLayout; }