Example usage for com.vaadin.ui Alignment MIDDLE_RIGHT

List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_RIGHT.

Prototype

Alignment MIDDLE_RIGHT

To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.

Click Source Link

Usage

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoadingView.java

public LoadingView() {
    setSizeFull();//from  w  w  w.j av a  2 s . c om
    VerticalLayout center = new VerticalLayout();
    this.addComponent(center);
    this.setComponentAlignment(center, Alignment.MIDDLE_CENTER);

    center.setHeight("180px");
    HorizontalLayout info = new HorizontalLayout();

    Label title = new Label("PFServer Dashboard");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H4);
    title.addStyleName(ValoTheme.LABEL_COLORED);
    // center.addComponent(title);
    // center.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    Label loading = new Label("Initalizing");
    loading.addStyleName(ValoTheme.LABEL_H1);
    loading.addStyleName(ValoTheme.LABEL_LIGHT);
    info.addComponent(loading);
    info.addComponent(title);
    info.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    center.addComponent(info);
    info.setComponentAlignment(loading, Alignment.MIDDLE_LEFT);
    loading.setWidth("160px");

    center.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
    // center.addComponent(loading);
    // center.setComponentAlignment(loading, Alignment.TOP_CENTER);
    ProgressBar indeterminate = new ProgressBar();
    indeterminate.setIndeterminate(true);
    center.addComponent(indeterminate);
    center.setComponentAlignment(indeterminate, Alignment.TOP_CENTER);

}

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

License:Open Source License

private void initComponents() {
    setSizeFull();//from   www. j  a va 2 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, "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 ww  w . j ava2 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.analyzer.querybuilder.ResultPanel.java

License:Open Source License

private void initComponents() {
    setSpacing(true);//from w w  w . j  a  va2s  . c  om
    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  av  a  2  s . c om*/

    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();/*from   w  ww .j  ava2  s  .  c  om*/
    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);//ww w.  ja  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;
}

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();/*ww w  .j  a  v  a2 s  .  co m*/
    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. jav  a  2s  .c om*/
    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);/*from w  w w .ja v a  2s  .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();
}