diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/TemplateApplyProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/TemplateApplyProgressDialog.java index a7551da..d597256 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/TemplateApplyProgressDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/TemplateApplyProgressDialog.java @@ -1,6 +1,6 @@ package org.gcube.portlets.user.td.tablewidget.client.progress; -import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession; +import org.gcube.portlets.user.td.tablewidget.client.template.TemplateApplyDialog; 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.type.ChangeTableRequestType; @@ -31,14 +31,14 @@ public class TemplateApplyProgressDialog extends Window implements TemplateApply public static final int STATUS_POLLING_DELAY = 1000; protected String WIDTH = "400px"; protected String HEIGHT = "120px"; - protected TemplateApplySession templateApplySession; + protected TemplateApplyDialog templateApplyDialog; protected EventBus eventBus; protected TemplateApplyProgressUpdater progressUpdater; protected TextButton ok; protected TRId trId; - public TemplateApplyProgressDialog(TemplateApplySession templateApplySession, EventBus eventBus) { - this.templateApplySession=templateApplySession; + public TemplateApplyProgressDialog(TemplateApplyDialog templateApplySession, EventBus eventBus) { + this.templateApplyDialog=templateApplySession; this.eventBus=eventBus; setWidth(WIDTH); setHeight(HEIGHT); diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyDialog.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyDialog.java index 6ec95cb..bff103b 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyDialog.java @@ -1,8 +1,14 @@ package org.gcube.portlets.user.td.tablewidget.client.template; +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession; +import org.gcube.portlets.user.td.tablewidget.client.progress.TemplateApplyProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle; +import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.web.bindery.event.shared.EventBus; import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.event.SelectEvent; @@ -18,10 +24,13 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; public class TemplateApplyDialog extends Window { protected String WIDTH = "650px"; 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; initWindow(); TemplateApplyPanel templateApplyPanel= new TemplateApplyPanel(this,trId, eventBus); @@ -59,11 +68,43 @@ public class TemplateApplyDialog extends Window { } protected void close (){ - /*ExpressionEvent expressionEvent = new ExpressionEvent( - ExpressionType.EXPRESSIONNULL); - //Log.debug(expressionEvent.toString());*/ hide(); - //eventBus.fireEvent(expressionEvent); } + + protected void applyTemplate(final TemplateApplySession templateApplySession){ + this.templateApplySession=templateApplySession; + + TDGWTServiceAsync.INSTANCE.startTemplateApply(templateApplySession, + new AsyncCallback() { + public void onFailure(Throwable caught) { + Log.debug("Apply Template Error: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Apply Template Error ", + "Error in invocation of apply template operation!"); + + } + + public void onSuccess(Void result) { + callApplyTemplateProgressDialog(); + } + + }); + + + } + + + + + protected void callApplyTemplateProgressDialog() { + TemplateApplyProgressDialog d = new TemplateApplyProgressDialog( + this, eventBus); + d.show(); + } + + + + + } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java index 8e69a11..93b3428 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java @@ -50,7 +50,7 @@ public class TemplateApplyPanel extends FramedPanel { protected EventBus eventBus; protected TemplateApplyDialog parent; protected TRId trId; - + protected TemplateApplySession templateApplySession; private TextButton btnApply; private TextButton btnClose; @@ -230,31 +230,15 @@ public class TemplateApplyPanel extends FramedPanel { protected void apply(){ - TemplateApplySession applyTemplateSession=new TemplateApplySession(); - applyTemplateSession.setTemplateData(getSelectedItem()); - applyTemplateSession.setTrId(trId); - Log.debug("applyTemplateSession: "+applyTemplateSession); + templateApplySession=new TemplateApplySession(); + templateApplySession.setTemplateData(getSelectedItem()); + templateApplySession.setTrId(trId); + Log.debug("applyTemplateSession: "+templateApplySession); + parent.applyTemplate(templateApplySession); - TDGWTServiceAsync.INSTANCE.startTemplateApply(applyTemplateSession, - new AsyncCallback() { - public void onFailure(Throwable caught) { - Log.debug("Apply Template Error: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Apply Template Error ", - "Error in invocation of apply template operation!"); - - } - - public void onSuccess(Void result) { - /*TemplateApplyProgressDialog = new ChangeColumnTypeProgressDialog( - changeColumnTypeSession, eventBus);*/ - } - - }); - - } - + + protected void close(){ parent.close(); }