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 9e7e7e01d164cb251ef4a2d1229445a7cd67525a..6e3d7e6e0ca3ef25ae22fe5b5b5930ac3a685708 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 acd394b49ea82435ce0fc9e874d3cbfbad3480ce..db916c7c158f2e878df92f69be5d54a23cd6f940 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 =