本文整理汇总了Java中org.vaadin.viritin.layouts.MHorizontalLayout.setExpandRatio方法的典型用法代码示例。如果您正苦于以下问题:Java MHorizontalLayout.setExpandRatio方法的具体用法?Java MHorizontalLayout.setExpandRatio怎么用?Java MHorizontalLayout.setExpandRatio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.vaadin.viritin.layouts.MHorizontalLayout
的用法示例。
在下文中一共展示了MHorizontalLayout.setExpandRatio方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initContent
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
protected Component initContent() {
MHorizontalLayout layout = new MHorizontalLayout().withFullWidth();
final PrefixNameComboBox prefixSelect = new PrefixNameComboBox();
prefixSelect.setValue(attachForm.getBean().getPrefixname());
layout.addComponent(prefixSelect);
prefixSelect.addValueChangeListener(event -> attachForm.getBean().setPrefixname((String) prefixSelect.getValue()));
TextField firstnameTxtField = new TextField();
firstnameTxtField.setWidth("100%");
firstnameTxtField.setNullRepresentation("");
layout.addComponent(firstnameTxtField);
layout.setExpandRatio(firstnameTxtField, 1.0f);
// binding field group
fieldGroup.bind(prefixSelect, "prefixname");
fieldGroup.bind(firstnameTxtField, "firstname");
return layout;
}
示例2: createTop
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private HorizontalLayout createTop() {
Label header = new Label("Bookery");
header.addStyleName(ValoTheme.LABEL_BOLD);
//header.addStyleName(ValoTheme.LABEL_H3);
header.setSizeUndefined();
MHorizontalLayout layout = new MHorizontalLayout(header);
layout.setWidth(100, Unit.PERCENTAGE);
layout.setExpandRatio(header, 1.0f);
layout.setComponentAlignment(header, Alignment.MIDDLE_LEFT);
//layout.setComponentAlignment(logoutButton, Alignment.BOTTOM_RIGHT);
return layout;
}
示例3: createSearchBar
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
private MHorizontalLayout createSearchBar() {
Label header = new Label("Bookery");
header.addStyleName(ValoTheme.LABEL_BOLD);
header.setSizeUndefined();
header.addStyleName(ValoTheme.LABEL_H3);
searchText = new TextField();
searchText.setIcon(FontAwesome.SEARCH);
searchText.addStyleName(ValoTheme.TEXTFIELD_LARGE);
searchText.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
searchText.setWidth(100, Unit.PERCENTAGE);
searchText.setInputPrompt("hier einfach suchen..");
Button searchButton = new Button("such!", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
Navigator navigator = ((App)UI.getCurrent()).getNavigator();
if (navigator.getState().contains("search")) {
navigator.navigateTo(navigator.getState());
}
else {
navigator.navigateTo(SearchView.id);
}
}
});
searchButton.addStyleName(ValoTheme.BUTTON_LARGE);
searchText.addShortcutListener(new Button.ClickShortcut(searchButton, ShortcutAction.KeyCode.ENTER));
MHorizontalLayout layout = new MHorizontalLayout(header,searchText,searchButton);
layout.setWidth(100, Unit.PERCENTAGE);
layout.setExpandRatio(searchText, 1.0f);
return layout;
}
示例4: 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;
}
示例5: ContactOpportunityList
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
ContactOpportunityList() {
this.setStyleName("contactopp-list");
MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true))
.withFullWidth().withStyleName("contactopp-list-header");
Label contactLbl = new Label(UserUIContext.getMessage(ContactI18nEnum.SINGLE));
contactLbl.setWidth("250px");
header.addComponent(contactLbl);
Label accountLbl = new Label(UserUIContext.getMessage(AccountI18nEnum.SINGLE));
accountLbl.setWidth("250px");
header.addComponent(accountLbl);
Label roleLbl = new Label(UserUIContext.getMessage(RoleI18nEnum.SINGLE));
roleLbl.setWidth("250px");
header.addComponent(roleLbl);
header.setExpandRatio(roleLbl, 1.0f);
this.addComponent(header);
bodyWrapper = new CssLayout();
bodyWrapper.setStyleName("contactopp-list-body");
bodyWrapper.setSizeFull();
ContactOpportunityService contactOppoService = AppContextUtil.getSpringBean(ContactOpportunityService.class);
ContactSearchCriteria criteria = new ContactSearchCriteria();
criteria.setSaccountid(new NumberSearchField(AppUI.getAccountId()));
criteria.setOpportunityId(new NumberSearchField(opportunity.getId()));
List<SimpleContactOpportunityRel> contactOppoRels = (List<SimpleContactOpportunityRel>) contactOppoService.findPageableListByCriteria(new BasicSearchRequest<>(criteria));
boolean oddRow = true;
if (!CollectionUtils.isEmpty(contactOppoRels)) {
for (SimpleContactOpportunityRel contactOppoRel : contactOppoRels) {
ContactRoleRowComp rowComp = new ContactRoleRowComp(contactOppoRel);
if (oddRow) {
rowComp.addStyleName("odd");
oddRow = !oddRow;
}
bodyWrapper.addComponent(rowComp);
}
}
if (bodyWrapper.getComponentCount() == 0) {
bodyWrapper.addStyleName("no-child");
}
this.addComponent(bodyWrapper);
}
示例6: generateBlock
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateBlock(final SimpleContact contact, int blockIndex) {
CssLayout beanBlock = new CssLayout();
beanBlock.addStyleName("bean-block");
beanBlock.setWidth("350px");
VerticalLayout blockContent = new VerticalLayout();
MHorizontalLayout blockTop = new MHorizontalLayout();
CssLayout iconWrap = new CssLayout();
iconWrap.setStyleName("icon-wrap");
ELabel contactAvatar = ELabel.fontIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
iconWrap.addComponent(contactAvatar);
blockTop.addComponent(iconWrap);
VerticalLayout contactInfo = new VerticalLayout();
contactInfo.setSpacing(true);
MButton btnDelete = 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()) {
ContactService contactService = AppContextUtil.getSpringBean(ContactService.class);
contact.setAccountid(null);
contactService.updateWithSession(contact, UserUIContext.getUsername());
AccountContactListComp.this.refresh();
}
});
}).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY);
blockContent.addComponent(btnDelete);
blockContent.setComponentAlignment(btnDelete, Alignment.TOP_RIGHT);
ELabel contactName = ELabel.html(String.format("Name: <a href='%s'>%s</a>", CrmLinkGenerator.generateCrmItemLink(
CrmTypeConstants.CONTACT, contact.getId()), contact.getContactName()));
contactInfo.addComponent(contactName);
Label contactTitle = new Label("Title: " + MoreObjects.firstNonNull(contact.getTitle(), ""));
contactInfo.addComponent(contactTitle);
Label contactEmail = new Label(String.format("Email: %s", contact.getEmail() == null ? "" :
String.format("<a href='mailto:%s'>%s</a>", contact.getEmail(), contact.getEmail())), ContentMode.HTML);
contactInfo.addComponent(contactEmail);
Label contactOfficePhone = new Label(String.format("Office Phone: %s",
MoreObjects.firstNonNull(contact.getOfficephone(), "")));
contactInfo.addComponent(contactOfficePhone);
blockTop.addComponent(contactInfo);
blockTop.setExpandRatio(contactInfo, 1.0f);
blockTop.setWidth("100%");
blockContent.addComponent(blockTop);
blockContent.setWidth("100%");
beanBlock.addComponent(blockContent);
return beanBlock;
}
示例7: generateBlock
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateBlock(final SimpleCase oneCase, int blockIndex) {
MCssLayout beanBlock = new MCssLayout().withWidth("350px").withStyleName("bean-block");
VerticalLayout blockContent = new VerticalLayout();
MHorizontalLayout blockTop = new MHorizontalLayout();
CssLayout iconWrap = new CssLayout();
iconWrap.setStyleName("icon-wrap");
ELabel caseIcon = ELabel.fontIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CASE));
iconWrap.addComponent(caseIcon);
blockTop.addComponent(iconWrap);
VerticalLayout caseInfo = new VerticalLayout();
caseInfo.setSpacing(true);
MButton deleteBtn = 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()) {
CaseService caseService = AppContextUtil.getSpringBean(CaseService.class);
caseService.removeWithSession(oneCase, UserUIContext.getUsername(), AppUI.getAccountId());
AccountCaseListComp.this.refresh();
}
})
).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY);
blockContent.addComponent(deleteBtn);
blockContent.setComponentAlignment(deleteBtn, Alignment.TOP_RIGHT);
A caseLink = new A(CrmLinkGenerator.generateCasePreviewLink(oneCase.getId())).appendText(oneCase.getSubject());
ELabel caseSubject = ELabel.h3(caseLink.write());
caseInfo.addComponent(caseSubject);
Label casePriority = new Label(UserUIContext.getMessage(CaseI18nEnum.FORM_PRIORITY) + ": " +
UserUIContext.getMessage(CasePriority.class, oneCase.getPriority()));
caseInfo.addComponent(casePriority);
Label caseStatus = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_STATUS) + ": " +
UserUIContext.getMessage(CaseStatus.class, oneCase.getStatus()));
caseInfo.addComponent(caseStatus);
if (oneCase.getStatus() != null) {
beanBlock.addStyleName(colorsMap.get(oneCase.getStatus()));
}
String assigneeValue = (oneCase.getAssignuser() == null) ? new Span().appendText(UserUIContext.getMessage
(GenericI18Enum.OPT_UNDEFINED)).write() : new A(AccountLinkGenerator.generateUserLink(oneCase.getAssignuser()))
.appendText(oneCase.getAssignUserFullName()).write();
Label caseAssignUser = ELabel.html(UserUIContext.getMessage(GenericI18Enum.FORM_ASSIGNEE) + ": " + assigneeValue);
caseInfo.addComponent(caseAssignUser);
ELabel caseCreatedTime = new ELabel(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME) + ": "
+ UserUIContext.formatPrettyTime(oneCase.getCreatedtime()))
.withDescription(UserUIContext.formatDateTime(oneCase.getCreatedtime()));
caseInfo.addComponent(caseCreatedTime);
blockTop.addComponent(caseInfo);
blockTop.setExpandRatio(caseInfo, 1.0f);
blockTop.setWidth("100%");
blockContent.addComponent(blockTop);
blockContent.setWidth("100%");
beanBlock.addComponent(blockContent);
return beanBlock;
}
示例8: generateBlock
import org.vaadin.viritin.layouts.MHorizontalLayout; //导入方法依赖的package包/类
@Override
public Component generateBlock(final SimpleContact contact, int blockIndex) {
CssLayout beanBlock = new CssLayout();
beanBlock.addStyleName("bean-block");
beanBlock.setWidth("350px");
VerticalLayout blockContent = new VerticalLayout();
CssLayout iconWrap = new CssLayout();
iconWrap.setStyleName("icon-wrap");
ELabel contactAvatar = ELabel.fontIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
iconWrap.addComponent(contactAvatar);
MHorizontalLayout blockTop = new MHorizontalLayout();
blockTop.addComponent(iconWrap);
VerticalLayout contactInfo = new VerticalLayout();
contactInfo.setSpacing(true);
MButton btnDelete = 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()) {
final ContactService contactService = AppContextUtil.getSpringBean(ContactService.class);
ContactCase associateContact = new ContactCase();
associateContact.setCaseid(cases.getId());
associateContact.setContactid(contact.getId());
contactService.removeContactCaseRelationship(associateContact, AppUI.getAccountId());
CaseContactListComp.this.refresh();
}
})
).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY);
blockContent.addComponent(btnDelete);
blockContent.setComponentAlignment(btnDelete, Alignment.TOP_RIGHT);
Label contactName = ELabel.html(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ": " + new A(CrmLinkGenerator.generateCrmItemLink(
CrmTypeConstants.CONTACT, contact.getId())).appendText(contact.getContactName()).write());
contactInfo.addComponent(contactName);
Label contactTitle = new Label(UserUIContext.getMessage(ContactI18nEnum.FORM_TITLE) + ": " + MoreObjects.firstNonNull(contact.getTitle(), ""));
contactInfo.addComponent(contactTitle);
Label contactEmail = ELabel.html(UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL) + ": " + new A
("mailto:" + contact.getEmail()).appendText(MoreObjects.firstNonNull(contact.getEmail(), "")));
contactInfo.addComponent(contactEmail);
Label contactOfficePhone = new Label(UserUIContext.getMessage(ContactI18nEnum.FORM_OFFICE_PHONE) + ": " + MoreObjects.firstNonNull(contact.getOfficephone(), ""));
contactInfo.addComponent(contactOfficePhone);
blockTop.addComponent(contactInfo);
blockTop.setExpandRatio(contactInfo, 1.0f);
blockTop.setWidth("100%");
blockContent.addComponent(blockTop);
blockContent.setWidth("100%");
beanBlock.addComponent(blockContent);
return beanBlock;
}