From a30655d39d91576c20e99c1c7c473f2a7ccaff5c Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Wed, 15 Aug 2012 07:21:33 +0000
Subject: [PATCH] SP-159 / BIS-93: YeastLab: Implement a way to download
 template files as part of the Custom Import functionality: - make the links
 open in a new tab rather than in a new window

SVN: 26373
---
 .../application/ui/CustomImportForm.java      | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/CustomImportForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/CustomImportForm.java
index 5efab99918e..12973009792 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/CustomImportForm.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/CustomImportForm.java
@@ -26,6 +26,7 @@ import com.extjs.gxt.ui.client.widget.form.FileUploadField;
 import com.extjs.gxt.ui.client.widget.form.LabelField;
 import com.extjs.gxt.ui.client.widget.form.MultiField;
 import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Window;
 
 import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
@@ -35,7 +36,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewConte
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.LinkRenderer;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.file.BasicFileFieldManager;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils;
-import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.WindowUtils;
 import ch.systemsx.cisd.openbis.generic.shared.basic.PermlinkUtilities;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AttachmentHolderKind;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.CustomImport;
@@ -182,9 +182,9 @@ public class CustomImportForm extends AbstractRegistrationForm
                     new LinkToProjectTemplateCallback(viewContext));
         } else
         {
-            WindowUtils.openWindow(PermlinkUtilities.createAttachmentPermlinkURL(
-                    GWTUtils.getBaseIndexURL(), getTemplateAttachmentName(), null,
-                    getTemplateEntityKind(), getTemplateEntityPermId()));
+            openUrl(PermlinkUtilities.createAttachmentPermlinkURL(GWTUtils.getBaseIndexURL(),
+                    getTemplateAttachmentName(), null, getTemplateEntityKind(),
+                    getTemplateEntityPermId()));
         }
     }
 
@@ -196,7 +196,7 @@ public class CustomImportForm extends AbstractRegistrationForm
                     new LinkToEntityWithProjectTemplateCallback(viewContext));
         } else
         {
-            WindowUtils.openWindow(PermlinkUtilities.createPermlinkURL(GWTUtils.getBaseIndexURL(),
+            openUrl(PermlinkUtilities.createPermlinkURL(GWTUtils.getBaseIndexURL(),
                     EntityKind.valueOf(getTemplateEntityKind().name()), getTemplateEntityPermId()));
         }
     }
@@ -212,7 +212,7 @@ public class CustomImportForm extends AbstractRegistrationForm
         @Override
         protected void process(Project project)
         {
-            WindowUtils.openWindow(PermlinkUtilities.createProjectAttachmentPermlinkURL(
+            openUrl(PermlinkUtilities.createProjectAttachmentPermlinkURL(
                     GWTUtils.getBaseIndexURL(), getTemplateAttachmentName(), null,
                     project.getCode(), project.getSpace().getCode()));
         }
@@ -229,8 +229,8 @@ public class CustomImportForm extends AbstractRegistrationForm
         @Override
         protected void process(Project project)
         {
-            WindowUtils.openWindow(PermlinkUtilities.createProjectPermlinkURL(
-                    GWTUtils.getBaseIndexURL(), project.getCode(), project.getSpace().getCode()));
+            openUrl(PermlinkUtilities.createProjectPermlinkURL(GWTUtils.getBaseIndexURL(),
+                    project.getCode(), project.getSpace().getCode()));
         }
     }
 
@@ -265,4 +265,9 @@ public class CustomImportForm extends AbstractRegistrationForm
                 .getName());
     }
 
+    private void openUrl(String url)
+    {
+        Window.open(url, "_blank", "");
+    }
+
 }
-- 
GitLab