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.esofthead.mycollab.module.crm.view.campaign.CampaignAccountListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/* w w  w  .j a v a2s. c  om*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_ACCOUNT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing accounts", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final CampaignAccountSelectionWindow accountsWindow = new CampaignAccountSelectionWindow(
                    CampaignAccountListComp.this);
            final AccountSearchCriteria criteria = new AccountSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(accountsWindow);
            accountsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

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

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*from w w w .ja va2 s  .  c  om*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = -5166203461087915517L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() {
        private static final long serialVersionUID = -4257729842567787799L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final CampaignContactSelectionWindow contactsWindow = new CampaignContactSelectionWindow(
                    CampaignContactListComp.this);
            final ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(contactsWindow);
            contactsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

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

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*  w  w w . j  a  va 2s.co m*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final CampaignLeadSelectionWindow leadsWindow = new CampaignLeadSelectionWindow(
                    CampaignLeadListComp.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

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

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

License:Open Source License

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

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*from   w  ww  . j ava2 s. c  o  m*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CaseContactSelectionWindow contactsWindow = new CaseContactSelectionWindow(
                    CaseContactListComp.this);
            ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(contactsWindow);
            contactsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");

    VerticalLayout buttonControlsLayout = new VerticalLayout();
    buttonControlsLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlsLayout);

    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));

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

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*www  .j  ava  2  s .c  o m*/
        public void splitButtonClick(SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    controlsBtn.setSizeUndefined();
    Button selectBtn = new Button("Select from existing opportunities", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ContactOpportunitySelectionWindow opportunitiesWindow = new ContactOpportunitySelectionWindow(
                    ContactOpportunityListComp.this);
            OpportunitySearchCriteria criteria = new OpportunitySearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(opportunitiesWindow);
            opportunitiesWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");

    VerticalLayout buttonControlsLayout = new VerticalLayout();
    buttonControlsLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlsLayout);

    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY));

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

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

License:Open Source License

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

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();//from  w w w .j a  v a 2 s  . c o m
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1099580202385205069L;

        @Override
        public void splitButtonClick(SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    Button selectBtn = new Button("Select from existing campaigns", new Button.ClickListener() {
        private static final long serialVersionUID = 3046728004767791528L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            LeadCampaignSelectionWindow leadsWindow = new LeadCampaignSelectionWindow(
                    LeadCampaignListComp.this);
            CampaignSearchCriteria criteria = new CampaignSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");

    VerticalLayout buttonControlsLayout = new VerticalLayout();
    buttonControlsLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlsLayout);

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

    return controlBtnWrap;
}

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

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*from w w w .j ava2 s.co  m*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final OpportunityLeadSelectionWindow leadsWindow = new OpportunityLeadSelectionWindow(
                    OpportunityLeadListComp.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

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

From source file:com.esofthead.mycollab.module.project.view.bug.BugAddFormLayoutFactory.java

License:Open Source License

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

    this.informationLayout = new GridFormLayoutHelper(2, 9, "100%", "167px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().setWidth("100%");
    this.informationLayout.getLayout().setMargin(false);
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);

    return layout;
}

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

License:Open Source License

public MilestoneAddWindow(final SimpleMilestone milestone) {
    if (milestone.getId() == null) {
        setCaption("New milestone");
    } else {//from  www  .  j  a v a2  s.  co  m
        setCaption("Edit milestone");
    }
    this.setWidth("800px");
    this.setModal(true);
    this.setResizable(false);
    VerticalLayout content = new VerticalLayout();
    this.setContent(content);
    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);

    MHorizontalLayout buttonControls = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, true, true, false));
    buttonControls.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);

    Button updateAllBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_OTHER_FIELDS),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    EventBusFactory.getInstance()
                            .post(new MilestoneEvent.GotoAdd(MilestoneAddWindow.this, milestone));
                    close();
                }
            });
    updateAllBtn.addStyleName(UIConstants.BUTTON_LINK);

    Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            if (editForm.validateForm()) {
                MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
                Integer milestoneId;
                if (milestone.getId() == null) {
                    milestoneId = milestoneService.saveWithSession(milestone, AppContext.getUsername());
                } else {
                    milestoneService.updateWithSession(milestone, AppContext.getUsername());
                    milestoneId = milestone.getId();
                }

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

                EventBusFactory.getInstance()
                        .post(new MilestoneEvent.NewMilestoneAdded(MilestoneAddWindow.this, milestoneId));
                EventBusFactory.getInstance().post(new AssignmentEvent.NewAssignmentAdd(MilestoneAddWindow.this,
                        ProjectTypeConstants.MILESTONE, milestoneId));
                close();
            }
        }
    });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.BUTTON_ACTION);
    saveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
    buttonControls.with(updateAllBtn, cancelBtn, saveBtn);
    content.addComponent(buttonControls);
    content.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT);
}

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

License:Open Source License

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

    this.informationLayout = new GridFormLayoutHelper(2, 5, "100%", "145px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().setWidth("100%");
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    this.informationLayout.getLayout().setMargin(false);
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}