Example usage for com.vaadin.ui HorizontalLayout addComponent

List of usage examples for com.vaadin.ui HorizontalLayout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout addComponent.

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

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

License:Open Source License

public ContactListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*from  w  w  w  .  ja v a2 s.  c om*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/contact.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new ContactEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Contacts", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

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

License:Open Source License

public Layout initContent() {

    CssLayout contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    contentLayout.setStyleName("lead-convert-window");

    contentLayout.addComponent(createBody());
    ComponentContainer buttonControls = createButtonControls();
    if (buttonControls != null) {
        final HorizontalLayout controlPanel = new HorizontalLayout();
        buttonControls.setSizeUndefined();
        controlPanel.addComponent(buttonControls);
        controlPanel.setWidth("100%");
        controlPanel.setMargin(true);/*from   w  ww . jav a 2  s.  c  om*/
        controlPanel.setComponentAlignment(buttonControls, Alignment.MIDDLE_CENTER);
        contentLayout.addComponent(controlPanel);
    }

    return contentLayout;
}

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

License:Open Source License

private ComponentContainer createButtonControls() {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);/*www  .j av a  2s  . c  o  m*/
    layout.setStyleName("addNewControl");

    Button convertButton = new Button(AppContext.getMessage(LeadI18nEnum.BUTTON_CONVERT_LEAD),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    LeadService leadService = ApplicationContextUtil.getSpringBean(LeadService.class);
                    lead.setStatus("Converted");
                    leadService.updateWithSession(lead, AppContext.getUsername());
                    Opportunity opportunity = null;
                    if (opportunityForm != null && opportunityForm.isVisible()) {
                        if (opportunityForm.validateForm()) {
                            opportunity = opportunityForm.getBean();
                        }
                    }

                    leadService.convertLead(lead, opportunity, AppContext.getUsername());
                    LeadConvertInfoWindow.this.close();
                    EventBusFactory.getInstance()
                            .post(new LeadEvent.GotoRead(LeadConvertInfoWindow.this, lead.getId()));
                }
            });
    convertButton.setStyleName(UIConstants.THEME_GREEN_LINK);
    layout.addComponent(convertButton);
    layout.setComponentAlignment(convertButton, Alignment.MIDDLE_CENTER);

    Button cancelButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    LeadConvertInfoWindow.this.close();

                }
            });
    cancelButton.setStyleName(UIConstants.THEME_GRAY_LINK);
    layout.addComponent(cancelButton);
    layout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);
    return layout;
}

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

License:Open Source License

public LeadListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//  ww  w.  ja v  a  2 s  .  c  o m
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/lead.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button btCreateContact = new Button("New Lead", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null));
        }
    });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Leads", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

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

License:Open Source License

@Override
public void display(SimpleOpportunity opportunity) {
    this.opportunity = opportunity;
    this.removeAllComponents();
    this.setMargin(new MarginInfo(false, true, true, true));
    this.addStyleName("oppcontact-role-edit");

    AddViewLayout2 previewLayout = new AddViewLayout2("Add or Edit Contact Roles",
            CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
    this.addComponent(previewLayout);

    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        previewLayout.addControlButtons(actionControls);
    }//from w ww  .  j a v  a 2  s .  co  m

    contactRoleList = new ContactOpportunityList();
    previewLayout.addBody(contactRoleList);

    Button addMoreContactRolesBtn = new Button("Add more contact roles", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            SimpleContactOpportunityRel contactRole = new SimpleContactOpportunityRel();
            ContactRoleRowComp row = new ContactRoleRowComp(contactRole);
            contactRoleList.addRow(row);
        }
    });
    addMoreContactRolesBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    HorizontalLayout buttonControls = new HorizontalLayout();
    buttonControls.addComponent(addMoreContactRolesBtn);
    buttonControls.setMargin(new MarginInfo(true, true, true, true));

    previewLayout.addBody(buttonControls);
}

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

License:Open Source License

private ComponentContainer createButtonControls() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);//from   www.  j  a  v a 2s  .c o m
    layout.setMargin(true);

    HorizontalLayout buttonWrapper = new HorizontalLayout();
    buttonWrapper.setWidthUndefined();
    buttonWrapper.setSpacing(true);

    Button updateBtn = new Button("Update", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            updateContactRoles();
        }
    });
    updateBtn.setIcon(FontAwesome.SAVE);
    updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    buttonWrapper.addComponent(updateBtn);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    ViewState viewState = HistoryViewManager.back();

                    if (viewState instanceof NullViewState) {
                        EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null));
                    }

                }
            });
    cancelBtn.setIcon(FontAwesome.TIMES);
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    buttonWrapper.addComponent(cancelBtn);

    layout.addComponent(buttonWrapper);
    layout.setComponentAlignment(buttonWrapper, Alignment.MIDDLE_CENTER);

    return layout;
}

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

License:Open Source License

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

    HorizontalLayout notesWrap = new HorizontalLayout();
    notesWrap.setWidth("100%");
    notesWrap.setSpacing(true);/*  w w w . jav  a  2 s  . c o m*/
    Label noteLbl = new Label("Note: ");
    noteLbl.setSizeUndefined();
    noteLbl.setStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);

    CssLayout noteBlock = new CssLayout();
    noteBlock.setWidth("100%");
    noteBlock.setStyleName("list-note-block");
    for (int i = 0; i < CrmDataTypeFactory.getOpportunityContactRoleList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getOpportunityContactRoleList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunityContactRoleList()[i]));
        note.setSizeUndefined();

        noteBlock.addComponent(note);
    }
    notesWrap.addComponent(noteBlock);
    notesWrap.setExpandRatio(noteBlock, 1.0f);

    controlsBtnWrap.addComponent(notesWrap);

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption("Add/Edit Contacts' Role");
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

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

        @Override
        public void buttonClick(final ClickEvent event) {
            final OpportunityContactSelectionWindow contactsWindow = new OpportunityContactSelectionWindow(
                    OpportunityContactListComp.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.opportunity.OpportunityListNoItemView.java

License:Open Source License

public OpportunityListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);// w w  w . j a v a 2  s.  c  om
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/opportunity.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button btCreateContact = new Button(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new OpportunityEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Leads", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.file.view.components.AbstractResourceMovingWindow.java

License:Open Source License

private void constructBody() {
    MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(true).withMargin(true);
    this.setContent(contentLayout);

    final HorizontalLayout resourceContainer = new HorizontalLayout();
    resourceContainer.setSizeFull();// ww w .ja v  a 2s.  c o  m

    this.folderTree = new TreeTable();
    this.folderTree.setMultiSelect(false);
    this.folderTree.setSelectable(true);
    this.folderTree.setImmediate(true);
    this.folderTree.addContainerProperty("Name", String.class, "");
    this.folderTree.addContainerProperty("Date Modified", String.class, "");
    this.folderTree.setColumnWidth("Date Modified", UIConstants.TABLE_DATE_TIME_WIDTH);
    this.folderTree.setColumnExpandRatio("Name", 1.0f);
    this.folderTree.setWidth("100%");

    resourceContainer.addComponent(this.folderTree);

    this.folderTree.addExpandListener(new Tree.ExpandListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void nodeExpand(final ExpandEvent event) {
            final Folder expandFolder = (Folder) event.getItemId();
            // load externalResource if currentExpandFolder is
            // rootFolder
            if (rootPath.equals(expandFolder.getPath())) {
                List<ExternalDrive> externalDrives = externalDriveService
                        .getExternalDrivesOfUser(AppContext.getUsername());
                for (ExternalDrive externalDrive : externalDrives) {
                    ExternalFolder externalMapFolder = new ExternalFolder("/");
                    externalMapFolder.setStorageName(externalDrive.getStoragename());
                    externalMapFolder.setExternalDrive(externalDrive);
                    externalMapFolder.setName(externalDrive.getFoldername());

                    Calendar cal = GregorianCalendar.getInstance();
                    cal.setTime(externalDrive.getCreatedtime());

                    externalMapFolder.setCreated(cal);
                    expandFolder.addChild(externalMapFolder);

                    AbstractResourceMovingWindow.this.folderTree
                            .addItem(
                                    new Object[] { externalMapFolder.getName(),
                                            AppContext
                                                    .formatDateTime(externalMapFolder.getCreated().getTime()) },
                                    externalMapFolder);

                    AbstractResourceMovingWindow.this.folderTree.setItemIcon(externalMapFolder,
                            MyCollabResource.newResource("icons/16/ecm/dropbox.png"));
                    AbstractResourceMovingWindow.this.folderTree.setItemCaption(externalMapFolder,
                            externalMapFolder.getName());
                    AbstractResourceMovingWindow.this.folderTree.setParent(externalMapFolder, expandFolder);
                }
            }
            if (expandFolder instanceof ExternalFolder) {
                List<ExternalFolder> subFolders = externalResourceService.getSubFolders(
                        ((ExternalFolder) expandFolder).getExternalDrive(), expandFolder.getPath());
                for (final Folder subFolder : subFolders) {
                    expandFolder.addChild(subFolder);
                    Date dateTime = ((ExternalFolder) subFolder).getExternalDrive().getCreatedtime();

                    AbstractResourceMovingWindow.this.folderTree.addItem(
                            new Object[] { subFolder.getName(), AppContext.formatDateTime(dateTime) },
                            subFolder);

                    AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder,
                            MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png"));
                    AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder, subFolder.getName());
                    AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder);
                }
            } else {
                final List<Folder> subFolders = AbstractResourceMovingWindow.this.resourceService
                        .getSubFolders(expandFolder.getPath());

                AbstractResourceMovingWindow.this.folderTree.setItemIcon(expandFolder,
                        MyCollabResource.newResource("icons/16/ecm/folder_open.png"));

                if (subFolders != null) {
                    for (final Folder subFolder : subFolders) {
                        expandFolder.addChild(subFolder);
                        AbstractResourceMovingWindow.this.folderTree.addItem(
                                new Object[] { subFolder.getName(),
                                        AppContext.formatDateTime(subFolder.getCreated().getTime()) },
                                subFolder);

                        AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder,
                                MyCollabResource.newResource("icons/16/ecm/folder_close.png"));
                        AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder,
                                subFolder.getName());
                        AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder);
                    }
                }
            }
        }
    });

    this.folderTree.addCollapseListener(new Tree.CollapseListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void nodeCollapse(final CollapseEvent event) {
            final Folder collapseFolder = (Folder) event.getItemId();
            if (collapseFolder instanceof ExternalFolder) {
                if (collapseFolder.getPath().equals("/"))
                    AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder,
                            MyCollabResource.newResource("icons/16/ecm/dropbox.png"));
                else
                    AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder,
                            MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png"));
            } else {
                AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder,
                        MyCollabResource.newResource("icons/16/ecm/folder_close.png"));
            }
            for (Folder folder : collapseFolder.getChilds()) {
                recursiveRemoveSubItem(folder);
            }
        }

        private void recursiveRemoveSubItem(Folder collapseFolder) {
            List<Folder> childs = collapseFolder.getChilds();
            if (childs.size() > 0) {
                for (final Folder subFolder : childs) {
                    recursiveRemoveSubItem(subFolder);
                }
                AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder);
            } else {
                AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder);
            }
        }
    });

    this.folderTree.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void itemClick(final ItemClickEvent event) {
            AbstractResourceMovingWindow.this.baseFolder = (Folder) event.getItemId();
        }
    });

    contentLayout.addComponent(resourceContainer);
    displayFiles();

    HorizontalLayout controlGroupBtnLayout = new HorizontalLayout();
    controlGroupBtnLayout.setSpacing(true);

    Button moveBtn = new Button("Move", new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (resourceEditting != null) {
                try {
                    resourceMover.moveResource(resourceEditting, baseFolder, AppContext.getUsername(),
                            AppContext.getAccountId());

                    displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, false);
                } finally {
                    AbstractResourceMovingWindow.this.close();
                }
            } else if (!CollectionUtils.isEmpty(lstResEditting)) {
                boolean checkingFail = false;
                for (Resource res : lstResEditting) {
                    try {
                        resourceMover.moveResource(res, baseFolder, AppContext.getUsername(),
                                AppContext.getAccountId());
                    } catch (Exception e) {
                        checkingFail = true;
                    }
                }
                AbstractResourceMovingWindow.this.close();
                displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, checkingFail);
            }
        }

    });
    moveBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlGroupBtnLayout.addComponent(moveBtn);
    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            AbstractResourceMovingWindow.this.close();
        }
    });
    cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    controlGroupBtnLayout.addComponent(cancelBtn);

    contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.module.file.view.components.FileDashboardComponent.java

License:Open Source License

public HorizontalLayout constructHeader() {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.setSpacing(true);//from   w w  w.j ava  2s  . c o m
    layout.setMargin(true);

    final Image titleIcon = new Image(null, MyCollabResource.newResource("icons/24/project/file.png"));
    layout.addComponent(titleIcon);
    layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_LEFT);

    final Label searchtitle = new Label("Files");
    searchtitle.setStyleName(Reindeer.LABEL_H2);
    layout.addComponent(searchtitle);
    layout.setComponentAlignment(searchtitle, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(searchtitle, 1.0f);
    return layout;
}