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