Example usage for com.vaadin.server FontAwesome QUESTION_CIRCLE

List of usage examples for com.vaadin.server FontAwesome QUESTION_CIRCLE

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome QUESTION_CIRCLE.

Prototype

FontAwesome QUESTION_CIRCLE

To view the source code for com.vaadin.server FontAwesome QUESTION_CIRCLE.

Click Source Link

Usage

From source file:annis.gui.SearchView.java

License:Apache License

public SearchView(AnnisUI ui) {
    super(2, 2);/*from ww w.  j  a  v  a  2 s.c o  m*/
    this.ui = ui;
    this.selectedTabHistory = new LinkedHashSet<>();

    // init a doc browser controller
    this.docBrowserController = new DocBrowserController(ui);

    // always get the resize events directly
    setImmediate(true);

    setSizeFull();
    setMargin(false);
    setRowExpandRatio(1, 1.0f);
    setColumnExpandRatio(1, 1.0f);

    final HelpPanel help = new HelpPanel(ui);

    mainTab = new TabSheet();
    mainTab.setSizeFull();
    mainTab.setCloseHandler(SearchView.this);
    mainTab.addStyleName(ValoTheme.TABSHEET_FRAMED);
    mainTab.addSelectedTabChangeListener(SearchView.this);

    TabSheet.Tab helpTab = mainTab.addTab(help, "Help/Examples");
    helpTab.setIcon(FontAwesome.QUESTION_CIRCLE);
    helpTab.setClosable(false);

    controlPanel = new ControlPanel(ui.getInstanceConfig(), help.getExamples(), ui);

    controlPanel.setWidth(CONTROL_PANEL_WIDTH, Layout.Unit.PIXELS);
    controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE);

    ui.addAction(new ShortcutListener("Tutor^eial") {
        @Override
        public void handleAction(Object sender, Object target) {
            mainTab.setSelectedTab(help);
        }
    });

    addComponent(controlPanel, 0, 1);
    addComponent(mainTab, 1, 1);
}

From source file:com.esofthead.mycollab.module.project.view.ProjectAddBaseTemplateWindow.java

License:Open Source License

public ProjectAddBaseTemplateWindow() {
    super(AppContext.getMessage(ProjectI18nEnum.OPT_CREATE_PROJECT_FROM_TEMPLATE));
    this.setModal(true);
    this.setClosable(true);
    this.setResizable(false);
    this.setWidth("550px");
    MVerticalLayout content = new MVerticalLayout();
    GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3);
    final TemplateProjectComboBox templateProjectComboBox = new TemplateProjectComboBox();
    Button helpBtn = new Button("");
    helpBtn.setIcon(FontAwesome.QUESTION_CIRCLE);
    helpBtn.addStyleName(UIConstants.BUTTON_ACTION);
    helpBtn.setDescription(AppContext.getMessage(ProjectI18nEnum.OPT_MARK_TEMPLATE_HELP));
    gridFormLayoutHelper//  w w  w  .  ja v  a 2  s .c  o  m
            .addComponent(
                    new MHorizontalLayout().withFullWidth().with(templateProjectComboBox, helpBtn)
                            .expand(templateProjectComboBox),
                    AppContext.getMessage(ProjectI18nEnum.FORM_TEMPLATE), 0, 0);
    final TextField prjNameField = new TextField();
    gridFormLayoutHelper.addComponent(prjNameField, AppContext.getMessage(GenericI18Enum.FORM_NAME), 0, 1);
    final TextField prjKeyField = new TextField();
    gridFormLayoutHelper.addComponent(prjKeyField, AppContext.getMessage(ProjectI18nEnum.FORM_SHORT_NAME), 0,
            2);
    MHorizontalLayout buttonControls = new MHorizontalLayout();
    content.with(gridFormLayoutHelper.getLayout(), buttonControls).withAlign(buttonControls,
            Alignment.MIDDLE_RIGHT);
    Button okBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OK), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            SimpleProject templatePrj = (SimpleProject) templateProjectComboBox.getValue();
            if (templatePrj == null) {
                NotificationUtil.showErrorNotification(
                        AppContext.getMessage(ProjectI18nEnum.ERROR_MUST_CHOOSE_TEMPLATE_PROJECT));
                return;
            }
            String newPrjName = prjNameField.getValue();
            if (newPrjName.length() == 0) {
                NotificationUtil.showErrorNotification("Project name must be not null");
                return;
            }
            String newPrjKey = prjKeyField.getValue();
            if (newPrjKey.length() > 3 || newPrjKey.length() == 0) {
                NotificationUtil
                        .showErrorNotification("Project key must be not null and less than 3 characters");
                return;
            }
            ProjectTemplateService projectTemplateService = AppContextUtil
                    .getSpringBean(ProjectTemplateService.class);
            if (projectTemplateService != null) {
                Integer newProjectId = projectTemplateService.cloneProject(templatePrj.getId(), newPrjName,
                        newPrjKey, AppContext.getAccountId(), AppContext.getUsername());
                EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this,
                        new PageActionChain(new ProjectScreenData.Goto(newProjectId))));
                close();
            }
        }
    });
    okBtn.setIcon(FontAwesome.SAVE);
    okBtn.addStyleName(UIConstants.BUTTON_ACTION);
    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.addStyleName(UIConstants.BUTTON_OPTION);
    buttonControls.with(cancelBtn, okBtn);
    this.setContent(content);
}

From source file:com.esofthead.mycollab.module.user.ui.components.ImagePreviewCropWindow.java

License:Open Source License

private void displayPreviewImage() {
    previewPhoto.removeAllComponents();//  w  w w  . j a  v a  2s  .c o m
    if (scaleImageData != null && scaleImageData.length > 0) {
        Embedded previewImage = new Embedded(null, new ByteArrayImageResource(scaleImageData, "image/png"));
        previewImage.setWidth("100px");
        previewPhoto.addComponent(previewImage);
    } else {
        previewPhoto.addComponent(
                ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE).withStyleName("icon-48px").withWidthUndefined());
    }
}

From source file:com.esofthead.mycollab.vaadin.web.ui.grid.GridFormLayoutHelper.java

License:Open Source License

public GridCellWrapper buildCell(String caption, String contextHelp, int columns, int rows, int colSpan,
        String width, Alignment alignment) {
    if (StringUtils.isNotBlank(caption)) {
        ELabel captionLbl = new ELabel(caption).withStyleName(UIConstants.TEXT_ELLIPSIS)
                .withDescription(caption);
        MHorizontalLayout captionWrapper = new MHorizontalLayout().withSpacing(false).withMargin(true)
                .withWidth(defaultCaptionWidth).withFullHeight().withStyleName("gridform-caption")
                .with(captionLbl).expand(captionLbl).withAlign(captionLbl, alignment);
        if (StringUtils.isNotBlank(contextHelp)) {
            ELabel contextHelpLbl = new ELabel("&nbsp;" + FontAwesome.QUESTION_CIRCLE.getHtml(),
                    ContentMode.HTML).withStyleName(UIConstants.INLINE_HELP).withDescription(contextHelp)
                            .withWidthUndefined();
            captionWrapper.with(contextHelpLbl);
        }//from  w w  w .ja v a  2  s  .  co  m
        layout.addComponent(captionWrapper, 2 * columns, rows);
    }
    GridCellWrapper fieldWrapper = new GridCellWrapper();
    fieldWrapper.setWidth(width);
    layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colSpan - 1) + 1, rows);
    layout.setColumnExpandRatio(2 * columns + 1, 1.0f);

    if (StringUtils.isNotBlank(caption)) {
        fieldCaptionMappings.put(caption, fieldWrapper);
    }
    return fieldWrapper;
}

From source file:com.mycollab.module.crm.ui.components.CrmFollowersComp.java

License:Open Source License

public void displayFollowers(final V bean) {
    this.bean = bean;
    try {/*w  w  w.ja v a  2s .c  om*/
        typeId = (Integer) PropertyUtils.getProperty(bean, "id");
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
        LOG.error("Error", e);
        return;
    }
    this.removeAllComponents();

    MHorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label followerHeader = new Label(
            FontAwesome.EYE.getHtml() + " " + UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS),
            ContentMode.HTML);
    header.addComponent(followerHeader);

    if (hasEditPermission()) {
        final PopupView addPopupView = new PopupView(UserUIContext.getMessage(GenericI18Enum.ACTION_MODIFY),
                new MVerticalLayout());
        addPopupView.addPopupVisibilityListener(popupVisibilityEvent -> {
            PopupView.Content content = addPopupView.getContent();
            if (popupVisibilityEvent.isPopupVisible()) {
                MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent();
                popupComponent.removeAllComponents();
                popupComponent.with(new ELabel(UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS))
                        .withStyleName(ValoTheme.LABEL_H3), new ModifyWatcherPopup());
            } else {
                MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent();
                ModifyWatcherPopup popup = (ModifyWatcherPopup) popupComponent.getComponent(1);
                List<MonitorItem> unsavedItems = popup.getUnsavedItems();
                monitorItemService.saveMonitorItems(unsavedItems);
                loadWatchers();
            }
        });
        header.addComponent(addPopupView);
    }
    header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE).withStyleName(WebThemes.INLINE_HELP)
            .withDescription(UserUIContext.getMessage(FollowerI18nEnum.FOLLOWER_EXPLAIN_HELP)));

    this.addComponent(header);
    watcherLayout = new MCssLayout().withFullWidth().withStyleName(WebThemes.FLEX_DISPLAY);
    this.addComponent(watcherLayout);
    loadWatchers();
}

From source file:com.mycollab.module.project.ui.components.ProjectFollowersComp.java

License:Open Source License

public void displayFollowers(final V bean) {
    this.bean = bean;
    try {//ww  w . j  a  v  a  2s  .c o  m
        typeId = (Integer) PropertyUtils.getProperty(bean, "id");
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
        LOG.error("Error", e);
        return;
    }
    this.removeAllComponents();

    MHorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label followerHeader = new Label(
            FontAwesome.EYE.getHtml() + " " + UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS),
            ContentMode.HTML);
    header.addComponent(followerHeader);

    if (hasEditPermission()) {
        final PopupView addPopupView = new PopupView(UserUIContext.getMessage(GenericI18Enum.ACTION_MODIFY),
                new MVerticalLayout());
        addPopupView.addPopupVisibilityListener(popupVisibilityEvent -> {
            PopupView.Content content = addPopupView.getContent();
            if (popupVisibilityEvent.isPopupVisible()) {
                MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent();
                popupComponent.removeAllComponents();
                popupComponent.with(new ELabel(UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS))
                        .withStyleName(ValoTheme.LABEL_H3), new ModifyWatcherPopup());
            } else {
                MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent();
                ModifyWatcherPopup popup = (ModifyWatcherPopup) popupComponent.getComponent(1);
                List<MonitorItem> unsavedItems = popup.getUnsavedItems();
                monitorItemService.saveMonitorItems(unsavedItems);
                loadWatchers();
            }
        });
        header.addComponent(addPopupView);
    }
    header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE).withStyleName(WebThemes.INLINE_HELP)
            .withDescription(UserUIContext.getMessage(FollowerI18nEnum.FOLLOWER_EXPLAIN_HELP)));

    this.addComponent(header);

    watcherLayout = new MCssLayout().withFullWidth().withStyleName(WebThemes.FLEX_DISPLAY);
    this.addComponent(watcherLayout);
    loadWatchers();
}

From source file:com.mycollab.module.project.ui.components.TimeLogComp.java

License:Open Source License

protected TimeLogComp() {
    this.itemTimeLoggingService = AppContextUtil.getSpringBean(ItemTimeLoggingService.class);
    this.withMargin(false);

    HorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label dateInfoHeader = new Label(
            FontAwesome.CLOCK_O.getHtml() + " " + UserUIContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME),
            ContentMode.HTML);/*from w ww  .j  a va2  s.c  om*/
    header.addComponent(dateInfoHeader);

    if (hasEditPermission()) {
        MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                clickEvent -> showEditTimeWindow(beanItem)).withStyleName(WebThemes.BUTTON_LINK);
        header.addComponent(editBtn);
    }
    header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE)
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.TIME_EXPLAIN_HELP))
            .withStyleName(WebThemes.INLINE_HELP));

    this.addComponent(header);

    MVerticalLayout layout = new MVerticalLayout().withFullWidth()
            .withMargin(new MarginInfo(false, false, false, true));

    billableHoursLbl = new Label();
    nonBillableHoursLbl = new Label();
    remainHoursLbl = new Label();
    layout.addComponent(billableHoursLbl);
    layout.addComponent(nonBillableHoursLbl);
    layout.addComponent(remainHoursLbl);
    this.addComponent(layout);
}

From source file:com.mycollab.vaadin.web.ui.grid.GridFormLayoutHelper.java

License:Open Source License

public GridCellWrapper buildCell(String caption, String contextHelp, int columns, int rows, int colSpan,
        String width, Alignment alignment) {
    if (StringUtils.isNotBlank(caption)) {
        ELabel captionLbl = new ELabel(caption).withStyleName(UIConstants.LABEL_WORD_WRAP)
                .withDescription(caption);
        MHorizontalLayout captionWrapper = new MHorizontalLayout().withSpacing(false).withMargin(true)
                .withWidth(defaultCaptionWidth).withFullHeight().withStyleName("gridform-caption")
                .with(captionLbl).expand(captionLbl).withAlign(captionLbl, alignment);
        if (StringUtils.isNotBlank(contextHelp)) {
            ELabel contextHelpLbl = new ELabel("&nbsp;" + FontAwesome.QUESTION_CIRCLE.getHtml(),
                    ContentMode.HTML).withStyleName(WebThemes.INLINE_HELP).withDescription(contextHelp)
                            .withWidthUndefined();
            captionWrapper.with(contextHelpLbl);
        }/*from  w ww  . j  a  v a  2 s. com*/
        layout.addComponent(captionWrapper, 2 * columns, rows);
    }
    GridCellWrapper fieldWrapper = new GridCellWrapper();
    fieldWrapper.setWidth(width);
    layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colSpan - 1) + 1, rows);
    layout.setColumnExpandRatio(2 * columns + 1, 1.0f);

    if (StringUtils.isNotBlank(caption)) {
        fieldCaptionMappings.put(caption, fieldWrapper);
    }
    return fieldWrapper;
}

From source file:de.catma.ui.CatmaApplication.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    backgroundService = new UIBackgroundService(true);

    storeParameters(request.getParameterMap());

    Page.getCurrent().setTitle("CATMA 5.0 " + MINORVERSION);

    mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();/*from  ww  w .ja  va2 s. c  o m*/

    menuPanel = new Panel();
    menuPanel.addStyleName("menuPanel");
    mainLayout.addComponent(menuPanel);

    contentPanel = new Panel();
    contentPanel.setHeight("100%");
    contentPanel.addStyleName("contentPanel");

    defaultContentPanelLabel = new Label("Please log in to get started");
    defaultContentPanelLabel.addStyleName("defaultContentPanelLabel");
    contentPanel.setContent(defaultContentPanelLabel);

    mainLayout.addComponent(contentPanel);
    mainLayout.setExpandRatio(contentPanel, 1.0f);

    menuLayout = new HorizontalLayout();
    menuLayout.setMargin(true);
    menuLayout.setSpacing(true);

    logoResource = new ThemeResource("catma-logo.png");
    Link logoImage = new Link(null, new ExternalResource("http://www.catma.de"));
    logoImage.setIcon(logoResource);
    logoImage.setTargetName("_blank");
    menuLayout.addComponent(logoImage);

    MenuFactory menuFactory = new MenuFactory();
    try {

        initTempDirectory();
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(
                new RepositoryManager(this, tagManager, RepositoryProperties.INSTANCE.getProperties()));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        menu = menuFactory.createMenu(menuLayout, contentPanel,
                new MenuFactory.MenuEntryDefinition("Repository Manager", repositoryManagerView),
                new MenuFactory.MenuEntryDefinition("Tag Type Manager", tagManagerView),
                new MenuFactory.MenuEntryDefinition("Tagger", taggerManagerView),
                new MenuFactory.MenuEntryDefinition("Analyzer", analyzerManagerView),
                new MenuFactory.MenuEntryDefinition("Visualizer", visualizationManagerView));
        addPropertyChangeListener(CatmaApplicationEvent.userChange, menu.userChangeListener);

        Link latestFeaturesLink = new Link("Latest Features",
                new ExternalResource("http://www.catma.de/latestfeatures"));
        latestFeaturesLink.setTargetName("_blank");
        menuLayout.addComponent(latestFeaturesLink);
        menuLayout.setComponentAlignment(latestFeaturesLink, Alignment.TOP_RIGHT);
        menuLayout.setExpandRatio(latestFeaturesLink, 1.0f);

        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        menuLayout.addComponent(aboutLink);
        menuLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);

        Link termsOfUseLink = new Link("Terms of Use", new ExternalResource("http://www.catma.de/termsofuse"));
        termsOfUseLink.setTargetName("_blank");
        menuLayout.addComponent(termsOfUseLink);
        menuLayout.setComponentAlignment(termsOfUseLink, Alignment.TOP_RIGHT);

        Link manualLink = new Link("Manual", new ExternalResource(request.getContextPath() + "/manual/"));
        manualLink.setTargetName("_blank");
        menuLayout.addComponent(manualLink);
        menuLayout.setComponentAlignment(manualLink, Alignment.TOP_RIGHT);

        Link helpLink = new Link("Helpdesk", new ExternalResource("http://www.catma.de/helpdesk/"));
        helpLink.setTargetName("_blank");
        menuLayout.addComponent(helpLink);
        menuLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);
        helpLink.setVisible(false);

        btHelp = new Button(FontAwesome.QUESTION_CIRCLE);
        btHelp.addStyleName("help-button");
        btHelp.addStyleName("application-help-button");

        menuLayout.addComponent(btHelp);

        btHelp.addClickListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {

                if (uiHelpWindow.getParent() == null) {
                    UI.getCurrent().addWindow(uiHelpWindow);
                } else {
                    UI.getCurrent().removeWindow(uiHelpWindow);
                }

            }
        });

        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView);
        Button btloginLogout = new Button("Sign in", event -> loginLogoutCommand.menuSelected(null));
        btloginLogout.setStyleName(BaseTheme.BUTTON_LINK);
        btloginLogout.addStyleName("application-loginlink");

        loginLogoutCommand.setLoginLogoutButton(btloginLogout);

        menuLayout.addComponent(btloginLogout);
        menuLayout.setComponentAlignment(btloginLogout, Alignment.TOP_RIGHT);
        menuLayout.setWidth("100%");

        menuPanel.setContent(menuLayout);

        setContent(mainLayout);

        if (getParameter(Parameter.USER_IDENTIFIER) != null) {
            btloginLogout.click();
        }

        setPollInterval(10000);

        if ((getParameter(Parameter.AUTOLOGIN) != null) && (getUser() == null)) {
            getPage().setLocation(repositoryManagerView.createAuthenticationDialog().createLogInClick(this,
                    RepositoryPropertyKey.CATMA_oauthAuthorizationCodeRequestURL.getValue(),
                    RepositoryPropertyKey.CATMA_oauthAccessTokenRequestURL.getValue(),
                    RepositoryPropertyKey.CATMA_oauthClientId.getValue(),
                    RepositoryPropertyKey.CATMA_oauthClientSecret.getValue(), URLEncoder.encode("/", "UTF-8")));
        }

    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DatasetComponent.java

License:Open Source License

/**
 * Precondition: {DatasetView#table} has to be initialized. e.g. with
 * {DatasetView#buildFilterTable} If it is not, strange behaviour has to be expected. builds the
 * Layout of this view./*from   w w w  .ja  v  a 2s.com*/
 */
private void buildLayout() {
    this.vert.removeAllComponents();
    this.vert.setSizeFull();

    vert.setResponsive(true);

    // Table (containing datasets) section
    VerticalLayout tableSection = new VerticalLayout();
    HorizontalLayout tableSectionContent = new HorizontalLayout();
    tableSection.setResponsive(true);
    tableSectionContent.setResponsive(true);

    // tableSectionContent.setCaption("Datasets");
    // tableSectionContent.setIcon(FontAwesome.FLASK);
    // tableSection.addComponent(new Label(String.format("This project contains %s dataset(s).",
    // numberOfDatasets)));
    tableSectionContent.setMargin(new MarginInfo(true, false, true, false));

    tableSection.addComponent(headerLabel);
    tableSectionContent.addComponent(this.table);
    vert.setMargin(new MarginInfo(false, true, false, false));

    tableSection.setMargin(new MarginInfo(true, false, false, true));
    // tableSectionContent.setMargin(true);
    // tableSection.setMargin(true);

    tableSection.addComponent(tableSectionContent);
    this.vert.addComponent(tableSection);

    table.setSizeFull();
    tableSection.setSizeFull();
    tableSectionContent.setSizeFull();

    // this.table.setSizeFull();

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setMargin(new MarginInfo(false, false, true, true));
    buttonLayout.setHeight(null);
    // buttonLayout.setWidth("100%");
    buttonLayout.setSpacing(true);
    buttonLayout.setResponsive(true);

    // final Button visualize = new Button(VISUALIZE_BUTTON_CAPTION);

    Button checkAll = new Button("Select all datasets");
    checkAll.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            for (Object itemId : table.getItemIds()) {
                ((CheckBox) table.getItem(itemId).getItemProperty("Select").getValue()).setValue(true);
            }
        }
    });

    Button uncheckAll = new Button("Unselect all datasets");
    uncheckAll.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            for (Object itemId : table.getItemIds()) {
                ((CheckBox) table.getItem(itemId).getItemProperty("Select").getValue()).setValue(false);
            }
        }
    });

    String content = "<p> In case of multiple file selections, Project Browser will create a tar archive.</p>"
            + "<hr>" + "<p> If you need help on extracting a tar archive file, follow the tips below: </p>"
            + "<p>" + FontAwesome.WINDOWS.getHtml() + " Windows </p>"
            + "<p> To open/extract TAR file on Windows, you can use 7-Zip, Easy 7-Zip, PeaZip.</p>" + "<hr>"
            + "<p>" + FontAwesome.APPLE.getHtml() + " MacOS </p>"
            + "<p> To open/extract TAR file on Mac, you can use Mac OS built-in utility Archive Utility,<br> or third-party freeware. </p>"
            + "<hr>" + "<p>" + FontAwesome.LINUX.getHtml() + " Linux </p>"
            + "<p> You need to use command tar. The tar is the GNU version of tar archiving utility. <br> "
            + "To extract/unpack a tar file, type: $ tar -xvf file.tar</p>";

    export.setIcon(FontAwesome.DOWNLOAD);

    PopupView tooltip = new PopupView(new helpers.ToolTip(content));
    tooltip.setHeight("44px");

    HorizontalLayout help = new HorizontalLayout();
    help.setSizeFull();
    HorizontalLayout helpContent = new HorizontalLayout();
    // helpContent.setSizeFull();

    help.setMargin(new MarginInfo(false, false, false, true));
    Label helpText = new Label("Attention: Click here before Download!");
    helpContent.addComponent(new Label(FontAwesome.QUESTION_CIRCLE.getHtml(), ContentMode.HTML));
    helpContent.addComponent(helpText);
    helpContent.addComponent(tooltip);
    helpContent.setSpacing(true);

    help.addComponent(helpContent);
    help.setComponentAlignment(helpContent, Alignment.TOP_CENTER);

    buttonLayout.addComponent(export);
    buttonLayout.addComponent(checkAll);
    buttonLayout.addComponent(uncheckAll);
    // buttonLayout.addComponent(visualize);
    buttonLayout.addComponent(this.download);

    /**
     * prepare download.
     */
    download.setEnabled(false);
    download.setResource(new ExternalResource("javascript:"));
    // visualize.setEnabled(false);

    for (final Object itemId : this.table.getItemIds()) {
        setCheckedBox(itemId, (String) this.table.getItem(itemId).getItemProperty("CODE").getValue());
    }

    this.table.addItemClickListener(new ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (!event.isDoubleClick()
                    & !((boolean) table.getItem(event.getItemId()).getItemProperty("isDirectory").getValue())) {
                String datasetCode = (String) table.getItem(event.getItemId()).getItemProperty("CODE")
                        .getValue();
                String datasetFileName = (String) table.getItem(event.getItemId()).getItemProperty("File Name")
                        .getValue();
                URL url;
                try {
                    Resource res = null;
                    Object parent = table.getParent(event.getItemId());
                    if (parent != null) {
                        String parentDatasetFileName = (String) table.getItem(parent)
                                .getItemProperty("File Name").getValue();
                        url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode,
                                parentDatasetFileName + "/" + datasetFileName);
                    } else {
                        url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, datasetFileName);
                    }

                    Window subWindow = new Window();
                    VerticalLayout subContent = new VerticalLayout();
                    subContent.setMargin(true);
                    subContent.setSizeFull();
                    subWindow.setContent(subContent);
                    QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent();
                    Boolean visualize = false;

                    if (datasetFileName.endsWith(".pdf")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("application/pdf");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".png")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        // streamres.setMIMEType("application/png");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".qcML")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/xml");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".alleles")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".tsv")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".GSvar")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".log")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/plain");
                        res = streamres;
                        visualize = true;
                    }

                    if (datasetFileName.endsWith(".html")) {
                        QcMlOpenbisSource re = new QcMlOpenbisSource(url);
                        StreamResource streamres = new StreamResource(re, datasetFileName);
                        streamres.setMIMEType("text/html");
                        res = streamres;
                        visualize = true;
                    }

                    if (visualize) {
                        // LOGGER.debug("Is resource null?: " + String.valueOf(res == null));
                        BrowserFrame frame = new BrowserFrame("", res);

                        subContent.addComponent(frame);

                        // Center it in the browser window
                        subWindow.center();
                        subWindow.setModal(true);
                        subWindow.setSizeUndefined();
                        subWindow.setHeight("75%");
                        subWindow.setWidth("75%");
                        subWindow.setResizable(false);

                        frame.setSizeFull();
                        frame.setHeight("100%");
                        // frame.setHeight((int) (ui.getPage().getBrowserWindowHeight() * 0.9), Unit.PIXELS);

                        // Open it in the UI
                        ui.addWindow(subWindow);
                    }

                } catch (MalformedURLException e) {
                    LOGGER.error(String.format("Visualization failed because of malformedURL for dataset: %s",
                            datasetCode));
                    Notification.show(
                            "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data",
                            Notification.Type.ERROR_MESSAGE);
                }
            }
        }
    });

    this.vert.addComponent(buttonLayout);
    this.vert.addComponent(help);

}