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


Java MHorizontalLayout.with方法代码示例

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


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

示例1: createLegendBox

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected final ComponentContainer createLegendBox() {
    final CssLayout mainLayout = new CssLayout();
    mainLayout.setWidth("100%");
    mainLayout.addStyleName("legendBoxContent");
    final List series = dataSet.getSeries();

    for (int i = 0; i < series.size(); i++) {
        final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true));
        layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

        final TimeSeries key = (TimeSeries) series.get(i);
        int colorIndex = i % CHART_COLOR_STR.size();
        final String color = "<div style = \" width:13px;height:13px;background: #" + CHART_COLOR_STR.get(colorIndex) + "\" />";
        final ELabel lblCircle = ELabel.html(color);

        String captionBtn = UserUIContext.getMessage(StatusI18nEnum.class, (String) key.getKey());
        final MButton btnLink = new MButton(StringUtils.trim(captionBtn, 30, true)).withDescription
                (captionBtn).withStyleName(WebThemes.BUTTON_LINK);
        layout.with(lblCircle, btnLink);
        mainLayout.addComponent(layout);
    }

    return mainLayout;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:26,代码来源:TicketCloseTrendChartWidget.java

示例2: generateRow

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<ProjectTicket> host, ProjectTicket genericTask, int rowIndex) {
    MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName(WebThemes.HOVER_EFFECT_NOT_BOX, "margin-bottom");
    rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    rowComp.with(ELabel.fontIcon(ProjectAssetsManager.getAsset(genericTask.getType())).withWidthUndefined());
    String status = "";
    if (genericTask.isMilestone()) {
        status = UserUIContext.getMessage(MilestoneStatus.class, genericTask.getStatus());
    } else {
        status = UserUIContext.getMessage(StatusI18nEnum.class, genericTask.getStatus());
    }
    rowComp.with(new ELabel(status).withStyleName(UIConstants.BLOCK).withWidthUndefined());
    String avatarLink = StorageUtils.getAvatarPath(genericTask.getAssignUserAvatarId(), 16);
    Img img = new Img(genericTask.getAssignUserFullName(), avatarLink).setCSSClass(UIConstants.CIRCLE_BOX)
            .setTitle(genericTask.getAssignUserFullName());

    ToggleTicketSummaryField toggleTicketSummaryField = new ToggleTicketSummaryField(genericTask);
    rowComp.with(ELabel.html(img.write()).withWidthUndefined(), toggleTicketSummaryField).expand(toggleTicketSummaryField);
    return rowComp;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:21,代码来源:MilestonePreviewForm.java

示例3: constructBody

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

    Label nameLbl = new Label("Name:");
    basicSearchBody.with(nameLbl);

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

    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
            .withIcon(FontAwesome.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;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:24,代码来源:VersionSearchPanel.java

示例5: initContent

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component initContent() {
    MHorizontalLayout content = new MHorizontalLayout().withSpacing(true).withWidth(widthVal).with(componentsText)
            .withAlign(componentsText, Alignment.MIDDLE_LEFT);

    componentPopupSelection.addStyleName(WebThemes.MULTI_SELECT_BG);
    componentPopupSelection.setDirection(Alignment.TOP_LEFT);

    MHorizontalLayout multiSelectComp = new MHorizontalLayout().withSpacing(false).with(componentsText, componentPopupSelection)
            .expand(componentsText);
    content.with(multiSelectComp);

    if (canAddNew) {
        MButton newBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> requestAddNewComp())
                .withStyleName(WebThemes.BUTTON_LINK);
        content.with(newBtn);
    }
    content.expand(multiSelectComp);
    return content;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:21,代码来源:MultiSelectComp.java

示例6: buildCell

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public GridCellWrapper buildCell(String caption, String contextHelp, int columns, int rows, int colSpan, String width, Alignment alignment) {
    if (StringUtils.isNotBlank(caption)) {
        ELabel captionLbl = new ELabel(caption).withStyleName(UIConstants.LABEL_WORD_WRAP).withDescription(caption);
        MHorizontalLayout captionWrapper = new MHorizontalLayout().withSpacing(false).withMargin(true)
                .withWidth(defaultCaptionWidth).withFullHeight().withStyleName("gridform-caption").with(captionLbl).expand(captionLbl)
                .withAlign(captionLbl, alignment);
        if (StringUtils.isNotBlank(contextHelp)) {
            ELabel contextHelpLbl = ELabel.html("&nbsp;" + FontAwesome.QUESTION_CIRCLE.getHtml())
                    .withStyleName(WebThemes.INLINE_HELP).withDescription(contextHelp).withWidthUndefined();
            captionWrapper.with(contextHelpLbl);
        }
        layout.addComponent(captionWrapper, 2 * columns, rows);
    }
    GridCellWrapper fieldWrapper = new GridCellWrapper();
    fieldWrapper.setWidth(width);
    layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colSpan - 1) + 1, rows);
    layout.setColumnExpandRatio(2 * columns + 1, 1.0f);

    if (StringUtils.isNotBlank(caption)) {
        fieldCaptionMappings.put(caption, fieldWrapper);
    }
    return fieldWrapper;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:24,代码来源:GridFormLayoutHelper.java

示例7: initContent

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component initContent() {
    componentsText = new TextField();
    componentsText.setNullRepresentation("");
    componentsText.setReadOnly(true);
    componentsText.addStyleName("noBorderRight");
    componentsText.setWidth("100%");
    componentPopupSelection = new PopupButton();
    componentPopupSelection.addStyleName(WebThemes.MULTI_SELECT_BG);
    componentPopupSelection.setDirection(Alignment.BOTTOM_LEFT);
    componentPopupSelection.addClickListener(clickEvent -> initContentPopup());

    popupContent = new OptionPopupContent();
    componentPopupSelection.setContent(popupContent);

    MHorizontalLayout content = new MHorizontalLayout(componentsText).withAlign(componentsText, Alignment.MIDDLE_LEFT);

    MHorizontalLayout multiSelectComp = new MHorizontalLayout(componentsText, componentPopupSelection)
            .withSpacing(false).expand(componentsText);
    content.with(multiSelectComp);
    return content;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:23,代码来源:SavedFilterComboBox.java

示例8: buildRightComponent

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component buildRightComponent() {
    MHorizontalLayout controls = new MHorizontalLayout();
    controls.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
    SearchNavigationButton searchBtn = new SearchNavigationButton() {
        @Override
        protected SearchInputView getSearchInputView() {
            return new TicketSearchInputView();
        }
    };
    controls.with(searchBtn);
    NavigationBarQuickMenu actionMenu = new NavigationBarQuickMenu();
    MVerticalLayout content = new MVerticalLayout();
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        content.with(new Button(UserUIContext.getMessage(TaskI18nEnum.NEW),
                clickEvent -> EventBusFactory.getInstance().post(new TaskEvent.GotoAdd(TicketListViewImpl.this, null))));
    }

    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
        content.with(new Button(UserUIContext.getMessage(BugI18nEnum.NEW),
                clickEvent -> EventBusFactory.getInstance().post(new BugEvent.GotoAdd(TicketListViewImpl.this, null))));
    }

    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.RISKS) && !SiteConfiguration.isCommunityEdition()) {
        content.with(new Button(UserUIContext.getMessage(RiskI18nEnum.NEW),
                clickEvent -> EventBusFactory.getInstance().post(new RiskEvent.GotoAdd(TicketListViewImpl.this, null))));
    }


    if (content.getComponentCount() > 0) {
        actionMenu.setContent(content);
        controls.with(actionMenu);
    }
    return controls;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:36,代码来源:TicketListViewImpl.java

示例9: 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

示例10: initContent

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component initContent() {
    MHorizontalLayout layout = new MHorizontalLayout();
    MButton browseBtn = new MButton(FontAwesome.ELLIPSIS_H)
            .withListener(clickEvent -> UI.getCurrent().addWindow(new BugSelectionWindow(BugSelectionField.this)))
            .withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);
    layout.with(suggestField, new Label("or browse"), browseBtn);
    return layout;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:10,代码来源:BugSelectionField.java

示例11: createSaveTagComp

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private HorizontalLayout createSaveTagComp() {
    final MHorizontalLayout layout = new MHorizontalLayout();
    final SuggestField field = new SuggestField();
    field.setInputPrompt(UserUIContext.getMessage(TagI18nEnum.OPT_ENTER_TAG_NAME));
    field.setMinimumQueryCharacters(2);
    field.setSuggestionConverter(new TagSuggestionConverter());
    field.setSuggestionHandler(query -> {
        tagQuery = query;
        return handleSearchQuery(query);
    });

    MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
        String tagName = (field.getValue() == null) ? tagQuery : field.getValue().toString().trim();
        if (!tagName.equals("")) {
            Tag tag = new Tag();
            tag.setName(tagName);
            tag.setType(type);
            tag.setTypeid(typeId + "");
            tag.setSaccountid(AppUI.getAccountId());
            tag.setExtratypeid(CurrentProjectVariables.getProjectId());
            int result = tagService.saveWithSession(tag, UserUIContext.getUsername());
            if (result > 0) {
                this.removeComponent(layout);
                addComponent(new TagBlock(tag));
                addComponent(createAddTagBtn());
            } else {
                removeComponent(layout);
                addComponent(createAddTagBtn());
            }
        } else {
            NotificationUtil.showWarningNotification(UserUIContext.getMessage(TagI18nEnum.ERROR_TAG_NAME_HAS_MORE_2_CHARACTERS));
        }
        tagQuery = "";
    }).withStyleName(WebThemes.BUTTON_ACTION);
    layout.with(field, addBtn);
    return layout;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:38,代码来源:TagViewComponent.java

示例12: initContent

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component initContent() {
    MHorizontalLayout layout = new MHorizontalLayout().withSpacing(false);
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label httpsLabel = new Label("https://");
    Label domainLbl = new Label(".mycollab.com");
    layout.with(httpsLabel, subDomainField, domainLbl);
    return layout;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:10,代码来源:AccountInfoChangeWindow.java

示例13: getLayout

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public AbstractComponent getLayout() {
    contactLayout.getLayout().setSpacing(true);
    advancedInfoLayout.getLayout().setSpacing(true);
    FormContainer layout = new FormContainer();
    layout.addComponent(avatarAndPass);

    MHorizontalLayout contactInformationHeader = new MHorizontalLayout();
    contactInformationHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label contactInformationHeaderLbl = new Label(UserUIContext.getMessage(UserI18nEnum.SECTION_CONTACT_INFORMATION));

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

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

    MHorizontalLayout advanceInfoHeader = new MHorizontalLayout();
    Label advanceInfoHeaderLbl = new Label(UserUIContext.getMessage(UserI18nEnum.SECTION_ADVANCED_INFORMATION));

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

    advanceInfoHeader.with(advanceInfoHeaderLbl, btnChangeAdvanceInfo);
    layout.addSection(new CssLayout(advanceInfoHeader), advancedInfoLayout.getLayout());
    return layout;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:30,代码来源:ProfileReadViewImpl.java

示例14: generateRow

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<SimpleMessage> host, final SimpleMessage message, int rowIndex) {
    MHorizontalLayout mainLayout = new MHorizontalLayout().withStyleName("message-block").withFullWidth();
    Image userAvatarImg = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(message.getPostedUserAvatarId(), 32);
    userAvatarImg.addStyleName(UIConstants.CIRCLE_BOX);
    mainLayout.addComponent(userAvatarImg);

    CssLayout rightCol = new CssLayout();
    rightCol.setWidth("100%");

    MHorizontalLayout metadataRow = new MHorizontalLayout().withFullWidth();

    ELabel userNameLbl = new ELabel(message.getFullPostedUserName()).withStyleName(UIConstants.META_INFO,
            UIConstants.TEXT_ELLIPSIS);

    ELabel messageTimePost = new ELabel(UserUIContext.formatPrettyTime(message.getPosteddate())).withStyleName
            (UIConstants.META_INFO).withWidthUndefined();
    metadataRow.with(userNameLbl, messageTimePost).withAlign(messageTimePost, Alignment.TOP_RIGHT).expand(userNameLbl);
    rightCol.addComponent(metadataRow);

    MHorizontalLayout titleRow = new MHorizontalLayout().withFullWidth().withStyleName("title-row");

    A messageLink = new A(ProjectLinkGenerator.generateMessagePreviewLink(CurrentProjectVariables
            .getProjectId(), message.getId())).appendText(message.getTitle());
    ELabel messageTitle = ELabel.h3(messageLink.write());
    CssLayout messageWrap = new CssLayout(messageTitle);

    if (message.getCommentsCount() > 0) {
        Label msgCommentCount = new Label(String.valueOf(message.getCommentsCount()));
        msgCommentCount.setStyleName("comment-count");
        msgCommentCount.setWidthUndefined();
        titleRow.addComponent(msgCommentCount);
        titleRow.addStyleName("has-comment");
        titleRow.with(messageWrap, msgCommentCount).expand(messageWrap);
    } else {
        titleRow.with(messageWrap);
    }
    rightCol.addComponent(titleRow);

    Label messageContent = new Label(StringUtils.trim(StringUtils.trimHtmlTags(message.getMessage()), 150, true));
    rightCol.addComponent(messageContent);

    ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class);
    List<Content> attachments = attachmentService.getContents(AttachmentUtils.getProjectEntityAttachmentPath(
            AppUI.getAccountId(), message.getProjectid(), ProjectTypeConstants.MESSAGE, "" + message.getId()));
    if (CollectionUtils.isNotEmpty(attachments)) {
        CssLayout attachmentPanel = new CssLayout();
        attachmentPanel.setStyleName("attachment-panel");
        attachmentPanel.setWidth("100%");

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

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

示例15: generateRow

import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<ProjectTicket> host, ProjectTicket ticket, int rowIndex) {
    MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName("list-row").withFullWidth();
    rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    Div issueDiv = new Div();
    issueDiv.appendText(ProjectAssetsManager.getAsset(ticket.getType()).getHtml());

    String status = "";
    if (ticket.isBug()) {
        status = UserUIContext.getMessage(StatusI18nEnum.class, ticket.getStatus());
        rowComp.addStyleName("bug");
    } else if (ticket.isMilestone()) {
        status = UserUIContext.getMessage(MilestoneStatus.class, ticket.getStatus());
        rowComp.addStyleName("milestone");
    } else if (ticket.isRisk()) {
        status = UserUIContext.getMessage(StatusI18nEnum.class, ticket.getStatus());
        rowComp.addStyleName("risk");
    } else if (ticket.isTask()) {
        status = UserUIContext.getMessage(StatusI18nEnum.class, ticket.getStatus());
        rowComp.addStyleName("task");
    }
    issueDiv.appendChild(new Span().appendText(status).setCSSClass(UIConstants.BLOCK));

    String avatarLink = StorageUtils.getAvatarPath(ticket.getAssignUserAvatarId(), 16);
    Img img = new Img(ticket.getAssignUserFullName(), avatarLink).setCSSClass(UIConstants.CIRCLE_BOX)
            .setTitle(ticket.getAssignUserFullName());
    issueDiv.appendChild(img, DivLessFormatter.EMPTY_SPACE);

    A ticketLink = new A().setId("tag" + TooltipHelper.TOOLTIP_ID);
    ticketLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(ticket.getType(), ticket.getTypeId() + ""));
    ticketLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction());
    if (ProjectTypeConstants.BUG.equals(ticket.getType()) || ProjectTypeConstants.TASK.equals(ticket.getType())) {
        if (displayPrjShortname) {
            ticketLink.appendText(String.format("[%s-%d] - %s", ticket.getProjectShortName(), ticket.getExtraTypeId(),
                    ticket.getName()));
        } else {
            ticketLink.appendText(ticket.getName());
        }
        ticketLink.setHref(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(),
                ticket.getProjectId(), ticket.getType(), ticket.getExtraTypeId() + ""));
    } else {
        ticketLink.appendText(ticket.getName());
        ticketLink.setHref(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(),
                ticket.getProjectId(), ticket.getType(), ticket.getTypeId() + ""));
    }

    issueDiv.appendChild(ticketLink);
    if (ticket.isClosed()) {
        ticketLink.setCSSClass("completed");
    } else if (ticket.isOverdue()) {
        ticketLink.setCSSClass("overdue");
        issueDiv.appendChild(new Span().appendText(" - " + UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_DUE_IN,
                UserUIContext.formatDuration(ticket.getDueDate()))).setCSSClass(UIConstants.META_INFO));
    }

    rowComp.with(ELabel.html(issueDiv.write()));
    return rowComp;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:59,代码来源:TicketRowDisplayHandler.java


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