本文整理汇总了Java中org.vaadin.viritin.layouts.MHorizontalLayout.addStyleName方法的典型用法代码示例。如果您正苦于以下问题:Java MHorizontalLayout.addStyleName方法的具体用法?Java MHorizontalLayout.addStyleName怎么用?Java MHorizontalLayout.addStyleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.vaadin.viritin.layouts.MHorizontalLayout
的用法示例。
在下文中一共展示了MHorizontalLayout.addStyleName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateRow
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<SimpleBug> host, SimpleBug bug, int rowIndex) {
ToggleBugSummaryField toggleBugSummaryField = new ToggleBugSummaryField(bug);
MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName(WebThemes.HOVER_EFFECT_NOT_BOX);
rowComp.addStyleName("margin-bottom");
rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT);
String bugPriority = bug.getPriority();
Span priorityLink = new Span().appendText(ProjectAssetsManager.getPriorityHtml(bugPriority)).setTitle(bugPriority);
Span statusSpan = new Span().appendText(UserUIContext.getMessage(StatusI18nEnum.class,
bug.getStatus())).setCSSClass(UIConstants.BLOCK);
String avatarLink = StorageUtils.getAvatarPath(bug.getAssignUserAvatarId(), 16);
Img img = new Img(bug.getAssignuserFullName(), avatarLink).setTitle(bug.getAssignuserFullName())
.setCSSClass(UIConstants.CIRCLE_BOX);
rowComp.with(ELabel.fontIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)).withWidthUndefined(),
ELabel.html(priorityLink.write()).withWidthUndefined(),
ELabel.html(statusSpan.write()).withWidthUndefined(),
ELabel.html(img.write()).withWidthUndefined(),
toggleBugSummaryField).expand(toggleBugSummaryField);
return rowComp;
}
示例2: constructTableActionControls
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private ComponentContainer constructTableActionControls() {
MHorizontalLayout layout = new MHorizontalLayout().withFullWidth();
layout.addStyleName(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(FontAwesome.ADJUST);
customizeViewBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_LAYOUT_OPTIONS));
layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT);
return layout;
}
示例3: 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;
}
示例4: 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;
}
示例5: generateRow
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<SimpleProject> host, final SimpleProject project, final int rowIndex) {
final MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName("projectblock");
layout.addComponent(ProjectAssetsUtil.projectLogoComp(project.getShortname(), project.getId(), project.getAvatarid(), 64));
if (project.isArchived()) {
layout.addStyleName("projectlink-wrapper-archived");
}
final VerticalLayout linkIconFix = new VerticalLayout();
linkIconFix.setSpacing(true);
A projectDiv = new A(ProjectLinkGenerator.generateProjectLink(project.getId())).appendText(project.getName());
ELabel projectLbl = ELabel.h3(projectDiv.write()).withStyleName(UIConstants.TEXT_ELLIPSIS).withFullWidth();
projectLbl.setDescription(ProjectTooltipGenerator.generateToolTipProject(UserUIContext.getUserLocale(),
AppUI.getDateFormat(), project, AppUI.getSiteUrl(), UserUIContext.getUserTimeZone()));
linkIconFix.addComponent(projectLbl);
MHorizontalLayout metaInfo = new MHorizontalLayout().withFullWidth();
metaInfo.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
Div activeMembersDiv = new Div().appendText(FontAwesome.USERS.getHtml() + " " + project.getNumActiveMembers())
.setTitle(UserUIContext.getMessage(ProjectMemberI18nEnum.OPT_ACTIVE_MEMBERS));
Div createdTimeDiv = new Div().appendText(FontAwesome.CLOCK_O.getHtml() + " " + UserUIContext
.formatPrettyTime(project.getCreatedtime())).setTitle(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME));
Div billableHoursDiv = new Div().appendText(FontAwesome.MONEY.getHtml() + " " + NumberUtils.roundDouble(2, project.getTotalBillableHours())).
setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS));
Div nonBillableHoursDiv = new Div().appendText(FontAwesome.GIFT.getHtml() + " " + NumberUtils.roundDouble(2,
project.getTotalNonBillableHours())).setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS));
Div metaDiv = new Div().appendChild(activeMembersDiv, DivLessFormatter.EMPTY_SPACE, createdTimeDiv,
DivLessFormatter.EMPTY_SPACE, billableHoursDiv, DivLessFormatter.EMPTY_SPACE,
nonBillableHoursDiv, DivLessFormatter.EMPTY_SPACE);
if (project.getLead() != null) {
Div leadDiv = new Div().appendChild(new Img("", StorageUtils.getAvatarPath(project
.getLeadAvatarId(), 16)).setCSSClass(UIConstants.CIRCLE_BOX), DivLessFormatter.EMPTY_SPACE,
new A(ProjectLinkGenerator.generateProjectMemberLink(project.getId(), project.getLead()))
.appendText(StringUtils.trim(project.getLeadFullName(), 30, true))).setTitle
(UserUIContext.getMessage(ProjectI18nEnum.FORM_LEADER));
metaDiv.appendChild(0, leadDiv);
metaDiv.appendChild(1, DivLessFormatter.EMPTY_SPACE);
}
if (project.getAccountid() != null) {
Div accountDiv = new Div();
if (project.getClientAvatarId() == null) {
accountDiv.appendText(FontAwesome.INSTITUTION.getHtml() + " ");
} else {
Img clientImg = new Img("", StorageUtils.getEntityLogoPath(AppUI.getAccountId(),
project.getClientAvatarId(), 16)).setCSSClass(UIConstants.CIRCLE_BOX);
accountDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE);
}
accountDiv.appendChild(new A(ProjectLinkGenerator.generateClientPreviewLink(project.getAccountid()))
.appendText(StringUtils.trim(project.getClientName(), 30, true))).setCSSClass(UIConstants.BLOCK)
.setTitle(project.getClientName());
metaDiv.appendChild(0, accountDiv);
metaDiv.appendChild(1, DivLessFormatter.EMPTY_SPACE);
}
metaDiv.setCSSClass(WebThemes.FLEX_DISPLAY);
metaInfo.addComponent(ELabel.html(metaDiv.write()).withStyleName(UIConstants.META_INFO).withWidthUndefined());
linkIconFix.addComponent(metaInfo);
int openAssignments = project.getNumOpenBugs() + project.getNumOpenTasks() + project.getNumOpenRisks();
int totalAssignments = project.getNumBugs() + project.getNumTasks() + project.getNumRisks();
ELabel progressInfoLbl;
if (totalAssignments > 0) {
progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_PROJECT_TICKET,
(totalAssignments - openAssignments), totalAssignments, (totalAssignments - openAssignments)
* 100 / totalAssignments)).withStyleName(UIConstants.META_INFO);
} else {
progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET))
.withStyleName(UIConstants.META_INFO);
}
linkIconFix.addComponent(progressInfoLbl);
layout.with(linkIconFix).expand(linkIconFix);
return layout;
}
示例6: DateTimeOptionField
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public DateTimeOptionField(boolean hideTimeOptionVal) {
this.hideTimeOption = hideTimeOptionVal;
popupDateField = new PopupDateFieldExt();
popupDateField.addValueChangeListener(valueChangeEvent -> {
Date date = (Date) valueChangeEvent.getProperty().getValue();
if (date != null) {
trickModified = true;
popupDateField.setPropertyDataSource(new ObjectProperty(date));
}
});
popupDateField.setImmediate(true);
popupDateField.setResolution(Resolution.DAY);
hourPickerComboBox = new HourPickerComboBox();
hourPickerComboBox.setWidth("60px");
minutePickerComboBox = new MinutePickerComboBox();
minutePickerComboBox.setImmediate(true);
minutePickerComboBox.setWidth("60px");
timeFormatComboBox = new ValueComboBox();
timeFormatComboBox.setWidth("65px");
timeFormatComboBox.setImmediate(true);
timeFormatComboBox.setCaption(null);
timeFormatComboBox.loadData("AM", "PM");
timeFormatComboBox.setNullSelectionAllowed(false);
toggleTimeBtn = new Button("", clickEvent -> toggleHideTimeOption(!hideTimeOption));
toggleTimeBtn.addStyleName(WebThemes.BUTTON_LINK);
container = new MHorizontalLayout();
container.addStyleName(WebThemes.FLEX_DISPLAY);
if (hideTimeOption) {
toggleTimeBtn.setCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_SET_TIME));
container.with(popupDateField, toggleTimeBtn);
} else {
toggleTimeBtn.setCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_HIDE_TIME));
container.with(popupDateField, new MHorizontalLayout(hourPickerComboBox, minutePickerComboBox,
timeFormatComboBox), toggleTimeBtn);
}
}