Minor update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@101400 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-11-03 17:21:54 +00:00
parent a928695c02
commit d8be8fddfa
3 changed files with 99 additions and 71 deletions

View File

@ -562,7 +562,7 @@ public class TabularDataController {
Log.debug("TabularResourceDataView:" + tabularResourceDataView);
openTRIdAfterServerUpdate = tabularResourceDataView.getTrId();
TDGWTServiceAsync.INSTANCE.setActiveTabularResource(
openTRIdAfterServerUpdate, new AsyncCallback<Void>() {
openTRIdAfterServerUpdate, new AsyncCallback<TRId>() {
@Override
public void onFailure(Throwable caught) {
@ -583,7 +583,8 @@ public class TabularDataController {
}
@Override
public void onSuccess(Void result) {
public void onSuccess(TRId result) {
openTRIdAfterServerUpdate=result;
doOpenTRIdAfterServerUpdate();
}

View File

@ -2,13 +2,18 @@ package org.gcube.portlets.user.td.client.template;
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
@ -18,29 +23,30 @@ import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TemplateApplyDialog extends Window implements MonitorDialogListener{
public class TemplateApplyDialog extends Window implements
MonitorDialogListener {
protected String WIDTH = "720px";
protected String HEIGHT = "530px";
protected TemplateApplySession templateApplySession;
protected TRId trId;
protected EventBus eventBus;
public TemplateApplyDialog(TRId trId, EventBus eventBus) {
this.trId=trId;
this.eventBus=eventBus;
this.trId = trId;
this.eventBus = eventBus;
initWindow();
TemplateApplyPanel templateApplyPanel= new TemplateApplyPanel(this,trId, eventBus);
add(templateApplyPanel);
TemplateApplyPanel templateApplyPanel = new TemplateApplyPanel(this,
trId, eventBus);
add(templateApplyPanel);
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
@ -53,7 +59,7 @@ public class TemplateApplyDialog extends Window implements MonitorDialogListene
getHeader().setIcon(TabularDataResources.INSTANCE.templateApply());
}
/**
* {@inheritDoc}
*/
@ -63,30 +69,45 @@ public class TemplateApplyDialog extends Window implements MonitorDialogListene
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
protected void close (){
protected void close() {
hide();
}
protected void applyTemplate(final TemplateApplySession templateApplySession){
this.templateApplySession=templateApplySession;
protected void applyTemplate(final TemplateApplySession templateApplySession) {
this.templateApplySession = templateApplySession;
TDGWTServiceAsync.INSTANCE.startTemplateApply(templateApplySession,
new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
Log.debug("Apply Template Error: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Apply Template Error ",
"Error in invocation of apply template operation!");
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 Is Final",
caught.getLocalizedMessage());
} else {
Log.debug("Apply Template Error: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Apply Template Error ",
"Error in invocation of apply template operation! "+caught.getLocalizedMessage());
}
}
}
}
public void onSuccess(String taskId) {
@ -94,13 +115,11 @@ public class TemplateApplyDialog extends Window implements MonitorDialogListene
}
});
}
protected void openMonitorDialog(String taskId){
MonitorDialog monitorDialog=new MonitorDialog(taskId,eventBus);
protected void openMonitorDialog(String taskId) {
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
monitorDialog.addProgressDialogListener(this);
monitorDialog.show();
}
@ -111,14 +130,14 @@ public class TemplateApplyDialog extends Window implements MonitorDialogListene
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.TEMPLATEAPPLY, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
close();
}
@Override
public void operationFailed(Throwable caught, String reason, String details) {
UtilsGXT3.alert(reason, details);
close();
}
@Override
@ -128,21 +147,19 @@ public class TemplateApplyDialog extends Window implements MonitorDialogListene
ChangeTableRequestType.TEMPLATEAPPLY, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
close();
}
@Override
public void operationAborted() {
close();
}
@Override
public void operationPutInBackground() {
close();
}
}

View File

@ -2,9 +2,12 @@ package org.gcube.portlets.user.td.client.template;
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSession;
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -13,27 +16,27 @@ import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TemplateDeleteDialog extends Window {
public class TemplateDeleteDialog extends Window {
protected String WIDTH = "720px";
protected String HEIGHT = "530px";
protected TemplateDeleteSession templateDeleteSession;
protected EventBus eventBus;
public TemplateDeleteDialog(EventBus eventBus) {
this.eventBus=eventBus;
this.eventBus = eventBus;
initWindow();
TemplateDeletePanel templateDeletePanel= new TemplateDeletePanel(this, eventBus);
add(templateDeletePanel);
TemplateDeletePanel templateDeletePanel = new TemplateDeletePanel(this,
eventBus);
add(templateDeletePanel);
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
@ -46,7 +49,7 @@ public class TemplateDeleteDialog extends Window {
getHeader().setIcon(TabularDataResources.INSTANCE.templateDelete());
}
/**
* {@inheritDoc}
*/
@ -56,42 +59,49 @@ public class TemplateDeleteDialog extends Window {
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
protected void close (){
protected void close() {
hide();
}
protected void templatesDelete(final TemplateDeleteSession templateDeleteSession){
this.templateDeleteSession=templateDeleteSession;
protected void templatesDelete(
final TemplateDeleteSession templateDeleteSession) {
this.templateDeleteSession = templateDeleteSession;
TDGWTServiceAsync.INSTANCE.templateDelete(templateDeleteSession,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
Log.debug("Delete Template Error: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Apply Template Error ",
"Error in invocation of delete template operation!");
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 {
Log.debug("Delete Template Error: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Apply Template Error ",
"Error in invocation of delete template operation! "
+ caught.getLocalizedMessage());
}
}
}
public void onSuccess(Void result) {
UtilsGXT3.info("Delete Template",
"Template deleted!");
UtilsGXT3.info("Delete Template", "Template deleted!");
close();
}
});
}
}