org.vaadin.viritin.button.MButton Java Examples

The following examples show how to use org.vaadin.viritin.button.MButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MassUpdateWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
protected ComponentContainer buildButtonControls() {
    MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withFullWidth();

    updateBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), clickEvent -> {
        updateForm.commit();
        massUpdateCommand.massUpdate(beanItem);
        close();
    }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.CLIPBOARD);

    closeBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLOSE), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    Label spacing = new Label();
    controlsLayout.with(spacing, closeBtn, updateBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing);
    return controlsLayout;
}
 
Example #2
Source File: TicketRelationComp.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
public TicketRelationComp(SimpleTicketRelation ticketRelation) {
    buildTicketLink(ticketRelation);
    this.addComponent(titleLinkLbl);
    this.addStyleName("editable-field");
    // TODO: may check the permission here?
    buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
    MButton unlinkBtn = new MButton("", clickEvent -> {
        ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                AppUI.getSiteName()),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                UserUIContext.getMessage(GenericI18Enum.ACTION_YES),
                UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
                    TicketRelationExample ex = new TicketRelationExample();
                    ex.or().andTicketidEqualTo(ticketRelation.getTicketid()).andTickettypeEqualTo(ticketRelation.getTickettype());
                    ex.or().andTicketidEqualTo(ticketRelation.getTypeid()).andTickettypeEqualTo(ticketRelation.getType());

                    TicketRelationMapper ticketRelationMapper = AppContextUtil.getSpringBean(TicketRelationMapper.class);
                    ticketRelationMapper.deleteByExample(ex);
                    UIUtils.removeChildAssociate(TicketRelationComp.this, RemoveInlineComponentMarker.class);
                });
    }).withIcon(VaadinIcons.UNLINK).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP, ValoTheme.BUTTON_ICON_ONLY)
            .withDescription(UserUIContext.getMessage(TicketI18nEnum.OPT_REMOVE_RELATIONSHIP));
    buttonControls.with(unlinkBtn);
    this.addComponent(buttonControls);
}
 
Example #3
Source File: GroupPageAddWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public AbstractComponent getLayout() {
    final MVerticalLayout layout = new MVerticalLayout().withMargin(false);
    informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    layout.addComponent(informationLayout.getLayout());

    final MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        if (EditForm.this.validateForm()) {
            PageService pageService = AppContextUtil.getSpringBean(PageService.class);
            pageService.createFolder(folder, UserUIContext.getUsername());
            folder.setCreatedTime(new GregorianCalendar());
            folder.setCreatedUser(UserUIContext.getUsername());
            GroupPageAddWindow.this.close();
            EventBusFactory.getInstance().post(new PageEvent.GotoList(GroupPageAddWindow.this, folder.getPath()));
        }
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout controlsBtn = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(new MarginInfo(true, false, true, false));
    layout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);
    return layout;
}
 
Example #4
Source File: MessageListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected SearchLayout<MessageSearchCriteria> createBasicSearchLayout() {
    return new BasicSearchLayout<MessageSearchCriteria>(MessageSearchPanel.this) {
        @Override
        public ComponentContainer constructBody() {
            nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
                    .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);

            MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
                    .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.SEARCH)
                    .withClickShortcut(KeyCode.ENTER);
            return new MHorizontalLayout(nameField, searchBtn).withMargin(true).withAlign(nameField, Alignment.MIDDLE_LEFT);
        }

        @Override
        protected MessageSearchCriteria fillUpSearchCriteria() {
            MessageSearchCriteria criteria = new MessageSearchCriteria();
            criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
            criteria.setMessage(StringSearchField.and(nameField.getValue()));
            return criteria;
        }
    };
}
 
Example #5
Source File: ProjectRoleSearchPanel.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true);
    basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    basicSearchBody.addComponent(new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":"));
    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.addComponent(nameField);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.addComponent(searchBtn);

    MButton clearBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue(""))
            .withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.addComponent(clearBtn);
    return basicSearchBody;
}
 
Example #6
Source File: ComponentSearchPanel.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true);
    basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label nameLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":");
    basicSearchBody.with(nameLbl);

    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.with(nameField);

    myItemCheckbox = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
    basicSearchBody.with(myItemCheckbox);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.with(searchBtn);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue(""))
            .withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.with(cancelBtn);

    return basicSearchBody;
}
 
Example #7
Source File: RoleSearchPanel.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public ComponentContainer constructBody() {
    MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true)
            .with(new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":"));

    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
            .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.addComponent(nameField);

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);
    basicSearchBody.addComponent(searchBtn);

    MButton clearBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue(""))
            .withStyleName(WebThemes.BUTTON_OPTION);
    basicSearchBody.addComponent(clearBtn);
    basicSearchBody.setComponentAlignment(clearBtn, Alignment.MIDDLE_LEFT);
    return basicSearchBody;
}
 
Example #8
Source File: AccountModuleImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
public AccountModuleImpl() {
    addStyleName("module");
    ControllerRegistry.addController(new UserAccountController(this));

    MHorizontalLayout topPanel = new MHorizontalLayout().withFullWidth().withMargin(true).withStyleName(WebThemes.BORDER_BOTTOM).withId("tab-content-header");
    AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);

    MButton helpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_HELP))
            .withIcon(VaadinIcons.ACADEMY_CAP).withStyleName(WebThemes.BUTTON_LINK);
    ExternalResource helpRes = new ExternalResource("https://docs.mycollab.com/user-guide/account-management/");
    BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes);
    helpOpener.extend(helpBtn);

    topPanel.with(breadcrumb, helpBtn).withAlign(helpBtn, Alignment.TOP_RIGHT);

    tabSheet = new VerticalTabsheet();
    tabSheet.getContentWrapper().addStyleName("content-height");
    tabSheet.setSizeFull();
    tabSheet.addToggleNavigatorControl();
    CssLayout contentWrapper = tabSheet.getContentWrapper();
    contentWrapper.addComponentAsFirst(topPanel);

    this.buildComponents();
    this.setContent(tabSheet);
}
 
Example #9
Source File: SubSetSelector.java    From viritin with Apache License 2.0 6 votes vote down vote up
/**
 * Sets a form which can be used to add new items to the selection. A button
 * to add new instances is displayed if this method is called.
 *
 * @param newInstanceForm the form
 */
public void setNewInstanceForm(AbstractForm<ET> newInstanceForm) {
    this.newInstanceForm = newInstanceForm;
    if (newInstanceForm != null) {
        if (newInstanceBtn == null) {
            newInstanceBtn = new MButton(VaadinIcons.PLUS)
                    .withStyleName(ValoTheme.BUTTON_ICON_ONLY);
            newInstanceBtn.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent clickEvent) {
                    addEntity(null);
                }
            });
            toprow.add(newInstanceBtn);
        }
    } else if (newInstanceBtn != null) {
        toprow.removeComponent(newInstanceBtn);
        newInstanceBtn = null;
    }
}
 
Example #10
Source File: TaskReadViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected HorizontalLayout createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleTask> taskPreviewFormControls = new ProjectPreviewFormControlsGenerator<>(previewForm);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        MButton linkBtn = new MButton(UserUIContext.getMessage(TicketI18nEnum.OPT_DEPENDENCIES),
                clickEvent -> UI.getCurrent().addWindow(new TicketRelationWindow(ProjectTicket.buildTicketByTask(beanItem))))
                .withIcon(VaadinIcons.BOLT);
        taskPreviewFormControls.addOptionButton(linkBtn);
    }

    return taskPreviewFormControls.createButtonControls(
            ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.ASSIGN_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.PRINT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.NAVIGATOR_BTN_PRESENTED,
            ProjectRolePermissionCollections.TASKS);
}
 
Example #11
Source File: ProjectActivityStreamPagedList.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected MHorizontalLayout createPageControls() {
    controlBarWrapper = new MHorizontalLayout().withFullHeight().withStyleName("page-controls");

    MButton prevBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_NAV_NEWER), clickEvent -> pageChange(currentPage - 1))
            .withWidth("64px").withStyleName(WebThemes.BUTTON_ACTION);
    if (currentPage == 1) {
        prevBtn.setEnabled(false);
    }

    MButton nextBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_NAV_OLDER), clickEvent -> pageChange(currentPage + 1))
            .withWidth("64px").withStyleName(WebThemes.BUTTON_ACTION);
    if (currentPage == totalPage) {
        nextBtn.setEnabled(false);
    }

    ButtonGroup controlBtns = new ButtonGroup(prevBtn, nextBtn);
    controlBtns.setStyleName(WebThemes.BUTTON_ACTION);

    controlBarWrapper.addComponent(controlBtns);
    return controlBarWrapper;
}
 
Example #12
Source File: AdvancedInfoChangeWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initUI() {
    MVerticalLayout mainLayout = new MVerticalLayout().withMargin(true).withFullWidth();

    GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);

    passInfo.addComponent(txtWebsite, UserUIContext.getMessage(UserI18nEnum.FORM_WEBSITE), 0, 0);
    passInfo.addComponent(txtCompany, UserUIContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 1);
    passInfo.addComponent(cboCountry, UserUIContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 2);

    txtWebsite.setValue(MoreObjects.firstNonNull(user.getWebsite(), ""));
    txtCompany.setValue(MoreObjects.firstNonNull(user.getCompany(), ""));
    cboCountry.setValue(MoreObjects.firstNonNull(user.getCountry(), ""));

    mainLayout.with(passInfo.getLayout()).withAlign(passInfo.getLayout(), Alignment.TOP_LEFT);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeInfo())
            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.CLIPBOARD).withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn);
    mainLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
    this.setModal(true);
    this.setContent(mainLayout);
}
 
Example #13
Source File: BuildCriterionComponent.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private void buildSaveFilterBox() {
    filterBox.removeAllComponents();

    TextField queryTextField = new TextField();
    filterBox.addComponent(queryTextField);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        String queryText = queryTextField.getValue();
        saveSearchCriteria(queryText);
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(ShortcutAction.KeyCode.ENTER);
    filterBox.addComponent(saveBtn);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> buildFilterBox(null))
            .withStyleName(WebThemes.BUTTON_OPTION);
    filterBox.addComponent(cancelBtn);
}
 
Example #14
Source File: ProfileReadViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public AbstractComponent getLayout() {
    FormContainer layout = new FormContainer();
    layout.addComponent(avatarAndPass);

    MButton btnChangeContactInfo = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            clickEvent -> UI.getCurrent().addWindow(new ContactInfoChangeWindow(formItem.getBean())))
            .withStyleName(WebThemes.BUTTON_LINK);

    MHorizontalLayout contactInformationHeader = new MHorizontalLayout(new ELabel(UserUIContext.getMessage(UserI18nEnum.SECTION_CONTACT_INFORMATION))
            .withStyleName(ValoTheme.LABEL_H3, ValoTheme.LABEL_NO_MARGIN), btnChangeContactInfo).alignAll(Alignment.MIDDLE_LEFT);

    layout.addSection(new CssLayout(contactInformationHeader), contactLayout.getLayout());

    MButton btnChangeAdvanceInfo = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            clickEvent -> UI.getCurrent().addWindow(new AdvancedInfoChangeWindow(formItem.getBean())))
            .withStyleName(WebThemes.BUTTON_LINK);

    MHorizontalLayout advanceInfoHeader = new MHorizontalLayout(new ELabel(UserUIContext.getMessage(UserI18nEnum.SECTION_ADVANCED_INFORMATION))
            .withStyleName(ValoTheme.LABEL_H3, ValoTheme.LABEL_NO_MARGIN), btnChangeAdvanceInfo).alignAll(Alignment.MIDDLE_LEFT);

    layout.addSection(new CssLayout(advanceInfoHeader), advancedInfoLayout.getLayout());
    return layout;
}
 
Example #15
Source File: ResourcesDisplayComponent.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
AddNewFolderWindow() {
    this.setCaption(UserUIContext.getMessage(FileI18nEnum.ACTION_NEW_FOLDER));

    MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(false).withMargin(new MarginInfo(false, true, true, true));
    withModal(true).withResizable(false).withWidth("500px").withCenter().withContent(contentLayout);

    GridFormLayoutHelper layoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    TextField folderName = layoutHelper.addComponent(new TextField(), UserUIContext.getMessage(GenericI18Enum.FORM_NAME), 0, 0);
    TextArea descAreaField = layoutHelper.addComponent(new TextArea(), UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 1);
    contentLayout.addComponent(layoutHelper.getLayout());

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        String folderVal = folderName.getValue();

        if (StringUtils.isNotBlank(folderVal)) {
            FileUtils.assertValidFolderName(folderVal);
            String baseFolderPath = baseFolder.getPath();
            String desc = descAreaField.getValue();
            folderVal = FileUtils.escape(folderVal);

            resourceService.createNewFolder(baseFolderPath, folderVal, desc, UserUIContext.getUsername());
            resourcesContainer.constructBody(baseFolder);
            close();
        } else {
            NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL,
                    UserUIContext.getMessage(GenericI18Enum.FORM_NAME)));
        }
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(KeyCode.ENTER);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);
    MHorizontalLayout controlsLayout = new MHorizontalLayout(cancelBtn, saveBtn);
    contentLayout.with(controlsLayout).withAlign(controlsLayout, Alignment.MIDDLE_RIGHT);
}
 
Example #16
Source File: ProjectMemberSelectionField.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public ProjectMemberSelectionField() {
    memberSelectionBox = new ProjectMemberSelectionBox(true);

    assignToMeBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.ACTION_ASSIGN_TO_ME), clickEvent -> {
        memberSelectionBox.setSelectedUser(UserUIContext.getUser().getUsername());
    }).withStyleName(WebThemes.BUTTON_LINK);
}
 
Example #17
Source File: ProjectRoleSearchPanel.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected Component buildExtraControls() {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.ROLES)) {
        return new MButton(UserUIContext.getMessage(ProjectRoleI18nEnum.NEW),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectRoleEvent.GotoAdd(this, null)))
                .withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
    } else return null;
}
 
Example #18
Source File: RoleSearchPanel.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected Component buildExtraControls() {
    return new MButton(UserUIContext.getMessage(RoleI18nEnum.NEW),
            clickEvent -> EventBusFactory.getInstance().post(new RoleEvent.GotoAdd(this, null)))
            .withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION)
            .withVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_ROLE));
}
 
Example #19
Source File: VersionSearchPanel.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected Component buildExtraControls() {
    return new MButton(UserUIContext.getMessage(VersionI18nEnum.NEW),
            clickEvent -> EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null)))
            .withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION)
            .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS));
}
 
Example #20
Source File: MailFormWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initButtonLinkCcBcc() {
    btnLinkCc = new MButton("Add Cc", clickEvent -> toggleCcLink()).withStyleName(WebThemes.BUTTON_LINK);
    inputLayout.addComponent(btnLinkCc, 1, 0);
    inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER);

    btnLinkBcc = new MButton("Add Bcc", clickEvent -> toggleBccLink()).withStyleName(WebThemes.BUTTON_LINK);
    inputLayout.addComponent(btnLinkBcc, 2, 0);
    inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER);
}
 
Example #21
Source File: AccountSettingBreadcrumb.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void gotoCancelAccountPage() {
    removeAllComponents();
    this.addComponent(ELabel.html(VaadinIcons.HOME.getHtml()));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(AdminI18nEnum.VIEW_BILLING),
            clickEvent -> EventBusFactory.getInstance().post(new AccountBillingEvent.GotoSummary(this, null))).withStyleName(WebThemes.BUTTON_LINK));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(AdminI18nEnum.ACTION_CANCEL_ACCOUNT)).withStyleName(WebThemes.BUTTON_LINK));
    AppUI.addFragment("account/billing/cancel", UserUIContext.getMessage(AdminI18nEnum.ACTION_CANCEL_ACCOUNT));
}
 
Example #22
Source File: ProjectListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private ComponentContainer constructTableActionControls() {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);

    selectOptionButton = new SelectionOptionButton(tableItem);
    selectOptionButton.setWidthUndefined();
    layout.addComponent(selectOptionButton);

    tableActionControls = new DefaultMassItemActionHandlerContainer();

    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    tableActionControls.setVisible(false);
    tableActionControls.setWidthUndefined();

    layout.addComponent(tableActionControls);
    selectedItemsNumberLabel.setWidth("100%");
    layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER).expand(selectedItemsNumberLabel);

    MButton customizeViewBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem)))
            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.ADJUST);
    customizeViewBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_LAYOUT_OPTIONS));
    layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}
 
Example #23
Source File: TimeLogComp.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
protected TimeLogComp() {
    this.itemTimeLoggingService = AppContextUtil.getSpringBean(ItemTimeLoggingService.class);
    this.withMargin(false);

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

    ELabel dateInfoHeader = ELabel.html(VaadinIcons.CLOCK.getHtml() + " " +
            UserUIContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME));
    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(VaadinIcons.QUESTION_CIRCLE).withDescription(UserUIContext.getMessage
            (TimeTrackingI18nEnum.TIME_EXPLAIN_HELP)).withStyleName(WebThemes.INLINE_HELP));

    this.addComponent(header);

    layout = new GridLayout(2, 3);
    layout.setSpacing(true);
    layout.setWidth("100%");
    layout.setMargin(new MarginInfo(false, false, false, true));
    layout.setColumnExpandRatio(1, 1.0f);
    this.addComponent(layout);
}
 
Example #24
Source File: ReportBreadcrumb.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void gotoUserWorkloadReport() {
    removeAllComponents();
    this.addComponent(ELabel.html(VaadinIcons.HOME.getHtml()));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS), new GotoReportsListener()).withStyleName(WebThemes.BUTTON_LINK));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_ASSIGNMENT)).withStyleName(WebThemes.BUTTON_LINK));
    AppUI.addFragment(ProjectLinkGenerator.generateUsersWorkloadReportLink(), UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_ASSIGNMENT));
}
 
Example #25
Source File: ReportBreadcrumb.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void gotoTimesheetReport() {
    removeAllComponents();
    this.addComponent(ELabel.html(VaadinIcons.HOME.getHtml()));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS), new GotoReportsListener()).withStyleName(WebThemes.BUTTON_LINK));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TIMESHEET)).withStyleName(WebThemes.BUTTON_LINK));
}
 
Example #26
Source File: AccountSettingBreadcrumb.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void gotoRoleList() {
    removeAllComponents();
    this.addComponent(ELabel.html(VaadinIcons.HOME.getHtml()));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(RoleI18nEnum.LIST)).withStyleName(WebThemes.BUTTON_LINK));
    AppUI.addFragment("account/role/list", UserUIContext.getMessage(RoleI18nEnum.LIST));
}
 
Example #27
Source File: LoginViewImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected Component createContent(TextField usernameField, PasswordField passwordField, Button loginBtn) {
    custom = CustomLayoutExt.createLayout("loginForm");
    Resource logoResource = AccountAssetsResolver.createLogoResource(AppUI.getBillingAccount().getLogopath(), 150);
    custom.addComponent(new Image(null, logoResource), "logo-here");
    custom.addComponent(ELabel.h1(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ShellI18nEnum.BUTTON_LOG_IN))
            .withUndefinedWidth(), "form-header");
    custom.addStyleName("customLoginForm");
    custom.addComponent(usernameField, "usernameField");
    custom.addComponent(passwordField, "passwordField");

    rememberMe = new CheckBox(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ShellI18nEnum.OPT_REMEMBER_PASSWORD),
            false);
    custom.addComponent(rememberMe, "rememberMe");

    loginBtn.setStyleName(WebThemes.BUTTON_ACTION);
    loginBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    custom.addComponent(loginBtn, "loginButton");

    MButton forgotPasswordBtn = new MButton(LocalizationHelper.getMessage(AppUI.getDefaultLocale(),
            ShellI18nEnum.BUTTON_FORGOT_PASSWORD), clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.GotoForgotPasswordPage(this, null)))
            .withStyleName(WebThemes.BUTTON_LINK);
    custom.addComponent(forgotPasswordBtn, "forgotLink");

    custom.addComponent(ELabel.html(LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ShellI18nEnum.OPT_REMEMBER_PASSWORD,
            ShellI18nEnum.OPT_SIGNIN_MYCOLLAB)), "newToUs");
    custom.addComponent(ELabel.html(new A("https://www.mycollab.com/pricing/", "_blank").appendText
            (LocalizationHelper.getMessage(AppUI.getDefaultLocale(), ShellI18nEnum.ACTION_CREATE_ACCOUNT)).write())
            .withUndefinedWidth(), "createAccountLink");

    return custom;
}
 
Example #28
Source File: ReportBreadcrumb.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void gotoReportDashboard() {
    removeAllComponents();
    this.addComponent(ELabel.html(VaadinIcons.HOME.getHtml()));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS)).withStyleName(WebThemes.BUTTON_LINK));
    AppUI.addFragment("project/reports", UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS));
}
 
Example #29
Source File: AccountSettingBreadcrumb.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void gotoGeneralSetting() {
    removeAllComponents();
    this.addComponent(ELabel.html(VaadinIcons.HOME.getHtml()));
    this.addComponent(ELabel.html(VaadinIcons.ANGLE_RIGHT.getHtml()));
    this.addComponent(new MButton(UserUIContext.getMessage(AdminI18nEnum.VIEW_CUSTOMIZATION)).withStyleName(WebThemes.BUTTON_LINK));
    AppUI.addFragment("account/setting/general", UserUIContext.getMessage(AdminI18nEnum.VIEW_SETTING));
}
 
Example #30
Source File: ProjectMembersWidget.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
ProjectMembersWidget() {
    super("", new CssLayout());
    MButton sortBtn = new MButton().withIcon(VaadinIcons.CARET_UP).withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;
        if (sortAsc) {
            sortBtn.setIcon(VaadinIcons.CARET_UP);
            searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("memberFullName", SearchCriteria.ASC)));
        } else {
            sortBtn.setIcon(VaadinIcons.CARET_DOWN);
            searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("memberFullName",
                    SearchCriteria.DESC)));
        }
        memberList.setSearchCriteria(searchCriteria);
        setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.WIDGET_MEMBERS_TITLE, memberList.getTotalCount()));
    });
    addHeaderElement(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setMemberFullName(StringSearchField.and(value));
            showMembers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setMemberFullName(null);
            showMembers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    addHeaderElement(searchTextField);

    memberList = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectMemberService.class),
            new MemberRowDisplayHandler(), 7);
    bodyContent.addComponent(memberList);
}