Added confirm messagebox on delete tr

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@90954 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-05 18:58:52 +00:00
parent 8e7ca4e296
commit 0acae79beb
2 changed files with 36 additions and 16 deletions

View File

@ -19,10 +19,10 @@
<dependent-module archiveName="tabular-data-wizard-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-wizard-widget/tabular-data-wizard-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-csv-export-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-csv-export-widget/tabular-data-csv-export-widget">
<dependent-module archiveName="tabular-data-toolbox-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-toolbox-widget/tabular-data-toolbox-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-toolbox-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-toolbox-widget/tabular-data-toolbox-widget">
<dependent-module archiveName="tabular-data-column-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-column-widget/tabular-data-column-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="tabular-data-portlet"/>

View File

@ -33,7 +33,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
@ -201,20 +203,39 @@ public class TabularDataController {
}
protected void deleteTabularResource() {
Log.debug("Remove TR:" + trId);
TDGWTServiceAsync.INSTANCE.removeTabularResource(trId,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
alertMessage("Error", "Error on remove TabResource: "
+ caught.getLocalizedMessage());
}
final ConfirmMessageBox mb = new ConfirmMessageBox(
"Confirm", "Are you sure you want to delete the taular resource?");
mb.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
.name())) {
Log.debug("Remove TR:" + trId);
TDGWTServiceAsync.INSTANCE.removeTabularResource(trId,
new AsyncCallback<Void>() {
public void onSuccess(Void result) {
closeTabularResource();
}
public void onFailure(Throwable caught) {
alertMessage(
"Error",
"Error on remove TabResource: "
+ caught.getLocalizedMessage());
}
});
public void onSuccess(Void result) {
closeTabularResource();
}
});
mb.hide();
} else if (mb.getHideButton() == mb
.getButtonById(PredefinedButton.NO.name())) {
mb.hide();
}
}
});
mb.setWidth(300);
mb.show();
}
@ -583,8 +604,8 @@ public class TabularDataController {
protected void openColumnTYPE() {
openColumnTYPE(null);
}
protected void openColumnTYPE(String columnName){
protected void openColumnTYPE(String columnName) {
Log.debug("Request Open Change Column Tab");
if (trId != null) {
WidgetRequestEvent e = new WidgetRequestEvent(
@ -594,7 +615,6 @@ public class TabularDataController {
eventBus.fireEvent(e);
}
}
protected void doGridHeaderColumnMenuCommand(
GridHeaderColumnMenuItemEvent event) {