本文整理汇总了Java中org.vaadin.viritin.layouts.MHorizontalLayout.setDefaultComponentAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java MHorizontalLayout.setDefaultComponentAlignment方法的具体用法?Java MHorizontalLayout.setDefaultComponentAlignment怎么用?Java MHorizontalLayout.setDefaultComponentAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.vaadin.viritin.layouts.MHorizontalLayout
的用法示例。
在下文中一共展示了MHorizontalLayout.setDefaultComponentAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initContent
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component initContent() {
MHorizontalLayout layout = new MHorizontalLayout().withFullWidth();
layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
MButton browseBtn = new MButton("", clickEvent -> {
CampaignSelectionWindow campaignWindow = new CampaignSelectionWindow(CampaignSelectionField.this);
UI.getCurrent().addWindow(campaignWindow);
campaignWindow.show();
}).withIcon(FontAwesome.ELLIPSIS_H).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);
MButton clearBtn = new MButton("", clickEvent -> {
campaignName.setValue("");
internalValue = null;
}).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);
layout.with(campaignName, browseBtn, clearBtn).expand(campaignName);
return layout;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: PreviewFormControlsGenerator
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public PreviewFormControlsGenerator(AdvancedPreviewBeanForm<T> editForm) {
this.previewForm = editForm;
layout = new MHorizontalLayout();
layout.setSizeUndefined();
popupButtonsControl = new OptionPopupContent();
editButtons = new MHorizontalLayout();
editButtons.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
}
示例8: getLayout
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public AbstractComponent getLayout() {
MHorizontalLayout header = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
final AddViewLayout projectAddLayout = new AddViewLayout(header);
projectInformationLayout = new ProjectInformationLayout();
projectAddLayout.addHeaderTitle(buildHeaderTitle());
projectAddLayout.addHeaderRight(createButtonControls());
projectAddLayout.addBody(projectInformationLayout.getLayout());
return projectAddLayout;
}
示例9: feedBlocksPut
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
protected void feedBlocksPut(Date currentDate, Date nextDate, ComponentContainer currentBlock) {
MHorizontalLayout blockWrapper = new MHorizontalLayout().withSpacing(false).withFullWidth().withStyleName
("feed-block-wrap");
blockWrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);
Calendar cal1 = Calendar.getInstance();
cal1.setTime(currentDate);
Calendar cal2 = Calendar.getInstance();
cal2.setTime(nextDate);
if (cal1.get(Calendar.YEAR) != cal2.get(Calendar.YEAR)) {
int currentYear = cal2.get(Calendar.YEAR);
Label yearLbl = new Label("<div>" + String.valueOf(currentYear) + "</div>", ContentMode.HTML);
yearLbl.setStyleName("year-lbl");
yearLbl.setWidthUndefined();
listContainer.addComponent(yearLbl);
} else {
blockWrapper.setMargin(new MarginInfo(true, false, false, false));
}
Label dateLbl = new Label(UserUIContext.formatShortDate(nextDate));
dateLbl.setStyleName("date-lbl");
dateLbl.setWidthUndefined();
blockWrapper.with(dateLbl, currentBlock).expand(currentBlock);
this.listContainer.addComponent(blockWrapper);
}
示例10: 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;
}
示例11: ProjectPreviewFormControlsGenerator
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public ProjectPreviewFormControlsGenerator(AdvancedPreviewBeanForm<T> editForm) {
this.previewForm = editForm;
layout = new MHorizontalLayout();
layout.setSizeUndefined();
layout.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
popupButtonsControl = new OptionPopupContent();
editButtons = new MHorizontalLayout();
}
示例12: BuildCriterionComponent
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
public BuildCriterionComponent(SearchLayout<S> searchLayout, Param[] paramFields, String searchCategory) {
this.hostSearchLayout = searchLayout;
this.paramFields = paramFields;
this.searchCategory = searchCategory;
MHorizontalLayout headerBox = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, true));
headerBox.setDefaultComponentAlignment(Alignment.TOP_LEFT);
addComponent(headerBox);
Label filterLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_SAVED_FILTER));
headerBox.with(filterLbl).withAlign(filterLbl, Alignment.TOP_LEFT);
filterBox = new MHorizontalLayout();
headerBox.with(filterBox).withAlign(filterBox, Alignment.TOP_LEFT);
buildFilterBox(null);
searchContainer = new MVerticalLayout().withMargin(false);
searchContainer.setDefaultComponentAlignment(Alignment.TOP_LEFT);
MButton addCriteriaBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD_CRITERIA), clickEvent -> {
CriteriaSelectionLayout newCriteriaBar = new CriteriaSelectionLayout(searchContainer.getComponentCount() + 1);
searchContainer.addComponent(newCriteriaBar);
}).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
this.with(searchContainer, new MHorizontalLayout(addCriteriaBtn).withMargin(true));
}
示例13: createBottomPanel
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected ComponentContainer createBottomPanel() {
MHorizontalLayout toolbarLayout = new MHorizontalLayout();
toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
return toolbarLayout;
}
示例14: generateRow
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<SimpleComment> host, final SimpleComment comment, int rowIndex) {
final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, 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().withMargin(false).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()));
timePostLbl.setStyleName(UIConstants.META_INFO);
if (hasDeletePermission(comment)) {
MButton msgDeleteBtn = new MButton(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY)
.withListener(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());
((BeanList) host).removeRow(layout);
}
});
});
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().withSpacing(false).withFullWidth();
AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
attachmentDisplay.setWidth("100%");
messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT);
rowLayout.addComponent(messageFooter);
}
layout.with(rowLayout).expand(rowLayout);
return layout;
}
示例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;
}