Example usage for com.vaadin.server FontAwesome SHARE

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

Introduction

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

Prototype

FontAwesome SHARE

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

Click Source Link

Usage

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

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleBug> bugPreviewFormControls = new ProjectPreviewFormControlsGenerator<>(
            previewForm);//from  w  ww .ja  v  a 2 s  . c o  m
    MButton linkBtn = new MButton("Link", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            UI.getCurrent().addWindow(new LinkIssueWindow(beanItem));
        }
    }).withIcon(FontAwesome.LINK);
    linkBtn.addStyleName("black");
    bugPreviewFormControls.addOptionButton(linkBtn);

    final HorizontalLayout topPanel = bugPreviewFormControls.createButtonControls(
            ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED,
            ProjectRolePermissionCollections.BUGS);

    final Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    UI.getCurrent().addWindow(new AssignBugWindow(BugReadViewImpl.this, beanItem));
                }
            });
    assignBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    assignBtn.setIcon(FontAwesome.SHARE);

    assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    this.bugWorkflowControl = new HorizontalLayout();
    this.bugWorkflowControl.setMargin(false);
    this.bugWorkflowControl.addStyleName("workflow-controls");

    bugPreviewFormControls.insertToControlBlock(bugWorkflowControl);
    bugPreviewFormControls.insertToControlBlock(assignBtn);
    topPanel.setSizeUndefined();

    return topPanel;
}

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

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(UIConstants.BOX);
    optionBtn.setIcon(FontAwesome.ELLIPSIS_H);

    if (permissionItem != null) {
        boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
        boolean canRead = CurrentProjectVariables.canRead(permissionItem);

        if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
            Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            T item = previewForm.getBean();
                            previewForm.fireAssignForm(item);
                        }/* w  w w.  j a v  a  2  s.  com*/
                    });
            assignBtn.setIcon(FontAwesome.SHARE);
            assignBtn.setStyleName(UIConstants.BUTTON_ACTION);
            editButtons.addComponent(assignBtn);
            assignBtn.setEnabled(canWrite);
        }

        if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireAddForm(item);
                        }
                    });
            addBtn.setIcon(FontAwesome.PLUS);
            addBtn.setStyleName(UIConstants.BUTTON_ACTION);
            addBtn.setEnabled(canWrite);
            editButtons.addComponent(addBtn);
        }

        if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireEditForm(item);
                        }
                    });
            editBtn.setIcon(FontAwesome.EDIT);
            editBtn.setStyleName(UIConstants.BUTTON_ACTION);
            editBtn.setEnabled(canWrite);
            editButtons.addComponent(editBtn);
        }

        if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
            Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            T item = previewForm.getBean();
                            previewForm.fireDeleteForm(item);
                        }
                    });
            deleteBtn.setIcon(FontAwesome.TRASH_O);
            deleteBtn.setStyleName(UIConstants.BUTTON_DANGER);
            deleteBtn.setEnabled(canAccess);
            editButtons.addComponent(deleteBtn);
        }

        if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
            final PrintButton printBtn = new PrintButton();
            printBtn.addClickListener(new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.firePrintForm(printBtn, item);
                }
            });
            printBtn.setStyleName(UIConstants.BUTTON_OPTION);
            printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_PRINT));
            printBtn.setEnabled(canRead);
            editButtons.addComponent(printBtn);
        }

        if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireCloneForm(item);
                        }
                    });
            cloneBtn.setIcon(FontAwesome.ROAD);
            cloneBtn.setEnabled(canWrite);
            popupButtonsControl.addOption(cloneBtn);
        }

        layout.with(editButtons);

        if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            Button previousItem = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoPrevious(item);
                }
            });
            previousItem.setIcon(FontAwesome.CHEVRON_LEFT);
            previousItem.setCaptionAsHtml(true);
            previousItem.setStyleName(UIConstants.BUTTON_OPTION);
            previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
            previousItem.setEnabled(canRead);
            navigationBtns.addButton(previousItem);

            Button nextItemBtn = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoNextItem(item);
                }
            });
            nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT);
            nextItemBtn.setStyleName(UIConstants.BUTTON_OPTION);
            nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
            nextItemBtn.setEnabled(canRead);
            navigationBtns.addButton(nextItemBtn);

            layout.addComponent(navigationBtns);
        }

        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.addComponent(optionBtn);
        }
    }

    return layout;
}

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

License:Open Source License

@Override
protected HorizontalLayout createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleBug> bugPreviewFormControls = new ProjectPreviewFormControlsGenerator<>(
            previewForm);//w  w  w.  j  a va 2  s.  c o m
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
        MButton linkBtn = new MButton(UserUIContext.getMessage(BugI18nEnum.OPT_BUG_DEPENDENCIES),
                clickEvent -> UI.getCurrent().addWindow(new LinkIssueWindow(beanItem)))
                        .withIcon(FontAwesome.BOLT);
        bugPreviewFormControls.addOptionButton(linkBtn);
    }

    HorizontalLayout topPanel = bugPreviewFormControls.createButtonControls(
            ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.PRINT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.NAVIGATOR_BTN_PRESENTED,
            ProjectRolePermissionCollections.BUGS);

    MButton assignBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
            clickEvent -> UI.getCurrent().addWindow(new AssignBugWindow(beanItem))).withIcon(FontAwesome.SHARE)
                    .withStyleName(WebThemes.BUTTON_ACTION);
    assignBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));

    bugWorkflowControl = new CssLayout();
    bugPreviewFormControls.insertToControlBlock(bugWorkflowControl);
    bugPreviewFormControls.insertToControlBlock(assignBtn);
    topPanel.setSizeUndefined();

    return topPanel;
}

From source file:com.mycollab.vaadin.web.ui.ProjectPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(WebThemes.BUTTON_OPTION);
    optionBtn.setIcon(FontAwesome.ELLIPSIS_H);

    if (permissionItem != null) {
        boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
        boolean canRead = CurrentProjectVariables.canRead(permissionItem);

        if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
            MButton assignBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
                    clickEvent -> {/*from   ww w.jav a  2 s  .com*/
                        T item = previewForm.getBean();
                        previewForm.fireAssignForm(item);
                    }).withIcon(FontAwesome.SHARE).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(assignBtn);
        }

        if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireAddForm(item);
            }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(addBtn);
        }

        if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }).withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(editBtn);
        }

        if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
            MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                    clickEvent -> {
                        T item = previewForm.getBean();
                        previewForm.fireDeleteForm(item);
                    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER)
                            .withVisible(canAccess);
            editButtons.addComponent(deleteBtn);
        }

        if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
            final PrintButton printBtn = new PrintButton();
            printBtn.withListener(clickEvent -> {
                T item = previewForm.getBean();
                previewForm.firePrintForm(printBtn, item);
            }).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_PRINT))
                    .withVisible(canRead);
            editButtons.addComponent(printBtn);
        }

        if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                    clickEvent -> {
                        optionBtn.setPopupVisible(false);
                        T item = previewForm.getBean();
                        previewForm.fireCloneForm(item);
                    }).withIcon(FontAwesome.ROAD).withVisible(canWrite);
            popupButtonsControl.addOption(cloneBtn);
        }

        layout.with(editButtons);

        if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            MButton previousItem = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }).withIcon(FontAwesome.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM))
                    .withVisible(canRead);
            navigationBtns.addButton(previousItem);

            MButton nextItemBtn = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoNextItem(item);
            }).withIcon(FontAwesome.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM))
                    .withVisible(canRead);
            navigationBtns.addButton(nextItemBtn);
            layout.addComponent(navigationBtns);
        }

        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.addComponent(optionBtn);
        }
    }

    return layout;
}

From source file:gov.va.ehtac.appsonfhir.ui.Vitals.java

public Vitals() {
    session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes();
    setCaption("Observations - " + session.getPatientNameAgeGenderDisplay());
    final VerticalComponentGroup content = new VerticalComponentGroup();

    createTable();//w  w w.j  a va  2s . co  m

    content.addComponent(vitalsTable);

    final Button submitButton = new Button("Submit");
    submitButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Notification.show("Thanks!");
        }
    });
    Button b = new Button("HCS");
    b.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                HCSOrchestratorService service = new HCSOrchestratorService();
                HCSOrchestrator port = service.getHCSOrchestratorPort();
                ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                        "http://localhost:7080/HCSServices/HCSOrchestratorService?wsdl");

                List<HcsCategory> hcs = new ArrayList();
                ApplySecurityLabelsFHIRForResourceReleaseResponse.Return r = port
                        .applySecurityLabelsFHIRForResourceRelease(composeXMLStringFeed(bundle), "1", hcs,
                                session.getPurposeOfUse());
                System.out.println(r.getProcessedAtomFeed());
                //HcsTaggingResponse res = port.genFHIRConfidentialityLabels(composeXMLStringFeed(bundle), hcs);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }

    });

    b.setIcon(FontAwesome.SHARE);
    setRightComponent(b);
    setContent(new CssLayout(content));

}

From source file:org.opennms.features.topology.app.internal.TopologyUI.java

License:Open Source License

@Override
public void menuBarUpdated(CommandManager commandManager) {
    if (m_menuBar != null) {
        m_rootLayout.removeComponent(m_menuBar);
    }//  w  w w . ja v  a2 s  . c o m

    if (m_contextMenu != null) {
        m_contextMenu.detach();
    }

    m_menuBar = commandManager.getMenuBar(m_graphContainer, this);
    m_menuBar.setWidth(100, Unit.PERCENTAGE);
    // Set expand ratio so that extra space is not allocated to this vertical component
    if (m_showHeader) {
        m_rootLayout.addComponent(m_menuBar, 1);
    } else {
        m_rootLayout.addComponent(m_menuBar, 0);
    }

    m_contextMenu = commandManager
            .getContextMenu(new DefaultOperationContext(this, m_graphContainer, DisplayLocation.CONTEXTMENU));
    m_contextMenu.setAsContextMenuOf(this);

    // Add Menu Item to share the View with others
    m_menuBar.addItem("Share", FontAwesome.SHARE, new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            // create the share link
            String fragment = getPage().getLocation().getFragment();
            String url = getPage().getLocation().toString().replace("#" + getPage().getLocation().getFragment(),
                    "");
            String shareLink = String.format("%s?%s=%s", url,
                    TopologyUIRequestHandler.PARAMETER_HISTORY_FRAGMENT, fragment);

            // Create the Window
            Window shareWindow = new Window();
            shareWindow.setCaption("Share Link");
            shareWindow.setModal(true);
            shareWindow.setClosable(true);
            shareWindow.setResizable(false);
            shareWindow.setWidth(400, Unit.PIXELS);

            TextArea shareLinkField = new TextArea();
            shareLinkField.setValue(shareLink);
            shareLinkField.setReadOnly(true);
            shareLinkField.setRows(3);
            shareLinkField.setWidth(100, Unit.PERCENTAGE);

            // Close Button
            Button close = new Button("Close");
            close.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);
            close.addClickListener(event -> shareWindow.close());

            // Layout for Buttons
            HorizontalLayout buttonLayout = new HorizontalLayout();
            buttonLayout.setMargin(true);
            buttonLayout.setSpacing(true);
            buttonLayout.setWidth("100%");
            buttonLayout.addComponent(close);
            buttonLayout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);

            // Content Layout
            VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.setMargin(true);
            verticalLayout.setSpacing(true);
            verticalLayout.addComponent(
                    new Label("Please use the following link to share the current view with others."));
            verticalLayout.addComponent(shareLinkField);
            verticalLayout.addComponent(buttonLayout);

            shareWindow.setContent(verticalLayout);

            getUI().addWindow(shareWindow);
        }
    });

    updateMenuItems();
}

From source file:ui.menu.LifetimeMenu.java

License:Apache License

private void initShareOptions() {
    shareButton = new LifetimeButtonLink("Share", FontAwesome.SHARE);
    shareButton.addClickListener(this);
    shareButton.addFocusListener(this);
    FacebookPostButton facebookPostButton = new FacebookPostButton(userId, language);
    VerticalLayout options = new VerticalLayout();
    options.setStyleName("v-menu-options");
    options.addComponent(facebookPostButton);
    menu.put(shareButton, options);/* ww  w.  j  av  a  2s.  co m*/
}