(grid);
+ dt.setFeedback(Feedback.BOTH);
+ dt.setAllowSelfAsSource(true);
+
+
+ // Delete Button
+ reorder = new TextButton("Apply");
+ reorder.setIcon(ResourceBundle.INSTANCE.columnReorder());
+ reorder.setIconAlign(IconAlign.RIGHT);
+ reorder.setTitle("Apply Position Columns");
+
+ SelectHandler deleteHandler = new SelectHandler() {
+
+ public void onSelect(SelectEvent event) {
+ onReorderColumns();
+
+ }
+ };
+ reorder.addSelectHandler(deleteHandler);
+
+ HTML columnsLabel = new HTML("Use drag and drop in order to change the position of the columns:
");
+ HBoxLayoutContainer hBox = new HBoxLayoutContainer();
+ hBox.add(reorder, new BoxLayoutData(new Margins(2, 5, 2, 5)));
+
+ VerticalLayoutContainer v = new VerticalLayoutContainer();
+ v.setScrollMode(ScrollMode.AUTOY);
+ v.setAdjustForScroll(true);
+ v.add(columnsLabel, new VerticalLayoutData(-1, -1, new Margins(2, 1, 5,
+ 1)));
+ v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
+ v.add(hBox, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
+ add(v, new VerticalLayoutData(1, -1, new Margins(0)));
+
+ }
+
+ protected ArrayList getReorderedColumns() {
+ return new ArrayList(grid.getStore().getAll());
+
+ }
+
+ public void update(TRId trId) {
+ this.trId = trId;
+ loader.load();
+ }
+
+ protected void loadData(ListLoadConfig loadConfig,
+ final AsyncCallback> callback) {
+ TDGWTServiceAsync.INSTANCE.getColumns(trId,
+ new AsyncCallback>() {
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ if (caught instanceof TDGWTIsLockedException) {
+ Log.error(caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error Locked",
+ caught.getLocalizedMessage());
+ } else {
+ if (caught instanceof TDGWTIsFinalException) {
+ Log.error(caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error Final",
+ caught.getLocalizedMessage());
+ } else {
+ Log.error("load columns failure:"
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error retrieving columns",
+ "Error retrieving columns");
+ }
+ }
+ }
+ callback.onFailure(caught);
+
+ }
+
+ public void onSuccess(ArrayList result) {
+ try {
+ Log.debug("loaded " + result.size() + " ColumnData");
+ callback.onSuccess(new ListLoadResultBean(
+ result));
+
+ } catch (UmbrellaException e) {
+ Log.debug("Umbrella exception "
+ + e.getLocalizedMessage());
+ } catch (com.google.web.bindery.event.shared.UmbrellaException e) {
+ Log.debug("Umbrella exception "
+ + e.getLocalizedMessage());
+ }
+
+ }
+
+ });
+
+ }
+
+ protected void onReorderColumns() {
+ ArrayList columns = getReorderedColumns();
+ if (columns == null || columns.size() < 1) {
+ UtilsGXT3.alert("Attention", "Attention no column change!");
+ return;
+ } else {
+ callReorderColumn(columns);
+ }
+ }
+
+ private void callReorderColumn(ArrayList columns) {
+
+ changeColumnsPositionSession = new ChangeColumnsPositionSession(trId, columns);
+
+ Log.debug("ChangeColumnsSession: "+changeColumnsPositionSession);
+ /*
+ TDGWTServiceAsync.INSTANCE.startChangeColumnsPosition(changeColumnsPositionSession,
+ new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ if (caught instanceof TDGWTIsLockedException) {
+ Log.error(caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error Locked",
+ caught.getLocalizedMessage());
+ } else {
+ if (caught instanceof TDGWTIsFinalException) {
+ Log.error(caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error Final",
+ caught.getLocalizedMessage());
+ } else {
+ Log.debug("Error changing the position of the columns: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3
+ .alert("Error",
+ "Error changing the position of the columns! "+caught.getLocalizedMessage());
+ }
+ }
+ }
+ }
+
+ public void onSuccess(String taskId) {
+ //openMonitorDialog(taskId);
+ }
+
+ });
+ */
+ }
+
+ public void close() {
+ if (parent != null) {
+ parent.close();
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/ResourceBundle.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/ResourceBundle.java
index f6a7ccb..4e8c94c 100644
--- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/ResourceBundle.java
+++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/ResourceBundle.java
@@ -64,6 +64,13 @@ public interface ResourceBundle extends ClientBundle {
@Source("column-type_32.png")
ImageResource columnType32();
+ @Source("column-reorder.png")
+ ImageResource columnReorder();
+
+ @Source("column-reorder_32.png")
+ ImageResource columnReorder32();
+
+
@Source("column-replace.png")
ImageResource replace();
diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder.png b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder.png
new file mode 100644
index 0000000..0c12d56
Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder.png differ
diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder_32.png b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder_32.png
new file mode 100644
index 0000000..7b6cba3
Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder_32.png differ
diff --git a/src/main/resources/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder.png b/src/main/resources/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder.png
new file mode 100644
index 0000000..0c12d56
Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder.png differ
diff --git a/src/main/resources/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder_32.png b/src/main/resources/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder_32.png
new file mode 100644
index 0000000..7b6cba3
Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/columnwidget/client/resources/column-reorder_32.png differ