From dca4ebcf38f7dca6b0dde468122e04080e9313cb Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Thu, 28 Apr 2011 15:20:46 +0000
Subject: [PATCH] LMS-2235 fixed

SVN: 21071
---
 .../ui/attachment/AttachmentBrowser.java           | 14 +++++++-------
 .../ui/attachment/AttachmentDownloadHelper.java    |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java
index 9e7e7e01d16..6e3d7e6e0ca 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java
@@ -212,7 +212,10 @@ public class AttachmentBrowser extends TypedTableGrid<AttachmentVersions>
                         public String tryGetLink(AttachmentVersions entity,
                                 ISerializableComparable comparableValue)
                         {
-                            return null;
+                            Attachment current = entity.getCurrent();
+                            final String fileName = current.getFileName();
+                            final int version = current.getVersion();
+                            return AttachmentDownloadHelper.createURL(fileName, version, attachmentHolder);
                         }
                     });
     }
@@ -238,7 +241,8 @@ public class AttachmentBrowser extends TypedTableGrid<AttachmentVersions>
                         public String tryGetLink(AttachmentVersions entity,
                                 ISerializableComparable comparableValue)
                         {
-                            return null;
+                            String linkText = viewContext.getMessage(Dict.SHOW_ALL_VERSIONS);
+                            return LinkRenderer.renderAsLinkWithAnchor(linkText);
                         }
                     });
     }
@@ -455,15 +459,12 @@ public class AttachmentBrowser extends TypedTableGrid<AttachmentVersions>
                 .toLowerCase();
     }
 
-    @SuppressWarnings("deprecation")
     @Override
     protected BaseEntityModel<TableModelRowWithObject<AttachmentVersions>> createModel(
             GridRowModel<TableModelRowWithObject<AttachmentVersions>> entity)
     {
         BaseEntityModel<TableModelRowWithObject<AttachmentVersions>> model =
                 super.createModel(entity);
-        // TODO 2011-01-11, Piotr Buczek: get rid of this - extend createColumnDefinitions()
-        model.renderAsLinkWithAnchor(AttachmentGridColumnIDs.FILE_NAME);
         renderVersionAsLink(model);
         return model;
     }
@@ -473,8 +474,7 @@ public class AttachmentBrowser extends TypedTableGrid<AttachmentVersions>
         String versionId = AttachmentGridColumnIDs.VERSION;
         String originalValue = model.get(versionId);
         String linkText = viewContext.getMessage(Dict.SHOW_ALL_VERSIONS);
-        String link = LinkRenderer.renderAsLinkWithAnchor(linkText);
-        model.set(versionId, originalValue + " (" + link + ")");
+        model.set(versionId, originalValue + " (" + linkText + ")");
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentDownloadHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentDownloadHelper.java
index acd394b49ea..db916c7c158 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentDownloadHelper.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentDownloadHelper.java
@@ -30,10 +30,10 @@ public class AttachmentDownloadHelper
 {
     public static void download(String fileName, int version, IAttachmentHolder holder)
     {
-        WindowUtils.openWindow(createURL(version, fileName, holder));
+        WindowUtils.openWindow(createURL(fileName, version, holder));
     }
 
-    private final static String createURL(final int version, final String fileName,
+    public final static String createURL(final String fileName, final int version,
             final IAttachmentHolder attachmentHolder)
     {
         URLMethodWithParameters methodWithParameters =
-- 
GitLab