List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT
Alignment MIDDLE_LEFT
To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.
Click Source Link
From source file:com.esofthead.mycollab.module.project.view.task.FilterTaskViewImpl.java
License:Open Source License
public FilterTaskViewImpl() { this.setMargin(new MarginInfo(false, true, true, true)); final HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);/*from w ww .ja v a 2s. c o m*/ header.setMargin(new MarginInfo(true, false, true, false)); header.setStyleName(UIConstants.HEADER_VIEW); header.setWidth("100%"); Image titleIcon = new Image(null, MyCollabResource.newResource("icons/24/project/task.png")); headerText = new Label(); headerText.setSizeUndefined(); headerText.setStyleName(UIConstants.HEADER_TEXT); Button backtoTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_BACK_TO_DASHBOARD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); backtoTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); UiUtils.addComponent(header, titleIcon, Alignment.TOP_LEFT); UiUtils.addComponent(header, headerText, Alignment.MIDDLE_LEFT); UiUtils.addComponent(header, backtoTaskListBtn, Alignment.MIDDLE_RIGHT); header.setExpandRatio(headerText, 1.0f); this.addComponent(header); HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setWidth("100%"); contentLayout.setSpacing(true); this.addComponent(contentLayout); this.taskTableDisplay = new TaskTableDisplay(Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate, TaskTableFieldDef.percentagecomplete)); this.taskTableDisplay.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleTask task = (SimpleTask) event.getData(); if ("taskname".equals(event.getFieldName())) { EventBusFactory.getInstance() .post(new TaskEvent.GotoRead(FilterTaskViewImpl.this, task.getId())); } } }); taskTableDisplay.setWidth("100%"); taskTableDisplay.setStyleName("filter-task-table"); leftColumn = new VerticalLayout(); leftColumn.addComponent(taskTableDisplay); leftColumn.setStyleName("depotComp"); leftColumn.setMargin(new MarginInfo(true, true, false, false)); rightColumn = new VerticalLayout(); rightColumn.setWidth("300px"); contentLayout.addComponent(leftColumn); contentLayout.addComponent(rightColumn); contentLayout.setExpandRatio(leftColumn, 1.0f); unresolvedTaskByAssigneeWidget = new UnresolvedTaskByAssigneeWidget(); rightColumn.addComponent(unresolvedTaskByAssigneeWidget); unresolvedTaskByPriorityWidget = new UnresolvedTaskByPriorityWidget(); rightColumn.addComponent(unresolvedTaskByPriorityWidget); }
From source file:com.esofthead.mycollab.module.project.view.task.GanttChartViewImpl.java
License:Open Source License
public GanttChartViewImpl() { this.withMargin(new MarginInfo(false, true, true, true)); MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withStyleName("hdr-view").withWidth("100%"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label headerText = new Label(FontAwesome.BAR_CHART_O.getHtml() + " Gantt chart", ContentMode.HTML); headerText.setStyleName(UIConstants.HEADER_TEXT); Button advanceDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w . ja v a 2s . c o m public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.ADVANCED_VIEW_TOOLTIP)); Button simpleDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { TaskSearchCriteria searchCriteria = new TaskSearchCriteria(); searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId())); searchCriteria.setStatuses( new SetSearchField<>(new String[] { OptionI18nEnum.StatusI18nEnum.Open.name() })); TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search"); taskFilter.setAdvanceSearch(true); EventBusFactory.getInstance().post(new TaskEvent.Search(this, taskFilter)); } }); simpleDisplayBtn.setIcon(FontAwesome.LIST_UL); simpleDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.LIST_VIEW_TOOLTIP)); Button chartDisplayBtn = new Button(); chartDisplayBtn.setIcon(FontAwesome.BAR_CHART_O); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(simpleDisplayBtn); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(chartDisplayBtn); viewButtons.setDefaultButton(chartDisplayBtn); header.with(headerText, viewButtons).withAlign(headerText, Alignment.MIDDLE_LEFT).expand(headerText); taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); HorizontalLayout ganttLayout = constructGanttChart(); MVerticalLayout wrapContent = new MVerticalLayout().withSpacing(false).withMargin(false) .withStyleName("gantt-view").with(createControls(), ganttLayout); this.with(header, wrapContent); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskDashboardViewImpl.java
License:Open Source License
public TaskDashboardViewImpl() { this.withMargin(new MarginInfo(false, true, true, true)); taskSearchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); groupWrapLayout.addComponent(new Label("Sort")); final ComboBox sortCombo = new ValueComboBox(false, AppContext.getMessage(GenericI18Enum.OPT_SORT_DESCENDING), AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING)); sortCombo.addValueChangeListener(new Property.ValueChangeListener() { @Override//from w w w . j a v a 2 s. c o m public void valueChange(Property.ValueChangeEvent valueChangeEvent) { String sortValue = (String) sortCombo.getValue(); if (AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) { sortDirection = SearchCriteria.ASC; } else { sortDirection = SearchCriteria.DESC; } queryAndDisplayTasks(); } }); sortDirection = SearchCriteria.DESC; groupWrapLayout.addComponent(sortCombo); groupWrapLayout.addComponent(new Label("Group by")); final ComboBox groupCombo = new ValueComboBox(false, GROUP_DUE_DATE, GROUP_START_DATE, GROUP_CREATED_DATE, PLAIN_LIST, GROUP_USER); groupCombo.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { groupByState = (String) groupCombo.getValue(); queryAndDisplayTasks(); } }); groupByState = GROUP_DUE_DATE; groupWrapLayout.addComponent(groupCombo); taskSearchPanel.addHeaderRight(groupWrapLayout); Button printBtn = new Button("", new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { UI.getCurrent().addWindow(new TaskCustomizeReportOutputWindow(new LazyValueInjector() { @Override protected Object doEval() { return baseCriteria; } })); } }); printBtn.setIcon(FontAwesome.PRINT); printBtn.addStyleName(UIConstants.BUTTON_OPTION); printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT)); groupWrapLayout.addComponent(printBtn); Button newTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { SimpleTask newTask = new SimpleTask(); newTask.setProjectid(CurrentProjectVariables.getProjectId()); newTask.setSaccountid(AppContext.getAccountId()); newTask.setLogby(AppContext.getUsername()); UI.getCurrent().addWindow(new TaskAddWindow(newTask)); } } }); newTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); newTaskBtn.setIcon(FontAwesome.PLUS); newTaskBtn.setStyleName(UIConstants.BUTTON_ACTION); groupWrapLayout.addComponent(newTaskBtn); Button advanceDisplayBtn = new Button("List"); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Advance View"); Button kanbanBtn = new Button("Kanban", new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { displayKanbanView(); } }); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(advanceDisplayBtn); groupWrapLayout.addComponent(viewButtons); MHorizontalLayout mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth(); wrapBody = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, false)); rightColumn = new MVerticalLayout().withWidth("370px") .withMargin(new MarginInfo(true, false, false, false)); mainLayout.with(wrapBody, rightColumn).expand(wrapBody); this.with(taskSearchPanel, mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskFormLayoutFactory.java
License:Open Source License
@Override public void attachField(final Object propertyId, final Field<?> field) { if (propertyId.equals("taskname")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_TASK_NAME), 0, 0, 2, "100%"); } else if (propertyId.equals("startdate")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_START_DATE), 0, 1); } else if (propertyId.equals("enddate")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_END_DATE), 0, 2); } else if (propertyId.equals("actualstartdate")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_ACTUAL_START_DATE), 1, 1);//ww w. jav a 2 s.c o m } else if (propertyId.equals("actualenddate")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_ACTUAL_END_DATE), 1, 2); } else if (propertyId.equals("deadline")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_DEADLINE), 0, 3); } else if (propertyId.equals("priority")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_PRIORITY), 1, 3); } else if (propertyId.equals("assignuser")) { this.informationLayout.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 4); } else if (propertyId.equals("tasklistid")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_TASKGROUP), 1, 4); } else if (propertyId.equals("percentagecomplete")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_PERCENTAGE_COMPLETE), 0, 5, 2, "100%", Alignment.MIDDLE_LEFT); } else if (propertyId.equals("notes")) { field.setSizeUndefined(); this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_NOTES), 0, 6, 2, "100%"); } else if (propertyId.equals("id")) { this.informationLayout.addComponent(field, AppContext.getMessage(TaskI18nEnum.FORM_ATTACHMENT), 0, 7, 2, "100%"); } }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupDisplayViewImpl.java
License:Open Source License
private void constructUI() { this.removeAllComponents(); this.withMargin(new MarginInfo(false, true, true, true)); header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withStyleName("hdr-view").withWidth("100%"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.taskGroupSelection = new PopupButton( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE)); this.taskGroupSelection.setEnabled(CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)); this.taskGroupSelection.addStyleName("link"); this.taskGroupSelection.addStyleName("hdr-text"); taskGroupSelection.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK_LIST)); header.with(taskGroupSelection).withAlign(taskGroupSelection, Alignment.MIDDLE_LEFT) .expand(taskGroupSelection); final MVerticalLayout filterBtnLayout = new MVerticalLayout().withMargin(true).withSpacing(true) .withWidth("200px"); final Button allTasksFilterBtn = new Button( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w .ja v a 2s .co m public void buttonClick(final ClickEvent event) { TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false); TaskGroupDisplayViewImpl.this.taskGroupSelection .setCaption(AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE)); TaskGroupDisplayViewImpl.this.displayAllTaskGroups(); } }); allTasksFilterBtn.setStyleName("link"); filterBtnLayout.addComponent(allTasksFilterBtn); final Button activeTasksFilterBtn = new Button( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false); TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE)); TaskGroupDisplayViewImpl.this.displayActiveTaskGroups(); } }); activeTasksFilterBtn.setStyleName("link"); filterBtnLayout.addComponent(activeTasksFilterBtn); final Button archivedTasksFilterBtn = new Button( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE)); TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false); TaskGroupDisplayViewImpl.this.displayInActiveTaskGroups(); } }); archivedTasksFilterBtn.setStyleName("link"); filterBtnLayout.addComponent(archivedTasksFilterBtn); this.taskGroupSelection.setContent(filterBtnLayout); final Button newTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final TaskGroupAddWindow taskListWindow = new TaskGroupAddWindow( TaskGroupDisplayViewImpl.this); UI.getCurrent().addWindow(taskListWindow); } }); newTaskListBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); newTaskListBtn.setIcon(FontAwesome.PLUS); newTaskListBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP)); newTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); header.addComponent(newTaskListBtn); header.setComponentAlignment(newTaskListBtn, Alignment.MIDDLE_RIGHT); Button reOrderBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.ReoderTaskList(this, null)); } }); reOrderBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); reOrderBtn.setIcon(FontAwesome.SORT); reOrderBtn.setStyleName(UIConstants.THEME_BLUE_LINK); reOrderBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_REODER_TASKGROUP)); header.addComponent(reOrderBtn); header.setComponentAlignment(reOrderBtn, Alignment.MIDDLE_RIGHT); PopupButton exportButtonControl = new PopupButton(); exportButtonControl.addStyleName(UIConstants.THEME_BLUE_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); exportButtonControl.setDescription("Export to file"); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); exportButtonControl.setWidthUndefined(); Button exportPdfBtn = new Button(AppContext.getMessage(FileI18nEnum.PDF)); FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF)); pdfDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button(AppContext.getMessage(FileI18nEnum.EXCEL)); FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL)); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); header.with(exportButtonControl).withAlign(exportButtonControl, Alignment.MIDDLE_LEFT); Button advanceDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { displayAdvancedView(); } }); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.ADVANCED_VIEW_TOOLTIP)); Button simpleDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { TaskSearchCriteria searchCriteria = new TaskSearchCriteria(); searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId())); searchCriteria.setStatuses(new SetSearchField<>(new String[] { StatusI18nEnum.Open.name() })); TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search"); taskFilter.setAdvanceSearch(true); moveToTaskSearch(taskFilter); } }); simpleDisplayBtn.setIcon(FontAwesome.LIST_UL); simpleDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.LIST_VIEW_TOOLTIP)); Button chartDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = -5707546605789537298L; @Override public void buttonClick(ClickEvent event) { displayGanttChartView(); } }); chartDisplayBtn.setIcon(FontAwesome.BAR_CHART_O); viewButtons = new ToggleButtonGroup(); viewButtons.addButton(simpleDisplayBtn); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(chartDisplayBtn); viewButtons.setDefaultButton(advanceDisplayBtn); mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth().withSpacing(true); this.taskListsWidget = new TaskGroupDisplayWidget(); MVerticalLayout leftColumn = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, false)) .with(taskListsWidget); this.rightColumn = new MVerticalLayout().withWidth("300px") .withMargin(new MarginInfo(true, false, false, false)); mainLayout.with(leftColumn, rightColumn).expand(leftColumn); FloatingComponent floatSidebar = FloatingComponent.floatThis(this.rightColumn); floatSidebar.setContainerId("main-body"); implementTaskFilterButton(); basicSearchView = new TaskSearchViewImpl(); basicSearchView.getSearchHandlers().addSearchHandler(new SearchHandler<TaskSearchCriteria>() { @Override public void onSearch(TaskSearchCriteria criteria) { doSearch(criteria); } }); basicSearchView.removeComponent(basicSearchView.getComponent(0)); displayAdvancedView(); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupReorderViewImpl.java
License:Open Source License
private void constructHeader() { CssLayout headerWrapper = new CssLayout(); headerWrapper.setWidth("100%"); headerWrapper.addStyleName("taskgroup-header"); HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);/*from w w w .jav a 2s.c o m*/ header.setWidth("100%"); Label headerLbl = new Label("All Tasks"); headerLbl.setStyleName("h2"); header.addComponent(headerLbl); header.setComponentAlignment(headerLbl, Alignment.MIDDLE_LEFT); header.setExpandRatio(headerLbl, 1.0f); Button backToListBtn = new Button("Back to dashboard", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); backToListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); header.addComponent(backToListBtn); header.setComponentAlignment(backToListBtn, Alignment.MIDDLE_RIGHT); saveOrderBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.SaveReoderTaskList(event, changeSet)); } }); saveOrderBtn.setStyleName(UIConstants.THEME_GREEN_LINK); header.addComponent(saveOrderBtn); header.setComponentAlignment(saveOrderBtn, Alignment.MIDDLE_RIGHT); headerWrapper.addComponent(header); this.addComponent(headerWrapper); final DDVerticalLayout ddLayout = new DDVerticalLayout(); ddLayout.addStyleName("taskgroup-reorder"); ddLayout.setComponentVerticalDropRatio(0.3f); ddLayout.setDragMode(LayoutDragMode.CLONE); ddLayout.setDropHandler(new DropHandler() { private static final long serialVersionUID = 1L; @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDVerticalLayout.VerticalLayoutTargetDetails details = (DDVerticalLayout.VerticalLayoutTargetDetails) event .getTargetDetails(); TaskListComponent comp = (TaskListComponent) transferable.getComponent(); int currentIndex = ddLayout.getComponentIndex(comp); int newIndex = details.getOverIndex(); ddLayout.removeComponent(comp); if (currentIndex > newIndex && details.getDropLocation() == VerticalDropLocation.BOTTOM) { newIndex++; } SimpleTaskList dropTaskList = comp.getTaskList(); dropTaskList.setGroupindex(newIndex); changeSet.add(dropTaskList); ddLayout.addComponent(comp, newIndex); // change affected task list items for (int i = 0; i < ddLayout.getComponentCount(); i++) { TaskListComponent affectedComp = (TaskListComponent) ddLayout.getComponent(i); SimpleTaskList affectedTaskList = affectedComp.getTaskList(); affectedTaskList.setGroupindex(i); changeSet.add(affectedTaskList); } } }); taskLists = new BeanList<ProjectTaskListService, TaskListSearchCriteria, SimpleTaskList>(null, ApplicationContextUtil.getSpringBean(ProjectTaskListService.class), TaskListRowDisplayHandler.class, ddLayout); this.addComponent(taskLists); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskKanbanBoardViewImpl.java
License:Open Source License
public TaskKanbanBoardViewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); toggleShowColumsBtn = new Button(""); toggleShowColumsBtn.addClickListener(new Button.ClickListener() { @Override//from w w w.jav a 2s. c om public void buttonClick(Button.ClickEvent clickEvent) { displayHiddenColumns = !displayHiddenColumns; reload(); toggleShowButton(); } }); toggleShowColumsBtn.addStyleName(UIConstants.BUTTON_LINK); groupWrapLayout.addComponent(toggleShowColumsBtn); toggleShowButton(); Button addNewColumnBtn = new Button(AppContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent().addWindow(new AddNewColumnWindow(TaskKanbanBoardViewImpl.this, ProjectTypeConstants.TASK, "status")); } }); addNewColumnBtn.setIcon(FontAwesome.PLUS); addNewColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); addNewColumnBtn.setStyleName(UIConstants.BUTTON_ACTION); groupWrapLayout.addComponent(addNewColumnBtn); Button deleteColumnBtn = new Button("Delete columns", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent() .addWindow(new DeleteColumnWindow(TaskKanbanBoardViewImpl.this, ProjectTypeConstants.TASK)); } }); deleteColumnBtn.setIcon(FontAwesome.TRASH_O); deleteColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); deleteColumnBtn.setStyleName(UIConstants.BUTTON_DANGER); Button advanceDisplayBtn = new Button("List", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoDashboard(TaskKanbanBoardViewImpl.this, null)); } }); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Advance View"); Button kanbanBtn = new Button("Kanban"); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new DDHorizontalLayout(); kanbanLayout.setHeight("100%"); kanbanLayout.addStyleName("kanban-layout"); kanbanLayout.setSpacing(true); kanbanLayout.setMargin(new MarginInfo(true, false, true, false)); kanbanLayout.setComponentHorizontalDropRatio(0.3f); kanbanLayout.setDragMode(LayoutDragMode.CLONE_OTHER); // Enable dropping components kanbanLayout.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDHorizontalLayout.HorizontalLayoutTargetDetails details = (DDHorizontalLayout.HorizontalLayoutTargetDetails) event .getTargetDetails(); Component dragComponent = transferable.getComponent(); if (dragComponent instanceof KanbanBlock) { KanbanBlock kanbanItem = (KanbanBlock) dragComponent; int newIndex = details.getOverIndex(); if (details.getDropLocation() == HorizontalDropLocation.RIGHT) { kanbanLayout.addComponent(kanbanItem); } else if (newIndex == -1) { kanbanLayout.addComponent(kanbanItem, 0); } else { kanbanLayout.addComponent(kanbanItem, newIndex); } //Update options index for this project List<Map<String, Integer>> indexMap = new ArrayList<>(); for (int i = 0; i < kanbanLayout.getComponentCount(); i++) { KanbanBlock blockItem = (KanbanBlock) kanbanLayout.getComponent(i); Map<String, Integer> map = new HashedMap(2); map.put("id", blockItem.optionVal.getId()); map.put("index", i); indexMap.add(map); } if (indexMap.size() > 0) { optionValService.massUpdateOptionIndexes(indexMap, AppContext.getAccountId()); } } } @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } }); this.setWidth("100%"); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskKanbanviewImpl.java
License:Open Source License
public TaskKanbanviewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new TaskSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); Button addNewColumnBtn = new Button("New column", new Button.ClickListener() { @Override// www . ja v a2 s.c o m public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent() .addWindow(new AddNewColumnWindow(TaskKanbanviewImpl.this, ProjectTypeConstants.TASK)); } }); addNewColumnBtn.setIcon(FontAwesome.PLUS); addNewColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); addNewColumnBtn.setStyleName(UIConstants.BUTTON_ACTION); groupWrapLayout.addComponent(addNewColumnBtn); Button deleteColumBtn = new Button("Delete columns", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent() .addWindow(new DeleteColumnWindow(TaskKanbanviewImpl.this, ProjectTypeConstants.TASK)); } }); deleteColumBtn.setIcon(FontAwesome.TRASH_O); deleteColumBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); deleteColumBtn.setStyleName(UIConstants.BUTTON_DANGER); Button advanceDisplayBtn = new Button("List", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoDashboard(TaskKanbanviewImpl.this, null)); } }); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Advance View"); Button kanbanBtn = new Button("Kanban"); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.setDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new DDHorizontalLayout(); kanbanLayout.setHeight("100%"); kanbanLayout.addStyleName("kanban-layout"); kanbanLayout.setSpacing(true); kanbanLayout.setMargin(new MarginInfo(true, false, true, false)); kanbanLayout.setComponentHorizontalDropRatio(0.3f); kanbanLayout.setDragMode(LayoutDragMode.CLONE_OTHER); // Enable dropping components kanbanLayout.setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDHorizontalLayout.HorizontalLayoutTargetDetails details = (DDHorizontalLayout.HorizontalLayoutTargetDetails) event .getTargetDetails(); Component dragComponent = transferable.getComponent(); if (dragComponent instanceof KanbanBlock) { KanbanBlock kanbanItem = (KanbanBlock) dragComponent; int newIndex = details.getOverIndex(); if (details.getDropLocation() == HorizontalDropLocation.RIGHT) { kanbanLayout.addComponent(kanbanItem); } else if (newIndex == -1) { kanbanLayout.addComponent(kanbanItem, 0); } else { kanbanLayout.addComponent(kanbanItem, newIndex); } //Update options index for this project List<Map<String, Integer>> indexMap = new ArrayList<>(); for (int i = 0; i < kanbanLayout.getComponentCount(); i++) { KanbanBlock blockItem = (KanbanBlock) kanbanLayout.getComponent(i); Map<String, Integer> map = new HashedMap(2); map.put("id", blockItem.optionVal.getId()); map.put("index", i); indexMap.add(map); } if (indexMap.size() > 0) { optionValService.massUpdateOptionIndexes(indexMap, AppContext.getAccountId()); } } } @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } }); this.setWidth("100%"); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskSearchViewImpl.java
License:Open Source License
public TaskSearchViewImpl() { this.withMargin(new MarginInfo(false, true, true, true)); MVerticalLayout taskListLayout = new MVerticalLayout().withSpacing(false); with(taskListLayout);/*from ww w .j a v a2 s. c o m*/ this.taskSearchPanel = new TaskSearchPanel(); this.generateDisplayTable(); final MHorizontalLayout header = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW) .withWidth("100%"); headerText = new Label(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml(), ContentMode.HTML); headerText.setSizeUndefined(); headerText.setStyleName(UIConstants.HEADER_TEXT); Button backBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_BACK_TO_DASHBOARD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); backBtn.setStyleName(UIConstants.THEME_GREEN_LINK); backBtn.setIcon(FontAwesome.ARROW_LEFT); header.with(headerText, backBtn).withAlign(headerText, Alignment.MIDDLE_LEFT) .withAlign(backBtn, Alignment.MIDDLE_RIGHT).expand(headerText); taskListLayout.with(header, taskSearchPanel, tableItem); }
From source file:com.esofthead.mycollab.module.project.view.TimeTrackingSummaryViewImpl.java
License:Open Source License
@Override public void display() { projects = ApplicationContextUtil.getSpringBean(ProjectService.class) .getProjectsUserInvolved(AppContext.getUsername(), AppContext.getAccountId()); if (CollectionUtils.isNotEmpty(projects)) { itemTimeLoggingService = ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class); final CssLayout headerWrapper = new CssLayout(); headerWrapper.setWidth("100%"); headerWrapper.setStyleName("projectfeed-hdr-wrapper"); HorizontalLayout loggingPanel = new HorizontalLayout(); HorizontalLayout controlBtns = new HorizontalLayout(); controlBtns.setMargin(new MarginInfo(true, false, true, false)); final Label layoutHeader = new Label( ProjectAssetsManager.getAsset(ProjectTypeConstants.TIME).getHtml() + " Time Tracking", ContentMode.HTML); layoutHeader.addStyleName("h2"); final MHorizontalLayout header = new MHorizontalLayout().withWidth("100%"); header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader); final CssLayout contentWrapper = new CssLayout(); contentWrapper.setWidth("100%"); contentWrapper.addStyleName(UIConstants.CONTENT_WRAPPER); headerWrapper.addComponent(header); this.addComponent(headerWrapper); contentWrapper.addComponent(controlBtns); MHorizontalLayout controlsPanel = new MHorizontalLayout().withWidth("100%"); contentWrapper.addComponent(controlsPanel); contentWrapper.addComponent(loggingPanel); this.addComponent(contentWrapper); final Button backBtn = new Button("Back to Workboard"); backBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from ww w.j ava 2 s. c om*/ public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(TimeTrackingSummaryViewImpl.this, null)); } }); backBtn.addStyleName(UIConstants.THEME_GREEN_LINK); backBtn.setIcon(FontAwesome.ARROW_LEFT); controlBtns.addComponent(backBtn); VerticalLayout selectionLayoutWrapper = new VerticalLayout(); selectionLayoutWrapper.setWidth("100%"); selectionLayoutWrapper.addStyleName("time-tracking-summary-search-panel"); controlsPanel.addComponent(selectionLayoutWrapper); final GridLayout selectionLayout = new GridLayout(9, 2); selectionLayout.setSpacing(true); selectionLayout.setDefaultComponentAlignment(Alignment.TOP_RIGHT); selectionLayout.setMargin(true); selectionLayoutWrapper.addComponent(selectionLayout); Label fromLb = new Label("From:"); fromLb.setWidthUndefined(); selectionLayout.addComponent(fromLb, 0, 0); this.fromDateField = new PopupDateFieldExt(); this.fromDateField.setResolution(Resolution.DAY); this.fromDateField.setDateFormat(AppContext.getUserDateFormat()); this.fromDateField.setWidth("100px"); selectionLayout.addComponent(this.fromDateField, 1, 0); Label toLb = new Label("To:"); toLb.setWidthUndefined(); selectionLayout.addComponent(toLb, 2, 0); this.toDateField = new PopupDateFieldExt(); this.toDateField.setResolution(Resolution.DAY); this.toDateField.setDateFormat(AppContext.getUserDateFormat()); this.toDateField.setWidth("100px"); selectionLayout.addComponent(this.toDateField, 3, 0); Label groupLb = new Label("Group:"); groupLb.setWidthUndefined(); selectionLayout.addComponent(groupLb, 0, 1); this.groupField = new ValueComboBox(false, GROUPBY_PROJECT, GROUPBY_DATE, GROUPBY_USER); this.groupField.setWidth("100px"); selectionLayout.addComponent(this.groupField, 1, 1); Label sortLb = new Label("Sort:"); sortLb.setWidthUndefined(); selectionLayout.addComponent(sortLb, 2, 1); this.orderField = new ItemOrderComboBox(); this.orderField.setWidth("100px"); selectionLayout.addComponent(this.orderField, 3, 1); Label projectLb = new Label("Project:"); projectLb.setWidthUndefined(); selectionLayout.addComponent(projectLb, 4, 0); this.projectField = new UserInvolvedProjectsListSelect(); initListSelectStyle(this.projectField); selectionLayout.addComponent(this.projectField, 5, 0, 5, 1); Label userLb = new Label("User:"); userLb.setWidthUndefined(); selectionLayout.addComponent(userLb, 6, 0); this.userField = new UserInvolvedProjectsMemberListSelect(getProjectIds()); initListSelectStyle(this.userField); selectionLayout.addComponent(this.userField, 7, 0, 7, 1); final Button queryBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SUBMIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { fromDate = fromDateField.getValue(); toDate = toDateField.getValue(); searchCriteria.setRangeDate(new RangeDateSearchField(fromDate, toDate)); searchTimeReporting(); } }); queryBtn.setStyleName(UIConstants.THEME_GREEN_LINK); selectionLayout.addComponent(queryBtn, 8, 0); loggingPanel.setWidth("100%"); loggingPanel.setHeight("80px"); loggingPanel.setSpacing(true); totalHoursLoggingLabel = new Label("Total Hours Logging: 0 Hrs", ContentMode.HTML); totalHoursLoggingLabel.addStyleName(UIConstants.LAYOUT_LOG); totalHoursLoggingLabel.addStyleName(UIConstants.TEXT_LOG_DATE_FULL); loggingPanel.addComponent(totalHoursLoggingLabel); loggingPanel.setExpandRatio(totalHoursLoggingLabel, 1.0f); loggingPanel.setComponentAlignment(totalHoursLoggingLabel, Alignment.MIDDLE_LEFT); Button exportBtn = new Button("Export", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { exportButtonControl.setPopupVisible(true); } }); exportButtonControl = new SplitButton(exportBtn); exportButtonControl.setWidthUndefined(); exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); Button exportPdfBtn = new Button("Pdf"); FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF)); pdfDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button("Excel"); FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL)); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); controlBtns.addComponent(exportButtonControl); controlBtns.setComponentAlignment(exportButtonControl, Alignment.TOP_RIGHT); controlBtns.setComponentAlignment(backBtn, Alignment.TOP_LEFT); controlBtns.setSizeFull(); this.timeTrackingWrapper = new VerticalLayout(); this.timeTrackingWrapper.setWidth("100%"); contentWrapper.addComponent(this.timeTrackingWrapper); Calendar date = new GregorianCalendar(); date.set(Calendar.DAY_OF_MONTH, 1); fromDate = date.getTime(); date.add(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH)); toDate = date.getTime(); fromDateField.setValue(fromDate); toDateField.setValue(toDate); searchCriteria = new ItemTimeLoggingSearchCriteria(); searchCriteria.setRangeDate(new RangeDateSearchField(fromDate, toDate)); } else { final Button backBtn = new Button("Back to Workboard"); backBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(TimeTrackingSummaryViewImpl.this, null)); } }); backBtn.addStyleName(UIConstants.THEME_GREEN_LINK); backBtn.setIcon(FontAwesome.ARROW_LEFT); VerticalLayout contentWrapper = new VerticalLayout(); contentWrapper.setSpacing(true); Label infoLbl = new Label("You are not involved in any project yet to track time working"); infoLbl.setWidthUndefined(); contentWrapper.setMargin(true); contentWrapper.addComponent(infoLbl); contentWrapper.setComponentAlignment(infoLbl, Alignment.MIDDLE_CENTER); contentWrapper.addComponent(backBtn); contentWrapper.setComponentAlignment(backBtn, Alignment.MIDDLE_CENTER); this.addComponent(contentWrapper); this.setComponentAlignment(contentWrapper, Alignment.MIDDLE_CENTER); } }