List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:de.catma.ui.analyzer.querybuilder.ResultPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);/* w ww . j av a2s .com*/ 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.TagKwicDialog.java
License:Open Source License
private void initComponents() { window = new Window("Select affected User Markup Collections"); window.setModal(true);/*from w w w . j a v a2s . co 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.repository.CorpusContentSelectionDialog.java
License:Open Source License
private void initComponents() { setSizeFull();/* w ww .j av 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);//w w w . j a v a 2 s.co m 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); 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; }
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 .ja va 2s . 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.tagmanager.PropertyDefinitionDialog.java
License:Open Source License
private void initComponents(String caption) { setMargin(true);/* w ww . ja va 2 s .co 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.decidr.ui.view.windows.StartConfigurationWindow.java
License:Apache License
private void init() { VerticalLayout mainVerticalLayout = new VerticalLayout(); HorizontalLayout buttonHorizontalLayout = new HorizontalLayout(); checkBox = new CheckBox(); this.setContent(mainVerticalLayout); this.setCaption("Start configuration window"); this.setModal(true); this.setWidth("800px"); this.setHeight("500px"); this.setResizable(false); mainVerticalLayout.setSpacing(true); mainVerticalLayout.setMargin(true);//from w w w . j a v a2 s.c o m if (workflow.getVariables() != null && workflow.getVariables().getVariable().size() > 0) { configVariableForm = new ConfigVariableForm(workflow.getVariables()); configVariableForm.setCaption("Configuration variables"); configVariableForm.setWriteThrough(false); configVariableForm.setInvalidCommitted(false); } if (workflow.getRoles() != null) { configRoles = new ConfigRoles(workflow.getRoles()); } if (configRoles != null && configVariableForm != null) { // Set up split panel. SplitPanel splitPanel = new SplitPanel(); splitPanel.setOrientation(SplitPanel.ORIENTATION_HORIZONTAL); splitPanel.setSplitPosition(450, Sizeable.UNITS_PIXELS); splitPanel.setHeight("400px"); splitPanel.setLocked(true); splitPanel.setFirstComponent(configRoles); splitPanel.setSecondComponent(configVariableForm); mainVerticalLayout.addComponent(splitPanel); } else { // At least one of the components is unneeded, so no split panel this.setWidth("600px"); if (configRoles != null) { mainVerticalLayout.addComponent(configRoles); } else if (configVariableForm != null) { mainVerticalLayout.addComponent(configVariableForm); } } okButton = new Button("OK", new SaveStartConfigurationAction(configRoles, configVariableForm, tConfiguration, workflowModelId, checkBox.booleanValue())); cancelButton = new Button("Cancel", new HideDialogWindowAction()); mainVerticalLayout.addComponent(buttonHorizontalLayout); buttonHorizontalLayout.setSpacing(true); buttonHorizontalLayout.addComponent(checkBox); checkBox.setCaption("Start Immediately"); buttonHorizontalLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_RIGHT); buttonHorizontalLayout.addComponent(okButton); buttonHorizontalLayout.addComponent(cancelButton); }
From source file:de.escidoc.admintool.view.contentmodel.ContentModelEditView.java
License:Open Source License
private void addButtons(final HorizontalLayout footerLayout) { addSaveButton();//from w w w .j a v a 2 s .c o m addCancelButton(); footerLayout.addComponent(buttonLayout); footerLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); }
From source file:de.escidoc.admintool.view.EscidocPagedTable.java
License:Open Source License
public HorizontalLayout createControls() { // final Label itemsPerPageLabel = new Label("Items per page:"); final Label pageLabel = new Label("Page: ", Label.CONTENT_XHTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.addValidator(new IntegerValidator(null)); final Label separatorLabel = new Label(" / ", Label.CONTENT_XHTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addListener(new ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) { if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) { @SuppressWarnings("boxing") final int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page);//w w w .jav a2 s . com } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("20px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); final HorizontalLayout controlBar = new HorizontalLayout(); final HorizontalLayout pageSize = new HorizontalLayout(); final HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(0); } }); final Button previous = new Button("<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new ClickListener() { private static final long serialVersionUID = -1927138212640638452L; public void buttonClick(final ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(BaseTheme.BUTTON_LINK); previous.setStyleName(BaseTheme.BUTTON_LINK); next.setStyleName(BaseTheme.BUTTON_LINK); last.setStyleName(BaseTheme.BUTTON_LINK); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @SuppressWarnings("boxing") public void pageChanged(final PagedTableChangeEvent event) { previous.setEnabled(true); next.setEnabled(true); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(getTotalAmountOfPages()); } }); return controlBar; }
From source file:de.escidoc.admintool.view.user.UserAddView.java
License:Open Source License
private Component createLayout(final String nameLabel, final AbstractTextField textField, final int leftMargin, final boolean required) { final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(37, UNITS_PIXELS);/*from w ww . jav a 2 s .c o m*/ hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + nameLabel + Constants.P; Label l; hor.addComponent(l = new Label(text, Label.CONTENT_XHTML)); l.setWidth(leftMargin + Constants.PX); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(textField); hor.setComponentAlignment(textField, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ")); hor.setSpacing(false); return hor; }