Example usage for com.vaadin.ui VerticalLayout setExpandRatio

List of usage examples for com.vaadin.ui VerticalLayout setExpandRatio

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setExpandRatio.

Prototype

public void setExpandRatio(Component component, float ratio) 

Source Link

Document

This method is used to control how excess space in layout is distributed among components.

Usage

From source file:de.catma.ui.analyzer.MarkupResultPanel.java

License:Open Source License

private void initComponents() {
    setSizeFull();/*  w  ww.  j  a  v  a2 s.c om*/

    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    VerticalLayout leftComponent = new VerticalLayout();
    leftComponent.setSpacing(true);
    leftComponent.setSizeFull();

    resultTable = new TreeTable();
    resultTable.setSelectable(true);
    resultTable.setMultiSelect(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, "Tag Definition");

    resultTable.addContainerProperty(TreePropertyName.sourcedocument, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.sourcedocument, "Source Document");

    resultTable.addContainerProperty(TreePropertyName.markupcollection, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.markupcollection, "Markup Collection");

    resultTable.addContainerProperty(TreePropertyName.phrase, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.phrase, "Phrase");

    resultTable.addContainerProperty(TreePropertyName.propertyname, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.propertyname, "Property");

    resultTable.addContainerProperty(TreePropertyName.propertyvalue, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.propertyvalue, "Property value");

    resultTable.addContainerProperty(TreePropertyName.frequency, Integer.class, null);
    resultTable.setColumnHeader(TreePropertyName.frequency, "Frequency");
    resultTable.addContainerProperty(TreePropertyName.visible, AbstractComponent.class, null);
    resultTable.setColumnHeader(TreePropertyName.visible, "Visible in Kwic");

    resultTable.setItemCaptionPropertyId(TreePropertyName.caption);
    resultTable.setPageLength(10); //TODO: config
    resultTable.setSizeFull();
    resultTable.setColumnCollapsingAllowed(true);
    resultTable.setColumnCollapsible(TreePropertyName.caption, false);
    resultTable.setColumnCollapsible(TreePropertyName.sourcedocument, true);
    resultTable.setColumnCollapsible(TreePropertyName.markupcollection, true);
    resultTable.setColumnCollapsible(TreePropertyName.phrase, true);
    resultTable.setColumnCollapsible(TreePropertyName.propertyname, true);
    resultTable.setColumnCollapsible(TreePropertyName.propertyvalue, true);
    resultTable.setColumnCollapsible(TreePropertyName.frequency, false);
    resultTable.setColumnCollapsible(TreePropertyName.visible, false);

    //TODO: a description generator that shows the version of a Tag
    //      resultTable.setItemDescriptionGenerator(generator);

    leftComponent.addComponent(resultTable);
    leftComponent.setExpandRatio(resultTable, 1.0f);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);
    buttonPanel.setWidth("100%");

    btDist = new Button();
    btDist.setIcon(new ClassResource("ui/analyzer/resources/chart.gif", getApplication()));
    buttonPanel.addComponent(btDist);

    btResultExcelExport = new Button();
    btResultExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btResultExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    buttonPanel.addComponent(btResultExcelExport);

    cbFlatTable = new CheckBox("flat table", false);
    cbFlatTable.setImmediate(true);

    buttonPanel.addComponent(cbFlatTable);
    buttonPanel.setComponentAlignment(cbFlatTable, Alignment.MIDDLE_RIGHT);
    buttonPanel.setExpandRatio(cbFlatTable, 1f);

    btSelectAll = new Button("Select all for Kwic");

    buttonPanel.addComponent(btSelectAll);
    buttonPanel.setComponentAlignment(btSelectAll, Alignment.MIDDLE_RIGHT);
    //      buttonPanel.setExpandRatio(btSelectAll, 1f);
    btDeselectAll = new Button("Deselect all for Kwic");
    buttonPanel.addComponent(btDeselectAll);
    buttonPanel.setComponentAlignment(btDeselectAll, Alignment.MIDDLE_RIGHT);

    leftComponent.addComponent(buttonPanel);

    splitPanel.addComponent(leftComponent);

    VerticalLayout rightComponent = new VerticalLayout();
    rightComponent.setSpacing(true);
    rightComponent.setSizeFull();

    this.kwicPanel = new KwicPanel(repository, relevantUserMarkupCollectionProvider, true);
    rightComponent.addComponent(kwicPanel);
    rightComponent.setExpandRatio(kwicPanel, 1f);

    HorizontalLayout kwicButtonPanel = new HorizontalLayout();
    kwicButtonPanel.setSpacing(true);
    kwicButtonPanel.setWidth("100%");

    btKwicExcelExport = new Button();
    btKwicExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btKwicExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    kwicButtonPanel.addComponent(btKwicExcelExport);
    kwicButtonPanel.setComponentAlignment(btKwicExcelExport, Alignment.MIDDLE_LEFT);

    btUntagResults = new Button("Untag selected Kwics");
    kwicButtonPanel.addComponent(btUntagResults);
    kwicButtonPanel.setComponentAlignment(btUntagResults, Alignment.MIDDLE_RIGHT);
    kwicButtonPanel.setExpandRatio(btUntagResults, 1f);

    Label helpLabel = new Label();
    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication()));
    helpLabel.setWidth("20px");

    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tagging search results</h4>"
            + "You can tag the search results in the Kwic-view: "
            + "<p>First select one or more rows and then drag the desired "
            + "Tag from the Tag Manager over the Kwic-results.</p>" + "<h4>Take a closer look</h4>"
            + "You can jump to the location in the full text by double "
            + "clicking on a row in the Kwic-view.");
    kwicButtonPanel.addComponent(helpLabel);

    kwicButtonPanel.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    rightComponent.addComponent(kwicButtonPanel);
    rightComponent.setComponentAlignment(kwicButtonPanel, Alignment.MIDDLE_RIGHT);

    splitPanel.addComponent(rightComponent);

    addComponent(splitPanel);
}

From source file:de.catma.ui.analyzer.PhraseResultPanel.java

License:Open Source License

private void initComponents() {
    setSizeFull();//from  w  w w . j a v  a2  s  .  co  m

    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    VerticalLayout leftComponent = new VerticalLayout();
    leftComponent.setSpacing(true);
    leftComponent.setSizeFull();

    resultTable = new TreeTable();
    resultTable.setSelectable(true);
    resultTable.setMultiSelect(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");
    resultTable.addContainerProperty(TreePropertyName.visibleInKwic, AbstractComponent.class, null);
    resultTable.setColumnHeader(TreePropertyName.visibleInKwic, "Visible in Kwic");

    resultTable.setItemCaptionPropertyId(TreePropertyName.caption);
    resultTable.setPageLength(10); //TODO: config
    resultTable.setSizeFull();

    leftComponent.addComponent(resultTable);
    leftComponent.setExpandRatio(resultTable, 1.0f);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);
    buttonPanel.setWidth("100%");

    btDist = new Button();
    btDist.setIcon(new ClassResource("ui/analyzer/resources/chart.gif", getApplication()));
    btDist.setDescription("Show selected phrases as a distribution trend in a " + "chart like visualization.");

    buttonPanel.addComponent(btDist);

    btDoubleTree = new Button();
    btDoubleTree.setIcon(new ClassResource("ui/analyzer/resources/doubletree.gif", getApplication()));
    btDoubleTree.setDescription("Show a selected phrase with a doubletree kwic visualization.");

    buttonPanel.addComponent(btDoubleTree);

    btExcelExport = new Button();
    btExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    buttonPanel.addComponent(btExcelExport);

    btSelectAll = new Button("Select all for Kwic");

    buttonPanel.addComponent(btSelectAll);
    buttonPanel.setComponentAlignment(btSelectAll, Alignment.MIDDLE_RIGHT);
    buttonPanel.setExpandRatio(btSelectAll, 1f);
    btDeselectAll = new Button("Deselect all for Kwic");
    buttonPanel.addComponent(btDeselectAll);
    buttonPanel.setComponentAlignment(btDeselectAll, Alignment.MIDDLE_RIGHT);

    leftComponent.addComponent(buttonPanel);
    splitPanel.addComponent(leftComponent);

    VerticalLayout rightComponent = new VerticalLayout();
    rightComponent.setSpacing(true);
    rightComponent.setSizeFull();

    this.kwicPanel = new KwicPanel(repository, relevantUserMarkupCollectionProvider);
    rightComponent.addComponent(kwicPanel);
    rightComponent.setExpandRatio(kwicPanel, 1f);

    HorizontalLayout kwicButtonPanel = new HorizontalLayout();
    kwicButtonPanel.setSpacing(true);
    kwicButtonPanel.setWidth("100%");

    btKwicExcelExport = new Button();
    btKwicExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btKwicExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    kwicButtonPanel.addComponent(btKwicExcelExport);

    Label helpLabel = new Label();
    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication()));

    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tagging search results</h4>"
            + "You can tag the search results in the Kwic-view: "
            + "<p>First select one or more rows and then drag the desired "
            + "Tag from the Tag Manager over the Kwic-results.</p>" + "<h4>Take a closer look</h4>"
            + "You can jump to the location in the full text by double " + "clicking on a row in the Kwic-view."
            + "<h4>Untag search results</h4>" + "The \"Results by markup\" tab gives you the opportunity "
            + "to untag markup for selected search results in the Kwic-view.");

    kwicButtonPanel.addComponent(helpLabel);
    kwicButtonPanel.setExpandRatio(helpLabel, 1f);
    kwicButtonPanel.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    rightComponent.addComponent(kwicButtonPanel);
    rightComponent.setComponentAlignment(kwicButtonPanel, Alignment.MIDDLE_RIGHT);

    splitPanel.addComponent(rightComponent);
    addComponent(splitPanel);
}

From source file:de.catma.ui.repository.SourceDocumentPanel.java

License:Open Source License

private Component createOuterDocumentsPanel() {

    VerticalLayout outerDocumentsPanel = new VerticalLayout();
    outerDocumentsPanel.setSpacing(true);
    outerDocumentsPanel.setMargin(false, true, true, true);
    outerDocumentsPanel.setSizeFull();//from   w  w w.j  a  v a  2 s. co m

    Component documentsPanel = createDocumentsPanel();
    outerDocumentsPanel.addComponent(documentsPanel);
    outerDocumentsPanel.setExpandRatio(documentsPanel, 1.0f);
    outerDocumentsPanel.addComponent(createDocumentButtonsPanel());

    return outerDocumentsPanel;
}

From source file:de.catma.ui.repository.SourceDocumentPanel.java

License:Open Source License

private Component createContentInfoPanel() {
    VerticalLayout contentInfoPanel = new VerticalLayout();
    contentInfoPanel.setSpacing(true);/*from www  .  j av  a 2s .c o  m*/
    contentInfoPanel.setSizeFull();
    contentInfoPanel.setMargin(false, false, true, true);
    Component contentInfoForm = createContentInfoForm();
    contentInfoPanel.addComponent(contentInfoForm);
    contentInfoPanel.setExpandRatio(contentInfoForm, 1.0f);

    contentInfoPanel.addComponent(createContentInfoButtonsPanel());

    return contentInfoPanel;
}

From source file:de.catma.ui.repository.TagLibraryPanel.java

License:Open Source License

private Component createTagLibraryPanel() {
    VerticalLayout tagLibraryPanel = new VerticalLayout();
    tagLibraryPanel.setSpacing(true);/*from w  w w .j a v  a 2s . co m*/
    tagLibraryPanel.setSizeFull();
    Component tagLibraryTreePanel = createTagLibraryTreePanel();
    tagLibraryPanel.addComponent(tagLibraryTreePanel);
    tagLibraryPanel.setExpandRatio(tagLibraryTreePanel, 1.0f);
    tagLibraryPanel.addComponent(createTagLibraryButtonPanel());

    return tagLibraryPanel;
}

From source file:de.catma.ui.tagger.MarkupPanel.java

License:Open Source License

private void initComponents(PropertyChangeListener tagDefinitionSelectionListener,
        PropertyChangeListener tagDefinitionsRemovedListener) {

    tabSheet = new TabSheet();
    tabSheet.setSizeFull();/*from  www  .  ja  v a2s  .  c om*/
    VerticalLayout tabContent = new VerticalLayout();
    tabContent.setSpacing(true);
    tabContent.setSizeFull();

    Label helpLabel = new Label();

    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", application));
    helpLabel.setWidth("20px");
    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Creating Tags</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."
            + " If you already have an active Tagset you want to use, you can skip this step.</li>"
            + "<li>Now you can select the Tagset and click the \"Create Tag\"-Button.</li></ol>"
            + "<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."
            + " If you already have an active Tagset you want to use, you can skip this step.</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.");
    tabContent.addComponent(helpLabel);
    tabContent.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    tagsetTree = new TagsetTree(repository.getTagManager(), null, false, colorButtonListener);
    tabContent.addComponent(tagsetTree);
    tabContent.setExpandRatio(tagsetTree, 1.0f);

    tabSheet.addTab(tabContent, "Active Tagsets");

    markupCollectionsPanel = new MarkupCollectionsPanel(repository);
    markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.tagDefinitionSelected,
            tagDefinitionSelectionListener);
    markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.tagDefinitionsRemoved,
            tagDefinitionsRemovedListener);

    markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.userMarkupCollectionSelected,
            new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                    if (evt.getNewValue() != null) {
                        writableUserMarkupCollectionLabel.setValue(evt.getNewValue());
                    } else {
                        writableUserMarkupCollectionLabel.setValue("");
                    }
                    colorButtonListener.setEnabled(evt.getNewValue() != null);
                }
            });

    tabSheet.addTab(markupCollectionsPanel, "Active Markup Collections");

    addComponent(tabSheet);

    Component markupInfoPanel = createInfoPanel();
    addComponent(markupInfoPanel);
}

From source file:de.catma.ui.tagger.PropertyEditDialog.java

License:Open Source License

private void initComponents() {
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setMargin(true);//from  w  w w .  j  a v a  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.escidoc.admintool.view.context.ContextView.java

License:Open Source License

public ContextView(final AdminToolApplication app, final ContextListView contextList,
        final ContextEditForm contextEditForm, final ContextAddView contextAddView,
        final PdpRequest pdpRequest) {

    Preconditions.checkNotNull(app, "App can not be null");
    Preconditions.checkNotNull(contextList, "contextList can not be null");
    Preconditions.checkNotNull(contextEditForm, "contextEditForm can not be null");
    Preconditions.checkNotNull(contextAddView, "contextAddView can not be null");
    Preconditions.checkNotNull(pdpRequest, "pdpRequest is null: %s", pdpRequest);

    this.app = app;
    this.contextList = contextList;
    this.contextEditForm = contextEditForm;
    this.pdpRequest = pdpRequest;

    final VerticalLayout vLayout = new VerticalLayout();
    vLayout.setHeight(100, UNITS_PERCENTAGE);
    final Label text = new Label("<b>" + "Contexts" + "</b>", Label.CONTENT_XHTML);
    vLayout.addComponent(text);//ww  w  .  j  a va 2 s  . c  om
    contextList.setSizeFull();

    vLayout.addComponent(contextList);
    vLayout.addComponent(contextList.createControls());

    vLayout.setExpandRatio(contextList, 1.0f);
    setFirstComponent(vLayout);

    setSplitPosition(ViewConstants.SPLIT_POSITION_IN_PERCENT);
    setOrientation(ORIENTATION_HORIZONTAL);
    setSecondComponent(new Label(""));
}

From source file:de.escidoc.admintool.view.user.UserView.java

License:Open Source License

private void addListView(final VerticalLayout vLayout) {
    userList.setSizeFull();//w ww.  j  a  v a2 s. co m
    vLayout.addComponent(userList);
    vLayout.addComponent(userList.createControls());
    vLayout.setExpandRatio(userList, 1.0f);
}

From source file:de.fatalix.lighty.web.LightyApp.java

@Override
protected void init(VaadinRequest request) {
    setSizeFull();//from w  ww.j ava  2s  .  c o  m
    VerticalLayout navigatorLayout = new VerticalLayout();
    navigatorLayout.setSizeFull();
    navigatorLayout.setSpacing(true);

    Panel contentPanel = new Panel(navigatorLayout);
    contentPanel.setSizeFull();
    contentPanel.addStyleName(LightyTheme.BACKGROUND);

    Navigator navigator = new Navigator(LightyApp.this, contentPanel);
    navigator.addProvider(viewProvider);

    VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.addComponent(new LightyHeader());
    rootLayout.addComponent(new LightyNavigation());
    rootLayout.addComponent(notificationBar);

    rootLayout.addComponent(contentPanel);
    rootLayout.setExpandRatio(contentPanel, 1.0f);
    rootLayout.setSizeFull();
    setContent(rootLayout);
}