@Override public void init(TaskDetailsPresenter presenter) { this.presenter = presenter; // Commented out until we add the posibility of adding sub tasks // for (String strategy : subTaskStrategies) { // subTaskStrategyListBox.addItem(strategy); // // } for (int i = 0; i < priorities.length; i++) { final Option option = new Option(); option.setText(priorities[i]); option.setValue(String.valueOf(i)); taskPriorityListBox.add(option); } taskPriorityListBox.refresh(); taskStatusLabel.setText(constants.Status()); userLabel.setText(constants.User()); dueDateLabel.setText(constants.Due_On()); taskPriorityLabel.setText(constants.Priority()); taskDescriptionLabel.setText(constants.Description()); updateTaskButton.setText(constants.Update()); dueDate.getDateBox().setContainer(this); }
@Override public void init(TaskCommentsPresenter presenter) { this.presenter = presenter; listContainer.add(commentsListGrid); listContainer.add(pager); commentsAccordionLabel.add(new HTMLPanel(constants.Add_Comment())); commentsListGrid.setHeight("350px"); commentsListGrid.setEmptyTableWidget(new HTMLPanel(constants.No_Comments_For_This_Task())); // Attach a column sort handler to the ListDataProvider to sort the list. sortHandler = new ListHandler<CommentSummary>(presenter.getDataProvider().getList()); commentsListGrid.addColumnSortHandler(sortHandler); initTableColumns(); presenter.addDataDisplay(commentsListGrid); // Create a Pager to control the table. pager.setDisplay(commentsListGrid); pager.setPageSize(COMMENTS_PER_PAGE); adjustDisplayForListOfSize(1); newTaskCommentTextArea.setWidth("300px"); addCommentButton.setText(constants.Add_Comment()); newTaskCommentLabel.setText(constants.Comment()); }
@WorkbenchPartTitle public String getTitle() { return constants.New_Task(); }
@WorkbenchPartTitle public String getTitle() { return constants.Tasks_List(); }
@Override public void getData(final Range visibleRange) { try { if (!isAddingDefaultFilters()) { FilterSettings currentTableSettings = dataSetQueryHelper.getCurrentTableSettings(); if (currentTableSettings != null) { currentTableSettings.setServerTemplateId(selectedServerTemplate); currentTableSettings.setTablePageSize(view.getListGrid().getPageSize()); ColumnSortList columnSortList = view.getListGrid().getColumnSortList(); if (columnSortList != null && columnSortList.size() > 0) { dataSetQueryHelper.setLastOrderedColumn( columnSortList.size() > 0 ? columnSortList.get(0).getColumn().getDataStoreName() : ""); dataSetQueryHelper.setLastSortOrder( (columnSortList.size() > 0) && columnSortList.get(0).isAscending() ? SortOrder.ASCENDING : SortOrder.DESCENDING); } else { dataSetQueryHelper.setLastOrderedColumn(COLUMN_CREATED_ON); dataSetQueryHelper.setLastSortOrder(SortOrder.ASCENDING); } final List<ColumnFilter> filters = getColumnFilters(textSearchStr); if (filters.isEmpty() == false) { if (currentTableSettings.getDataSetLookup().getFirstFilterOp() != null) { currentTableSettings .getDataSetLookup() .getFirstFilterOp() .addFilterColumn(OR(filters)); } else { final DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(OR(filters)); currentTableSettings.getDataSetLookup().addOperation(filter); } } boolean isAdminDataset = currentTableSettings .getDataSetLookup() .getDataSetUUID() .equals(HUMAN_TASKS_WITH_ADMIN_DATASET); if (isAdminDataset || currentTableSettings .getDataSetLookup() .getDataSetUUID() .equals(HUMAN_TASKS_WITH_USER_DATASET)) { if (currentTableSettings.getDataSetLookup().getFirstFilterOp() != null) { currentTableSettings .getDataSetLookup() .getFirstFilterOp() .addFilterColumn(getUserGroupFilters(isAdminDataset)); } else { final DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(getUserGroupFilters(isAdminDataset)); currentTableSettings.getDataSetLookup().addOperation(filter); } } dataSetQueryHelper.setDataSetHandler(currentTableSettings); dataSetQueryHelper.lookupDataSet( visibleRange.getStart(), createDataSetTaskCallback(visibleRange.getStart(), currentTableSettings)); } else { taskService .call( new RemoteCallback<List<TaskSummary>>() { @Override public void callback(List<TaskSummary> taskSummaries) { boolean lastPage = false; if (taskSummaries.size() < visibleRange.getLength()) { lastPage = true; } updateDataOnCallback( taskSummaries, visibleRange.getStart(), visibleRange.getStart() + taskSummaries.size(), lastPage); } }) .getActiveTasks( selectedServerTemplate, visibleRange.getStart() / visibleRange.getLength(), visibleRange.getLength()); } } } catch (Exception e) { errorPopup.showMessage(constants.UnexpectedError(e.getMessage())); } }
private void initTableColumns() { // addedBy Column<CommentSummary, String> addedByColumn = new Column<CommentSummary, String>(new TextCell()) { @Override public String getValue(CommentSummary c) { // for some reason the username comes in format [User:'******'], so parse just the // <name> int first = c.getAddedBy().indexOf('\''); int last = c.getAddedBy().lastIndexOf('\''); return c.getAddedBy().substring(first + 1, last); } }; addedByColumn.setSortable(false); commentsListGrid.addColumn(addedByColumn, constants.Added_By()); commentsListGrid.setColumnWidth(addedByColumn, "100px"); // date Column<CommentSummary, String> addedAtColumn = new Column<CommentSummary, String>(new TextCell()) { @Override public String getValue(CommentSummary c) { DateTimeFormat format = DateTimeFormat.getFormat("dd/MM/yyyy HH:mm"); return format.format(c.getAddedAt()); } }; addedAtColumn.setSortable(true); addedAtColumn.setDefaultSortAscending(true); commentsListGrid.addColumn(addedAtColumn, constants.At()); sortHandler.setComparator( addedAtColumn, new Comparator<CommentSummary>() { @Override public int compare(CommentSummary o1, CommentSummary o2) { return o1.getAddedAt().compareTo(o2.getAddedAt()); } }); // comment text Column<CommentSummary, String> commentTextColumn = new Column<CommentSummary, String>(new TextCell()) { @Override public String getValue(CommentSummary object) { return object.getText(); } }; addedByColumn.setSortable(false); commentsListGrid.addColumn(commentTextColumn, constants.Comment()); List<HasCell<CommentSummary, ?>> cells = new LinkedList<HasCell<CommentSummary, ?>>(); cells.add( new DeleteCommentActionHasCell( constants.Delete(), new Delegate<CommentSummary>() { @Override public void execute(CommentSummary comment) { presenter.removeTaskComment(comment.getId()); } })); CompositeCell<CommentSummary> cell = new CompositeCell<CommentSummary>(cells); Column<CommentSummary, CommentSummary> actionsColumn = new Column<CommentSummary, CommentSummary>(cell) { @Override public CommentSummary getValue(CommentSummary object) { return object; } }; commentsListGrid.addColumn(actionsColumn, ""); }