Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_LEFT.

Prototype

Alignment MIDDLE_LEFT

To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.

Click Source Link

Usage

From source file:com.mycollab.mobile.module.crm.view.cases.CaseReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.contact.ContactReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedOpportunities = new Button();
    relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(OpportunityI18nEnum.LIST) + "</div>");
    relatedOpportunities.setHtmlContentAllowed(true);
    relatedOpportunities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateOpportunityList))));

    toolbarLayout.addComponent(relatedOpportunities);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivityList))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.lead.LeadReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/* www .j  av a  2s  .  c  om*/

    Button relatedCampaigns = new Button();
    relatedCampaigns.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CAMPAIGN
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CampaignI18nEnum.LIST)
            + "</div>");
    relatedCampaigns.setHtmlContentAllowed(true);
    relatedCampaigns
            .addClickListener(clickEvent -> EventBusFactory.getInstance().post(new LeadEvent.GoToRelatedItems(
                    LeadReadViewImpl.this, new CrmRelatedItemsScreenData(associateCampaigns))));
    toolbarLayout.addComponent(relatedCampaigns);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.opportunity.OpportunityReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*from w ww  .  j ava 2 s.c  o  m*/

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(LeadI18nEnum.LIST)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))));
    toolbarLayout.addComponent(relatedLeads);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.ui.FormSectionBuilder.java

License:Open Source License

public static MHorizontalLayout build(FontAwesome icon, Component comp) {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth()
            .withStyleName(MobileUIConstants.FORM_SECTION);
    layout.with(ELabel.fontIcon(icon), comp).expand(comp).alignAll(Alignment.MIDDLE_LEFT);
    return layout;
}

From source file:com.mycollab.mobile.ui.MobileAttachmentUtils.java

License:Open Source License

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;//  www  . j av a  2s .c  o  m

    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;
}

From source file:com.mycollab.mobile.ui.MobileAttachmentUtils.java

License:Open Source License

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());
    }//  w  w w .  j a  v  a2s. c o m

    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.BUTTON_YES),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), dialog -> {
                    if (dialog.isConfirmed()) {
                        ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class);
                        attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(),
                                true, MyCollabUI.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;
}

From source file:com.mycollab.module.crm.ui.components.AbstractListItemComp.java

License:Open Source License

private ComponentContainer buildControlsLayout() {
    MHorizontalLayout viewControlsLayout = new MHorizontalLayout()
            .withStyleName(WebThemes.TABLE_ACTION_CONTROLS).withFullWidth();

    selectOptionButton = new SelectionOptionButton(tableItem);
    selectOptionButton.setSizeUndefined();
    tableActionControls = createActionControls();

    MHorizontalLayout leftContainer = new MHorizontalLayout(selectOptionButton, tableActionControls,
            selectedItemsNumberLabel);//ww  w.ja  v  a 2s.  c  om
    leftContainer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    extraControlsLayout = new ButtonGroup();
    buildExtraControls();

    viewControlsLayout.with(leftContainer, extraControlsLayout).withAlign(leftContainer, Alignment.MIDDLE_LEFT)
            .withAlign(extraControlsLayout, Alignment.MIDDLE_RIGHT);
    return viewControlsLayout;
}

From source file:com.mycollab.module.crm.ui.components.AbstractPreviewItemComp.java

License:Open Source License

public AbstractPreviewItemComp(FontAwesome iconResource) {
    setSizeFull();//from w  ww .j a  v a2  s . co  m
    this.iconResource = iconResource;
    tabSheet = new VerticalTabsheet();
    tabSheet.setSizeFull();
    tabSheet.setNavigatorWidth("100%");
    tabSheet.setNavigatorStyleName("sidebar-menu");
    tabSheet.addToggleNavigatorControl();

    headerTitle = ELabel.h2("");
    header = new MHorizontalLayout(headerTitle).withStyleName("hdr-view").withFullWidth()
            .withMargin(new MarginInfo(true, false, true, false)).expand(headerTitle);
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    addComponent(tabSheet);

    CssLayout navigatorWrapper = tabSheet.getNavigatorWrapper();
    navigatorWrapper.setWidth("200px");

    tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            Tab tab = ((VerticalTabsheet) event.getSource()).getSelectedTab();
            tabSheet.selectTab(((TabImpl) tab).getTabId());
        }
    });

    tabContent = tabSheet.getContentWrapper();
    tabContent.addComponent(header, 0);

    previewForm = initPreviewForm();
    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        header.with(actionControls).withAlign(actionControls, Alignment.TOP_RIGHT);
    }

    previewLayout = new DefaultReadViewLayout("");
    RightSidebarLayout bodyContainer = new RightSidebarLayout();
    bodyContainer.addStyleName(WebThemes.CONTENT_WRAPPER);

    MVerticalLayout bodyContent = new MVerticalLayout(previewForm).withSpacing(false).withMargin(false)
            .withFullWidth();
    bodyContainer.setContent(bodyContent);
    sidebarContent = new MVerticalLayout().withWidth("250px").withStyleName("readview-sidebar");
    bodyContainer.setSidebar(sidebarContent);
    previewLayout.addBody(bodyContainer);

    tabContent.addComponent(previewLayout);

    initRelatedComponents();
    ComponentContainer bottomPanel = createBottomPanel();
    if (bottomPanel != null) {
        if (bodyContent.getComponentCount() >= 2) {
            bodyContent.replaceComponent(bodyContent.getComponent(bodyContent.getComponentCount() - 1),
                    bottomPanel);
        } else {
            bodyContent.addComponent(bottomPanel);
        }
    }
}

From source file:com.mycollab.module.crm.ui.components.CommentRowDisplayHandler.java

License:Open Source License

@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();/*www .j  av a 2 s  . co m*/

    UserBlock memberBlock = new UserBlock(comment.getCreateduser(), comment.getOwnerAvatarId(),
            comment.getOwnerFullName());
    layout.addComponent(memberBlock);

    CssLayout rowLayout = new CssLayout();
    rowLayout.setStyleName(WebThemes.MESSAGE_CONTAINER);
    rowLayout.setWidth("100%");

    MHorizontalLayout messageHeader = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, true, false, true)).withFullWidth();
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel timePostLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT,
            comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime())),
            ContentMode.HTML).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime()));

    timePostLbl.setSizeUndefined();
    timePostLbl.setStyleName(UIConstants.META_INFO);
    messageHeader.with(timePostLbl).expand(timePostLbl);

    // Message delete button
    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = new MButton("", clickEvent -> {
            ConfirmDialogExt.show(UI.getCurrent(),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            CommentService commentService = AppContextUtil.getSpringBean(CommentService.class);
                            commentService.removeWithSession(comment, UserUIContext.getUsername(),
                                    MyCollabUI.getAccountId());
                            ((BeanList) host).removeRow(layout);
                        }
                    });
        }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY);
        messageHeader.addComponent(msgDeleteBtn);
    }

    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);
        messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }

    layout.with(rowLayout).expand(rowLayout);
    return layout;
}