3131import javax .enterprise .event .Event ;
3232import javax .inject .Inject ;
3333
34- import com .github .gwtbootstrap .client .ui .Label ;
3534import com .github .gwtbootstrap .client .ui .NavLink ;
3635import com .github .gwtbootstrap .client .ui .TextBox ;
3736import com .github .gwtbootstrap .client .ui .base .IconAnchor ;
4443import com .google .gwt .event .logical .shared .ValueChangeHandler ;
4544import com .google .gwt .resources .client .ImageResource ;
4645import com .google .gwt .safehtml .shared .SafeHtmlBuilder ;
47- import com .google .gwt .safehtml .shared .SafeHtmlUtils ;
4846import com .google .gwt .user .cellview .client .Column ;
4947import com .google .gwt .user .cellview .client .ColumnSortEvent ;
5048import com .google .gwt .user .cellview .client .ColumnSortEvent .ListHandler ;
5149import com .google .gwt .user .client .ui .AbstractImagePrototype ;
5250import com .google .gwt .user .client .ui .Composite ;
5351import com .google .gwt .user .client .ui .FlowPanel ;
52+ import com .google .gwt .user .client .ui .HTMLPanel ;
5453import com .google .gwt .view .client .DefaultSelectionEventManager ;
5554import com .google .gwt .view .client .MultiSelectionModel ;
5655import com .google .gwt .view .client .SelectionChangeEvent ;
@@ -135,7 +134,7 @@ public class TasksListViewImpl extends Composite implements TasksListPresenter.T
135134
136135
137136 @ DataField
138- public Heading taskCalendarViewLabel = new Heading (4 );
137+ public Heading taskListViewLabel = new Heading (4 );
139138
140139 @ Inject
141140 @ DataField
@@ -161,7 +160,6 @@ public class TasksListViewImpl extends Composite implements TasksListPresenter.T
161160 private Event <TaskSelectionEvent > taskSelection ;
162161
163162 @ Inject
164- @ DataField
165163 public IconAnchor refreshIcon ;
166164
167165 private Set <TaskSummary > selectedTasks ;
@@ -172,9 +170,6 @@ public class TasksListViewImpl extends Composite implements TasksListPresenter.T
172170 public DataGrid <TaskSummary > myTaskListGrid ;
173171
174172 public SimplePager pager ;
175-
176-
177-
178173
179174 @ Override
180175 public void init ( final TasksListPresenter presenter ) {
@@ -338,10 +333,13 @@ public void onClick( ClickEvent event ) {
338333
339334 }
340335 } );
341-
342- taskCalendarViewLabel .setText ( constants .Tasks_List () );
343- taskCalendarViewLabel .setStyleName ( "" );
344-
336+ //taskListViewLabel.setText( constants.Tasks_List() );
337+ HTMLPanel span2 = new HTMLPanel (constants .Tasks_List ());
338+ span2 .setStyleName ("span2" );
339+ taskListViewLabel .add (span2 );
340+ refreshIcon .setCustomIconStyle ("icon-jbpm-refresh" );
341+ taskListViewLabel .add (refreshIcon );
342+
345343 searchBox .addKeyUpHandler (new KeyUpHandler () {
346344
347345 @ Override
@@ -380,14 +378,14 @@ private void initializeGridView() {
380378 tasksViewContainer .add (myTaskListGrid );
381379 tasksViewContainer .add (pager );
382380
383- myTaskListGrid .setHeight ("350px " );
381+ myTaskListGrid .setHeight ("400px " );
384382 // Set the message to display when the table is empty.
385- myTaskListGrid .setEmptyTableWidget (new Label (constants .No_Tasks_Found ()));
383+ myTaskListGrid .setEmptyTableWidget (new HTMLPanel (constants .No_Tasks_Found ()));
386384
387385 // Attach a column sort handler to the ListDataProvider to sort the list.
388- sortHandler = new ColumnSortEvent .ListHandler <TaskSummary >(presenter .getAllTaskSummaries ());
386+ sortHandler = new ColumnSortEvent .ListHandler <TaskSummary >(presenter .getDataProvider (). getList ());
389387
390- myTaskListGrid . addColumnSortHandler ( sortHandler );
388+
391389
392390 // Add a selection model so we can select cells.
393391 selectionModel = new MultiSelectionModel <TaskSummary >();
@@ -404,6 +402,8 @@ public void onSelectionChange(SelectionChangeEvent event) {
404402 myTaskListGrid .setSelectionModel (selectionModel , DefaultSelectionEventManager .<TaskSummary > createCheckboxManager ());
405403
406404 initTableColumns (selectionModel );
405+
406+ myTaskListGrid .addColumnSortHandler (sortHandler );
407407 presenter .addDataDisplay (myTaskListGrid );
408408
409409 }
@@ -449,7 +449,7 @@ public Boolean getValue(TaskSummary object) {
449449 return selectionModel .isSelected (object );
450450 }
451451 };
452- myTaskListGrid .addColumn (checkColumn , SafeHtmlUtils . fromSafeConstant ( "<br/>" ));
452+ myTaskListGrid .addColumn (checkColumn , new ResizableHeader ( "" , myTaskListGrid , checkColumn ));
453453 myTaskListGrid .setColumnWidth (checkColumn , "40px" );
454454
455455 // Id
@@ -460,7 +460,7 @@ public Number getValue(TaskSummary object) {
460460 }
461461 };
462462 taskIdColumn .setSortable (true );
463- myTaskListGrid .setColumnWidth (taskIdColumn , "40px " );
463+ myTaskListGrid .setColumnWidth (taskIdColumn , "50px " );
464464
465465 myTaskListGrid .addColumn (taskIdColumn , new ResizableHeader (constants .Id (), myTaskListGrid , taskIdColumn ));
466466 sortHandler .setComparator (taskIdColumn , new Comparator <TaskSummary >() {
@@ -548,24 +548,6 @@ public int compare(TaskSummary o1, TaskSummary o2) {
548548
549549
550550 List <HasCell <TaskSummary , ?>> cells = new LinkedList <HasCell <TaskSummary , ?>>();
551- cells .add (new StartActionHasCell ("Start" , new ActionCell .Delegate <TaskSummary >() {
552- @ Override
553- public void execute (TaskSummary task ) {
554- List <Long > tasks = new ArrayList <Long >(1 );
555- tasks .add (task .getId ());
556- presenter .startTasks (tasks , identity .getName ());
557- }
558- }));
559-
560- cells .add (new CompleteActionHasCell ("Complete" , new ActionCell .Delegate <TaskSummary >() {
561- @ Override
562- public void execute (TaskSummary task ) {
563- List <Long > tasks = new ArrayList <Long >(1 );
564- tasks .add (task .getId ());
565- presenter .completeTasks (tasks , identity .getName ());
566- }
567- }));
568-
569551 cells .add (new ClaimActionHasCell ("Claim" , new ActionCell .Delegate <TaskSummary >() {
570552 @ Override
571553 public void execute (TaskSummary task ) {
@@ -584,16 +566,25 @@ public void execute(TaskSummary task) {
584566 }
585567 }));
586568
587- cells .add (new DetailsHasCell ("Edit " , new ActionCell .Delegate <TaskSummary >() {
569+ cells .add (new DetailsHasCell ("Details " , new ActionCell .Delegate <TaskSummary >() {
588570 @ Override
589571 public void execute (TaskSummary task ) {
590572 PlaceRequest placeRequestImpl = new DefaultPlaceRequest ("Task Details Popup" );
591573 placeRequestImpl .addParameter ("taskId" , Long .toString (task .getId ()));
592574 placeManager .goTo (placeRequestImpl );
593575 }
594576 }));
595-
596- cells .add (new PopupActionHasCell ("Work Popup" , new ActionCell .Delegate <TaskSummary >() {
577+
578+ cells .add (new StartActionHasCell ("Start" , new ActionCell .Delegate <TaskSummary >() {
579+ @ Override
580+ public void execute (TaskSummary task ) {
581+ List <Long > tasks = new ArrayList <Long >(1 );
582+ tasks .add (task .getId ());
583+ presenter .startTasks (tasks , identity .getName ());
584+ }
585+ }));
586+
587+ cells .add (new CompleteActionHasCell ("Complete" , new ActionCell .Delegate <TaskSummary >() {
597588 @ Override
598589 public void execute (TaskSummary task ) {
599590 PlaceRequest placeRequestImpl = new DefaultPlaceRequest ("Form Display" );
@@ -610,7 +601,9 @@ public TaskSummary getValue(TaskSummary object) {
610601 return object ;
611602 }
612603 };
613- myTaskListGrid .addColumn (actionsColumn , constants .Actions ());
604+ myTaskListGrid .addColumn (actionsColumn , new ResizableHeader (constants .Actions (), myTaskListGrid , actionsColumn ));
605+ myTaskListGrid .setColumnWidth (actionsColumn , "120px" );
606+
614607
615608 }
616609
@@ -662,7 +655,7 @@ public void render(Cell.Context context, TaskSummary value, SafeHtmlBuilder sb)
662655 if (value .getActualOwner () != null && (value .getStatus ().equals ("Reserved" ))) {
663656 AbstractImagePrototype imageProto = AbstractImagePrototype .create (images .startGridIcon ());
664657 SafeHtmlBuilder mysb = new SafeHtmlBuilder ();
665- mysb .appendHtmlConstant ("<span title='" + constants .Start () + "'>" );
658+ mysb .appendHtmlConstant ("<span title='" + constants .Start () + "' style='margin-right:5px;' >" );
666659 mysb .append (imageProto .getSafeHtml ());
667660 mysb .appendHtmlConstant ("</span>" );
668661 sb .append (mysb .toSafeHtml ());
@@ -698,7 +691,7 @@ public void render(Cell.Context context, TaskSummary value, SafeHtmlBuilder sb)
698691 if (value .getActualOwner () != null && value .getStatus ().equals ("InProgress" )) {
699692 AbstractImagePrototype imageProto = AbstractImagePrototype .create (images .completeGridIcon ());
700693 SafeHtmlBuilder mysb = new SafeHtmlBuilder ();
701- mysb .appendHtmlConstant ("<span title='" + constants .Complete () + "'>" );
694+ mysb .appendHtmlConstant ("<span title='" + constants .Complete () + "' style='margin-right:5px;' >" );
702695 mysb .append (imageProto .getSafeHtml ());
703696 mysb .appendHtmlConstant ("</span>" );
704697 sb .append (mysb .toSafeHtml ());
@@ -723,42 +716,7 @@ public TaskSummary getValue(TaskSummary object) {
723716 }
724717 }
725718
726- private class PopupActionHasCell implements HasCell <TaskSummary , TaskSummary > {
727-
728- private ActionCell <TaskSummary > cell ;
729-
730- public PopupActionHasCell (String text , ActionCell .Delegate <TaskSummary > delegate ) {
731- cell = new ActionCell <TaskSummary >(text , delegate ) {
732- @ Override
733- public void render (Cell .Context context , TaskSummary value , SafeHtmlBuilder sb ) {
734- if (value .getActualOwner () != null
735- && (value .getStatus ().equals ("Reserved" ) || value .getStatus ().equals ("InProgress" ))) {
736- AbstractImagePrototype imageProto = AbstractImagePrototype .create (images .popupIcon ());
737- SafeHtmlBuilder mysb = new SafeHtmlBuilder ();
738- mysb .appendHtmlConstant ("<span title='" + constants .Work () + "'>" );
739- mysb .append (imageProto .getSafeHtml ());
740- mysb .appendHtmlConstant ("</span>" );
741- sb .append (mysb .toSafeHtml ());
742- }
743- }
744- };
745- }
746-
747- @ Override
748- public Cell <TaskSummary > getCell () {
749- return cell ;
750- }
751-
752- @ Override
753- public FieldUpdater <TaskSummary , TaskSummary > getFieldUpdater () {
754- return null ;
755- }
756-
757- @ Override
758- public TaskSummary getValue (TaskSummary object ) {
759- return object ;
760- }
761- }
719+
762720
763721 private class ClaimActionHasCell implements HasCell <TaskSummary , TaskSummary > {
764722
@@ -772,7 +730,7 @@ public void render(Cell.Context context, TaskSummary value, SafeHtmlBuilder sb)
772730 && value .getStatus ().equals ("Ready" )) {
773731 AbstractImagePrototype imageProto = AbstractImagePrototype .create (images .releaseGridIcon ());
774732 SafeHtmlBuilder mysb = new SafeHtmlBuilder ();
775- mysb .appendHtmlConstant ("<span title='" + constants .Claim () + "'>" );
733+ mysb .appendHtmlConstant ("<span title='" + constants .Claim () + "' style='margin-right:5px;' >" );
776734 mysb .append (imageProto .getSafeHtml ());
777735 mysb .appendHtmlConstant ("</span>" );
778736 sb .append (mysb .toSafeHtml ());
@@ -809,7 +767,7 @@ public void render(Cell.Context context, TaskSummary value, SafeHtmlBuilder sb)
809767 && ( value .getStatus ().equals ( "Reserved" ) || value .getStatus ().equals ( "InProgress" ) )) {
810768 AbstractImagePrototype imageProto = AbstractImagePrototype .create (images .claimGridIcon ());
811769 SafeHtmlBuilder mysb = new SafeHtmlBuilder ();
812- mysb .appendHtmlConstant ("<span title='" + constants .Release () + "'>" );
770+ mysb .appendHtmlConstant ("<span title='" + constants .Release () + "' style='margin-right:5px;' >" );
813771 mysb .append (imageProto .getSafeHtml ());
814772 mysb .appendHtmlConstant ("</span>" );
815773 sb .append (mysb .toSafeHtml ());
0 commit comments