From e2a076f459650be184564d5692bacc1a68364696 Mon Sep 17 00:00:00 2001 From: salaboy Date: Fri, 20 Sep 2013 14:43:33 +0100 Subject: [PATCH] - reverting fix path commit - BZ-1009915: improving comments screen - BZ-1009911: checking for empty comments --- .../TaskAssignmentsViewImpl.java | 4 +- .../taskcomments/TaskCommentsPresenter.java | 13 +++ .../taskcomments/TaskCommentsViewImpl.java | 90 +++++++++++++++++- .../console/ng/ht/client/i18n/Constants.java | 2 + .../ht/client/resources/HumanTasksImages.java | 3 + .../ng/ht/client/i18n/Constants.properties | 1 + .../ht/client/i18n/Constants_es_AR.properties | 1 + .../public/images/icons/abort-grid-icon.png | Bin 0 -> 1353 bytes .../console/ng/pr/model/DummyProcessPath.java | 4 - 9 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/public/images/icons/abort-grid-icon.png diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskassignments/TaskAssignmentsViewImpl.java b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskassignments/TaskAssignmentsViewImpl.java index b8edecaba0..e43762a686 100644 --- a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskassignments/TaskAssignmentsViewImpl.java +++ b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskassignments/TaskAssignmentsViewImpl.java @@ -68,9 +68,7 @@ public class TaskAssignmentsViewImpl extends Composite implements TaskAssignment @Inject @DataField public Label usersGroupsControlsPanel; - - - + @Inject private Event notification; diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsPresenter.java b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsPresenter.java index 8368a17119..31893d3a75 100644 --- a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsPresenter.java +++ b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsPresenter.java @@ -61,6 +61,8 @@ public interface TaskCommentsView extends UberView { DataGrid getDataGrid(); SimplePager getPager(); + + void displayNotification( String text ); } @Inject @@ -141,6 +143,17 @@ public void callback( Long response ) { } } ).addComment( currentTaskId, text, identity.getName(), addedOn ); } + + public void removeTaskComment( long commentId ) { + taskServices.call( new RemoteCallback() { + @Override + public void callback( Long response ) { + refreshComments( ); + view.getNewTaskCommentTextArea().setText(""); + view.displayNotification("Comment Deleted!"); + } + } ).deleteComment( currentTaskId, commentId ); + } public void addDataDisplay( HasData display ) { dataProvider.addDataDisplay( display ); diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsViewImpl.java b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsViewImpl.java index 644ddd99df..ffa70381a0 100644 --- a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsViewImpl.java +++ b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskcomments/TaskCommentsViewImpl.java @@ -33,22 +33,37 @@ import com.github.gwtbootstrap.client.ui.Label; import com.github.gwtbootstrap.client.ui.SimplePager; import com.github.gwtbootstrap.client.ui.TextArea; -import com.github.gwtbootstrap.client.ui.base.UnorderedList; +import com.google.gwt.cell.client.ActionCell; +import com.google.gwt.cell.client.ActionCell.Delegate; +import com.google.gwt.cell.client.Cell; +import com.google.gwt.cell.client.CompositeCell; +import com.google.gwt.cell.client.FieldUpdater; +import com.google.gwt.cell.client.HasCell; import com.google.gwt.cell.client.TextCell; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler; +import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTMLPanel; +import java.util.LinkedList; +import java.util.List; +import javax.enterprise.event.Event; import org.jbpm.console.ng.ht.client.i18n.Constants; +import org.jbpm.console.ng.ht.client.resources.HumanTasksImages; +import org.jbpm.console.ng.ht.client.util.ResizableHeader; +import org.jbpm.console.ng.pr.model.ProcessInstanceSummary; +import org.uberfire.workbench.events.NotificationEvent; @Dependent @Templated(value = "TaskCommentsViewImpl.html") public class TaskCommentsViewImpl extends Composite implements TaskCommentsPresenter.TaskCommentsView { private Constants constants = GWT.create(Constants.class); + private HumanTasksImages images = GWT.create( HumanTasksImages.class ); private TaskCommentsPresenter presenter; @@ -84,6 +99,8 @@ public class TaskCommentsViewImpl extends Composite implements TaskCommentsPrese private ListHandler sortHandler; + @Inject + private Event notification; @Override public TextArea getNewTaskCommentTextArea() { @@ -131,7 +148,16 @@ public void init(TaskCommentsPresenter presenter) { @EventHandler("addCommentButton") public void addCommentButton(ClickEvent e) { - presenter.addTaskComment(newTaskCommentTextArea.getText(), new Date()); + if(!newTaskCommentTextArea.getText().equals("")){ + presenter.addTaskComment(newTaskCommentTextArea.getText(), new Date()); + }else{ + displayNotification("The Comment cannot be empty!"); + } + } + + @Override + public void displayNotification( String text ) { + notification.fire( new NotificationEvent( text ) ); } private void initTableColumns() { @@ -176,5 +202,65 @@ public String getValue(CommentSummary object) { }; addedByColumn.setSortable(false); commentsListGrid.addColumn(commentTextColumn, constants.Comment()); + + List> cells = new LinkedList>(); + + cells.add( new DeleteCommentActionHasCell( "Delete", new Delegate() { + @Override + public void execute( CommentSummary comment ) { + + presenter.removeTaskComment(comment.getId()); + } + } ) ); + + CompositeCell cell = new CompositeCell( cells ); + Column actionsColumn = new Column( + cell ) { + @Override + public CommentSummary getValue( CommentSummary object ) { + return object; + } + }; + commentsListGrid.addColumn( actionsColumn, new ResizableHeader( "", commentsListGrid, + actionsColumn ) ); + } + + private class DeleteCommentActionHasCell implements HasCell { + + private ActionCell cell; + + public DeleteCommentActionHasCell( String text, + Delegate delegate ) { + cell = new ActionCell( text, delegate ) { + @Override + public void render( Cell.Context context, + CommentSummary value, + SafeHtmlBuilder sb ) { + + AbstractImagePrototype imageProto = AbstractImagePrototype.create( images.abortGridIcon() ); + SafeHtmlBuilder mysb = new SafeHtmlBuilder(); + mysb.appendHtmlConstant( ""); + mysb.append( imageProto.getSafeHtml() ); + mysb.appendHtmlConstant( "" ); + sb.append( mysb.toSafeHtml() ); + + } + }; + } + + @Override + public Cell getCell() { + return cell; + } + + @Override + public FieldUpdater getFieldUpdater() { + return null; + } + + @Override + public CommentSummary getValue( CommentSummary object ) { + return object; + } } } diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/i18n/Constants.java b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/i18n/Constants.java index 4cb8d81cd9..51e171aa27 100644 --- a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/i18n/Constants.java +++ b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/i18n/Constants.java @@ -160,4 +160,6 @@ public interface Constants extends Messages { String Parent_Group(); String Save(); + + String Delete(); } diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/resources/HumanTasksImages.java b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/resources/HumanTasksImages.java index 59ecff3a0d..36b53093d2 100644 --- a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/resources/HumanTasksImages.java +++ b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/resources/HumanTasksImages.java @@ -24,6 +24,9 @@ public interface HumanTasksImages extends ClientBundle { HumanTasksImages INSTANCE = GWT.create(HumanTasksImages.class); + @Source("org/jbpm/console/ng/ht/public/images/icons/abort-grid-icon.png") + public ImageResource abortGridIcon(); + @Source("org/jbpm/console/ng/ht/public/images/icons/complete-grid-icon.png") public ImageResource completeGridIcon(); diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants.properties b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants.properties index ae809fd649..89a397d3ec 100644 --- a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants.properties +++ b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants.properties @@ -63,3 +63,4 @@ Add_TypeRole=Add Type Role Type_Role=Type Role Parent_Group=Parent Group Save=Save +Delete=Delete diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants_es_AR.properties b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants_es_AR.properties index 7c23de23e3..4ba0db5de9 100644 --- a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants_es_AR.properties +++ b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/client/i18n/Constants_es_AR.properties @@ -63,3 +63,4 @@ Add_TypeRole=Agregar tipo de rol Type_Role=Tipo de rol Parent_Group=Grupo Padre Save=Guardar +Delete=Borrar diff --git a/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/public/images/icons/abort-grid-icon.png b/jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/resources/org/jbpm/console/ng/ht/public/images/icons/abort-grid-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8e62555ac6a479b79ae921eee950b4eff0936d4e GIT binary patch literal 1353 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`Gjk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m{l@EB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvO-#a&$DaFmZKu zGjuV7>2=9ZF3nBND}m`vLFhHasTY(OatnYqyQCInmZhe+73JqDfIV%MiPJ4ct~kwu z>P^Av79%&Ddi8;h(Fa8>QdGl)fawRsgeP1e2cGm(^ML8S2$--BTYcTez`(fM)5S5Q z;?|p~=d}+f${eqK{-8nnl>7$fiQNL%wj7?bW~J{UkDxc}Vq#*R@L%8(H#eObrq{Km zXIqR(VZ=@?dp;Mwj5z<=u-7-g-`r>YM(KXl*LAk@&;R~gGvD_7=dGW9*2L<{zs_fk zm=+pz;qGnomL6yEEeDnFIM`HA^?dpDS4%IWM7e^sK}1@U_y&gyxuJ|ReotUAITaw) z_fRtG0RLa3Z>*DBWGuKQ%uHXv`7UwVv*OuHKP$Lj;IV(D{_5QqhUsUs-H+O^GqV+c zT@{@4kN4}P@J~CoxaltnxXh9KFD2qPZ^RVU*%PYPf0{ejEw z)uUB$ZO&7f+PE3nK8vP^-b)bqye91ZN|6hCvo;&{E4==|$#~|n>tV~a``^sZG5=hd z61?q+#52$3>XG~v0;S?J{gtDWGy=(>ZrG+cRO>gKiReJCj0aMi}Sz#;WA+8E3t2pu)}5)z4*}Q$iB}QCatF literal 0 HcmV?d00001 diff --git a/jbpm-console-ng-process-runtime/jbpm-console-ng-process-runtime-api/src/main/java/org/jbpm/console/ng/pr/model/DummyProcessPath.java b/jbpm-console-ng-process-runtime/jbpm-console-ng-process-runtime-api/src/main/java/org/jbpm/console/ng/pr/model/DummyProcessPath.java index aef2c85c3b..e56e499f22 100644 --- a/jbpm-console-ng-process-runtime/jbpm-console-ng-process-runtime-api/src/main/java/org/jbpm/console/ng/pr/model/DummyProcessPath.java +++ b/jbpm-console-ng-process-runtime/jbpm-console-ng-process-runtime-api/src/main/java/org/jbpm/console/ng/pr/model/DummyProcessPath.java @@ -43,10 +43,6 @@ public String getFileName() { return fileName + ".bpmn2"; } - @Override - public String getFileNameWithoutExtension() { - return fileName; - } @Override public String toURI() {