当前位置: 首页>>代码示例>>Java>>正文


Java MHorizontalLayout.addComponent方法代码示例

本文整理汇总了Java中org.vaadin.viritin.layouts.MHorizontalLayout.addComponent方法的典型用法代码示例。如果您正苦于以下问题:Java MHorizontalLayout.addComponent方法的具体用法?Java MHorizontalLayout.addComponent怎么用?Java MHorizontalLayout.addComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.vaadin.viritin.layouts.MHorizontalLayout的用法示例。


在下文中一共展示了MHorizontalLayout.addComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
	final VerticalLayout root = new VerticalLayout();
	root.setSizeFull();
	root.setMargin(true);
	root.setSpacing(true);
	setContent(root);
	MHorizontalLayout horizontalLayout = new MHorizontalLayout();
	for (MenuEntry menuEntry : menuEntries) {
		horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> {
			navigator.navigateTo(menuEntry.getNavigationTarget());
		}));
	}
	root.addComponent(horizontalLayout);
	springViewDisplay = new Panel();
	springViewDisplay.setSizeFull();
	root.addComponent(springViewDisplay);
	root.setExpandRatio(springViewDisplay, 1.0f);

}
 
开发者ID:dve,项目名称:spring-boot-plugins-example,代码行数:21,代码来源:VaadinUI.java

示例2: constructTableActionControls

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private ComponentContainer constructTableActionControls() {
    CssLayout layoutWrapper = new CssLayout();
    layoutWrapper.setWidth("100%");
    MHorizontalLayout layout = new MHorizontalLayout();
    layoutWrapper.addStyleName(WebThemes.TABLE_ACTION_CONTROLS);
    layoutWrapper.addComponent(layout);

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

    tableActionControls = new DefaultMassItemActionHandlerContainer();
    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.ROLES)) {
        tableActionControls.addDeleteActionItem();
    }

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

    layout.with(this.tableActionControls, this.selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel,
            Alignment.MIDDLE_LEFT);
    return layoutWrapper;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:24,代码来源:ProjectRoleListViewImpl.java

示例3: generateTopControls

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component generateTopControls() {
    MHorizontalLayout controlsBtnWrap = new MHorizontalLayout().withFullWidth();

    MHorizontalLayout notesWrap = new MHorizontalLayout().withFullWidth();
    ELabel noteLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_NOTE)).withWidthUndefined()
            .withStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);

    MCssLayout noteBlock = new MCssLayout().withFullWidth().withStyleName("list-note-block");
    for (CaseStatus status : CrmDataTypeFactory.casesStatusList) {
        ELabel note = new ELabel(UserUIContext.getMessage(status)).withStyleName("note-label", colorsMap.get(status
                .name())).withWidthUndefined();
        noteBlock.addComponent(note);
    }
    notesWrap.with(noteBlock).expand(noteBlock);
    controlsBtnWrap.with(notesWrap).expand(notesWrap);

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CASE)) {
        MButton createBtn = new MButton(UserUIContext.getMessage(CaseI18nEnum.NEW), clickEvent -> fireNewRelatedItem(""))
                .withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
        controlsBtnWrap.with(createBtn).withAlign(createBtn, Alignment.TOP_RIGHT);
    }

    return controlsBtnWrap;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:27,代码来源:AccountCaseListComp.java

示例4: constructBody

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@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().withInputPrompt(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(FontAwesome.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;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:20,代码来源:ProjectRoleSearchPanel.java

示例5: generateRow

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<SimpleComment> host, SimpleComment comment, int rowIndex) {
    MHorizontalLayout commentBlock = new MHorizontalLayout().withSpacing(true).withFullWidth();
    commentBlock.setStyleName("comment-block");
    Image userAvatarImg = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(comment.getOwnerAvatarId(), 32);
    userAvatarImg.addStyleName(UIConstants.CIRCLE_BOX);
    commentBlock.addComponent(userAvatarImg);

    CssLayout rightCol = new CssLayout();
    rightCol.setStyleName("right-col");

    MHorizontalLayout metadataRow = new MHorizontalLayout().withFullWidth();
    ELabel userNameLbl = new ELabel(comment.getOwnerFullName()).withStyleName(UIConstants.META_INFO);
    CssLayout userNameWrap = new CssLayout(userNameLbl);

    ELabel commentTimePost = new ELabel(UserUIContext.formatPrettyTime(comment.getCreatedtime())).withStyleName
            (UIConstants.META_INFO).withWidthUndefined();
    metadataRow.with(userNameWrap, commentTimePost).withAlign(commentTimePost, Alignment.TOP_RIGHT).expand
            (userNameWrap);
    rightCol.addComponent(metadataRow);

    SafeHtmlLabel commentContent = new SafeHtmlLabel(comment.getComment());
    commentContent.setStyleName("comment-content");
    rightCol.addComponent(commentContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        CssLayout attachmentPanel = new CssLayout();
        attachmentPanel.setStyleName("attachment-panel");
        attachmentPanel.setWidth("100%");

        for (Content attachment : attachments) {
            attachmentPanel.addComponent(MobileAttachmentUtils.renderAttachmentRow(attachment));
        }
        rightCol.addComponent(attachmentPanel);
    }

    commentBlock.with(rightCol).expand(rightCol);
    return commentBlock;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:41,代码来源:MessageCommentListDisplay.java

示例6: renderAttachmentRow

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public static Component renderAttachmentRow(final Content attachment) {
    String docName = attachment.getPath();
    int lastIndex = docName.lastIndexOf("/");
    MHorizontalLayout attachmentRow = new MHorizontalLayout().withSpacing(false).withFullWidth().withStyleName("attachment-row");
    attachmentRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    CssLayout thumbnailWrap = new CssLayout();
    thumbnailWrap.setWidth("25px");
    thumbnailWrap.setStyleName("thumbnail-wrap");

    Component thumbnail;

    if (StringUtils.isNotBlank(attachment.getThumbnail())) {
        thumbnail = new Image(null, VaadinResourceFactory.getResource(attachment.getThumbnail()));
    } else {
        thumbnail = new ELabel(FileAssetsUtil.getFileIconResource(attachment.getName()).getHtml(), ContentMode.HTML);
    }
    thumbnail.setWidth("100%");
    thumbnailWrap.addComponent(thumbnail);
    attachmentRow.addComponent(thumbnailWrap);

    if (lastIndex != -1) {
        docName = docName.substring(lastIndex + 1, docName.length());
    }

    if (MimeTypesUtil.isImageType(docName)) {
        MButton b = new MButton(attachment.getTitle(), clickEvent -> {
            AttachmentPreviewView previewView = new AttachmentPreviewView(VaadinResourceFactory.getResource(attachment.getPath()));
            EventBusFactory.getInstance().post(new ShellEvent.PushView(attachment, previewView));
        }).withStyleName(UIConstants.TEXT_ELLIPSIS);
        b.setWidth("100%");
        attachmentRow.with(b).expand(b);
    } else {
        Label l = new Label(attachment.getTitle());
        l.setWidth("100%");
        attachmentRow.addComponent(l);
        attachmentRow.setExpandRatio(l, 1.0f);
    }
    return attachmentRow;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:41,代码来源:MobileAttachmentUtils.java

示例7: createPageControls

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected MHorizontalLayout createPageControls() {
    MHorizontalLayout pageControls = super.createPageControls();
    if (pageControls != null) {
        Button browseProjectsBtn = new Button(UserUIContext.getMessage(ProjectI18nEnum.ACTION_BROWSE),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoList(this, null)));
        browseProjectsBtn.addStyleName(WebThemes.BUTTON_LINK);
        pageControls.addComponent(browseProjectsBtn, 0);
        pageControls.setComponentAlignment(browseProjectsBtn, Alignment.MIDDLE_LEFT);
    }
    return pageControls;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:13,代码来源:ProjectPagedList.java

示例8: setupHeader

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private ComponentContainer setupHeader() {
    MHorizontalLayout headerWrapper = new MHorizontalLayout().withFullWidth().withStyleName("projectfeed-hdr-wrapper");

    Image avatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(UserUIContext.getUserAvatarId(), 64);
    avatar.setStyleName(UIConstants.CIRCLE_BOX);
    headerWrapper.addComponent(avatar);

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

    ELabel headerLabel = ELabel.h2(UserUIContext.getUser().getDisplayName()).withStyleName(UIConstants.TEXT_ELLIPSIS);
    MHorizontalLayout headerContentTop = new MHorizontalLayout();
    headerContentTop.with(headerLabel).withAlign(headerLabel, Alignment.TOP_LEFT).expand(headerLabel);

    SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            displaySearchResult(value);
        }

        @Override
        public void emptySearch() {

        }
    };
    headerContentTop.with(searchTextField).withAlign(searchTextField, Alignment.TOP_RIGHT);
    headerContent.with(headerContentTop);
    MHorizontalLayout metaInfoLayout = new MHorizontalLayout();
    if (Boolean.TRUE.equals(AppUI.getBillingAccount().getDisplayemailpublicly())) {
        metaInfoLayout.with(new ELabel(UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL) + ": ").withStyleName(UIConstants.META_INFO),
                ELabel.html(new A(String.format("mailto:%s", UserUIContext.getUsername())).appendText(UserUIContext.getUsername()).write()));
    }
    metaInfoLayout.with(ELabel.html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE,
            UserUIContext.formatPrettyTime(UserUIContext.getUser().getRegisteredtime()))));
    metaInfoLayout.with(ELabel.html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN,
            UserUIContext.formatPrettyTime(UserUIContext.getUser().getLastaccessedtime()))));
    metaInfoLayout.alignAll(Alignment.TOP_LEFT);
    headerContent.addComponent(metaInfoLayout);
    headerWrapper.with(headerContent).expand(headerContent);
    return headerWrapper;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:41,代码来源:UserDashboardViewImpl.java

示例9: buildCommentBlock

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private Component buildCommentBlock(final SimpleComment comment) {
    final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth();

    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);

    MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);

    MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth();
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(
            GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(),
            UserUIContext.formatPrettyTime(comment.getCreatedtime())))
            .withDescription(UserUIContext.formatDateTime(comment.getCreatedtime()))
            .withStyleName(UIConstants.META_INFO);

    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = 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 -> {
                            if (confirmDialog.isConfirmed()) {
                                CommentService commentService = AppContextUtil.getSpringBean(CommentService.class);
                                commentService.removeWithSession(comment, UserUIContext.getUsername(), AppUI.getAccountId());
                                activityBox.removeComponent(layout);
                            }
                        })
        ).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY);

        messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl);
    } else {
        messageHeader.with(timePostLbl).expand(timePostLbl);
    }

    rowLayout.addComponent(messageHeader);

    Label messageContent = new SafeHtmlLabel(comment.getComment());
    rowLayout.addComponent(messageContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withMargin(false).withSpacing(false).withFullWidth();
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.with(attachmentDisplay);
        rowLayout.addComponent(messageFooter);
    }

    layout.with(rowLayout).expand(rowLayout);
    return layout;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:57,代码来源:CrmActivityComponent.java

示例10: buildAuditBlock

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private Component buildAuditBlock(SimpleAuditLog auditLog) {
    List<AuditChangeItem> changeItems = auditLog.getChangeItems();
    if (CollectionUtils.isNotEmpty(changeItems)) {
        final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
                .withFullWidth();

        ProjectMemberBlock memberBlock = new ProjectMemberBlock(auditLog.getPosteduser(), auditLog.getPostedUserAvatarId(),
                auditLog.getPostedUserFullName());
        layout.addComponent(memberBlock);

        MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);

        MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth();
        messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

        ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(
                GenericI18Enum.EXT_MODIFIED_ITEM, auditLog.getPostedUserFullName(),
                UserUIContext.formatPrettyTime(auditLog.getPosteddate())))
                .withDescription(UserUIContext.formatDateTime(auditLog.getPosteddate()))
                .withStyleName(UIConstants.META_INFO);
        messageHeader.with(timePostLbl).expand(timePostLbl);

        rowLayout.addComponent(messageHeader);

        for (AuditChangeItem item : changeItems) {
            String fieldName = item.getField();

            DefaultFieldDisplayHandler fieldDisplayHandler = groupFormatter.getFieldDisplayHandler(fieldName);
            if (fieldDisplayHandler != null) {
                Span fieldBlock = new Span().appendText(UserUIContext.getMessage(fieldDisplayHandler.getDisplayName()))
                        .setCSSClass(UIConstants.BLOCK);
                Div historyDiv = new Div().appendChild(fieldBlock).appendText(fieldDisplayHandler.getFormat()
                        .toString(item.getOldvalue())).appendText(" " + FontAwesome.LONG_ARROW_RIGHT.getHtml() +
                        " ").appendText(fieldDisplayHandler.getFormat().toString(item.getNewvalue()));
                rowLayout.addComponent(ELabel.html(historyDiv.write()));
            }
        }

        layout.with(rowLayout).expand(rowLayout);
        return layout;
    } else {
        return null;
    }
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:45,代码来源:CrmActivityComponent.java

示例11: displayDashboard

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public void displayDashboard() {
    mainLayout.removeAllComponents();
    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, CurrentProjectVariables.getProjectId())));
    btnGroup.addComponent(new NavigationButtonWrap(FontAwesome.USERS, userBtn));

    mainLayout.addComponent(btnGroup);
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:77,代码来源:ProjectDashboardViewImpl.java

示例12: createPagingControls

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private ComponentContainer createPagingControls() {
    controlBarWrapper = new HorizontalLayout();
    controlBarWrapper.setWidth("100%");
    controlBarWrapper.setStyleName("listControl");

    MHorizontalLayout pageManagement = new MHorizontalLayout();

    // defined layout here ---------------------------

    if (currentPage > 1) {
        MButton firstLink = new MButton("1", clickEvent -> pageChange(1)).withStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }

    if (currentPage > 3) {
        MButton previous2 = new MButton("" + (currentPage - 2), clickEvent -> pageChange(currentPage - 2))
                .withStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        MButton previous1 = new MButton("" + (currentPage - 1), clickEvent -> pageChange(currentPage - 1))
                .withStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    MButton current = new MButton("" + currentPage, clickEvent -> pageChange(currentPage))
            .withStyleName("buttonPaging", "current");

    pageManagement.addComponent(current);
    final int range = totalPage - currentPage;
    if (range >= 1) {
        MButton next1 = new MButton("" + (currentPage + 1), clickEvent -> pageChange(currentPage + 1))
                .withStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        MButton next2 = new MButton("" + (currentPage + 2), clickEvent -> pageChange(currentPage + 2))
                .withStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        MButton last = new MButton("" + totalPage, clickEvent -> pageChange(totalPage)).withStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }

    pageManagement.setWidth(null);
    controlBarWrapper.addComponent(pageManagement);
    controlBarWrapper.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT);

    return controlBarWrapper;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:62,代码来源:AbstractPagedBeanTable.java

示例13: StyleCalendarExp

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public StyleCalendarExp() {
    this.setWidth("230px");
    this.setHeightUndefined();
    this.setSpacing(false);
    this.setStyleName("stylecalendar-ext");
    this.setMargin(new MarginInfo(true, false, false, false));

    styleCalendar.setRenderHeader(false);
    styleCalendar.setRenderWeekNumbers(false);
    styleCalendar.setImmediate(true);
    styleCalendar.setWidth("100%");
    setDateOptionsGenerator();

    btnShowNextYear = new Button();
    btnShowNextYear.setIcon(new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/16/cal_year_next.png")));
    btnShowNextYear.setStyleName(WebThemes.BUTTON_LINK);

    btnShowNextMonth = new Button();
    btnShowNextMonth.setIcon(new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/16/cal_month_next.png")));
    btnShowNextMonth.setStyleName(WebThemes.BUTTON_LINK);

    btnShowPreviousMonth = new Button();
    btnShowPreviousMonth.setIcon(new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/16/cal_month_pre.png")));
    btnShowPreviousMonth.setStyleName(WebThemes.BUTTON_LINK);

    btnShowPreviousYear = new Button();
    btnShowPreviousYear.setIcon(new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/16/cal_year_pre.png")));
    btnShowPreviousYear.setStyleName(WebThemes.BUTTON_LINK);

    lbSelectedDate.setValue(UserUIContext.formatDate(new Date()));
    lbSelectedDate.addStyleName("calendarDateLabel");
    lbSelectedDate.setWidth("80");

    HorizontalLayout layoutControl = new HorizontalLayout();
    layoutControl.setStyleName("calendarHeader");
    layoutControl.setWidth("100%");
    layoutControl.setHeight("35px");

    HorizontalLayout layoutButtonPrevious = new HorizontalLayout();
    layoutButtonPrevious.setSpacing(true);
    layoutButtonPrevious.addComponent(btnShowPreviousYear);
    layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT);
    layoutButtonPrevious.addComponent(btnShowPreviousMonth);
    layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT);
    layoutControl.addComponent(layoutButtonPrevious);
    layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT);

    layoutControl.addComponent(lbSelectedDate);
    layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER);

    MHorizontalLayout layoutButtonNext = new MHorizontalLayout();
    layoutButtonNext.addComponent(btnShowNextMonth);
    layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT);
    layoutButtonNext.addComponent(btnShowNextYear);
    layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT);
    layoutControl.addComponent(layoutButtonNext);
    layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT);

    this.addComponent(layoutControl);
    this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER);

    this.addComponent(styleCalendar);
    this.setExpandRatio(styleCalendar, 1.0f);
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:65,代码来源:StyleCalendarExp.java

示例14: createPageControls

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
protected MHorizontalLayout createPageControls() {
    controlBarWrapper = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(false, true, false, true))
            .withStyleName(listControlStyle);

    pageManagement = new MHorizontalLayout();

    // defined layout here ---------------------------

    if (currentPage > 1) {
        MButton firstLink = new MButton("1", clickEvent -> pageChange(1)).withStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }
    if (currentPage > 3) {
        MButton previous2 = new MButton("" + (currentPage - 2), clickEvent -> pageChange(currentPage - 2))
                .withStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        MButton previous1 = new MButton("" + (currentPage - 1), clickEvent -> pageChange(currentPage - 1))
                .withStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    MButton current = new MButton("" + currentPage, clickEvent -> pageChange(currentPage)).withStyleName("buttonPaging", "current");

    pageManagement.addComponent(current);
    final int range = this.totalPage - currentPage;
    if (range >= 1) {
        MButton next1 = new MButton("" + (currentPage + 1), clickEvent -> pageChange(currentPage + 1)).withStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        MButton next2 = new MButton("" + (currentPage + 2), clickEvent -> pageChange(currentPage + 2)).withStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        MButton last = new MButton("" + this.totalPage, clickEvent -> pageChange(totalPage)).withStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }

    controlBarWrapper.with(pageManagement).withAlign(pageManagement, Alignment.MIDDLE_RIGHT);
    return controlBarWrapper;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:54,代码来源:AbstractBeanPagedList.java

示例15: renderAttachmentFieldRow

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public static Component renderAttachmentFieldRow(final Content attachment, Button.ClickListener additionalListener) {
    String docName = attachment.getPath();
    int lastIndex = docName.lastIndexOf("/");
    if (lastIndex != -1) {
        docName = docName.substring(lastIndex + 1, docName.length());
    }

    final MHorizontalLayout attachmentLayout = new MHorizontalLayout().withStyleName("attachment-row").withFullWidth();
    attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    CssLayout thumbnailWrap = new CssLayout();
    thumbnailWrap.setWidth("25px");
    thumbnailWrap.setStyleName("thumbnail-wrap");

    Component thumbnail;
    if (StringUtils.isNotBlank(attachment.getThumbnail())) {
        thumbnail = new Image(null, VaadinResourceFactory.getResource(attachment.getThumbnail()));
    } else {
        thumbnail = ELabel.fontIcon(FileAssetsUtil.getFileIconResource(attachment.getName()));
    }
    thumbnail.setWidth("100%");
    thumbnailWrap.addComponent(thumbnail);
    attachmentLayout.addComponent(thumbnailWrap);

    ELabel attachmentLink = new ELabel(docName).withStyleName(UIConstants.META_INFO, UIConstants.TEXT_ELLIPSIS);
    attachmentLayout.with(attachmentLink).expand(attachmentLink);

    MButton removeAttachment = new MButton("", clickEvent -> {
        ConfirmDialog.show(UI.getCurrent(),
                UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT),
                UserUIContext.getMessage(GenericI18Enum.ACTION_YES),
                UserUIContext.getMessage(GenericI18Enum.ACTION_NO),
                dialog -> {
                    if (dialog.isConfirmed()) {
                        ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class);
                        attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(), true,
                                AppUI.getAccountId());
                        ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout);
                    }
                });
    }).withIcon(FontAwesome.TRASH_O).withStyleName(MobileUIConstants.BUTTON_LINK);
    if (additionalListener != null) {
        removeAttachment.addClickListener(additionalListener);
    }
    removeAttachment.setHtmlContentAllowed(true);
    attachmentLayout.addComponent(removeAttachment);

    return attachmentLayout;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:50,代码来源:MobileAttachmentUtils.java


注:本文中的org.vaadin.viritin.layouts.MHorizontalLayout.addComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。