List of usage examples for com.vaadin.ui HorizontalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneBugListComp.java
License:Open Source License
private void displayAdvancedView() { if (this.getComponentCount() > 1) { this.removeComponent(this.getComponent(1)); }//from w w w . j a va2s . co m final HorizontalLayout bodyLayout = new HorizontalLayout(); bodyLayout.setSpacing(false); bodyLayout.setWidth("100%"); final VerticalLayout leftColumn = new VerticalLayout(); leftColumn.setMargin(new MarginInfo(false, true, false, false)); bodyLayout.addComponent(leftColumn); bodyLayout.setExpandRatio(leftColumn, 1.0f); final VerticalLayout rightColumn = new VerticalLayout(); bodyLayout.addComponent(rightColumn); final UnresolvedBugsByPriorityWidget unresolvedBugWidget = new UnresolvedBugsByPriorityWidget(this); unresolvedBugWidget.setWidth("100%"); leftColumn.addComponent(unresolvedBugWidget); final BugSearchCriteria unresolvedByPrioritySearchCriteria = new BugSearchCriteria(); unresolvedByPrioritySearchCriteria .setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); unresolvedByPrioritySearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); unresolvedByPrioritySearchCriteria.setStatuses(new SetSearchField<String>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); unresolvedBugWidget.setSearchCriteria(unresolvedByPrioritySearchCriteria); final UnresolvedBugsByAssigneeWidget unresolvedByAssigneeWidget = new UnresolvedBugsByAssigneeWidget(this); unresolvedByAssigneeWidget.setWidth("100%"); leftColumn.addComponent(unresolvedByAssigneeWidget); final BugSearchCriteria unresolvedByAssigneeSearchCriteria = new BugSearchCriteria(); unresolvedByAssigneeSearchCriteria .setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); unresolvedByAssigneeSearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); unresolvedByAssigneeSearchCriteria.setStatuses(new SetSearchField<String>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); unresolvedByAssigneeWidget.setSearchCriteria(unresolvedByAssigneeSearchCriteria); final BugSearchCriteria chartSearchCriteria = new BugSearchCriteria(); chartSearchCriteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); chartSearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); BugChartComponent bugChartComponent = null; bugChartComponent = new BugChartComponent(chartSearchCriteria, 400, 200); rightColumn.addComponent(bugChartComponent); rightColumn.setWidth("400px"); this.addComponent(bodyLayout); }
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); 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();/* w ww . ja v a 2s. c om*/ 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.GanttChartTaskContainer.java
License:Open Source License
private Panel createControls() { Panel panel = new Panel(); panel.setWidth(100, Unit.PERCENTAGE); HorizontalLayout controls = new HorizontalLayout(); controls.setSpacing(true); controls.setMargin(true);//ww w. ja v a 2 s. c om panel.setContent(controls); start = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE)); start.setValue(gantt.getStartDate()); start.setResolution(Resolution.DAY); start.setImmediate(true); start.addValueChangeListener(startDateValueChangeListener); end = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE)); end.setValue(gantt.getEndDate()); end.setResolution(Resolution.DAY); end.setImmediate(true); end.addValueChangeListener(endDateValueChangeListener); reso = new NativeSelect("Resolution"); reso.setNullSelectionAllowed(false); reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour); reso.addItem(org.tltv.gantt.client.shared.Resolution.Day); reso.addItem(org.tltv.gantt.client.shared.Resolution.Week); reso.setValue(gantt.getResolution()); reso.setImmediate(true); reso.addValueChangeListener(resolutionValueChangeListener); controls.addComponent(start); controls.addComponent(end); controls.addComponent(reso); panel.setStyleName(UIConstants.THEME_NO_BORDER); return panel; }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupNoItemView.java
License:Open Source License
public TaskGroupNoItemView() { this.setMargin(new MarginInfo(true, false, false, false)); VerticalLayout layout = new VerticalLayout(); layout.addStyleName("taskgroup-noitem"); layout.setSpacing(true);/*from ww w. java 2 s .c om*/ layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); layout.setMargin(true); Image image = new Image(null, MyCollabResource.newResource("icons/48/project/tasklist.png")); layout.addComponent(image); Label title = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_TITLE)); title.addStyleName("h2"); title.setWidthUndefined(); layout.addComponent(title); Label body = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_HINT)); body.setWidthUndefined(); layout.addComponent(body); Button createTaskGroupBtn = 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(null); UI.getCurrent().addWindow(taskListWindow); } }); createTaskGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); HorizontalLayout links = new HorizontalLayout(); links.addComponent(createTaskGroupBtn); createTaskGroupBtn.addStyleName(UIConstants.THEME_GREEN_LINK); links.setSpacing(true); layout.addComponent(links); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.TOP_CENTER); }
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); header.setWidth("100%"); Label headerLbl = new Label("All Tasks"); headerLbl.setStyleName("h2"); header.addComponent(headerLbl);/*ww w. j av a 2 s.com*/ 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.UnresolvedTaskByAssigneeWidget.java
License:Open Source License
public void setSearchCriteria(final TaskSearchCriteria searchCriteria) { this.searchCriteria = searchCriteria; this.bodyContent.removeAllComponents(); ProjectTaskService projectTaskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); int totalCountItems = projectTaskService.getTotalCount(searchCriteria); final List<GroupItem> groupItems = projectTaskService.getAssignedDefectsSummary(searchCriteria); if (!groupItems.isEmpty()) { for (final GroupItem item : groupItems) { final HorizontalLayout assigneeLayout = new HorizontalLayout(); assigneeLayout.setSpacing(true); assigneeLayout.setWidth("100%"); final String assignUser = item.getGroupid(); String assignUserFullName = item.getGroupid() == null ? "" : item.getGroupname(); if (assignUserFullName == null || assignUserFullName.trim().equals("")) { String displayName = item.getGroupid(); int index = displayName != null ? displayName.indexOf("@") : 0; if (index > 0) { assignUserFullName = displayName.substring(0, index); } else { assignUserFullName = AppContext.getMessage(TaskI18nEnum.OPT_UNDEFINED_USER); }//from w ww . jav a 2s . c o m } final TaskAssigneeLink userLbl = new TaskAssigneeLink(assignUser, item.getExtraValue(), assignUserFullName); assigneeLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCountItems, totalCountItems - item.getValue(), false); indicator.setWidth("100%"); assigneeLayout.addComponent(indicator); assigneeLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(assigneeLayout); } } }
From source file:com.esofthead.mycollab.module.project.view.task.UnresolvedTaskByPriorityWidget.java
License:Open Source License
public void setSearchCriteria(final TaskSearchCriteria searchCriteria) { this.searchCriteria = searchCriteria; this.bodyContent.removeAllComponents(); final ProjectTaskService taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); final int totalCount = taskService.getTotalCount(searchCriteria); final List<GroupItem> groupItems = taskService.getPrioritySummary(searchCriteria); final TaskPriorityClickListener listener = new TaskPriorityClickListener(); if (!groupItems.isEmpty()) { for (final TaskPriority priority : OptionI18nEnum.task_priorities) { boolean isFound = false; for (final GroupItem item : groupItems) { if (priority.name().equals(item.getGroupid())) { isFound = true;/*from w ww . j av a 2 s . c o m*/ final HorizontalLayout priorityLayout = new HorizontalLayout(); priorityLayout.setSpacing(true); priorityLayout.setWidth("100%"); final ButtonI18nComp userLbl = new ButtonI18nComp(priority.name(), priority, listener); final Resource iconPriority = new ExternalResource( ProjectResources.getIconResourceLink12ByTaskPriority(priority.name())); userLbl.setIcon(iconPriority); userLbl.setWidth("110px"); userLbl.setStyleName("link"); priorityLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount - item.getValue(), false); indicator.setWidth("100%"); priorityLayout.addComponent(indicator); priorityLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(priorityLayout); } } if (!isFound) { final HorizontalLayout priorityLayout = new HorizontalLayout(); priorityLayout.setSpacing(true); priorityLayout.setWidth("100%"); final ButtonI18nComp userLbl = new ButtonI18nComp(priority.name(), priority, listener); final Resource iconPriority = new ExternalResource( ProjectResources.getIconResourceLink12ByTaskPriority(priority.name())); userLbl.setIcon(iconPriority); userLbl.setWidth("110px"); userLbl.setStyleName("link"); priorityLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount, false); indicator.setWidth("100%"); priorityLayout.addComponent(indicator); priorityLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(priorityLayout); } } } }
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 w w w . j a v a 2 s . c o m*/ 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); } }
From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.RoleListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { final CssLayout layoutWrapper = new CssLayout(); layoutWrapper.setWidth("100%"); final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layoutWrapper.addStyleName(UIConstants.TABLE_ACTION_CONTROLS); layoutWrapper.addComponent(layout);/* w ww .jav a 2 s .c o m*/ this.selectOptionButton = new SelectionOptionButton(this.tableItem); layout.addComponent(this.selectOptionButton); final Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE)); deleteBtn.setEnabled(AppContext.canAccess(RolePermissionCollections.ACCOUNT_ROLE)); this.tableActionControls = new DefaultMassItemActionHandlersContainer(); if (AppContext.canAccess(RolePermissionCollections.ACCOUNT_ROLE)) { tableActionControls.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete", AppContext.getMessage(GenericI18Enum.BUTTON_DELETE)); } tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O, "export", "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION, FontAwesome.FILE_EXCEL_O, "export", "export.xlsx", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O, "export", "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV)); layout.addComponent(this.tableActionControls); layout.addComponent(this.selectedItemsNumberLabel); layout.setComponentAlignment(this.selectedItemsNumberLabel, Alignment.MIDDLE_CENTER); return layoutWrapper; }
From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleUser member) { CssLayout memberBlock = new CssLayout(); memberBlock.addStyleName("member-block"); VerticalLayout blockContent = new VerticalLayout(); HorizontalLayout blockTop = new HorizontalLayout(); blockTop.setSpacing(true); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100); blockTop.addComponent(memberAvatar); VerticalLayout memberInfo = new VerticalLayout(); HorizontalLayout layoutButtonDelete = new HorizontalLayout(); layoutButtonDelete.setVisible(AppContext.canWrite(RolePermissionCollections.ACCOUNT_USER)); layoutButtonDelete.setWidth("100%"); Label emptylb = new Label(""); layoutButtonDelete.addComponent(emptylb); layoutButtonDelete.setExpandRatio(emptylb, 1.0f); Button deleteBtn = new Button(); deleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w.j a v a 2s .c o m*/ public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { UserService userService = ApplicationContextUtil .getSpringBean(UserService.class); userService.pendingUserAccounts(Arrays.asList(member.getUsername()), AppContext.getAccountId()); EventBusFactory.getInstance() .post(new UserEvent.GotoList(UserListViewImpl.this, null)); } } }); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); layoutButtonDelete.addComponent(deleteBtn); memberInfo.addComponent(layoutButtonDelete); ButtonLink userAccountLink = new ButtonLink(member.getDisplayName()); userAccountLink.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance() .post(new UserEvent.GotoRead(UserListViewImpl.this, member.getUsername())); } }); userAccountLink.setWidth("100%"); userAccountLink.setHeight("100%"); memberInfo.addComponent(userAccountLink); Label memberEmailLabel = new Label( "<a href='mailto:" + member.getUsername() + "'>" + member.getUsername() + "</a>", ContentMode.HTML); memberEmailLabel.addStyleName("member-email"); memberEmailLabel.setWidth("100%"); memberInfo.addComponent(memberEmailLabel); Label memberSinceLabel = new Label("Member since: " + AppContext.formatDate(member.getRegisteredtime())); memberSinceLabel.addStyleName("member-email"); memberSinceLabel.setWidth("100%"); memberInfo.addComponent(memberSinceLabel); if (RegisterStatusConstants.SENT_VERIFICATION_EMAIL.equals(member.getRegisterstatus())) { final VerticalLayout waitingNotLayout = new VerticalLayout(); Label infoStatus = new Label("Waiting for accept invitation"); infoStatus.addStyleName("member-email"); waitingNotLayout.addComponent(infoStatus); ButtonLink resendInvitationLink = new ButtonLink("Resend Invitation", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { UserService userService = ApplicationContextUtil.getSpringBean(UserService.class); userService.updateUserAccountStatus(member.getUsername(), member.getAccountId(), RegisterStatusConstants.VERIFICATING); waitingNotLayout.removeAllComponents(); Label statusEmail = new Label("Sending invitation email"); statusEmail.addStyleName("member-email"); waitingNotLayout.addComponent(statusEmail); } }); resendInvitationLink.setStyleName("link"); resendInvitationLink.addStyleName("member-email"); waitingNotLayout.addComponent(resendInvitationLink); memberInfo.addComponent(waitingNotLayout); } else if (RegisterStatusConstants.ACTIVE.equals(member.getRegisterstatus())) { Label lastAccessTimeLbl = new Label("Logged in " + DateTimeUtils.getPrettyDateValue(member.getLastaccessedtime(), AppContext.getUserLocale())); lastAccessTimeLbl.addStyleName("member-email"); memberInfo.addComponent(lastAccessTimeLbl); } else if (RegisterStatusConstants.VERIFICATING.equals(member.getRegisterstatus())) { Label infoStatus = new Label("Sending invitation email"); infoStatus.addStyleName("member-email"); memberInfo.addComponent(infoStatus); } blockTop.addComponent(memberInfo); blockTop.setExpandRatio(memberInfo, 1.0f); blockTop.setWidth("100%"); blockContent.addComponent(blockTop); if (member.getRoleid() != null) { String memberRoleLinkPrefix = "<a href=\"" + AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid()) + "\""; Label memberRole = new Label(); memberRole.setContentMode(ContentMode.HTML); if (member.getIsAccountOwner() != null && member.getIsAccountOwner()) { memberRole.setValue(memberRoleLinkPrefix + "style=\"color: #B00000;\">" + "Account Owner" + "</a>"); } else { memberRole.setValue(memberRoleLinkPrefix + "style=\"color:gray;font-size:12px;\">" + member.getRoleName() + "</a>"); } memberRole.setSizeUndefined(); blockContent.addComponent(memberRole); blockContent.setComponentAlignment(memberRole, Alignment.MIDDLE_RIGHT); } else if (member.getIsAccountOwner() != null && member.getIsAccountOwner() == Boolean.TRUE) { Label memberRole = new Label(); memberRole.setContentMode(ContentMode.HTML); memberRole.setValue("<a style=\"color: #B00000;\">" + "Account Owner" + "</a>"); memberRole.setSizeUndefined(); blockContent.addComponent(memberRole); blockContent.setComponentAlignment(memberRole, Alignment.MIDDLE_RIGHT); } else { Label lbl = new Label(); lbl.setHeight("10px"); blockContent.addComponent(lbl); } blockContent.setWidth("100%"); memberBlock.addComponent(blockContent); return memberBlock; }