Example usage for com.vaadin.ui HorizontalLayout setExpandRatio

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

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout 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.CatmaApplication.java

License:Open Source License

@Override
public void init() {

    Properties properties = loadProperties();
    backgroundService = new BackgroundService(this);

    final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION);
    mainWindow.addParameterHandler(this);
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeUndefined();//from  ww w .j a v a 2s .com
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainWindow.addStyleName("catma-mainwindow");

    mainWindow.setContent(mainLayout);
    MenuFactory menuFactory = new MenuFactory();
    try {
        initTempDirectory(properties);
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        defaultProgressIndicator = new ProgressIndicator();
        defaultProgressIndicator.setIndeterminate(true);
        defaultProgressIndicator.setEnabled(false);
        defaultProgressIndicator.setPollingInterval(500);
        progressWindow = new ProgressWindow(defaultProgressIndicator);

        menu = menuFactory.createMenu(mainLayout,
                new MenuFactory.MenuEntryDefinition("Repository Manager",
                        new RepositoryManagerWindow(repositoryManagerView)),
                new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)),
                new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)),
                new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)),
                new MenuFactory.MenuEntryDefinition("Visualizer",
                        new VisualizationManagerWindow(visualizationManagerView)));
        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        mainLayout.addComponent(aboutLink);
        mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
        mainLayout.setExpandRatio(aboutLink, 1.0f);

        Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/"));
        helpLink.setTargetName("_blank");
        mainLayout.addComponent(helpLink);
        mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);

        Label helpLabel = new Label();
        helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this));
        helpLabel.setWidth("20px");
        helpLabel.setDescription(
                "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating "
                        + "through CATMA. They provide useful hints for managing the first "
                        + "steps within a CATMA component.</p>" + "<h4>Login</h4>"
                        + "Once you're logged in, you will see the Repository Manager, "
                        + "which will explain the first steps to you. "
                        + "Just hover your mouse over the question mark icons!");
        VerticalLayout helpWrapper = new VerticalLayout();
        helpWrapper.addComponent(helpLabel);
        helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT);

        Animator helpAnimator = new Animator(helpWrapper);

        helpAnimator.setFadedOut(true);

        mainLayout.addComponent(helpAnimator);
        mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT);
        helpAnimator.fadeIn(2000, 300);

        MenuBar loginLogoutMenu = new MenuBar();
        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this);
        MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand);
        loginLogoutCommand.setLoginLogoutItem(loginLogoutitem);

        mainLayout.addComponent(loginLogoutMenu);
        mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT);
        mainLayout.setWidth("100%");
    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

    setMainWindow(mainWindow);

    setTheme("cleatheme");
}

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

License:Open Source License

private Component createSearchPanel() {
    HorizontalLayout searchPanel = new HorizontalLayout();
    searchPanel.setSpacing(true);/* w w w.  j a  v a  2  s  .  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.MarkupResultPanel.java

License:Open Source License

private void initComponents() {
    setSizeFull();//from w w w . j a  va  2s  .  c o 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, "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 .  ja va 2  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, "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.analyzer.querybuilder.FreqPanel.java

License:Open Source License

private Component createSearchPanel() {
    HorizontalLayout searchPanel = new HorizontalLayout();
    searchPanel.setMargin(true, false, false, false);

    searchPanel.setSpacing(true);/*from  ww w.ja v a 2s .c  om*/

    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 w  w  w.  j av a 2  s.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);/*www. j a  v  a  2s.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.TagPanel.java

License:Open Source License

private void initComponents() {
    contentPanel = new VerticalLayout();
    contentPanel.setSizeFull();//w  w  w .j av  a  2s  .  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.repository.CorpusContentSelectionDialog.java

License:Open Source License

private void initComponents() {
    setSizeFull();//w w  w .  j  a  v a2s.  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 va 2s.c o  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;
}