List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
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); });/* w ww . ja v a 2 s . co 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.cases.CaseSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);/*from w w w. ja v a 2s .com*/ group = new ValueComboBox(false, "Subject", "Account Name", "Status", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Subject")) { addTextFieldSearch(); } else if (searchType.equals("Account Name")) { addTextFieldSearch(); } else if (searchType.equals("Status")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); layoutSearchPane.addComponent(group, 1, 0); layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.BUTTON_ACTION); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { doSearch(); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
From source file:com.mycollab.module.crm.view.contact.ContactReadFormFieldFactory.java
License:Open Source License
@Override protected Field<?> onCreateField(Object propertyId) { SimpleContact contact = attachForm.getBean(); if (propertyId.equals("accountid")) { return new LinkViewField(contact.getAccountName(), CrmLinkBuilder.generateAccountPreviewLinkFull(contact.getAccountid()), CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); } else if (propertyId.equals("email")) { return new EmailViewField(attachForm.getBean().getEmail()); } else if (propertyId.equals("assignuser")) { return new UserLinkViewField(contact.getAssignuser(), contact.getAssignUserAvatarId(), contact.getAssignUserFullName()); } else if (propertyId.equals("iscallable")) { if (Boolean.FALSE.equals(contact.getIscallable())) { return new DefaultViewField(UserUIContext.getMessage(GenericI18Enum.BUTTON_NO)); } else {/* w w w.ja va 2 s . c om*/ return new DefaultViewField(UserUIContext.getMessage(GenericI18Enum.BUTTON_YES)); } } else if (propertyId.equals("birthday")) { return new DateViewField(contact.getBirthday()); } else if (propertyId.equals("firstname")) { final ContainerHorizontalViewField containerField = new ContainerHorizontalViewField(); String displayName = ""; if (contact.getPrefix() != null) { displayName = contact.getPrefix(); } if (contact.getFirstname() != null) { displayName += contact.getFirstname(); } Label nameLbl = new Label(displayName); containerField.addComponentField(nameLbl); containerField.getLayout().setExpandRatio(nameLbl, 1.0f); Button vcardDownloadBtn = new Button(""); VCardStreamSource streamSource = new VCardStreamSource(); OnDemandFileDownloader downloaderExt = new OnDemandFileDownloader(streamSource); downloaderExt.extend(vcardDownloadBtn); vcardDownloadBtn.setIcon(FontAwesome.CREDIT_CARD); vcardDownloadBtn.setStyleName(WebThemes.BUTTON_ICON_ONLY); containerField.addComponentField(vcardDownloadBtn); containerField.getLayout().setComponentAlignment(vcardDownloadBtn, Alignment.TOP_RIGHT); return containerField; } else if (propertyId.equals("description")) { return new RichTextViewField(contact.getDescription()); } else if (Contact.Field.leadsource.equalTo(propertyId)) { return new I18nFormViewField(contact.getLeadsource(), OpportunityLeadSource.class) .withStyleName(UIConstants.FIELD_NOTE); } else if (Contact.Field.primcountry.equalTo(propertyId)) { return new CountryViewField(contact.getPrimcountry()); } else if (Contact.Field.othercountry.equalTo(propertyId)) { return new CountryViewField(contact.getOthercountry()); } return null; }
From source file:com.mycollab.module.crm.view.contact.ContactSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);//from w ww.j a v a2 s . c o m group = new ValueComboBox(false, "Name", "Email", "Phone", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Name")) { addTextFieldSearch(); } else if (searchType.equals("Email")) { addTextFieldSearch(); } else if (searchType.equals("Phone")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); layoutSearchPane.addComponent(group, 1, 0); layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.BUTTON_ACTION); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { doSearch(); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
From source file:com.mycollab.module.crm.view.CrmModule.java
License:Open Source License
@Override public MHorizontalLayout buildMenu() { if (serviceMenuContainer == null) { serviceMenuContainer = new MHorizontalLayout(); serviceMenu = new ServiceMenu(); serviceMenu.addService(CrmTypeConstants.DASHBOARD, UserUIContext.getMessage(CrmCommonI18nEnum.TOOLBAR_DASHBOARD_HEADER), clickEvent -> EventBusFactory.getInstance().post(new CrmEvent.GotoHome(this, null))); serviceMenu.addService(CrmTypeConstants.ACCOUNT, UserUIContext.getMessage(AccountI18nEnum.LIST), clickEvent -> EventBusFactory.getInstance().post(new AccountEvent.GotoList(this, null))); serviceMenu.addService(CrmTypeConstants.CONTACT, UserUIContext.getMessage(ContactI18nEnum.LIST), clickEvent -> EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null))); serviceMenu.addService(CrmTypeConstants.LEAD, UserUIContext.getMessage(LeadI18nEnum.LIST), clickEvent -> EventBusFactory.getInstance().post(new LeadEvent.GotoList(this, null))); serviceMenu.addService(CrmTypeConstants.CAMPAIGN, UserUIContext.getMessage(CampaignI18nEnum.LIST), clickEvent -> EventBusFactory.getInstance().post(new CampaignEvent.GotoList(this, null))); serviceMenu.addService(CrmTypeConstants.OPPORTUNITY, UserUIContext.getMessage(OpportunityI18nEnum.LIST), clickEvent -> EventBusFactory.getInstance().post(new OpportunityEvent.GotoList(this, null))); serviceMenu.addService(CrmTypeConstants.CASE, UserUIContext.getMessage(CaseI18nEnum.LIST), clickEvent -> EventBusFactory.getInstance().post(new CaseEvent.GotoList(this, null))); serviceMenuContainer.with(serviceMenu); Button.ClickListener listener = new CreateItemListener(); addPopupMenu = new PopupButton(UserUIContext.getMessage(GenericI18Enum.ACTION_NEW)); addPopupMenu.setIcon(FontAwesome.PLUS_CIRCLE); addPopupMenu.addStyleName("add-btn-popup"); addPopupMenu.setDirection(Alignment.BOTTOM_LEFT); OptionPopupContent popupButtonsControl = new OptionPopupContent(); if (UserUIContext.canWrite(RolePermissionCollections.CRM_ACCOUNT)) { Button newAccountBtn = new Button(UserUIContext.getMessage(AccountI18nEnum.SINGLE), listener); newAccountBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); popupButtonsControl.addOption(newAccountBtn); }//from www . j av a 2 s . c o m if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) { Button newContactBtn = new Button(UserUIContext.getMessage(ContactI18nEnum.SINGLE), listener); newContactBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); popupButtonsControl.addOption(newContactBtn); } if (UserUIContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN)) { Button newCampaignBtn = new Button(UserUIContext.getMessage(CampaignI18nEnum.SINGLE), listener); newCampaignBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CAMPAIGN)); popupButtonsControl.addOption(newCampaignBtn); } if (UserUIContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)) { Button newOpportunityBtn = new Button(UserUIContext.getMessage(OpportunityI18nEnum.SINGLE), listener); newOpportunityBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY)); popupButtonsControl.addOption(newOpportunityBtn); } if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) { Button newLeadBtn = new Button(UserUIContext.getMessage(LeadI18nEnum.SINGLE), listener); newLeadBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD)); popupButtonsControl.addOption(newLeadBtn); } if (UserUIContext.canWrite(RolePermissionCollections.CRM_CASE)) { Button newCaseBtn = new Button(UserUIContext.getMessage(CaseI18nEnum.SINGLE), listener); newCaseBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CASE)); popupButtonsControl.addOption(newCaseBtn); } if (UserUIContext.canWrite(RolePermissionCollections.CRM_TASK)) { Button newTaskBtn = new Button(UserUIContext.getMessage(TaskI18nEnum.SINGLE), listener); newTaskBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK)); popupButtonsControl.addOption(newTaskBtn); } if (UserUIContext.canWrite(RolePermissionCollections.CRM_CALL)) { Button newCallBtn = new Button(UserUIContext.getMessage(CallI18nEnum.SINGLE), listener); newCallBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL)); popupButtonsControl.addOption(newCallBtn); } if (UserUIContext.canWrite(RolePermissionCollections.CRM_MEETING)) { Button newMeetingBtn = new Button(UserUIContext.getMessage(MeetingI18nEnum.SINGLE), listener); newMeetingBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING)); popupButtonsControl.addOption(newMeetingBtn); } if (popupButtonsControl.getComponentCount() > 0) { addPopupMenu.setContent(popupButtonsControl); serviceMenuContainer.with(addPopupMenu).withAlign(addPopupMenu, Alignment.MIDDLE_LEFT); } } return serviceMenuContainer; }
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();/*from www.j a v a2 s. c o m*/ 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.lead.LeadSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { searchPanel = new GridLayout(3, 3); searchPanel.setSpacing(true);//from www . j a va 2 s .c o m group = new ValueComboBox(false, "Name", "Email", "Phone", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Name")) { addTextFieldSearch(); } else if (searchType.equals("Email")) { addTextFieldSearch(); } else if (searchType.equals("Phone")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); searchPanel.addComponent(group, 1, 0); searchPanel.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.BUTTON_ACTION); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { doSearch(); } }); searchPanel.addComponent(searchBtn, 2, 0); searchPanel.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(searchPanel); }
From source file:com.mycollab.module.crm.view.opportunity.OpportunityContactListComp.java
License:Open Source License
@Override protected Component generateTopControls() { MHorizontalLayout controlsBtnWrap = new MHorizontalLayout().withSpacing(false).withFullWidth(); MHorizontalLayout notesWrap = new MHorizontalLayout( new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_NOTE)).withWidthUndefined()).withFullWidth(); CssLayout noteBlock = new CssLayout(); noteBlock.setWidth("100%"); noteBlock.setStyleName("list-note-block"); for (OptionI18nEnum.OpportunityContactRole role : CrmDataTypeFactory.getOpportunityContactRoleList()) { ELabel note = new ELabel(UserUIContext.getMessage(role)) .withStyleName("note-label", colormap.get(role.name())).withWidthUndefined() .withHeightUndefined();/*from www . j a v a2 s . c om*/ noteBlock.addComponent(note); } notesWrap.with(noteBlock).expand(noteBlock); controlsBtnWrap.addComponent(notesWrap); if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) { final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined(); controlsBtn.addStyleName(WebThemes.BUTTON_ACTION); controlsBtn.setCaption(UserUIContext.getMessage(ContactI18nEnum.OPT_ADD_EDIT_CONTACT_ROLES)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(event -> EventBusFactory.getInstance() .post(new OpportunityEvent.GotoContactRoleEdit(this, opportunity))); final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> { OpportunityContactSelectionWindow contactsWindow = new OpportunityContactSelectionWindow( OpportunityContactListComp.this); 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.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT); } return controlsBtnWrap; }
From source file:com.mycollab.module.crm.view.opportunity.OpportunitySimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { searchPanel = new GridLayout(3, 3); searchPanel.setSpacing(true);//from w w w. ja v a 2 s.c o m group = new ValueComboBox(false, "Name", "Account Name", "Sales Stage", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Name")) { addTextFieldSearch(); } else if (searchType.equals("Account Name")) { addTextFieldSearch(); } else if (searchType.equals("Sales Stage")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); searchPanel.addComponent(group, 1, 0); searchPanel.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.BUTTON_ACTION); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { doSearch(); } }); searchPanel.addComponent(searchBtn, 2, 0); searchPanel.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(searchPanel); }
From source file:com.mycollab.module.file.view.components.AbstractResourceMovingWindow.java
License:Open Source License
private void constructBody() { MVerticalLayout contentLayout = new MVerticalLayout(); new Restrain(contentLayout).setMaxHeight("600px"); this.setContent(contentLayout); folderTree = new Tree(); folderTree.setMultiSelect(false);/*from www. jav a 2s.c o m*/ folderTree.setSelectable(true); folderTree.setImmediate(true); folderTree.setSizeFull(); 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 (baseFolder.getPath().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); folderTree.addItem(externalMapFolder); folderTree.setItemIcon(externalMapFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(externalMapFolder, externalMapFolder.getName()); 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); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(subFolder, subFolder.getName()); folderTree.setParent(subFolder, expandFolder); } } else { final List<Folder> subFolders = resourceService.getSubFolders(expandFolder.getPath()); folderTree.setItemIcon(expandFolder, FontAwesome.FOLDER_OPEN); if (subFolders != null) { for (final Folder subFolder : subFolders) { String subFolderName = subFolder.getName(); if (!subFolderName.startsWith(".")) { expandFolder.addChild(subFolder); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.FOLDER); folderTree.setItemCaption(subFolder, subFolderName); folderTree.setParent(subFolder, expandFolder); } } } } } }); 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) { folderTree.setItemIcon(collapseFolder, FontAwesome.DROPBOX); } else { folderTree.setItemIcon(collapseFolder, FontAwesome.FOLDER); } for (Folder folder : collapseFolder.getChilds()) { recursiveRemoveSubItem(folder); } } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childFolders = collapseFolder.getChilds(); if (childFolders.size() > 0) { for (Folder subFolder : childFolders) { recursiveRemoveSubItem(subFolder); } folderTree.removeItem(collapseFolder); } else { folderTree.removeItem(collapseFolder); } } }); folderTree.addItemClickListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final ItemClickEvent event) { baseFolder = (Folder) event.getItemId(); } }); CssLayout treeWrapper = new CssLayout(folderTree); treeWrapper.setSizeFull(); contentLayout.addComponent(treeWrapper); displayFiles(); MHorizontalLayout controlGroupBtnLayout = new MHorizontalLayout(); Button moveBtn = new Button("Move", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (!CollectionUtils.isEmpty(movedResources)) { boolean checkingFail = false; for (Resource res : movedResources) { try { resourceMover.moveResource(res, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); } catch (Exception e) { checkingFail = true; LOG.error("Error", e); } } close(); displayAfterMoveSuccess(baseFolder, checkingFail); } } }); moveBtn.setIcon(FontAwesome.ARROWS); moveBtn.addStyleName(UIConstants.BUTTON_ACTION); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { close(); } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); controlGroupBtnLayout.with(cancelBtn, moveBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_RIGHT); }