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


Java MHorizontalLayout.setWidth方法代码示例

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


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

示例1: 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;
}
 
开发者ID:felixhusse,项目名称:bookery,代码行数:14,代码来源:AppHeader.java

示例2: 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;
}
 
开发者ID:felixhusse,项目名称:bookery,代码行数:34,代码来源:AppHeader.java

示例3: 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;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:63,代码来源:AccountContactListComp.java

示例4: 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;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:71,代码来源:AccountCaseListComp.java

示例5: 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;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:64,代码来源:CaseContactListComp.java

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


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