List of usage examples for com.vaadin.ui HorizontalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:de.catma.ui.repository.SourceDocumentPanel.java
License:Open Source License
private Component createContentInfoButtonsPanel() { HorizontalLayout content = new HorizontalLayout(); content.setSpacing(true); Panel contentInfoButtonsPanel = new Panel(content); contentInfoButtonsPanel.setStyleName(Reindeer.PANEL_LIGHT); btEditContentInfo = new Button("Edit"); contentInfoButtonsPanel.addComponent(btEditContentInfo); btSaveContentInfoChanges = new Button("Save"); btSaveContentInfoChanges.setVisible(false); contentInfoButtonsPanel.addComponent(btSaveContentInfoChanges); btDiscardContentInfoChanges = new Button("Discard"); btDiscardContentInfoChanges.setVisible(false); contentInfoButtonsPanel.addComponent(btDiscardContentInfoChanges); return contentInfoButtonsPanel; }
From source file:de.catma.ui.repository.TagLibraryPanel.java
License:Open Source License
private Component createTagLibraryButtonPanel() { HorizontalLayout tagLibraryButtonPanel = new HorizontalLayout(); tagLibraryButtonPanel.setSpacing(true); btOpenTagLibrary = new Button("Open Tag Library"); btOpenTagLibrary.setEnabled(false);//from w w w . ja va 2 s . com tagLibraryButtonPanel.addComponent(btOpenTagLibrary); btCreateTagLibrary = new Button("Create Tag Library"); tagLibraryButtonPanel.addComponent(btCreateTagLibrary); MenuBar menuMoreTagLibraryActions = new MenuBar(); miMoreTagLibraryActions = menuMoreTagLibraryActions.addItem("More actions...", null); tagLibraryButtonPanel.addComponent(menuMoreTagLibraryActions); return tagLibraryButtonPanel; }
From source file:de.catma.ui.repository.wizard.IndexerOptionsPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);/*from w ww . j a v a 2s . c o 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);//from w w w . java 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.catma.ui.Slider.java
License:Open Source License
public Slider(String caption, int min, int max, final String unit) { this.setCaption(caption); setSizeUndefined();//from w w w.j a v a2 s . c o m HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setSpacing(true); this.sliderComp = new SliderComp(min, max); minLabel = new Label(String.valueOf(min)); maxLabel = new Label(String.valueOf(max)); sliderLayout.addComponent(minLabel); sliderLayout.addComponent(sliderComp); sliderLayout.addComponent(maxLabel); addComponent(sliderLayout); setComponentAlignment(sliderLayout, Alignment.MIDDLE_CENTER); final Label current = new Label(sliderComp.getValue().toString()); current.setWidth("100%"); current.addStyleName("slider-centered-text"); addComponent(current); setComponentAlignment(current, Alignment.MIDDLE_CENTER); sliderComp.addListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { current.setValue(event.getProperty().getValue() + (unit.isEmpty() ? "" : " ") + unit); } }); }
From source file:de.catma.ui.tagger.PropertyEditDialog.java
License:Open Source License
private void initComponents() { VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setMargin(true);//from www . j a v a 2 s. c o m mainLayout.setSpacing(true); mainLayout.setSizeFull(); hintText = new Label("Please use the check boxes to set or unset values."); mainLayout.addComponent(hintText); propertyTree = new TreeTable(); propertyTree.setSelectable(true); propertyTree.setSizeFull(); propertyTree.setPageLength(10); propertyTree.setImmediate(true); propertyTree.focus(); propertyTree.addShortcutListener( new AbstractField.FocusShortcut(propertyTree, KeyCode.ARROW_UP, ModifierKey.CTRL)); propertyTree.addContainerProperty(TreePropertyName.property, String.class, ""); propertyTree.setColumnHeader(TreePropertyName.property, "Property"); propertyTree.addContainerProperty(TreePropertyName.icon, Resource.class, ""); propertyTree.addContainerProperty(TreePropertyName.value, String.class, ""); propertyTree.setColumnHeader(TreePropertyName.value, "Value"); propertyTree.addContainerProperty(TreePropertyName.assigned, CheckBox.class, ""); propertyTree.setColumnHeader(TreePropertyName.assigned, "Assigned"); propertyTree.setItemCaptionPropertyId(TreePropertyName.property); propertyTree.setItemIconPropertyId(TreePropertyName.icon); propertyTree.setVisibleColumns( new Object[] { TreePropertyName.property, TreePropertyName.value, TreePropertyName.assigned }); mainLayout.addComponent(propertyTree); mainLayout.setExpandRatio(propertyTree, 1.0f); HorizontalLayout comboBox = new HorizontalLayout(); comboBox.setSpacing(true); newValueInput = new FilterExposingComboBox("Add ad hoc value"); newValueInput.setTextInputAllowed(true); newValueInput.setNewItemsAllowed(true); newValueInput.setImmediate(true); newValueInput.addShortcutListener( new AbstractField.FocusShortcut(newValueInput, KeyCode.ARROW_DOWN, ModifierKey.CTRL)); comboBox.addComponent(newValueInput); btAdd = new Button("+"); btAdd.setClickShortcut(KeyCode.INSERT); comboBox.addComponent(btAdd); comboBox.setComponentAlignment(btAdd, Alignment.BOTTOM_RIGHT); mainLayout.addComponent(comboBox); hintText = new Label("New property values, that are created ad hoc, exist only for this tag instance! " + "For the creation of new systematic values use the Tag Type Manager."); mainLayout.addComponent(hintText); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); btSave = new Button("Save"); btSave.setClickShortcut(KeyCode.ENTER, ModifierKey.ALT); buttonPanel.addComponent(btSave); buttonPanel.setComponentAlignment(btSave, Alignment.MIDDLE_RIGHT); btCancel = new Button("Cancel"); btCancel.setClickShortcut(KeyCode.ESCAPE); buttonPanel.addComponent(btCancel); buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT); mainLayout.addComponent(buttonPanel); mainLayout.setComponentAlignment(buttonPanel, Alignment.MIDDLE_RIGHT); setContent(mainLayout); setWidth("40%"); setHeight("80%"); setModal(true); center(); }
From source file:de.catma.ui.tagger.TaggerView.java
License:Open Source License
private void initComponents(Application application) { setSizeFull();/*from w w w .jav a 2 s. c o m*/ VerticalLayout taggerPanel = new VerticalLayout(); taggerPanel.setSpacing(true); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", application)); helpLabel.setWidth("20px"); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tag this Source Document</h4>" + "<ol><li>First you have to tell CATMA which Tagset you want to use. " + "Open a Tag Library from the Repository Manager and drag a Tagset to the \"Active Tagsets\" section.</li>" + "<li>Now you can mark the text sequence you want to tag.</li><li>Click the colored button of the desired Tag to apply it to the marked sequence.</li></ol> " + "When you click on a tagged text, i. e. a text that is underlined with colored bars, you should see " + "the available Tag Instances in the section on the lower right of this view."); pager = new Pager(taggerID, 80, 30); tagger = new Tagger(taggerID, pager, this); tagger.addStyleName("tagger"); tagger.setWidth("550px"); taggerPanel.addComponent(tagger); // Panel actionPanel = new Panel(new HorizontalLayout()); // ((HorizontalLayout)actionPanel.getContent()).setSpacing(true); HorizontalLayout actionPanel = new HorizontalLayout(); actionPanel.setSpacing(true); taggerPanel.addComponent(actionPanel); pagerComponent = new PagerComponent(pager, new PageChangeListener() { public void pageChanged(int number) { tagger.setPage(number); } }); actionPanel.addComponent(helpLabel); actionPanel.addComponent(pagerComponent); btAnalyze = new Button("Analyze Document"); btAnalyze.setEnabled(repository instanceof IndexedRepository); actionPanel.addComponent(btAnalyze); linesPerPageSlider = new Slider("page size zoom", 1, 100, "%"); linesPerPageSlider.setImmediate(true); linesPerPageSlider.setWidth("150px"); actionPanel.addComponent(linesPerPageSlider); markupPanel = new MarkupPanel(repository, new ColorButtonListener() { private boolean enabled = false; public void colorButtonClicked(TagDefinition tagDefinition) { if (enabled) { tagger.addTagInstanceWith(tagDefinition); } else { getWindow().showNotification( "Information", "Please select a User Markup Collection " + " to store your markup first!<br>" + "See 'Active Markup Collections'.", Notification.TYPE_TRAY_NOTIFICATION); } } public void setEnabled(boolean enabled) { this.enabled = enabled; } }, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { boolean selected = evt.getNewValue() != null; @SuppressWarnings("unchecked") List<TagReference> tagReferences = (List<TagReference>) (selected ? evt.getNewValue() : evt.getOldValue()); tagger.setVisible(tagReferences, selected); } }, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { @SuppressWarnings("unchecked") Set<TagDefinition> removedTagDefinitions = (Set<TagDefinition>) evt.getOldValue(); pager.removeTagInstances(removedTagDefinitions); tagger.setPage(pager.getCurrentPageNumber()); } }); HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.addComponent(taggerPanel); splitPanel.addComponent(markupPanel); addComponent(splitPanel); }
From source file:de.catma.ui.tagmanager.PropertyDefinitionDialog.java
License:Open Source License
private void initComponents(String caption) { setMargin(true);/* www. j ava2 s . c o m*/ setSpacing(true); GridLayout propPanel = new GridLayout(3, 3); propPanel.setSpacing(true); nameInput = new TextField("Name"); nameInput.setRequired(true); if (propertyDefinition != null) { nameInput.setValue(propertyDefinition.getName()); } propPanel.addComponent(nameInput, 0, 0, 2, 0); if (propertyDefinition != null) { valueInput = new ListSelect("Possible values", propertyDefinition.getPossibleValueList().getPropertyValueList().getValues()); } else { valueInput = new ListSelect("Possible values"); } valueInput.setWidth("100%"); valueInput.setRequired(true); valueInput.setNullSelectionAllowed(false); propPanel.addComponent(valueInput, 0, 1, 2, 1); newValueInput = new TextField("Add possible value"); propPanel.addComponent(newValueInput, 0, 2); btAdd = new Button("+"); propPanel.addComponent(btAdd, 1, 2); propPanel.setComponentAlignment(btAdd, Alignment.BOTTOM_CENTER); btRemove = new Button("-"); propPanel.addComponent(btRemove, 2, 2); propPanel.setComponentAlignment(btRemove, Alignment.BOTTOM_CENTER); addComponent(propPanel); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); btSave = new Button("Save"); buttonPanel.addComponent(btSave); buttonPanel.setComponentAlignment(btSave, Alignment.MIDDLE_RIGHT); btCancel = new Button("Cancel"); buttonPanel.addComponent(btCancel); buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT); addComponent(buttonPanel); setComponentAlignment(buttonPanel, Alignment.MIDDLE_RIGHT); window = new Window(caption); window.setContent(this); window.setWidth("30%"); window.setHeight("70%"); window.center(); }
From source file:de.catma.ui.visualizer.chart.DistributionChartView.java
License:Open Source License
private void initComponents(DistributionComputation distributionComputation) { setSpacing(true);/*from w w w .j a v a 2 s .c o m*/ setMargin(new MarginInfo(true, false, false, false)); addStyleName("distributionchartviewpanel"); zoom = new Slider("Zoom", 0, 100, "%"); zoom.setValue(100.0); addComponent(zoom); setComponentAlignment(zoom, Alignment.TOP_CENTER); zoomPanel = new ZoomableVerticalLayout(); zoomPanel.setSizeFull(); List<Distribution> distributions = distributionComputation.getDistributions(); int rows = distributions.size() / ROW_LENGTH; if (distributions.size() % ROW_LENGTH != 0) { rows++; } Integer firstRowLength = null; for (int rowIdx = 0; rowIdx < rows; rowIdx++) { HorizontalLayout row = new HorizontalLayout(); row.setSpacing(true); zoomPanel.addComponent(row); row.setWidth("100%"); int rowLength = Math.min(distributions.size() - ((rowIdx) * ROW_LENGTH), ROW_LENGTH); if (firstRowLength == null) { firstRowLength = rowLength; } for (int colIdx = 0; colIdx < rowLength; colIdx++) { Distribution distribution = distributions.get((rowIdx * ROW_LENGTH) + colIdx); Chart chart = new Chart(distribution, maxOccurrences, distributionSelectionListener); int width = (int) (500.0 * (3.0 / firstRowLength)); chart.setWidth(width + "px"); chart.setHeight("700px"); row.addComponent(chart); charts.put(distribution.getId(), chart); } } addComponent(zoomPanel); }
From source file:de.datenhahn.vaadin.componentrenderer.demo.StaticCustomerDetailsGenerator.java
License:Apache License
@Override public Component getDetails(Grid.RowReference rowReference) { rowReference.getGrid().scrollTo(rowReference.getItemId()); StaticCustomer customer = (StaticCustomer) rowReference.getItemId(); HorizontalLayout layout = new HorizontalLayout(); layout.setHeight(300, Sizeable.Unit.PIXELS); layout.setMargin(true);/*from w ww . j av a 2s . c o m*/ layout.setSpacing(true); Image image = new Image("", customer.getPhoto()); image.setHeight(200, Sizeable.Unit.PIXELS); image.setWidth(200, Sizeable.Unit.PIXELS); layout.addComponent(image); Label nameLabel = new Label("<h1>" + customer.getFirstName() + " " + customer.getLastName() + "</h1>", ContentMode.HTML); layout.addComponent(nameLabel); layout.setExpandRatio(nameLabel, 1.0f); return layout; }