Example usage for com.vaadin.ui HorizontalLayout setSpacing

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

Introduction

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

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

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

License:Open Source License

public CampaignListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*from w ww.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/campaign.png"));
    layout.addComponent(image);

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

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

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CampaignEvent.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 Campaigns", 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.cases.CaseListNoItemView.java

License:Open Source License

public CaseListNoItemView() {

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

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

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

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

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CaseEvent.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 Cases", 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.contact.ContactListNoItemView.java

License:Open Source License

public ContactListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//w w w.j a  v a  2  s. com
    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

private ComponentContainer createButtonControls() {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.setStyleName("addNewControl");

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

                @Override//www . j av  a  2 s . c o  m
                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);//from   w w  w  .  j  a  v  a2s .  c  om
    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

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

    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);
    Label noteLbl = new Label("Note: ");
    noteLbl.setSizeUndefined();//from  w  ww  .  j av a 2s  . co  m
    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);//ww w .  ja  va  2 s  .c  o  m
    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();/*from  w ww . j av  a2 s  . 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);
    layout.setMargin(true);/*w w w .j  a  va  2s. c o m*/

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