Skip to content

Commit e00a1c4

Browse files
committed
Optimized list of impex archives
1 parent 0e22b88 commit e00a1c4

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/impex/archives/ExportArchivesList.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ public class ExportArchivesList extends VLayout {
3636

3737
private static final String STATUS = "status";
3838

39-
private static final String STATUSICON = "statusicon";
40-
4139
protected Layout detailsContainer;
4240

4341
protected RefreshableListGrid list;
@@ -150,8 +148,7 @@ public void onDraw() {
150148
list.addSelectionChangedHandler(event -> {
151149
ListGridRecord rec = list.getSelectedRecord();
152150
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));
155152
} catch (Exception t) {
156153
// Nothing to do
157154
}
@@ -173,7 +170,7 @@ protected void showContextMenu() {
173170
Menu contextMenu = new Menu();
174171

175172
final ListGridRecord rec = list.getSelectedRecord();
176-
final long id = Long.parseLong(rec.getAttributeAsString("id"));
173+
final long id = rec.getAttributeAsLong("id");
177174

178175
MenuItem delete = new MenuItem();
179176
delete.setTitle(I18N.message("ddelete"));
@@ -203,10 +200,10 @@ public void onSuccess(Void result) {
203200
}
204201
}));
205202

206-
if (GUIArchive.STATUS_OPEN != Integer.parseInt(rec.getAttributeAsString(STATUS)))
203+
if (GUIArchive.STATUS_OPEN != rec.getAttributeAsInt(STATUS))
207204
close.setEnabled(false);
208205

209-
if (GUIArchive.STATUS_ERROR != Integer.parseInt(rec.getAttributeAsString(STATUS)))
206+
if (GUIArchive.STATUS_ERROR != rec.getAttributeAsInt(STATUS))
210207
open.setEnabled(false);
211208

212209
contextMenu.setItems(close, open, delete);
@@ -234,7 +231,6 @@ protected void closeArchive(final ListGridRecord rec) {
234231
@Override
235232
public void onSuccess(Void result) {
236233
rec.setAttribute(STATUS, GUIArchive.STATUS_CLOSED);
237-
rec.setAttribute(STATUSICON, "lock");
238234
list.refreshRow(list.getRecordIndex(rec));
239235
showDetails(Long.parseLong(rec.getAttributeAsString("id")), true);
240236
}
@@ -262,14 +258,13 @@ protected void onClosingArchive(final ListGridRecord rec) {
262258
}
263259

264260
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,
266262
new DefaultAsyncCallback<>() {
267263
@Override
268264
public void onSuccess(Void result) {
269-
rec.setAttribute(STATUS, "0");
270-
rec.setAttribute(STATUSICON, "lock_open");
265+
rec.setAttribute(STATUS, GUIArchive.STATUS_OPEN);
271266
list.refreshRow(list.getRecordIndex(rec));
272-
showDetails(Long.parseLong(rec.getAttributeAsString("id")), true);
267+
showDetails(rec.getAttributeAsLong("id"), true);
273268
}
274269
});
275270
}

logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/impex/archives/ImportArchivesList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void showContextMenu() {
141141
Menu contextMenu = new Menu();
142142

143143
final ListGridRecord rec = list.getSelectedRecord();
144-
final long id = Long.parseLong(rec.getAttributeAsString("id"));
144+
final long id = rec.getAttributeAsLong("id");
145145

146146
MenuItem delete = new MenuItem();
147147
delete.setTitle(I18N.message("ddelete"));

0 commit comments

Comments
 (0)