Example usage for com.vaadin.server FontAwesome CLOCK_O

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

Introduction

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

Prototype

FontAwesome CLOCK_O

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

Click Source Link

Usage

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

License:Open Source License

public void displayTime(final V bean) {
    this.removeAllComponents();

    MHorizontalLayout header = FormSectionBuilder.build(FontAwesome.CLOCK_O,
            TimeTrackingI18nEnum.SUB_INFO_TIME);

    if (hasEditPermission()) {
        MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                clickEvent -> showEditTimeView(bean)).withStyleName(MobileUIConstants.BUTTON_LINK);
        header.addComponent(editBtn);/*from  w w  w.  j a v  a 2 s.  c  o m*/
        header.setComponentAlignment(editBtn, Alignment.MIDDLE_RIGHT);
    }

    this.addComponent(header);

    GridFormLayoutHelper layout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3);

    double billableHours = getTotalBillableHours(bean);
    double nonBillableHours = getTotalNonBillableHours(bean);
    double remainHours = getRemainedHours(bean);
    layout.addComponent(new Label(billableHours + ""),
            UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS), 0, 0);
    layout.addComponent(new Label(nonBillableHours + ""),
            UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS), 0, 1);
    layout.addComponent(new Label(remainHours + ""),
            UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_REMAIN_HOURS), 0, 2);
    this.addComponent(layout.getLayout());
}

From source file:com.mycollab.mobile.module.project.view.milestone.MilestoneListViewImpl.java

License:Open Source License

@Override
protected Component buildToolbar() {
    Toolbar toolbar = new Toolbar();
    closedMilestoneBtn = new Button(UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_CLOSED_PHASE_TITLE),
            clickEvent -> displayStatus(MilestoneStatus.Closed));
    closedMilestoneBtn.setIcon(FontAwesome.MINUS_CIRCLE);
    toolbar.addComponent(closedMilestoneBtn);

    inProgressMilestoneBtn = new Button(
            UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_INPROGRESS_PHASE_TITLE),
            clickEvent -> displayStatus(MilestoneStatus.InProgress));
    inProgressMilestoneBtn.setIcon(FontAwesome.SPINNER);

    futureMilestoneBtn = new Button(UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_FUTURE_PHASE_TITLE),
            clickEvent -> displayStatus(MilestoneStatus.Future));
    futureMilestoneBtn.setIcon(FontAwesome.CLOCK_O);

    toolbar.addComponents(closedMilestoneBtn, inProgressMilestoneBtn, futureMilestoneBtn);
    return toolbar;
}

From source file:com.mycollab.mobile.module.project.view.ProjectDashboardViewImpl.java

License:Open Source License

@Override
public void displayDashboard() {
    mainLayout.removeAllComponents();//from w  w  w .j  a  v  a  2 s. c  o  m
    SimpleProject currentProject = CurrentProjectVariables.getProject();
    VerticalLayout projectInfo = new VerticalLayout();
    projectInfo.setStyleName("project-info-layout");
    projectInfo.setWidth("100%");
    projectInfo.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    ELabel projectIcon = ELabel.fontIcon(FontAwesome.BUILDING_O).withStyleName("project-icon")
            .withWidthUndefined();
    projectInfo.addComponent(projectIcon);

    ELabel projectName = new ELabel(currentProject.getName()).withFullWidth().withStyleName("project-name");
    projectInfo.addComponent(projectName);

    MHorizontalLayout metaInfo = new MHorizontalLayout();

    Label projectMemberBtn = ELabel
            .html(FontAwesome.USERS.getHtml() + " " + currentProject.getNumActiveMembers())
            .withDescription(UserUIContext.getMessage(ProjectMemberI18nEnum.OPT_ACTIVE_MEMBERS))
            .withStyleName(UIConstants.META_INFO);

    metaInfo.addComponent(projectMemberBtn);
    Label createdTimeLbl = ELabel
            .html(FontAwesome.CLOCK_O.getHtml() + " "
                    + UserUIContext.formatPrettyTime(currentProject.getCreatedtime()))
            .withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME))
            .withStyleName(UIConstants.META_INFO);
    metaInfo.addComponent(createdTimeLbl);

    Label billableHoursLbl = ELabel
            .html(FontAwesome.MONEY.getHtml() + " "
                    + NumberUtils.roundDouble(2, currentProject.getTotalBillableHours()))
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS))
            .withStyleName(UIConstants.META_INFO);
    metaInfo.addComponent(billableHoursLbl);

    Label nonBillableHoursLbl = ELabel
            .html(FontAwesome.GIFT.getHtml() + " "
                    + NumberUtils.roundDouble(2, currentProject.getTotalNonBillableHours()))
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS))
            .withStyleName(UIConstants.META_INFO);
    metaInfo.addComponent(nonBillableHoursLbl);
    projectInfo.addComponent(metaInfo);

    int openAssignments = currentProject.getNumOpenBugs() + currentProject.getNumOpenTasks()
            + currentProject.getNumOpenRisks();
    int totalAssignments = currentProject.getNumBugs() + currentProject.getNumTasks()
            + currentProject.getNumRisks();
    ELabel progressInfoLbl;
    if (totalAssignments > 0) {
        progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_PROJECT_TICKET,
                (totalAssignments - openAssignments), totalAssignments,
                (totalAssignments - openAssignments) * 100 / totalAssignments)).withWidthUndefined()
                        .withStyleName(UIConstants.META_INFO);
    } else {
        progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET))
                .withWidthUndefined().withStyleName(UIConstants.META_INFO);
    }
    projectInfo.addComponent(progressInfoLbl);

    mainLayout.addComponent(projectInfo);

    VerticalComponentGroup btnGroup = new VerticalComponentGroup();

    NavigationButton activityBtn = new NavigationButton(
            UserUIContext.getMessage(ProjectCommonI18nEnum.M_VIEW_PROJECT_ACTIVITIES));
    activityBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new ProjectEvent.MyProjectActivities(this, CurrentProjectVariables.getProjectId())));
    btnGroup.addComponent(new NavigationButtonWrap(FontAwesome.INBOX, activityBtn));

    NavigationButton messageBtn = new NavigationButton(UserUIContext.getMessage(MessageI18nEnum.LIST));
    messageBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new MessageEvent.GotoList(this, null)));
    btnGroup.addComponent(
            new NavigationButtonWrap(ProjectAssetsManager.getAsset(ProjectTypeConstants.MESSAGE), messageBtn));

    NavigationButton milestoneBtn = new NavigationButton(UserUIContext.getMessage(MilestoneI18nEnum.LIST));
    milestoneBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new MilestoneEvent.GotoList(this, null)));
    btnGroup.addComponent(new NavigationButtonWrap(
            ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE), milestoneBtn));

    NavigationButton taskBtn = new NavigationButton(UserUIContext.getMessage(TicketI18nEnum.LIST));
    taskBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new TicketEvent.GotoDashboard(this, null)));
    btnGroup.addComponent(
            new NavigationButtonWrap(ProjectAssetsManager.getAsset(ProjectTypeConstants.TICKET), taskBtn));

    NavigationButton userBtn = new NavigationButton(UserUIContext.getMessage(ProjectMemberI18nEnum.LIST));
    userBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new ProjectMemberEvent.GotoList(this, null)));
    btnGroup.addComponent(new NavigationButtonWrap(FontAwesome.USERS, userBtn));

    mainLayout.addComponent(btnGroup);
}

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 .ja va 2  s .  c  o  m
    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.module.project.ui.ProjectAssetsManager.java

License:Open Source License

public static FontAwesome getMilestoneStatus(String status) {
    if (MilestoneStatus.Closed.name().equals(status)) {
        return FontAwesome.MINUS_CIRCLE;
    } else if (MilestoneStatus.InProgress.name().equals(status)) {
        return FontAwesome.CLOCK_O;
    } else {/*from w  w w . ja  va2s .  com*/
        return FontAwesome.SPINNER;
    }
}

From source file:com.mycollab.module.project.ui.ProjectAssetsUtil.java

License:Open Source License

public static FontAwesome getPhaseIcon(String status) {
    if (MilestoneStatus.Closed.name().equals(status)) {
        return FontAwesome.MINUS_CIRCLE;
    } else if (MilestoneStatus.Future.name().equals(status)) {
        return FontAwesome.CLOCK_O;
    } else {//from  w w w.j a  v a 2 s . c  o  m
        return FontAwesome.SPINNER;
    }
}

From source file:com.mycollab.module.project.view.milestone.MilestoneRoadmapViewImpl.java

License:Open Source License

@Override
protected void displayView() {
    initUI();/*from   w w w .j a v a 2s.  c o  m*/

    baseCriteria = new MilestoneSearchCriteria();
    baseCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    baseCriteria.setOrderFields(Arrays.asList(new SearchCriteria.OrderField("startdate", SearchCriteria.DESC),
            new SearchCriteria.OrderField("enddate", SearchCriteria.DESC)));
    displayMilestones();

    closeMilestoneSelection = new CheckBox("", true);
    inProgressMilestoneSelection = new CheckBox("", true);
    futureMilestoneSelection = new CheckBox("", true);

    closeMilestoneSelection.addValueChangeListener(
            valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(),
                    inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue()));
    inProgressMilestoneSelection.addValueChangeListener(
            valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(),
                    inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue()));
    futureMilestoneSelection.addValueChangeListener(
            valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(),
                    inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue()));
    futureMilestoneSelection.setIcon(FontAwesome.CLOCK_O);

    filterPanel.with(closeMilestoneSelection, inProgressMilestoneSelection, futureMilestoneSelection);
    displayWidget();
}

From source file:com.mycollab.module.project.view.user.ProjectInfoComponent.java

License:Open Source License

public ProjectInfoComponent(SimpleProject project) {
    this.withMargin(false).withFullWidth();
    Component projectIcon = ProjectAssetsUtil.buildProjectLogo(project.getShortname(), project.getId(),
            project.getAvatarid(), 64);//  w ww .ja va 2s  .c  o  m
    this.with(projectIcon).withAlign(projectIcon, Alignment.TOP_LEFT);

    ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
    breadCrumb.setProject(project);
    MVerticalLayout headerLayout = new MVerticalLayout().withSpacing(false)
            .withMargin(new MarginInfo(false, true, false, true));

    MHorizontalLayout footer = new MHorizontalLayout().withStyleName(UIConstants.META_INFO,
            WebThemes.FLEX_DISPLAY);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel createdTimeLbl = ELabel
            .html(FontAwesome.CLOCK_O.getHtml() + " "
                    + UserUIContext.formatPrettyTime(project.getCreatedtime()))
            .withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME))
            .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
    footer.addComponents(createdTimeLbl);

    billableHoursLbl = ELabel
            .html(FontAwesome.MONEY.getHtml() + " "
                    + NumberUtils.roundDouble(2, project.getTotalBillableHours()))
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS))
            .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
    footer.addComponents(billableHoursLbl);

    nonBillableHoursLbl = ELabel.html(FontAwesome.GIFT.getHtml() + " " + project.getTotalNonBillableHours())
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS))
            .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
    footer.addComponents(nonBillableHoursLbl);

    if (project.getLead() != null) {
        Div leadAvatar = new DivLessFormatter()
                .appendChild(new Img("",
                        StorageFactory.getAvatarPath(project.getLeadAvatarId(), 16))
                                .setCSSClass(UIConstants.CIRCLE_BOX),
                        DivLessFormatter.EMPTY_SPACE(),
                        new A(ProjectLinkBuilder.generateProjectMemberFullLink(project.getId(),
                                project.getLead()))
                                        .appendText(StringUtils.trim(project.getLeadFullName(), 30, true)))
                .setTitle(project.getLeadFullName());
        ELabel leadLbl = ELabel
                .html(UserUIContext.getMessage(ProjectI18nEnum.FORM_LEADER) + ": " + leadAvatar.write())
                .withWidthUndefined();
        footer.addComponents(leadLbl);
    }
    if (project.getHomepage() != null) {
        ELabel homepageLbl = ELabel
                .html(FontAwesome.WECHAT.getHtml() + " " + new A(project.getHomepage())
                        .appendText(project.getHomepage()).setTarget("_blank").write())
                .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
        homepageLbl.setDescription(UserUIContext.getMessage(ProjectI18nEnum.FORM_HOME_PAGE));
    }

    if (project.getNumActiveMembers() > 0) {
        ELabel activeMembersLbl = ELabel.html(FontAwesome.USERS.getHtml() + " " + project.getNumActiveMembers())
                .withDescription(UserUIContext.getMessage(ProjectMemberI18nEnum.OPT_ACTIVE_MEMBERS))
                .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
        footer.addComponents(activeMembersLbl);
    }

    if (project.getAccountid() != null && !SiteConfiguration.isCommunityEdition()) {
        Div clientDiv = new Div();
        if (project.getClientAvatarId() == null) {
            clientDiv.appendText(FontAwesome.INSTITUTION.getHtml() + " ");
        } else {
            Img clientImg = new Img("", StorageFactory.getEntityLogoPath(MyCollabUI.getAccountId(),
                    project.getClientAvatarId(), 16)).setCSSClass(UIConstants.CIRCLE_BOX);
            clientDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE());
        }
        clientDiv.appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid()))
                .appendText(StringUtils.trim(project.getClientName(), 30, true)));
        ELabel accountBtn = ELabel.html(clientDiv.write()).withStyleName(WebThemes.BUTTON_LINK)
                .withWidthUndefined();
        footer.addComponents(accountBtn);
    }

    if (!SiteConfiguration.isCommunityEdition()) {
        MButton tagBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_TAG),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoTagListView(this, null)))
                        .withIcon(FontAwesome.TAGS)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(tagBtn);

        MButton favoriteBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_FAVORITES),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoFavoriteView(this, null)))
                        .withIcon(FontAwesome.STAR)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(favoriteBtn);

        MButton eventBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_CALENDAR),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoCalendarView(this)))
                        .withIcon(FontAwesome.CALENDAR)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(eventBtn);

        MButton ganttChartBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_GANTT_CHART),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoGanttChart(this, null)))
                        .withIcon(FontAwesome.BAR_CHART_O)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(ganttChartBtn);
    }

    headerLayout.with(breadCrumb, footer);

    MHorizontalLayout topPanel = new MHorizontalLayout().withMargin(false);
    this.with(headerLayout, topPanel).expand(headerLayout).withAlign(topPanel, Alignment.TOP_RIGHT);

    if (project.isProjectArchived()) {
        MButton activeProjectBtn = new MButton(
                UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECT), clickEvent -> {
                    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class);
                    project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Open.name());
                    projectService.updateSelectiveWithSession(project, UserUIContext.getUsername());

                    PageActionChain chain = new PageActionChain(
                            new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId()));
                    EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain));
                }).withStyleName(WebThemes.BUTTON_ACTION);
        topPanel.with(activeProjectBtn).withAlign(activeProjectBtn, Alignment.MIDDLE_RIGHT);
    } else {
        SearchTextField searchField = new SearchTextField() {
            public void doSearch(String value) {
                ProjectView prjView = UIUtils.getRoot(this, ProjectView.class);
                if (prjView != null) {
                    prjView.displaySearchResult(value);
                }
            }

            @Override
            public void emptySearch() {

            }
        };

        final PopupButton controlsBtn = new PopupButton();
        controlsBtn.addStyleName(WebThemes.BOX);
        controlsBtn.setIcon(FontAwesome.ELLIPSIS_H);

        OptionPopupContent popupButtonsControl = new OptionPopupContent();

        if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)) {
            MButton inviteMemberBtn = new MButton(
                    UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), clickEvent -> {
                        controlsBtn.setPopupVisible(false);
                        EventBusFactory.getInstance()
                                .post(new ProjectMemberEvent.GotoInviteMembers(this, null));
                    }).withIcon(FontAwesome.SEND);
            popupButtonsControl.addOption(inviteMemberBtn);
        }

        MButton settingBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS),
                clickEvent -> {
                    controlsBtn.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new ProjectNotificationEvent.GotoList(this, null));
                }).withIcon(FontAwesome.COG);
        popupButtonsControl.addOption(settingBtn);

        popupButtonsControl.addSeparator();

        if (UserUIContext.canAccess(RolePermissionCollections.CREATE_NEW_PROJECT)) {
            final MButton markProjectTemplateBtn = new MButton().withIcon(FontAwesome.ANCHOR);
            markProjectTemplateBtn.addClickListener(clickEvent -> {
                Boolean isTemplate = !MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE);
                project.setIstemplate(isTemplate);
                ProjectService prjService = AppContextUtil.getSpringBean(ProjectService.class);
                prjService.updateWithSession(project, UserUIContext.getUsername());
                if (project.getIstemplate()) {
                    markProjectTemplateBtn
                            .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE));
                } else {
                    markProjectTemplateBtn
                            .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE));
                }
            });

            Boolean isTemplate = MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE);
            if (isTemplate) {
                markProjectTemplateBtn
                        .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE));
            } else {
                markProjectTemplateBtn
                        .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE));
            }
            popupButtonsControl.addOption(markProjectTemplateBtn);
        }

        if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)) {
            MButton editProjectBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.EDIT), clickEvent -> {
                controlsBtn.setPopupVisible(false);
                EventBusFactory.getInstance()
                        .post(new ProjectEvent.GotoEdit(ProjectInfoComponent.this, project));
            }).withIcon(FontAwesome.EDIT);
            popupButtonsControl.addOption(editProjectBtn);
        }

        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) {
            MButton archiveProjectBtn = new MButton(
                    UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECT), clickEvent -> {
                        controlsBtn.setPopupVisible(false);
                        ConfirmDialogExt.show(UI.getCurrent(),
                                UserUIContext.getMessage(GenericI18Enum.WINDOW_WARNING_TITLE,
                                        MyCollabUI.getSiteName()),
                                UserUIContext.getMessage(
                                        ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_ARCHIVE_MESSAGE),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                                    if (confirmDialog.isConfirmed()) {
                                        ProjectService projectService = AppContextUtil
                                                .getSpringBean(ProjectService.class);
                                        project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Archived.name());
                                        projectService.updateSelectiveWithSession(project,
                                                UserUIContext.getUsername());

                                        PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(
                                                CurrentProjectVariables.getProjectId()));
                                        EventBusFactory.getInstance()
                                                .post(new ProjectEvent.GotoMyProject(this, chain));
                                    }
                                });
                    }).withIcon(FontAwesome.ARCHIVE);
            popupButtonsControl.addOption(archiveProjectBtn);
        }

        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) {
            popupButtonsControl.addSeparator();
            MButton deleteProjectBtn = new MButton(
                    UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_DELETE_PROJECT), clickEvent -> {
                        controlsBtn.setPopupVisible(false);
                        ConfirmDialogExt.show(UI.getCurrent(),
                                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                        MyCollabUI.getSiteName()),
                                UserUIContext.getMessage(
                                        ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_DELETE_MESSAGE),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                                    if (confirmDialog.isConfirmed()) {
                                        ProjectService projectService = AppContextUtil
                                                .getSpringBean(ProjectService.class);
                                        projectService.removeWithSession(CurrentProjectVariables.getProject(),
                                                UserUIContext.getUsername(), MyCollabUI.getAccountId());
                                        EventBusFactory.getInstance()
                                                .post(new ShellEvent.GotoProjectModule(this, null));
                                    }
                                });
                    }).withIcon(FontAwesome.TRASH_O);
            popupButtonsControl.addDangerOption(deleteProjectBtn);
        }

        controlsBtn.setContent(popupButtonsControl);
        controlsBtn.setWidthUndefined();

        topPanel.with(searchField, controlsBtn).withAlign(searchField, Alignment.TOP_RIGHT)
                .withAlign(controlsBtn, Alignment.TOP_RIGHT);
    }
}

From source file:lifetime.component.user.TimelineButton.java

License:Apache License

public TimelineButton(String language) {
    super("Timeline", language, FontAwesome.CLOCK_O);
    addClickListener(new ClickListener() {

        @Override//from  w  ww  . j a v a  2s. c  om
        public void buttonClick(ClickEvent event) {
            getUI().getNavigator().navigateTo(Navigation.TIMELINE_VIEW.getName());
        }
    });
}

From source file:org.eclipse.hawkbit.simulator.ui.GenerateDialog.java

License:Open Source License

/**
 * Creates a new pop window for setting the configuration of simulating
 * devices./*w  w w  .  ja  va  2 s .  c  o  m*/
 * 
 * @param callback
 *            the callback which is called when the dialog has been
 *            successfully confirmed.
 * @param dmfEnabled
 *            indicates if the AMQP/DMF interface is enabled by
 *            configuration and if the option DMF should be enabled or not
 */
public GenerateDialog(final GenerateDialogCallback callback, final boolean dmfEnabled) {
    this.dmfEnabled = dmfEnabled;
    formLayout.setSpacing(true);
    formLayout.setMargin(true);

    namePrefixTextField = createRequiredTextfield("name prefix", "dmfSimulated", FontAwesome.INFO,
            new NullValidator("Must be given", false));

    amountTextField = createRequiredTextfield("amount", new ObjectProperty<Integer>(10), FontAwesome.GEAR,
            new RangeValidator<Integer>("Must be between 1 and 30000", Integer.class, 1, 30000));

    tenantTextField = createRequiredTextfield("tenant", "default", FontAwesome.USER,
            new NullValidator("Must be given", false));

    pollDelayTextField = createRequiredTextfield("poll delay (sec)", new ObjectProperty<Integer>(10),
            FontAwesome.CLOCK_O, new RangeValidator<Integer>("Must be between 1 and 60", Integer.class, 1, 60));

    pollUrlTextField = createRequiredTextfield("base poll URL endpoint", "http://localhost:8080",
            FontAwesome.FLAG_O,
            new RegexpValidator("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]",
                    "is not an URL"));
    pollUrlTextField.setColumns(50);
    pollUrlTextField.setVisible(false);

    gatewayTokenTextField = createRequiredTextfield("gateway token", "", FontAwesome.FLAG_O, null);
    gatewayTokenTextField.setColumns(50);
    gatewayTokenTextField.setVisible(false);

    createProtocolGroup();
    createOkButton(callback);

    namePrefixTextField.addValueChangeListener(event -> checkValid());
    amountTextField.addValueChangeListener(event -> checkValid());
    tenantTextField.addValueChangeListener(event -> checkValid());

    formLayout.addComponent(namePrefixTextField);
    formLayout.addComponent(amountTextField);
    formLayout.addComponent(tenantTextField);
    formLayout.addComponent(protocolGroup);
    formLayout.addComponent(pollDelayTextField);
    formLayout.addComponent(pollUrlTextField);
    formLayout.addComponent(gatewayTokenTextField);
    formLayout.addComponent(buttonOk);

    setCaption("Simulate Devices");
    setContent(formLayout);
    setResizable(false);
    center();
}