updated form submit

This commit is contained in:
Francesco Mangiacrapa 2024-05-06 14:41:58 +02:00
parent 9ec3696203
commit 3aa7f6462f
1 changed files with 11 additions and 25 deletions

View File

@ -22,13 +22,13 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.util.NewBrowserWindow;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.FormElement;
import com.google.gwt.dom.client.UListElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@ -42,7 +42,9 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Hidden;
@ -236,28 +238,13 @@ public class ProjectViewer extends Composite {
String currentContextId = GCubeClientContext.getCurrentContextId();
String currentUserId = GCubeClientContext.getCurrentUserId();
/*
* USE TO GET REQUEST StringBuilder builder = new StringBuilder();
* builder.append(GeoportalDataViewerConstants.GEOPORTAL_EXPORT_ACTION_SERVLET +
* "?"); builder.append(GeoportalDataViewerConstants.UCD_ID_PARAMETER + "=" +
* projectView.getTheProjectDV().getProfileID()); builder.append("&");
* builder.append(GeoportalDataViewerConstants.PROIECT_ID_PARAMETER + "=" +
* projectView.getTheProjectDV().getId()); builder.append("&");
* builder.append(GeoportalDataViewerConstants.CONTEXT_ID_PARAMETER + "=" +
* currentContextId); builder.append("&");
* builder.append(GeoportalDataViewerConstants.USER_ID_PARAMETER + "=" +
* currentUserId);
*
* String geoportalExportActionServlet = builder.toString();
*
* NewBrowserWindow.open(geoportalExportActionServlet, "_blank", "");
*/
ProjectDV thePDV = projectView.getTheProjectDV();
final String targetWindow = "target_window_" + Random.nextInt() + "_" + Random.nextInt();
final FormPanel form = new FormPanel(targetWindow);
final FormPanel form = new FormPanel();
final FormElement fe = form.getElement().cast();
//NewBrowserWindow theNewTabWindow = NewBrowserWindow.open("", "", null);
RootPanel.get().add(form);
VerticalPanel panel = new VerticalPanel();
form.setWidget(panel);
@ -278,18 +265,17 @@ public class ProjectViewer extends Composite {
contactinServiceModal.show();
// Add an event handler to the form.
form.addSubmitHandler(new FormPanel.SubmitHandler() {
form.addSubmitHandler(new SubmitHandler() {
public void onSubmit(SubmitEvent event) {
GWT.log("onSubmit done");
contactinServiceModal.hide();
fe.setTarget(targetWindow);
}
});
form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
public void onSubmitComplete(SubmitCompleteEvent event) {
contactinServiceModal.hide();
NewBrowserWindow.open("", targetWindow, null);
GWT.log("onSubmitComplete done");
contactinServiceModal.hide();
}
});