Example usage for com.vaadin.ui Label setIcon

List of usage examples for com.vaadin.ui Label setIcon

Introduction

In this page you can find the example usage for com.vaadin.ui Label setIcon.

Prototype

@Override
public void setIcon(Resource icon) 

Source Link

Document

Sets the component's icon.

Usage

From source file:com.jain.addon.action.confirm.ConfirmWindow.java

License:Apache License

/**
 * //from   w  ww  .  j  a va2s .  c o m
 * @param confirm
 * @param layout
 */
private void findNAddIcon(JNConfirm confirm, HorizontalLayout layout) {
    if (StringHelper.isNotEmptyWithTrim(confirm.icon())) {
        String iconPath = PropertyReader.instance().getProperty(confirm.icon());

        if (StringHelper.isNotEmptyWithTrim(iconPath)) {
            Label label = new Label();
            ThemeResource icon = new ThemeResource(iconPath);
            label.setIcon(icon);
            layout.addComponent(label);
            layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
        }
    }
}

From source file:com.mycollab.module.project.view.bug.BugTableDisplay.java

License:Open Source License

BugTableDisplay(String viewId, TableViewField requiredColumn, List<TableViewField> displayColumns) {
    super(AppContextUtil.getSpringBean(BugService.class), SimpleBug.class, viewId, requiredColumn,
            displayColumns);//from  w w w  .  j  a  v  a 2 s  .  c  o  m

    this.addGeneratedColumn("assignuserFullName", (source, itemId, columnId) -> {
        SimpleBug bug = getBeanByIndex(itemId);
        return new ProjectUserLink(bug.getAssignuser(), bug.getAssignUserAvatarId(),
                bug.getAssignuserFullName());
    });

    this.addGeneratedColumn("loguserFullName", (source, itemId, columnId) -> {
        SimpleBug bug = getBeanByIndex(itemId);
        return new ProjectUserLink(bug.getCreateduser(), bug.getLoguserAvatarId(), bug.getLoguserFullName());
    });

    this.addGeneratedColumn("name", (source, itemId, columnId) -> {
        SimpleBug bug = getBeanByIndex(itemId);
        LabelLink b = new LabelLink(bug.getName(),
                ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName()));

        if (StringUtils.isNotBlank(bug.getPriority())) {
            b.setIconLink(ProjectAssetsManager.getPriority(bug.getPriority()));
            b.addStyleName("priority-" + bug.getPriority().toLowerCase());
        }

        b.setDescription(ProjectTooltipGenerator.generateToolTipBug(UserUIContext.getUserLocale(),
                MyCollabUI.getDateFormat(), bug, MyCollabUI.getSiteUrl(), UserUIContext.getUserTimeZone(),
                false));

        if (bug.isCompleted()) {
            b.addStyleName(WebThemes.LINK_COMPLETED);
        } else if (bug.isOverdue()) {
            b.addStyleName(WebThemes.LINK_OVERDUE);
        }
        return b;
    });

    this.addGeneratedColumn("severity", (source, itemId, columnId) -> {
        SimpleBug bug = getBeanByIndex(itemId);
        Label lbPriority = new Label(UserUIContext.getMessage(BugSeverity.class, bug.getSeverity()));
        lbPriority.setIcon(FontAwesome.STAR);
        if (bug.getSeverity() != null) {
            lbPriority.addStyleName("bug-severity-" + bug.getSeverity().toLowerCase());
        }
        return lbPriority;
    });

    this.addGeneratedColumn("duedate", (source, itemId, columnId) -> {
        SimpleBug bug = getBeanByIndex(itemId);
        return new ELabel().prettyDate(bug.getDuedate());
    });

    this.addGeneratedColumn("createdtime", (source, itemId, columnId) -> {
        SimpleBug bug = getBeanByIndex(itemId);
        return new ELabel().prettyDateTime(bug.getCreatedtime());
    });

    this.addGeneratedColumn("resolution", (source, itemId, columnId) -> {
        SimpleBug bug = getBeanByIndex(itemId);
        return new Label(UserUIContext.getMessage(BugResolution.class, bug.getResolution()));
    });
    this.setWidth("100%");
}

From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPost.java

/**
 * Adds post informations//from w  w w.  j  ava 2s  .  c om
 */
private void addPostInfo() {

    Label likeIMG = new Label();
    likeIMG.setIcon(new ThemeResource("./images/like.png"));
    likeIMG.setSizeUndefined();
    layout.addComponent(likeIMG, "picture-like");

    layout.addComponent(likes, "like");
    likes.setCaption(getLikesCaption());

    Label dislikeIMG = new Label();
    dislikeIMG.setIcon(new ThemeResource("./images/dislike.png"));
    dislikeIMG.setSizeUndefined();
    layout.addComponent(dislikeIMG, "picture-disagree");
    layout.addComponent(disagrees, "disagree");
    disagrees.setCaption(getDisagreeCaption());

    layout.addComponent(timestamp, "timestamp");

}

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  www.  j a v a 2 s .  c  o m
    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.MarkupResultPanel.java

License:Open Source License

private void initComponents() {
    setSizeFull();//from  w w w. j a  v  a 2  s  .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  v  a2  s  .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, "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.RepositoryView.java

License:Open Source License

private Component createDocumentsLabel() {
    HorizontalLayout labelLayout = new HorizontalLayout();
    labelLayout.setWidth("100%");
    labelLayout.setSpacing(true);/*from   w  ww .java 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.MarkupPanel.java

License:Open Source License

private void initComponents(PropertyChangeListener tagDefinitionSelectionListener,
        PropertyChangeListener tagDefinitionsRemovedListener) {

    tabSheet = new TabSheet();
    tabSheet.setSizeFull();//from   w  w  w  . ja  v a 2  s  .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.TaggerView.java

License:Open Source License

private void initComponents(Application application) {
    setSizeFull();/*from   ww w .  j  ava 2s . c o m*/

    VerticalLayout taggerPanel = new VerticalLayout();

    taggerPanel.setSpacing(true);

    Label helpLabel = new Label();

    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", application));
    helpLabel.setWidth("20px");
    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tag this Source Document</h4>"
            + "<ol><li>First you have to tell CATMA which Tagset you want to use. "
            + "Open a Tag Library from the Repository Manager and drag a Tagset to the \"Active Tagsets\" section.</li>"
            + "<li>Now you can mark the text sequence you want to tag.</li><li>Click the colored button of the desired Tag to apply it to the marked sequence.</li></ol> "
            + "When you click on a tagged text, i. e. a text that is underlined with colored bars, you should see "
            + "the available Tag Instances in the section on the lower right of this view.");
    pager = new Pager(taggerID, 80, 30);

    tagger = new Tagger(taggerID, pager, this);
    tagger.addStyleName("tagger");
    tagger.setWidth("550px");

    taggerPanel.addComponent(tagger);

    //      Panel actionPanel = new Panel(new HorizontalLayout());
    //      ((HorizontalLayout)actionPanel.getContent()).setSpacing(true);

    HorizontalLayout actionPanel = new HorizontalLayout();
    actionPanel.setSpacing(true);

    taggerPanel.addComponent(actionPanel);

    pagerComponent = new PagerComponent(pager, new PageChangeListener() {

        public void pageChanged(int number) {
            tagger.setPage(number);
        }
    });

    actionPanel.addComponent(helpLabel);

    actionPanel.addComponent(pagerComponent);

    btAnalyze = new Button("Analyze Document");
    btAnalyze.setEnabled(repository instanceof IndexedRepository);
    actionPanel.addComponent(btAnalyze);

    linesPerPageSlider = new Slider("page size zoom", 1, 100, "%");
    linesPerPageSlider.setImmediate(true);
    linesPerPageSlider.setWidth("150px");

    actionPanel.addComponent(linesPerPageSlider);

    markupPanel = new MarkupPanel(repository, new ColorButtonListener() {

        private boolean enabled = false;

        public void colorButtonClicked(TagDefinition tagDefinition) {
            if (enabled) {
                tagger.addTagInstanceWith(tagDefinition);
            } else {
                getWindow().showNotification(
                        "Information", "Please select a User Markup Collection "
                                + " to store your markup first!<br>" + "See 'Active Markup Collections'.",
                        Notification.TYPE_TRAY_NOTIFICATION);
            }
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }
    }, new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            boolean selected = evt.getNewValue() != null;
            @SuppressWarnings("unchecked")
            List<TagReference> tagReferences = (List<TagReference>) (selected ? evt.getNewValue()
                    : evt.getOldValue());

            tagger.setVisible(tagReferences, selected);
        }
    }, new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            @SuppressWarnings("unchecked")
            Set<TagDefinition> removedTagDefinitions = (Set<TagDefinition>) evt.getOldValue();
            pager.removeTagInstances(removedTagDefinitions);
            tagger.setPage(pager.getCurrentPageNumber());
        }
    });

    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.addComponent(taggerPanel);
    splitPanel.addComponent(markupPanel);
    addComponent(splitPanel);
}

From source file:de.catma.ui.tagmanager.TagsetTree.java

License:Open Source License

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

    tagTree = new EndorsedTreeTable();
    tagTree.setImmediate(true);
    tagTree.setSizeFull();
    tagTree.setSelectable(true);
    tagTree.setMultiSelect(false);

    tagTree.setContainerDataSource(new HierarchicalContainer());

    tagTree.addContainerProperty(TagTreePropertyName.caption, String.class, null);
    tagTree.setColumnHeader(TagTreePropertyName.caption, "Tagsets");

    tagTree.addContainerProperty(TagTreePropertyName.icon, Resource.class, null);

    tagTree.setItemCaptionPropertyId(TagTreePropertyName.caption);
    tagTree.setItemIconPropertyId(TagTreePropertyName.icon);
    tagTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);

    tagTree.setVisibleColumns(new Object[] { TagTreePropertyName.caption });

    if (colorButtonListener != null) {
        tagTree.addGeneratedColumn(TagTreePropertyName.color,
                new ColorButtonColumnGenerator(colorButtonListener));
        tagTree.setColumnReorderingAllowed(true);
    } else {
        tagTree.addGeneratedColumn(TagTreePropertyName.color, new ColorLabelColumnGenerator());
    }
    tagTree.setColumnHeader(TagTreePropertyName.color, "Tag Color");
    addComponent(tagTree);
    setExpandRatio(tagTree, 2);

    GridLayout buttonGrid = new GridLayout(1, 19);
    buttonGrid.setMargin(true);
    buttonGrid.setSpacing(true);

    buttonGrid.addStyleName("taglibrary-action-grid");
    int buttonGridRowCount = 0;

    if (withTagsetButtons) {
        btReload = new Button("");
        btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication()));
        btReload.addStyleName("icon-button");
        buttonGrid.addComponent(btReload);
        buttonGrid.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT);
        buttonGridRowCount++;

        Label tagsetLabel = new Label();
        tagsetLabel.setIcon(new ClassResource("ui/tagmanager/resources/grndiamd.gif", application));
        tagsetLabel.setCaption("Tagset");

        buttonGrid.addComponent(tagsetLabel);
        buttonGridRowCount++;

        btInsertTagset = new Button("Create Tagset");
        btInsertTagset.setEnabled(true);
        btInsertTagset.setWidth("100%");
        buttonGrid.addComponent(btInsertTagset);
        buttonGridRowCount++;

        btRemoveTagset = new Button("Remove Tagset");
        btRemoveTagset.setWidth("100%");
        buttonGrid.addComponent(btRemoveTagset);
        buttonGridRowCount++;

        btEditTagset = new Button("Edit Tagset");
        btEditTagset.setWidth("100%");
        buttonGrid.addComponent(btEditTagset);
        buttonGridRowCount++;
    }

    Label tagLabel = new Label();
    tagLabel.setIcon(new ClassResource("ui/tagmanager/resources/reddiamd.gif", application));
    tagLabel.setCaption("Tag");

    buttonGrid.addComponent(tagLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(tagLabel, Alignment.BOTTOM_LEFT);

    btInsertTag = new Button("Create Tag");
    btInsertTag.setWidth("100%");
    if (withTagsetButtons) {
        btInsertTag.setEnabled(true);
    }
    buttonGrid.addComponent(btInsertTag);
    buttonGridRowCount++;

    btRemoveTag = new Button("Remove Tag");
    btRemoveTag.setWidth("100%");
    buttonGrid.addComponent(btRemoveTag);
    buttonGridRowCount++;

    btEditTag = new Button("Edit Tag");
    btEditTag.setWidth("100%");
    buttonGrid.addComponent(btEditTag);
    buttonGridRowCount++;

    Label propertyLabel = new Label();
    propertyLabel.setIcon(new ClassResource("ui/tagmanager/resources/ylwdiamd.gif", application));
    propertyLabel.setCaption("Property");

    buttonGrid.addComponent(propertyLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(propertyLabel, Alignment.BOTTOM_LEFT);

    btInsertProperty = new Button("Create Property");
    btInsertProperty.setWidth("100%");
    buttonGrid.addComponent(btInsertProperty);
    buttonGridRowCount++;

    btRemoveProperty = new Button("Remove Property");
    // commented out on purpose: somehow this forces all the other buttons to 
    // show up in natural size...
    //      btRemoveProperty.setWidth("100%");
    buttonGrid.addComponent(btRemoveProperty);
    buttonGridRowCount++;

    btEditProperty = new Button("Edit Property");
    btEditProperty.setWidth("100%");
    buttonGrid.addComponent(btEditProperty);
    buttonGridRowCount++;

    addComponent(buttonGrid);
    setExpandRatio(buttonGrid, 0);

    if (!withButtonPanel) {
        buttonGrid.setVisible(false);
    }

}