diff --git a/README.md b/README.md index d53f898531..f84eea526a 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Free, open source CRM, Document and Project Management software [![License](http://img.shields.io/badge/License-GPLv3-orange.svg)](http://www.gnu.org/copyleft/gpl.html) [![Project Stats](https://www.openhub.net/p/mycollab/widgets/project_thin_badge.gif)](https://www.openhub.net/p/mycollab) [![Build](https://travis-ci.org/MyCollab/mycollab.svg)](https://travis-ci.org/MyCollab/mycollab) -[![Version](https://img.shields.io/badge/Version-5.2.11-brightgreen.svg)](https://community.mycollab.com/) +[![Version](https://img.shields.io/badge/Version-5.2.12-brightgreen.svg)](https://community.mycollab.com/) [![SourceForge](https://img.shields.io/sourceforge/dt/mycollab.svg)](https://community.mycollab.com/download) @@ -13,22 +13,22 @@ MyCollab does work well on both desktop and mobile devices.
- - Project Dashboard + + Project Dashboard
Project Dashboard
- - Bug Dashboard + + Bug Dashboard
Bug Dashboard
- - Task Dashboard + + Task Dashboard
Task Dashboard @@ -36,25 +36,25 @@ MyCollab does work well on both desktop and mobile devices.
- - Kanban Board + + Kanban Board
Kanban Board
- - Gantt Chart + + Roadmap
- Gantt Chart + Roadmap
- - Roadmap + + Gantt Chart
- Roadmap + Project Members
@@ -96,7 +96,7 @@ MyCollab requires a running Java Runtime Environment (7 or greater), Java comman ## Installation -The current MyCollab version is 5.2.10 released on 30th March, 2016. This branch focuses in mobile devices, reporting and customize options for on-demand edition. +The current MyCollab version is 5.2.12 released on 19th April, 2016. This branch focuses in mobile devices, reporting and customize options for on-demand edition. 1. Download MyCollab binary - https://www.mycollab.com/self-hosted/ 2. Follow installation guideline at https://community.mycollab.com/installing-mycollab/ diff --git a/mycollab-app-community/src/main/installer-resources/README.md b/mycollab-app-community/src/main/installer-resources/README.md index 0573845bd1..df01597572 100644 --- a/mycollab-app-community/src/main/installer-resources/README.md +++ b/mycollab-app-community/src/main/installer-resources/README.md @@ -53,6 +53,7 @@ Version 5.2.12 * Allow to upload project logo * Can adjust the parent-child relationship of tasks * New Project list view +* Adjust the java memory settings * Other minor improvements **Bug Fixes** diff --git a/mycollab-config/src/main/java/com/esofthead/mycollab/configuration/Storage.java b/mycollab-config/src/main/java/com/esofthead/mycollab/configuration/Storage.java index 361ec7a80d..c9bad963f6 100644 --- a/mycollab-config/src/main/java/com/esofthead/mycollab/configuration/Storage.java +++ b/mycollab-config/src/main/java/com/esofthead/mycollab/configuration/Storage.java @@ -45,6 +45,11 @@ public String getLogoPath(Integer accountId, String logoName, int size) { logoName, size); } + public static String getEntityLogoPath(Integer accountId, String id, Integer size) { + return String.format("%s%d/.assets/%s_%d.png", SiteConfiguration.getResourceDownloadUrl(), accountId, + id, size); + } + public String getFavIconPath(Integer sAccountId, String favIconName) { if (favIconName == null || "".equals(favIconName)) { return MyCollabAssets.newAssetLink("favicon.ico"); diff --git a/mycollab-services/src/main/java/com/esofthead/mycollab/module/file/PathUtils.java b/mycollab-services/src/main/java/com/esofthead/mycollab/module/file/PathUtils.java index 31d6d155a7..aa65abbd5e 100644 --- a/mycollab-services/src/main/java/com/esofthead/mycollab/module/file/PathUtils.java +++ b/mycollab-services/src/main/java/com/esofthead/mycollab/module/file/PathUtils.java @@ -29,6 +29,10 @@ public static String getProjectLogoPath(Integer accountId, Integer projectId) { return String.format("%d/project/%d/.attachments", accountId, projectId); } + public static String getEntityLogoPath(Integer accountId) { + return String.format("%d/.assets", accountId); + } + public static String buildLogoPath(Integer sAccountId, String logoFileName, Integer logoSize) { return String.format("%d/.assets/%s_%d.png", sAccountId, logoFileName, logoSize); } diff --git a/mycollab-services/src/main/java/com/esofthead/mycollab/module/project/domain/SimpleProject.java b/mycollab-services/src/main/java/com/esofthead/mycollab/module/project/domain/SimpleProject.java index 52a26a37ae..bb0417eb6b 100644 --- a/mycollab-services/src/main/java/com/esofthead/mycollab/module/project/domain/SimpleProject.java +++ b/mycollab-services/src/main/java/com/esofthead/mycollab/module/project/domain/SimpleProject.java @@ -55,6 +55,8 @@ public class SimpleProject extends Project { private String clientName; + private String clientAvatarId; + @NotBindable private ProjectCustomizeView customizeView; @@ -213,6 +215,14 @@ public void setClientName(String clientName) { this.clientName = clientName; } + public String getClientAvatarId() { + return clientAvatarId; + } + + public void setClientAvatarId(String clientAvatarId) { + this.clientAvatarId = clientAvatarId; + } + public enum Field { leadFullName, totalBillableHours, totalNonBillableHours, clientName; diff --git a/mycollab-services/src/main/resources/sqlMap/crm/AccountMapperExt.xml b/mycollab-services/src/main/resources/sqlMap/crm/AccountMapperExt.xml index 94b60ddb03..c86b9bbe27 100644 --- a/mycollab-services/src/main/resources/sqlMap/crm/AccountMapperExt.xml +++ b/mycollab-services/src/main/resources/sqlMap/crm/AccountMapperExt.xml @@ -175,6 +175,7 @@ m_crm_account.shippingCountry, m_crm_account.shippingState, m_crm_account.numemployees, m_crm_account.createdTime, m_crm_account.lastUpdatedTime, m_crm_account.createdUser, m_crm_account.sAccountId, m_crm_account.assignUser, m_crm_account.type, m_crm_account.industry, + m_crm_account.avatarId, s_user.avatarId AS assignUserAvatarId, LTRIM(concat(s_user.firstname, ' ', LTRIM(concat(IFNULL(s_user.middlename, ''), ' ')), s_user.lastname)) as assignUserFullName, createdUserTabl.avatarId AS createdUserAvatarId, diff --git a/mycollab-services/src/main/resources/sqlMap/project/ProjectMapperExt.xml b/mycollab-services/src/main/resources/sqlMap/project/ProjectMapperExt.xml index 6377035734..bfd17430d4 100644 --- a/mycollab-services/src/main/resources/sqlMap/project/ProjectMapperExt.xml +++ b/mycollab-services/src/main/resources/sqlMap/project/ProjectMapperExt.xml @@ -21,6 +21,7 @@ + @@ -138,7 +139,7 @@ concat(s_user.firstname, ' ', LTRIM(concat(IFNULL(s_user.middlename, ''), ' ')), s_user.lastname) AS createUserFullName, concat(leadUser.firstname, ' ', LTRIM(concat(IFNULL(leadUser.middlename, ''), ' ')), leadUser.lastname) AS leadFullName, leadUser.avatarId AS leadAvatarId, m_prj_project.accountId, - m_crm_account.accountName AS clientName, m_prj_project.currencyid, m_prj_project.progress, + m_crm_account.accountName AS clientName, m_crm_account.avatarId AS clientAvatarId, m_prj_project.currencyid, m_prj_project.progress, (SELECT COUNT(*) FROM m_tracker_bug WHERE m_tracker_bug.projectId=m_prj_project.id) AS numBugs, (SELECT COUNT(*) FROM m_tracker_bug WHERE m_tracker_bug.projectId=m_prj_project.id AND m_tracker_bug.status NOT IN ('Resolved', 'Verified')) AS numOpenBugs, (SELECT COUNT(*) FROM m_prj_task WHERE m_prj_task.projectId=m_prj_project.id) AS numTasks, diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/AbstractResourceMovingWindow.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/AbstractResourceMovingWindow.java index 879e303c2f..d7ebfd3393 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/AbstractResourceMovingWindow.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/AbstractResourceMovingWindow.java @@ -216,7 +216,7 @@ public void buttonClick(ClickEvent event) { }); moveBtn.setIcon(FontAwesome.ARROWS); moveBtn.addStyleName(UIConstants.BUTTON_ACTION); - controlGroupBtnLayout.addComponent(moveBtn); + Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @@ -226,9 +226,9 @@ public void buttonClick(ClickEvent event) { } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); - controlGroupBtnLayout.addComponent(cancelBtn); + controlGroupBtnLayout.with(cancelBtn, moveBtn); - contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_CENTER); + contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_RIGHT); } public abstract void displayAfterMoveSuccess(Folder folder, boolean checking); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/ResourcesDisplayComponent.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/ResourcesDisplayComponent.java index 44ab152984..1643d12b31 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/ResourcesDisplayComponent.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/file/view/components/ResourcesDisplayComponent.java @@ -536,9 +536,9 @@ public void buttonClick(final ClickEvent event) { } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); - controlButtons.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER); + controlButtons.with(cancelBtn, saveBtn); contentLayout.addComponent(controlButtons); - contentLayout.setComponentAlignment(controlButtons, Alignment.MIDDLE_CENTER); + contentLayout.setComponentAlignment(controlButtons, Alignment.MIDDLE_RIGHT); this.setContent(contentLayout); } @@ -557,7 +557,8 @@ public AddNewFolderWindow() { this.setCaption("New Folder"); this.center(); - MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(false).withMargin(new MarginInfo(false, false, true, false)); + MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(false).withMargin(new MarginInfo(false, + true, true, false)); this.setContent(contentLayout); GridFormLayoutHelper layoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 1); @@ -590,7 +591,6 @@ public void buttonClick(final ClickEvent event) { }); saveBtn.addStyleName(UIConstants.BUTTON_ACTION); saveBtn.setIcon(FontAwesome.SAVE); - controlsLayout.addComponent(saveBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @@ -601,10 +601,9 @@ public void buttonClick(final ClickEvent event) { } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); - controlsLayout.addComponent(cancelBtn); - controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT); + controlsLayout.with(cancelBtn, saveBtn); - contentLayout.with(controlsLayout).withAlign(controlsLayout, Alignment.MIDDLE_CENTER); + contentLayout.with(controlsLayout).withAlign(controlsLayout, Alignment.MIDDLE_RIGHT); } } @@ -635,7 +634,8 @@ public MultiUploadContentWindow() { this.layoutHelper.addComponent(multiFileUploadExt, "File", 0, 0); contentLayout.addComponent(this.layoutHelper.getLayout()); - MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, false, false)); + MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, false, + false)); final Button uploadBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPLOAD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @@ -675,7 +675,6 @@ public void buttonClick(final ClickEvent event) { }); uploadBtn.addStyleName(UIConstants.BUTTON_ACTION); uploadBtn.setIcon(FontAwesome.UPLOAD); - controlsLayout.addComponent(uploadBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @@ -686,11 +685,10 @@ public void buttonClick(final ClickEvent event) { } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); - controlsLayout.addComponent(cancelBtn); - controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT); + controlsLayout.with(cancelBtn, uploadBtn); contentLayout.addComponent(controlsLayout); - contentLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_CENTER); + contentLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT); } } @@ -709,7 +707,7 @@ public void displayAfterMoveSuccess(Folder folder, boolean checking) { NotificationUtil.showNotification("Congrats", "Moved asset(s) successfully."); } else { NotificationUtil.showWarningNotification("Moving assets is finished, some items can't move to destination. Please " + - "check duplicated file-name and try again."); + "check duplicated file-name and try again."); } } } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/ui/ProjectAssetsUtil.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/ui/ProjectAssetsUtil.java index bc3308a386..0e57b6ddaa 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/ui/ProjectAssetsUtil.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/ui/ProjectAssetsUtil.java @@ -18,6 +18,7 @@ import com.esofthead.mycollab.configuration.StorageFactory; import com.esofthead.mycollab.core.utils.StringUtils; +import com.esofthead.mycollab.module.crm.domain.SimpleAccount; import com.esofthead.mycollab.module.file.PathUtils; import com.esofthead.mycollab.module.project.domain.Project; import com.esofthead.mycollab.module.project.i18n.OptionI18nEnum; @@ -28,7 +29,6 @@ import com.vaadin.server.FontAwesome; import com.vaadin.server.Sizeable; import com.vaadin.ui.*; -import org.vaadin.jouni.restrain.Restrain; /** * @author MyCollab Ltd. @@ -65,4 +65,24 @@ public static final Component buildProjectLogo(Project project, int size) { "new project logo"); return wrapper; } + + public static final Component buildClientLogo(SimpleAccount account, int size) { + AbstractComponent wrapper; + if (!StringUtils.isBlank(account.getAvatarid())) { + wrapper = new Image(null, new ExternalResource(StorageFactory.getInstance().getEntityLogoPath(AppContext + .getAccountId(), account.getAvatarid(), 100))); + } else { + String accountName = account.getAccountname(); + accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName; + ELabel projectIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center"); + wrapper = new VerticalLayout(); + ((VerticalLayout) wrapper).addComponent(projectIcon); + ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); + } + wrapper.setWidth(size, Sizeable.Unit.PIXELS); + wrapper.setHeight(size, Sizeable.Unit.PIXELS); + wrapper.addStyleName(UIConstants.CIRCLE_BOX); + wrapper.setDescription("To change the client logo, select 'Edit client' and upload the new client logo"); + return wrapper; + } } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardPresenter.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardPresenter.java index 194f63a0b3..ed04a2f3a8 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardPresenter.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardPresenter.java @@ -17,6 +17,7 @@ package com.esofthead.mycollab.module.project.view; +import com.esofthead.mycollab.module.project.view.parameters.ProjectScreenData; import com.esofthead.mycollab.vaadin.AppContext; import com.esofthead.mycollab.vaadin.mvp.LoadPolicy; import com.esofthead.mycollab.vaadin.mvp.ScreenData; @@ -41,7 +42,11 @@ protected void onGo(ComponentContainer container, ScreenData data) { ProjectModule prjContainer = (ProjectModule) container; prjContainer.removeAllComponents(); prjContainer.addComponent(view); - view.lazyLoadView(); + if (data instanceof ProjectScreenData.GotoList) { + view.showProjectList(); + } else { + view.showDashboard(); + } AppContext.addFragment("project", "Project"); } } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardView.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardView.java index 490a50b95d..aaf26c507a 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardView.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardView.java @@ -16,7 +16,7 @@ */ package com.esofthead.mycollab.module.project.view; -import com.esofthead.mycollab.vaadin.mvp.LazyPageView; +import com.esofthead.mycollab.vaadin.mvp.PageView; import java.util.List; @@ -24,11 +24,11 @@ * @author MyCollab Ltd. * @since 1.0 */ -public interface UserDashboardView extends LazyPageView { - String DASHBOARD = "dashboard"; - String FOLLOWING_ITEMS = "following"; - String TIME = "time"; - String SETTING = "setting"; +public interface UserDashboardView extends PageView { - List getInvoledProjKeys(); + void showDashboard(); + + void showProjectList(); + + List getInvolvedProjectKeys(); } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardViewImpl.java index 4ac21e8022..0da8276d2c 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserDashboardViewImpl.java @@ -26,6 +26,7 @@ import com.esofthead.mycollab.security.RolePermissionCollections; import com.esofthead.mycollab.spring.ApplicationContextUtil; import com.esofthead.mycollab.vaadin.AppContext; +import com.esofthead.mycollab.vaadin.mvp.AbstractPageView; import com.esofthead.mycollab.vaadin.mvp.PresenterResolver; import com.esofthead.mycollab.vaadin.mvp.ViewComponent; import com.esofthead.mycollab.vaadin.mvp.view.AbstractLazyPageView; @@ -50,11 +51,14 @@ * @since 1.0 */ @ViewComponent -public class UserDashboardViewImpl extends AbstractLazyPageView implements UserDashboardView { +public class UserDashboardViewImpl extends AbstractPageView implements UserDashboardView { private static final long serialVersionUID = 1L; + private ProjectService prjService; private List prjKeys; + private TabSheet tabSheet; + private UserProjectDashboardPresenter userProjectDashboardPresenter; private ProjectListPresenter projectListPresenter; private FollowingTicketPresenter followingTicketPresenter; @@ -64,15 +68,11 @@ public class UserDashboardViewImpl extends AbstractLazyPageView implements UserD public UserDashboardViewImpl() { this.withMargin(false).withWidth("100%"); - } - @Override - protected void displayView() { - removeAllComponents(); - ProjectService prjService = ApplicationContextUtil.getSpringBean(ProjectService.class); + prjService = ApplicationContextUtil.getSpringBean(ProjectService.class); prjKeys = prjService.getProjectKeysUserInvolved(AppContext.getUsername(), AppContext.getAccountId()); - final TabSheet tabSheet = new TabSheet(); + tabSheet = new TabSheet(); tabSheet.addTab(buildDashboardComp(), "Dashboard", FontAwesome.DASHBOARD); tabSheet.addTab(buildProjectListComp(), "Projects", FontAwesome.BUILDING_O); tabSheet.addTab(buildFollowingTicketComp(), "Following Items", FontAwesome.EYE); @@ -101,6 +101,11 @@ public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) { }); this.with(setupHeader(), tabSheet).expand(tabSheet); + + } + + @Override + public void showDashboard() { userProjectDashboardPresenter.onGo(UserDashboardViewImpl.this, null); if (AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)) { @@ -112,7 +117,12 @@ public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) { } @Override - public List getInvoledProjKeys() { + public void showProjectList() { + tabSheet.setSelectedTab(projectListPresenter.getView()); + } + + @Override + public List getInvolvedProjectKeys() { return prjKeys; } @@ -202,7 +212,7 @@ private void displaySearchResult(String value) { Button backDashboard = new Button("Back to workboard", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { - displayView(); + showDashboard(); } }); backDashboard.setStyleName(UIConstants.BUTTON_ACTION); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserProjectDashboardViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserProjectDashboardViewImpl.java index a3ac72ad35..d45030a053 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserProjectDashboardViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/UserProjectDashboardViewImpl.java @@ -64,7 +64,7 @@ public void display() { contentWrapper.addComponent(layout); UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class); - List prjKeys = userDashboardView.getInvoledProjKeys(); + List prjKeys = userDashboardView.getInvolvedProjectKeys(); if (CollectionUtils.isNotEmpty(prjKeys)) { activityStreamComponent.showFeeds(prjKeys); milestoneTimelineWidget.display(); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/milestone/AllMilestoneTimelineWidget.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/milestone/AllMilestoneTimelineWidget.java index 527fc7efe2..30ab359817 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/milestone/AllMilestoneTimelineWidget.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/milestone/AllMilestoneTimelineWidget.java @@ -89,7 +89,7 @@ public void valueChange(Property.ValueChangeEvent event) { MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class); - searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvoledProjKeys())); + searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys())); searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC"))); MilestoneService milestoneService = ApplicationContextUtil.getSpringBean(MilestoneService.class); milestones = milestoneService.findPagableListByCriteria(new SearchRequest<>(searchCriteria, 0, Integer.MAX_VALUE)); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberInviteViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberInviteViewImpl.java index d598911d89..a711865a11 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberInviteViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberInviteViewImpl.java @@ -134,7 +134,7 @@ public void buttonClick(ClickEvent event) { } }); cancelBtn.setStyleName(UIConstants.BUTTON_OPTION); - controlButtons.with(inviteBtn, cancelBtn); + controlButtons.with(cancelBtn, inviteBtn); controlButtons.setSizeUndefined(); return controlButtons; diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberListViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberListViewImpl.java index 0060335644..d8b4b9ee68 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberListViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/settings/ProjectMemberListViewImpl.java @@ -186,11 +186,6 @@ private Component generateMemberBlock(final SimpleProjectMember member) { blockContent.setStyleName("member-block"); blockContent.setWidth("350px"); - MHorizontalLayout blockTop = new MHorizontalLayout().withWidth("100%"); - Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100); - memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); - blockTop.addComponent(memberAvatar); - MHorizontalLayout buttonControls = new MHorizontalLayout(); Button editBtn = new Button("", FontAwesome.EDIT); editBtn.addClickListener(new Button.ClickListener() { @@ -237,6 +232,11 @@ public void onClose(ConfirmDialog dialog) { blockContent.addComponent(buttonControls); blockContent.setComponentAlignment(buttonControls, Alignment.TOP_RIGHT); + MHorizontalLayout blockTop = new MHorizontalLayout().withWidth("100%"); + Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100); + memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); + blockTop.addComponent(memberAvatar); + A memberLink = new A(ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member .getUsername())).appendText(member.getMemberFullName()).setTitle(member.getMemberFullName()); ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS).withWidth("100%"); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/task/TaskReadViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/task/TaskReadViewImpl.java index a6b759da58..101242506f 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/task/TaskReadViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/task/TaskReadViewImpl.java @@ -239,7 +239,7 @@ public void addTitleStyleName(String styleName) { private static class ParentTaskComp extends MHorizontalLayout { ParentTaskComp(Integer parentTaskId, SimpleTask childTask) { - ELabel titleLbl = new ELabel("Parent").withStyleName(UIConstants.FIELD_NOTE).withWidthUndefined(); + ELabel titleLbl = new ELabel("Parent task").withStyleName(UIConstants.FIELD_NOTE).withWidthUndefined(); with(titleLbl); ProjectTaskService taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); SimpleTask parentTask = taskService.findById(parentTaskId, AppContext.getAccountId()); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectActivityStreamPagedList.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectActivityStreamPagedList.java index 7d250ea88c..ced395e255 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectActivityStreamPagedList.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectActivityStreamPagedList.java @@ -227,10 +227,8 @@ protected void feedBlocksPut(Date currentDate, Date nextDate, ComponentContainer } @Override - protected CssLayout createPageControls() { - this.controlBarWrapper = new CssLayout(); - this.controlBarWrapper.setWidth("100%"); - this.controlBarWrapper.setStyleName("page-controls"); + protected MHorizontalLayout createPageControls() { + this.controlBarWrapper = new MHorizontalLayout().withFullHeight().withStyleName("page-controls"); ButtonGroup controlBtns = new ButtonGroup(); controlBtns.setStyleName(UIConstants.BUTTON_ACTION); Button prevBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_NAV_NEWER), new Button.ClickListener() { diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectAddViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectAddViewImpl.java index 01080b2349..82a7b62ccd 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectAddViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectAddViewImpl.java @@ -44,6 +44,7 @@ import com.vaadin.server.ExternalResource; import com.vaadin.server.FontAwesome; import com.vaadin.server.Page; +import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.*; import org.vaadin.viritin.layouts.MHorizontalLayout; import org.vaadin.viritin.layouts.MVerticalLayout; @@ -100,7 +101,9 @@ private Layout createButtonControls() { @Override public ComponentContainer getLayout() { - final AddViewLayout projectAddLayout = new AddViewLayout(); + MHorizontalLayout header = new MHorizontalLayout().withWidth("100%").withMargin(new MarginInfo(true, false, true, false)); + header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); + final AddViewLayout projectAddLayout = new AddViewLayout(header); projectInformationLayout = new ProjectInformationLayout(); projectAddLayout.addHeaderTitle(buildHeaderTitle()); projectAddLayout.addHeaderRight(createButtonControls()); @@ -192,7 +195,7 @@ public void attachField(Object propertyId, final Field field) { } } - private class EditFormFieldFactory extends AbstractBeanFieldGroupEditFieldFactory { + private static class EditFormFieldFactory extends AbstractBeanFieldGroupEditFieldFactory { private static final long serialVersionUID = 1L; public EditFormFieldFactory(GenericBeanForm form) { @@ -201,6 +204,7 @@ public EditFormFieldFactory(GenericBeanForm form) { @Override protected Field onCreateField(final Object propertyId) { + Project project = attachForm.getBean(); if (Project.Field.description.equalTo(propertyId)) { final RichTextArea field = new RichTextArea(); field.setHeight("350px"); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectInfoComponent.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectInfoComponent.java index 10ca4a9378..5f39ad47bf 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectInfoComponent.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectInfoComponent.java @@ -145,11 +145,16 @@ public ProjectInfoComponent(final SimpleProject project) { } if (project.getAccountid() != null) { - Div clientDiv = new Div().appendText(FontAwesome.INSTITUTION.getHtml() + " ").appendChild(new A - (ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())) + Div clientDiv = new Div(); + if (project.getClientAvatarId() == null) { + clientDiv.appendText(FontAwesome.INSTITUTION.getHtml() + " "); + } else { + Img clientImg = new Img("", StorageFactory.getInstance().getEntityLogoPath(AppContext.getAccountId(), project.getClientAvatarId(), 16)); + clientDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE()); + } + clientDiv.appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())) .appendText(project.getClientName())); - ELabel accountBtn = new ELabel(clientDiv.write(), ContentMode.HTML).withStyleName(UIConstants - .BUTTON_BLOCK).withWidthUndefined(); + ELabel accountBtn = new ELabel(clientDiv.write(), ContentMode.HTML).withStyleName(UIConstants.BUTTON_BLOCK).withWidthUndefined(); footer.addComponents(accountBtn); } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectPagedList.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectPagedList.java index f576edf2b8..c80e866716 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectPagedList.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/ProjectPagedList.java @@ -19,11 +19,13 @@ import com.esofthead.mycollab.configuration.StorageFactory; import com.esofthead.mycollab.core.utils.NumberUtils; import com.esofthead.mycollab.core.utils.StringUtils; +import com.esofthead.mycollab.eventmanager.EventBusFactory; import com.esofthead.mycollab.html.DivLessFormatter; import com.esofthead.mycollab.module.project.ProjectLinkBuilder; import com.esofthead.mycollab.module.project.ProjectTooltipGenerator; import com.esofthead.mycollab.module.project.domain.SimpleProject; import com.esofthead.mycollab.module.project.domain.criteria.ProjectSearchCriteria; +import com.esofthead.mycollab.module.project.events.ProjectEvent; import com.esofthead.mycollab.module.project.service.ProjectService; import com.esofthead.mycollab.module.project.ui.ProjectAssetsUtil; import com.esofthead.mycollab.spring.ApplicationContextUtil; @@ -38,10 +40,9 @@ import com.vaadin.server.FontAwesome; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.themes.ValoTheme; -import org.vaadin.viritin.layouts.MCssLayout; import org.vaadin.viritin.layouts.MHorizontalLayout; /** @@ -55,6 +56,23 @@ public ProjectPagedList() { super(ApplicationContextUtil.getSpringBean(ProjectService.class), new ProjectRowDisplayHandler(), 4); } + @Override + protected MHorizontalLayout createPageControls() { + MHorizontalLayout pageControls = super.createPageControls(); + if (pageControls != null) { + Button browseProjectsBtn = new Button("Browse projects", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent clickEvent) { + EventBusFactory.getInstance().post(new ProjectEvent.GotoList(this, null)); + } + }); + browseProjectsBtn.addStyleName(UIConstants.BUTTON_LINK); + pageControls.addComponent(browseProjectsBtn, 0); + pageControls.setComponentAlignment(browseProjectsBtn, Alignment.MIDDLE_LEFT); + } + return pageControls; + } + public static class ProjectRowDisplayHandler implements AbstractBeanPagedList.RowDisplayHandler { @Override @@ -75,7 +93,7 @@ public Component generateRow(AbstractBeanPagedList host, final SimpleProject pro linkIconFix.addComponent(projectLbl); MHorizontalLayout metaInfo = new MHorizontalLayout().withFullWidth(); - metaInfo.setDefaultComponentAlignment(Alignment.TOP_LEFT); + metaInfo.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Div activeMembersDiv = new Div().appendText(FontAwesome.USERS.getHtml() + " " + project.getNumActiveMembers()).setTitle("Active members"); Div createdTimeDiv = new Div().appendText(FontAwesome.CLOCK_O.getHtml() + " " + AppContext @@ -97,9 +115,16 @@ public Component generateRow(AbstractBeanPagedList host, final SimpleProject pro } if (project.getAccountid() != null) { - Div accountDiv = new Div().appendText(FontAwesome.INSTITUTION.getHtml() + " ") - .appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())) - .appendText(StringUtils.trim(project.getClientName(), 30, true))).setCSSClass(UIConstants.BUTTON_BLOCK) + Div accountDiv = new Div(); + if (project.getClientAvatarId() == null) { + accountDiv.appendText(FontAwesome.INSTITUTION.getHtml() + " "); + } else { + Img clientImg = new Img("", StorageFactory.getInstance().getEntityLogoPath(AppContext.getAccountId(), project.getClientAvatarId(), 16)); + accountDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE()); + } + + accountDiv.appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())) + .appendText(StringUtils.trim(project.getClientName(), 30, true))).setCSSClass(UIConstants.BUTTON_BLOCK) .setTitle(project.getClientName()); metaDiv.appendChild(0, accountDiv); metaDiv.appendChild(1, DivLessFormatter.EMPTY_SPACE()); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/UserUnresolvedAssignmentWidget.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/UserUnresolvedAssignmentWidget.java index ea657ddf85..7df3855f01 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/UserUnresolvedAssignmentWidget.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/project/view/user/UserUnresolvedAssignmentWidget.java @@ -80,7 +80,7 @@ public void displayUnresolvedAssignmentsThisWeek() { searchCriteria = new ProjectGenericTaskSearchCriteria(); searchCriteria.setIsOpenned(new SearchField()); UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class); - searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvoledProjKeys())); + searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys())); LocalDate now = new LocalDate(); Date[] bounceDateofWeek = DateTimeUtils.getBounceDateofWeek(now.toDate()); RangeDateSearchField range = new RangeDateSearchField(bounceDateofWeek[0], bounceDateofWeek[1]); @@ -93,7 +93,7 @@ public void displayUnresolvedAssignmentsNextWeek() { searchCriteria = new ProjectGenericTaskSearchCriteria(); UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class); searchCriteria.setIsOpenned(new SearchField()); - searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvoledProjKeys())); + searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys())); LocalDate now = new LocalDate(); now = now.plusDays(7); Date[] bounceDateofWeek = DateTimeUtils.getBounceDateofWeek(now.toDate()); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/setup/view/SetupViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/setup/view/SetupViewImpl.java index aac5b59818..d2d2360c2e 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/setup/view/SetupViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/setup/view/SetupViewImpl.java @@ -142,7 +142,7 @@ public void onClose(ConfirmDialog dialog) { saveBtn.setStyleName(UIConstants.BUTTON_ACTION); saveBtn.setIcon(FontAwesome.SAVE); saveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER); - buttonControls.with(saveBtn, closeBtn).alignAll(Alignment.MIDDLE_RIGHT); + buttonControls.with(closeBtn, saveBtn).alignAll(Alignment.MIDDLE_RIGHT); return buttonControls; } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/team/view/UserReadViewImpl.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/team/view/UserReadViewImpl.java index b533a93762..7ce96f030f 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/team/view/UserReadViewImpl.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/accountsettings/team/view/UserReadViewImpl.java @@ -73,6 +73,7 @@ private void displayUserAvatar() { header.removeAllComponents(); MHorizontalLayout avatarAndPass = new MHorizontalLayout().withWidth("100%"); Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100); + cropField.addStyleName(UIConstants.CIRCLE_BOX); CssLayout userAvatar = new CssLayout(); userAvatar.addComponent(cropField); avatarAndPass.addComponent(userAvatar); diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/ImagePreviewCropWindow.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/ImagePreviewCropWindow.java index 23d0b9756b..156fb2222b 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/ImagePreviewCropWindow.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/ImagePreviewCropWindow.java @@ -107,6 +107,7 @@ public void buttonClick(Button.ClickEvent event) { try { BufferedImage image = ImageIO.read(new ByteArrayInputStream(scaleImageData)); imageSelectionCommand.process(image); + close(); } catch (IOException e) { throw new MyCollabException("Error when saving user avatar", e); } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/PreviewFormControlsGenerator.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/PreviewFormControlsGenerator.java index b105879232..f5b23d94b6 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/PreviewFormControlsGenerator.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/PreviewFormControlsGenerator.java @@ -64,15 +64,14 @@ public PreviewFormControlsGenerator(AdvancedPreviewBeanForm editForm) { } public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) { - Button optionParentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION), - new Button.ClickListener() { - private static final long serialVersionUID = 1L; + Button optionParentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION), new Button.ClickListener() { + private static final long serialVersionUID = 1L; - @Override - public void buttonClick(ClickEvent event) { - optionBtn.setPopupVisible(true); - } - }); + @Override + public void buttonClick(ClickEvent event) { + optionBtn.setPopupVisible(true); + } + }); optionBtn = new SplitButton(optionParentBtn); optionBtn.setWidthUndefined(); @@ -85,18 +84,16 @@ public void buttonClick(ClickEvent event) { boolean canRead = AppContext.canRead(permissionItem); if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) { - Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), - new Button.ClickListener() { - - private static final long serialVersionUID = 1L; - - @Override - public void buttonClick(final ClickEvent event) { - optionBtn.setPopupVisible(false); - T item = previewForm.getBean(); - previewForm.fireAddForm(item); - } - }); + Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() { + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(final ClickEvent event) { + optionBtn.setPopupVisible(false); + T item = previewForm.getBean(); + previewForm.fireAddForm(item); + } + }); addBtn.setIcon(FontAwesome.PLUS); addBtn.setStyleName(UIConstants.BUTTON_ACTION); addBtn.setEnabled(canWrite); @@ -104,18 +101,16 @@ public void buttonClick(final ClickEvent event) { } if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { - Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), - new Button.ClickListener() { - - private static final long serialVersionUID = 1L; - - @Override - public void buttonClick(final ClickEvent event) { - optionBtn.setPopupVisible(false); - T item = previewForm.getBean(); - previewForm.fireEditForm(item); - } - }); + Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(final ClickEvent event) { + optionBtn.setPopupVisible(false); + T item = previewForm.getBean(); + previewForm.fireEditForm(item); + } + }); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName(UIConstants.BUTTON_ACTION); editBtn.setEnabled(canWrite); @@ -123,17 +118,15 @@ public void buttonClick(final ClickEvent event) { } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { - Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), - new Button.ClickListener() { - - private static final long serialVersionUID = 1L; + Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { + private static final long serialVersionUID = 1L; - @Override - public void buttonClick(final ClickEvent event) { - T item = previewForm.getBean(); - previewForm.fireDeleteForm(item); - } - }); + @Override + public void buttonClick(final ClickEvent event) { + T item = previewForm.getBean(); + previewForm.fireDeleteForm(item); + } + }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName(UIConstants.BUTTON_DANGER); deleteBtn.setEnabled(canAccess); @@ -141,19 +134,17 @@ public void buttonClick(final ClickEvent event) { } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { - Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), - new Button.ClickListener() { - private static final long serialVersionUID = 1L; - - @Override - public void buttonClick(final ClickEvent event) { - optionBtn.setPopupVisible(false); - T item = previewForm.getBean(); - previewForm.fireCloneForm(item); - } - }); + Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() { + private static final long serialVersionUID = 1L; + + @Override + public void buttonClick(final ClickEvent event) { + optionBtn.setPopupVisible(false); + T item = previewForm.getBean(); + previewForm.fireCloneForm(item); + } + }); cloneBtn.setIcon(FontAwesome.ROAD); - cloneBtn.setStyleName(UIConstants.BUTTON_LINK); cloneBtn.setEnabled(canWrite); popupButtonsControl.addOption(cloneBtn); } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/UserBlock.java b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/UserBlock.java index ead182335b..5f216eb9df 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/UserBlock.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/module/user/ui/components/UserBlock.java @@ -36,7 +36,7 @@ public class UserBlock extends MVerticalLayout { public UserBlock(String username, String userAvatarId, String displayName) { withMargin(false).withWidth("80px"); - Image avatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(userAvatarId, 64); + Image avatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(userAvatarId, 48); avatar.addStyleName(UIConstants.CIRCLE_BOX); A userLink = new A().setId("tag" + TOOLTIP_ID).setHref(AccountLinkBuilder.generatePreviewFullUserLink(username)) diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AbstractBeanPagedList.java b/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AbstractBeanPagedList.java index 0b06bf4aea..72ec04b237 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AbstractBeanPagedList.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AbstractBeanPagedList.java @@ -20,6 +20,7 @@ import com.esofthead.mycollab.core.arguments.SearchRequest; import com.esofthead.mycollab.vaadin.events.HasPagableHandlers; import com.esofthead.mycollab.vaadin.events.PageableHandler; +import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.*; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -46,7 +47,7 @@ public abstract class AbstractBeanPagedList extends protected int totalPage = 1; protected int totalCount; protected List currentListData; - protected CssLayout controlBarWrapper; + protected MHorizontalLayout controlBarWrapper; protected MHorizontalLayout pageManagement; protected SearchRequest searchRequest; @@ -72,20 +73,15 @@ public void setControlStyle(String style) { this.listControlStyle = style; } - protected CssLayout createPageControls() { - controlBarWrapper = new CssLayout(); - controlBarWrapper.setStyleName(listControlStyle); - controlBarWrapper.setWidth("100%"); - - HorizontalLayout controlBar = new HorizontalLayout(); - controlBar.setWidth("100%"); - controlBarWrapper.addComponent(controlBar); + protected MHorizontalLayout createPageControls() { + controlBarWrapper = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(false, true, false, true)) + .withStyleName(listControlStyle); pageManagement = new MHorizontalLayout().withWidth(null); // defined layout here --------------------------- - if (this.currentPage > 1) { + if (currentPage > 1) { Button firstLink = new Button("1", new Button.ClickListener() { private static final long serialVersionUID = 1L; @@ -97,13 +93,13 @@ public void buttonClick(final ClickEvent event) { firstLink.addStyleName("buttonPaging"); pageManagement.addComponent(firstLink); } - if (this.currentPage >= 5) { + if (currentPage >= 5) { final Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); pageManagement.addComponent(ss1); } - if (this.currentPage > 3) { - Button previous2 = new Button("" + (this.currentPage - 2), new ClickListener() { + if (currentPage > 3) { + Button previous2 = new Button("" + (currentPage - 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override @@ -114,8 +110,8 @@ public void buttonClick(final ClickEvent event) { previous2.addStyleName("buttonPaging"); pageManagement.addComponent(previous2); } - if (this.currentPage > 2) { - final Button previous1 = new Button("" + (this.currentPage - 1), new ClickListener() { + if (currentPage > 2) { + final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override @@ -127,7 +123,7 @@ public void buttonClick(final ClickEvent event) { pageManagement.addComponent(previous1); } // Here add current ButtonLinkLegacy - final Button current = new Button("" + this.currentPage, new ClickListener() { + final Button current = new Button("" + currentPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override @@ -139,9 +135,9 @@ public void buttonClick(final ClickEvent event) { current.addStyleName("current"); pageManagement.addComponent(current); - final int range = this.totalPage - this.currentPage; + final int range = this.totalPage - currentPage; if (range >= 1) { - final Button next1 = new Button("" + (this.currentPage + 1), new ClickListener() { + final Button next1 = new Button("" + (currentPage + 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override @@ -153,7 +149,7 @@ public void buttonClick(final ClickEvent event) { pageManagement.addComponent(next1); } if (range >= 2) { - Button next2 = new Button("" + (this.currentPage + 2), new ClickListener() { + Button next2 = new Button("" + (currentPage + 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override @@ -182,9 +178,7 @@ public void buttonClick(final ClickEvent event) { pageManagement.addComponent(last); } - controlBar.addComponent(pageManagement); - controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT); - + controlBarWrapper.with(pageManagement).withAlign(pageManagement, Alignment.MIDDLE_RIGHT); return controlBarWrapper; } diff --git a/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AddViewLayout.java b/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AddViewLayout.java index 0eba3d21d4..0ccb6f788e 100644 --- a/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AddViewLayout.java +++ b/mycollab-web/src/main/java/com/esofthead/mycollab/vaadin/web/ui/AddViewLayout.java @@ -56,10 +56,9 @@ public AddViewLayout(String viewTitle, Resource viewIcon) { addComponent(header, "addViewHeader"); } - public AddViewLayout() { + public AddViewLayout(MHorizontalLayout header) { super("addView"); - header = new MHorizontalLayout().withWidth("100%").withMargin(new MarginInfo(true, false, true, false)); - header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); + this.header = header; addComponent(header, "addViewHeader"); } diff --git a/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ClientScreenData.scala b/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ClientScreenData.scala index f12bdbdd18..e6e0f2eb38 100644 --- a/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ClientScreenData.scala +++ b/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ClientScreenData.scala @@ -30,8 +30,6 @@ object ClientScreenData { class Add(param: Account) extends ScreenData[Account](param) {} - class Edit(param: Account) extends ScreenData[Account](param) {} - class Search(param: AccountSearchCriteria) extends ScreenData[AccountSearchCriteria](param) {} } diff --git a/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ProjectScreenData.scala b/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ProjectScreenData.scala index d87ec244d0..94222b5728 100644 --- a/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ProjectScreenData.scala +++ b/mycollab-web/src/main/scala/com.esofthead.mycollab.module.project.view.parameters/ProjectScreenData.scala @@ -25,6 +25,8 @@ import com.esofthead.mycollab.vaadin.mvp.ScreenData */ object ProjectScreenData { + class GotoList() extends ScreenData(null) {} + class Goto(params: Integer) extends ScreenData[Integer](params) {} class Edit(params: Project) extends ScreenData[Project](params) {} diff --git a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/events/ProjectEvent.scala b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/events/ProjectEvent.scala index 5edc40af7e..6505381732 100644 --- a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/events/ProjectEvent.scala +++ b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/events/ProjectEvent.scala @@ -29,6 +29,8 @@ object ProjectEvent { class GotoEdit(source: AnyRef, data: AnyRef) extends ApplicationEvent(source, data) {} + class GotoList(source: AnyRef, data: AnyRef) extends ApplicationEvent(source, data) {} + class GotoMyProject(source: AnyRef, data: AnyRef) extends ApplicationEvent(source, data) {} class GotoTagListView(source: AnyRef, data: AnyRef) extends ApplicationEvent(source, data) {} diff --git a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectController.scala b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectController.scala index dc75f54c51..b997a12780 100644 --- a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectController.scala +++ b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectController.scala @@ -14,22 +14,6 @@ * You should have received a copy of the GNU General Public License * along with mycollab-web. If not, see . */ -/** - * This file is part of mycollab-web. - * - * mycollab-web is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * mycollab-web is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mycollab-web. If not, see . - */ package com.esofthead.mycollab.module.project.view import java.util.GregorianCalendar diff --git a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectModuleController.scala b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectModuleController.scala index db28cadd7c..d47c9ca9f7 100644 --- a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectModuleController.scala +++ b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectModuleController.scala @@ -22,9 +22,9 @@ import com.esofthead.mycollab.module.crm.domain.criteria.AccountSearchCriteria import com.esofthead.mycollab.module.project.events.ProjectEvent.GotoMyProject import com.esofthead.mycollab.module.project.events.{ClientEvent, ProjectEvent} import com.esofthead.mycollab.module.project.view.client.IClientPresenter -import com.esofthead.mycollab.module.project.view.parameters.ClientScreenData +import com.esofthead.mycollab.module.project.view.parameters.{ClientScreenData, ProjectScreenData} import com.esofthead.mycollab.module.project.view.parameters.ClientScreenData.{Add, Read} -import com.esofthead.mycollab.vaadin.mvp.{AbstractController, PageActionChain, PresenterResolver} +import com.esofthead.mycollab.vaadin.mvp.{AbstractController, PageActionChain, PresenterResolver, ScreenData} import com.google.common.eventbus.Subscribe /** @@ -39,6 +39,13 @@ class ProjectModuleController(val container: ProjectModule) extends AbstractCont } }) + this.register(new ApplicationEventListener[ProjectEvent.GotoList]() { + @Subscribe override def handle(event: ProjectEvent.GotoList): Unit = { + val presenter = PresenterResolver.getPresenter(classOf[UserDashboardPresenter]) + presenter.go(container, new ProjectScreenData.GotoList()) + } + }) + this.register(new ApplicationEventListener[ClientEvent.GotoList]() { @Subscribe override def handle(event: ClientEvent.GotoList): Unit = { val presenter = PresenterResolver.getPresenter(classOf[IClientPresenter]) @@ -58,8 +65,7 @@ class ProjectModuleController(val container: ProjectModule) extends AbstractCont this.register(new ApplicationEventListener[ClientEvent.GotoEdit]() { @Subscribe def handle(event: ClientEvent.GotoEdit): Unit = { val presenter = PresenterResolver.getPresenter(classOf[IClientPresenter]) - val account = event.getData.asInstanceOf[SimpleAccount] - presenter.go(container, new Add(account)) + presenter.go(container, new ScreenData.Edit[Any](event.getData)) } }) diff --git a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectUrlResolver.scala b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectUrlResolver.scala index 1c4443ece7..4184464d88 100644 --- a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectUrlResolver.scala +++ b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/ProjectUrlResolver.scala @@ -45,6 +45,7 @@ import com.esofthead.mycollab.vaadin.web.ui.ModuleHelper */ class ProjectUrlResolver extends UrlResolver { def build: UrlResolver = { + this.addSubResolver("list", new ProjectListUrlResolver) this.addSubResolver("dashboard", new ProjectDashboardUrlResolver) this.addSubResolver("edit", new ProjectEditUrlResolver) this.addSubResolver("tag", new ProjectTagUrlResolver) @@ -102,6 +103,11 @@ class ProjectUrlResolver extends UrlResolver { } } + class ProjectListUrlResolver extends ProjectUrlResolver { + protected override def handlePage(params: String*): Unit = { + EventBusFactory.getInstance().post(new ProjectEvent.GotoList(this, null)) + } + } class ProjectDashboardUrlResolver extends ProjectUrlResolver { protected override def handlePage(params: String*) { diff --git a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/client/ClientUrlResolver.scala b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/client/ClientUrlResolver.scala index 3849ff75a7..2203d6ed31 100644 --- a/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/client/ClientUrlResolver.scala +++ b/mycollab-web/src/main/scala/com/esofthead/mycollab/module/project/view/client/ClientUrlResolver.scala @@ -19,10 +19,10 @@ package com.esofthead.mycollab.module.project.view.client import com.esofthead.mycollab.common.UrlTokenizer import com.esofthead.mycollab.eventmanager.EventBusFactory import com.esofthead.mycollab.module.project.domain.SimpleRisk -import com.esofthead.mycollab.module.project.events.ClientEvent.{GotoAdd, GotoRead} -import com.esofthead.mycollab.module.project.events.{ProjectEvent, ClientEvent} +import com.esofthead.mycollab.module.project.events.ClientEvent.{GotoAdd, GotoEdit, GotoRead} +import com.esofthead.mycollab.module.project.events.{ClientEvent, ProjectEvent} import com.esofthead.mycollab.module.project.view.ProjectUrlResolver -import com.esofthead.mycollab.module.project.view.parameters.{RiskScreenData, ProjectScreenData} +import com.esofthead.mycollab.module.project.view.parameters.{ProjectScreenData, RiskScreenData} import com.esofthead.mycollab.shell.events.ShellEvent import com.esofthead.mycollab.vaadin.mvp.PageActionChain @@ -34,6 +34,7 @@ class ClientUrlResolver extends ProjectUrlResolver { this.addSubResolver("list", new ListUrlResolver) this.addSubResolver("preview", new PreviewUrlResolver) this.addSubResolver("add", new AddUrlResolver) + this.addSubResolver("edit", new EditUrlResolver) private class ListUrlResolver extends ProjectUrlResolver { protected override def handlePage(params: String*) { @@ -55,6 +56,14 @@ class ClientUrlResolver extends ProjectUrlResolver { } } + private class EditUrlResolver extends ProjectUrlResolver { + protected override def handlePage(params: String*) { + val token = new UrlTokenizer(params(0)) + val clientId = token.getInt + EventBusFactory.getInstance().post(new GotoEdit(this, clientId)) + } + } + protected override def handlePage(params: String*) { EventBusFactory.getInstance().post(new ClientEvent.GotoList(this, null)) }