10
10
import stroom .data .client .presenter .DisplayMode ;
11
11
import stroom .data .grid .client .MyDataGrid ;
12
12
import stroom .data .grid .client .PagerView ;
13
- import stroom .dispatch .client .Rest ;
14
13
import stroom .dispatch .client .RestFactory ;
15
14
import stroom .pipeline .shared .SourceLocation ;
16
15
import stroom .svg .client .SvgPresets ;
16
+ import stroom .util .client .DataGridUtil ;
17
17
import stroom .widget .button .client .ButtonView ;
18
18
import stroom .widget .popup .client .event .ShowPopupEvent ;
19
19
import stroom .widget .popup .client .presenter .PopupSize ;
20
20
import stroom .widget .popup .client .presenter .PopupType ;
21
21
import stroom .widget .util .client .MultiSelectionModelImpl ;
22
22
23
- import com .google .gwt .cell .client .TextCell ;
24
23
import com .google .gwt .core .client .GWT ;
25
- import com .google .gwt .user .cellview .client .Column ;
26
24
import com .google .web .bindery .event .shared .EventBus ;
27
25
import com .gwtplatform .mvp .client .MyPresenterWidget ;
28
26
import com .gwtplatform .mvp .client .View ;
@@ -81,12 +79,11 @@ public LinkedEventPresenter(final EventBus eventBus,
81
79
view .setEventListView (pagerView );
82
80
view .setDataView (dataPresenter .getView ());
83
81
84
- dataGrid .addResizableColumn (new Column <EventId , String >(new TextCell ()) {
85
- @ Override
86
- public String getValue (final EventId eventId ) {
87
- return eventId .toString ();
88
- }
89
- }, "Id" , ColumnSizeConstants .SMALL_COL );
82
+ dataGrid .addAutoResizableColumn (
83
+ DataGridUtil .copyTextColumnBuilder (EventId ::toString )
84
+ .build (),
85
+ "Id" ,
86
+ ColumnSizeConstants .MEDIUM_COL );
90
87
}
91
88
92
89
@ Override
@@ -99,8 +96,9 @@ protected void onBind() {
99
96
dirty = true ;
100
97
101
98
final AnnotationResource annotationResource = GWT .create (AnnotationResource .class );
102
- final Rest <List <EventId >> rest = restFactory .create ();
103
- rest .onSuccess (this ::setData )
99
+ restFactory .builder ()
100
+ .forListOf (EventId .class )
101
+ .onSuccess (this ::setData )
104
102
.call (annotationResource )
105
103
.link (new EventLink (annotation .getId (), eventId ));
106
104
}
@@ -120,8 +118,9 @@ protected void onBind() {
120
118
}
121
119
122
120
final AnnotationResource annotationResource = GWT .create (AnnotationResource .class );
123
- final Rest <List <EventId >> rest = restFactory .create ();
124
- rest .onSuccess (this ::setData )
121
+ restFactory .builder ()
122
+ .forListOf (EventId .class )
123
+ .onSuccess (this ::setData )
125
124
.call (annotationResource )
126
125
.unlink (new EventLink (annotation .getId (), selected ));
127
126
}
@@ -134,14 +133,17 @@ public void edit(final Annotation annotation, final Consumer<Boolean> consumer)
134
133
dirty = false ;
135
134
136
135
final AnnotationResource annotationResource = GWT .create (AnnotationResource .class );
137
- final Rest <List <EventId >> rest = restFactory .create ();
138
- rest .onSuccess (this ::show ).call (annotationResource ).getLinkedEvents (annotation .getId ());
136
+ restFactory .builder ()
137
+ .forListOf (EventId .class )
138
+ .onSuccess (this ::show )
139
+ .call (annotationResource )
140
+ .getLinkedEvents (annotation .getId ());
139
141
}
140
142
141
143
private void show (final List <EventId > data ) {
142
144
setData (data );
143
145
144
- final PopupSize popupSize = PopupSize .resizable (800 , 600 );
146
+ final PopupSize popupSize = PopupSize .resizable (1100 , 600 );
145
147
ShowPopupEvent .builder (this )
146
148
.popupType (PopupType .CLOSE_DIALOG )
147
149
.popupSize (popupSize )
@@ -157,7 +159,7 @@ private void setData(final List<EventId> data) {
157
159
dataGrid .setRowCount (data .size ());
158
160
159
161
// Change the selection if we need to.
160
- if (data .size () > 0 ) {
162
+ if (! data .isEmpty () ) {
161
163
final EventId currentSelection = selectionModel .getSelected ();
162
164
if (nextSelection != null && data .contains (nextSelection )) {
163
165
selectionModel .setSelected (nextSelection );
0 commit comments