From 18ae973fdc79bc26f3f5f1a577025497e6778644 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 18 Mar 2014 12:06:26 +0000 Subject: [PATCH] Added UtilsGXT3 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@93273 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/ChangeColumnTypePanel.java | 39 +++++++------------ .../client/DeleteColumnPanel.java | 17 ++------ .../columnwidget/client/LabelColumnPanel.java | 31 +++------------ 3 files changed, 25 insertions(+), 62 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java index 1c183af..8a67d15 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java @@ -16,6 +16,7 @@ import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeElemen import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeStore; import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeElement; import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeStore; +import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; @@ -554,7 +555,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements public void onFailure(Throwable caught) { Log.error("load combo failure:" + caught.getLocalizedMessage()); - alert("Error", + UtilsGXT3.alert("Error", "Error retrieving columns of tabular resource:" + trId.getId()); callback.onFailure(caught); @@ -652,11 +653,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements .setColumnDataTypeTarget(dataType); callChangeColumnType(); } else { - alert("Attention", "Column data type not selected!"); + UtilsGXT3.alert("Attention", "Column data type not selected!"); } } else { - alert("Attention", "Column data type not selected!"); + UtilsGXT3.alert("Attention", "Column data type not selected!"); } break; case ATTRIBUTE: @@ -671,10 +672,10 @@ public class ChangeColumnTypePanel extends FramedPanel implements .setColumnDataTypeTarget(dataType); callChangeColumnType(); } else { - alert("Attention", "Column data type not selected!"); + UtilsGXT3.alert("Attention", "Column data type not selected!"); } } else { - alert("Attention", "Column data type not selected!"); + UtilsGXT3.alert("Attention", "Column data type not selected!"); } break; case CODE: @@ -702,7 +703,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements .setCodelistColumnReference(columnReference); callChangeColumnType(); } else { - alert("Attention", "No column reference selected!"); + UtilsGXT3.alert("Attention", "No column reference selected!"); } break; case TIMEDIMENSION: @@ -717,23 +718,23 @@ public class ChangeColumnTypePanel extends FramedPanel implements .setTimeDimensionType(timeDimensionType); callChangeColumnType(); } else { - alert("Attention", + UtilsGXT3.alert("Attention", "Time Dimension type not selected!"); } } else { - alert("Attention", "Time Dimension type not selected!"); + UtilsGXT3.alert("Attention", "Time Dimension type not selected!"); } break; default: - alert("Attention", "This column type is not supported now!"); + UtilsGXT3.alert("Attention", "This column type is not supported now!"); break; } } else { - alert("Attention", "Select a column type!"); + UtilsGXT3.alert("Attention", "Select a column type!"); } } else { - alert("Attention", "Select a column!"); + UtilsGXT3.alert("Attention", "Select a column!"); } } @@ -743,7 +744,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements public void onFailure(Throwable caught) { Log.debug("Change Column Type Error: " + caught.getLocalizedMessage()); - alert("Change Column Type Error ", + UtilsGXT3.alert("Change Column Type Error ", "Error in invocation of change column type operation!"); } @@ -757,17 +758,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements } - protected void alert(String title, String message) { - final AlertMessageBox d = new AlertMessageBox(title, message); - d.addHideHandler(new HideHandler() { - - public void onHide(HideEvent event) { - - } - }); - d.show(); - - } + protected void callDialogCodelistSelection() { DialogCodelistSelection dialogCodelistSelection = new DialogCodelistSelection( @@ -805,7 +796,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements public void onFailure(Throwable caught) { Log.debug("Error retrieving columns: " + caught.getLocalizedMessage()); - alert("Error retrieving columns", + UtilsGXT3.alert("Error retrieving columns", "Error retrieving columns on server!"); } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/DeleteColumnPanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/DeleteColumnPanel.java index b3f40b5..4be98ac 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/DeleteColumnPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/DeleteColumnPanel.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.columnwidget.client.progress.DeleteColumnProgressDialog; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties; +import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession; @@ -233,7 +234,7 @@ public class DeleteColumnPanel extends FramedPanel { if(columnData!=null){ callDeleteColumn(); } else { - alert("Attention", "Select a column!"); + UtilsGXT3.alert("Attention", "Select a column!"); } } @@ -244,7 +245,7 @@ public class DeleteColumnPanel extends FramedPanel { public void onFailure(Throwable caught) { Log.debug("Delete Column Error: " + caught.getLocalizedMessage()); - alert("Delete Column Error ", + UtilsGXT3.alert("Delete Column Error ", "Error in invocation of delete column operation!"); } @@ -257,16 +258,6 @@ public class DeleteColumnPanel extends FramedPanel { } - protected void alert(String title, String message) { - final AlertMessageBox d = new AlertMessageBox(title, message); - d.addHideHandler(new HideHandler() { - - public void onHide(HideEvent event) { - - } - }); - d.show(); - - } + } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/LabelColumnPanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/LabelColumnPanel.java index d5ee41b..47e2b7d 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/LabelColumnPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/LabelColumnPanel.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.columnwidget.client.progress.LabelColumnProgressDialog; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties; +import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.LabelColumnSession; @@ -29,12 +30,9 @@ import com.sencha.gxt.data.shared.loader.ListLoadResultBean; import com.sencha.gxt.data.shared.loader.ListLoader; import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding; import com.sencha.gxt.widget.core.client.FramedPanel; -import com.sencha.gxt.widget.core.client.box.AlertMessageBox; import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; -import com.sencha.gxt.widget.core.client.event.HideEvent; -import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.form.ComboBox; @@ -180,16 +178,9 @@ public class LabelColumnPanel extends FramedPanel { public void onFailure(Throwable caught) { Log.error("load combo failure:" + caught.getLocalizedMessage()); - AlertMessageBox d = new AlertMessageBox("Error", + UtilsGXT3.alert("Error", "Error retrieving columns of tabular resource:" + trId.getId()); - d.addHideHandler(new HideHandler() { - - public void onHide(HideEvent event) { - - } - }); - d.show(); callback.onFailure(caught); } @@ -243,10 +234,10 @@ public class LabelColumnPanel extends FramedPanel { labelColumnSession.setLabel(columnData.getLabel()); callLabelColumn(); } else { - alert("Attention", "Insert a valid label!"); + UtilsGXT3.alert("Attention", "Insert a valid label!"); } } else { - alert("Attention", "Select a column!"); + UtilsGXT3.alert("Attention", "Select a column!"); } } @@ -257,7 +248,7 @@ public class LabelColumnPanel extends FramedPanel { public void onFailure(Throwable caught) { Log.debug("Change The Column Label Error: " + caught.getLocalizedMessage()); - alert("Error Changing The Column Label", + UtilsGXT3.alert("Error Changing The Column Label", "Error in invocation of Change The Column Label operation!"); } @@ -270,16 +261,6 @@ public class LabelColumnPanel extends FramedPanel { } - protected void alert(String title, String message) { - final AlertMessageBox d = new AlertMessageBox(title, message); - d.addHideHandler(new HideHandler() { - - public void onHide(HideEvent event) { - - } - }); - d.show(); - - } + }