Example usage for com.vaadin.ui VerticalLayout setComponentAlignment

List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setComponentAlignment.

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:com.mycollab.module.crm.view.account.AccountLeadListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(LeadI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            AccountLeadSelectionWindow leadsWindow = new AccountLeadSelectionWindow(AccountLeadListComp.this);
            LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD));

        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }/*from w ww  .j  a va  2s. c  om*/
    return controlsBtnWrap;
}

From source file:com.mycollab.module.crm.view.campaign.CampaignAccountListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_ACCOUNT)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(AccountI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
                clickEvent -> {//from   w  w w.ja  v  a 2  s .co m
                    final CampaignAccountSelectionWindow accountsWindow = new CampaignAccountSelectionWindow(
                            CampaignAccountListComp.this);
                    final AccountSearchCriteria criteria = new AccountSearchCriteria();
                    criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
                    UI.getCurrent().addWindow(accountsWindow);
                    accountsWindow.setSearchCriteria(criteria);
                    controlsBtn.setPopupVisible(false);
                });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }

    return controlsBtnWrap;
}

From source file:com.mycollab.module.crm.view.campaign.CampaignContactListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(ContactI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
                clickEvent -> {// w  ww .j ava 2  s .c o m
                    final CampaignContactSelectionWindow contactsWindow = new CampaignContactSelectionWindow(
                            CampaignContactListComp.this);
                    final ContactSearchCriteria criteria = new ContactSearchCriteria();
                    criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
                    UI.getCurrent().addWindow(contactsWindow);
                    contactsWindow.setSearchCriteria(criteria);
                    controlsBtn.setPopupVisible(false);
                });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }

    return controlsBtnWrap;
}

From source file:com.mycollab.module.crm.view.campaign.CampaignLeadListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(LeadI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
                clickEvent -> {/*  w ww  .j  a  va  2s  . c  o m*/
                    CampaignLeadSelectionWindow leadsWindow = new CampaignLeadSelectionWindow(
                            CampaignLeadListComp.this);
                    LeadSearchCriteria criteria = new LeadSearchCriteria();
                    criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
                    UI.getCurrent().addWindow(leadsWindow);
                    leadsWindow.setSearchCriteria(criteria);
                    controlsBtn.setPopupVisible(false);
                });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD));
        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }

    return controlsBtnWrap;
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(ContactI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            CaseContactSelectionWindow contactsWindow = new CaseContactSelectionWindow(
                    CaseContactListComp.this);
            ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(contactsWindow);
            contactsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        });//from  w  w w.ja va2s  . c  o  m
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
        OptionPopupContent buttonControlsLayout = new OptionPopupContent();
        buttonControlsLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlsLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }

    return controlsBtnWrap;
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(OpportunityI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        controlsBtn.setSizeUndefined();/*from w w  w  .j a  v  a2s . co  m*/
        MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            ContactOpportunitySelectionWindow opportunitiesWindow = new ContactOpportunitySelectionWindow(
                    ContactOpportunityListComp.this);
            OpportunitySearchCriteria criteria = new OpportunitySearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(opportunitiesWindow);
            opportunitiesWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));

        OptionPopupContent buttonControlsLayout = new OptionPopupContent();
        buttonControlsLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlsLayout);
        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }
    return controlsBtnWrap;
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlBtnWrap = new VerticalLayout();
    controlBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.setSizeUndefined();/* w w  w .  j  a v  a 2 s  .  c om*/
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(CampaignI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            LeadCampaignSelectionWindow leadsWindow = new LeadCampaignSelectionWindow(
                    LeadCampaignListComp.this);
            CampaignSearchCriteria criteria = new CampaignSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CAMPAIGN));
        OptionPopupContent buttonControlsLayout = new OptionPopupContent();
        buttonControlsLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlsLayout);

        controlBtnWrap.addComponent(controlsBtn);
        controlBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }

    return controlBtnWrap;
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(LeadI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            final OpportunityLeadSelectionWindow leadsWindow = new OpportunityLeadSelectionWindow(
                    OpportunityLeadListComp.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD));

        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }// w w w.  ja va2s  . c  om

    return controlsBtnWrap;
}

From source file:com.mycollab.module.project.view.milestone.MilestoneAddWindow.java

License:Open Source License

public MilestoneAddWindow(final SimpleMilestone milestone) {
    if (milestone.getId() == null) {
        setCaption(UserUIContext.getMessage(MilestoneI18nEnum.NEW));
    } else {/*from   w w w  . j a  v  a 2 s  .  c  o  m*/
        setCaption(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE) + ": " + milestone.getName());
    }
    VerticalLayout content = new VerticalLayout();
    withWidth("800px").withModal(true).withResizable(false).withContent(content).withCenter();
    final AdvancedEditBeanForm<SimpleMilestone> editForm = new AdvancedEditBeanForm<>();
    content.addComponent(editForm);
    editForm.setFormLayoutFactory(new DefaultDynaFormLayout(ProjectTypeConstants.MILESTONE,
            MilestoneDefaultFormLayoutFactory.getForm(), Milestone.Field.id.name()));
    final MilestoneEditFormFieldFactory milestoneEditFormFieldFactory = new MilestoneEditFormFieldFactory(
            editForm);
    editForm.setBeanFormFieldFactory(milestoneEditFormFieldFactory);
    editForm.setBean(milestone);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        if (editForm.validateForm()) {
            MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
            Integer milestoneId;
            if (milestone.getId() == null) {
                milestoneId = milestoneService.saveWithSession(milestone, UserUIContext.getUsername());
            } else {
                milestoneService.updateWithSession(milestone, UserUIContext.getUsername());
                milestoneId = milestone.getId();
            }

            AttachmentUploadField uploadField = milestoneEditFormFieldFactory.getAttachmentUploadField();
            String attachPath = AttachmentUtils.getProjectEntityAttachmentPath(MyCollabUI.getAccountId(),
                    milestone.getProjectid(), ProjectTypeConstants.MILESTONE, "" + milestone.getId());
            uploadField.saveContentsToRepo(attachPath);

            EventBusFactory.getInstance()
                    .post(new MilestoneEvent.NewMilestoneAdded(MilestoneAddWindow.this, milestoneId));
            EventBusFactory.getInstance().post(new TicketEvent.NewTicketAdded(MilestoneAddWindow.this,
                    ProjectTypeConstants.MILESTONE, milestoneId));
            close();
        }
    }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION);
    saveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);
    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(true);
    content.addComponent(buttonControls);
    content.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT);
}

From source file:com.mycollab.module.project.view.page.PageFormLayoutFactory.java

License:Open Source License

@Override
public AbstractComponent getLayout() {
    final VerticalLayout layout = new VerticalLayout();

    informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 3);
    layout.addComponent(informationLayout.getLayout());
    layout.setComponentAlignment(informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}