@@ -36,8 +36,6 @@ public class ExportArchivesList extends VLayout {
36
36
37
37
private static final String STATUS = "status" ;
38
38
39
- private static final String STATUSICON = "statusicon" ;
40
-
41
39
protected Layout detailsContainer ;
42
40
43
41
protected RefreshableListGrid list ;
@@ -150,8 +148,7 @@ public void onDraw() {
150
148
list .addSelectionChangedHandler (event -> {
151
149
ListGridRecord rec = list .getSelectedRecord ();
152
150
try {
153
- showDetails (Long .parseLong (rec .getAttribute ("id" )),
154
- !Integer .toString (GUIArchive .STATUS_OPEN ).equals (rec .getAttribute (STATUS )));
151
+ showDetails (rec .getAttributeAsLong ("id" ), GUIArchive .STATUS_OPEN != rec .getAttributeAsInt (STATUS ));
155
152
} catch (Exception t ) {
156
153
// Nothing to do
157
154
}
@@ -173,7 +170,7 @@ protected void showContextMenu() {
173
170
Menu contextMenu = new Menu ();
174
171
175
172
final ListGridRecord rec = list .getSelectedRecord ();
176
- final long id = Long . parseLong ( rec .getAttributeAsString ("id" ) );
173
+ final long id = rec .getAttributeAsLong ("id" );
177
174
178
175
MenuItem delete = new MenuItem ();
179
176
delete .setTitle (I18N .message ("ddelete" ));
@@ -203,10 +200,10 @@ public void onSuccess(Void result) {
203
200
}
204
201
}));
205
202
206
- if (GUIArchive .STATUS_OPEN != Integer . parseInt ( rec .getAttributeAsString (STATUS ) ))
203
+ if (GUIArchive .STATUS_OPEN != rec .getAttributeAsInt (STATUS ))
207
204
close .setEnabled (false );
208
205
209
- if (GUIArchive .STATUS_ERROR != Integer . parseInt ( rec .getAttributeAsString (STATUS ) ))
206
+ if (GUIArchive .STATUS_ERROR != rec .getAttributeAsInt (STATUS ))
210
207
open .setEnabled (false );
211
208
212
209
contextMenu .setItems (close , open , delete );
@@ -234,7 +231,6 @@ protected void closeArchive(final ListGridRecord rec) {
234
231
@ Override
235
232
public void onSuccess (Void result ) {
236
233
rec .setAttribute (STATUS , GUIArchive .STATUS_CLOSED );
237
- rec .setAttribute (STATUSICON , "lock" );
238
234
list .refreshRow (list .getRecordIndex (rec ));
239
235
showDetails (Long .parseLong (rec .getAttributeAsString ("id" )), true );
240
236
}
@@ -262,14 +258,13 @@ protected void onClosingArchive(final ListGridRecord rec) {
262
258
}
263
259
264
260
protected void openArchive (final ListGridRecord rec ) {
265
- ImpexService .Instance .get ().setStatus (Long . parseLong ( rec .getAttributeAsString ("id" ) ), GUIArchive .STATUS_OPEN ,
261
+ ImpexService .Instance .get ().setStatus (rec .getAttributeAsLong ("id" ), GUIArchive .STATUS_OPEN ,
266
262
new DefaultAsyncCallback <>() {
267
263
@ Override
268
264
public void onSuccess (Void result ) {
269
- rec .setAttribute (STATUS , "0" );
270
- rec .setAttribute (STATUSICON , "lock_open" );
265
+ rec .setAttribute (STATUS , GUIArchive .STATUS_OPEN );
271
266
list .refreshRow (list .getRecordIndex (rec ));
272
- showDetails (Long . parseLong ( rec .getAttributeAsString ("id" ) ), true );
267
+ showDetails (rec .getAttributeAsLong ("id" ), true );
273
268
}
274
269
});
275
270
}
0 commit comments