diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java index f3eac7111..23dcadd84 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java @@ -40,7 +40,9 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti import java.io.IOException; import java.io.Writer; import java.text.DecimalFormat; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -56,6 +58,8 @@ import javax.servlet.jsp.PageContext; public class DownloadArtifact extends Component { + private static final String DEFAULT_DOWNLOAD_IMAGE = "download-type-other.png"; + /** * @plexus.requirement role-hint="jdo" */ @@ -81,6 +85,18 @@ public class DownloadArtifact private DecimalFormat decimalFormat; + private static final Map DOWNLOAD_IMAGES = new HashMap(); + + static + { + DOWNLOAD_IMAGES.put( "jar", "download-type-jar.png" ); + DOWNLOAD_IMAGES.put( "java-source", "download-type-jar.png" ); + DOWNLOAD_IMAGES.put( "pom", "download-type-pom.png" ); + DOWNLOAD_IMAGES.put( "maven-plugin", "download-type-maven-plugin.png" ); + DOWNLOAD_IMAGES.put( "maven-archetype", "download-type-archetype.png" ); + DOWNLOAD_IMAGES.put( "maven-skin", "download-type-skin.png" ); + } + public DownloadArtifact( ValueStack stack, PageContext pageContext ) { super( stack ); @@ -238,10 +254,16 @@ public class DownloadArtifact ArchivaArtifact artifact ) { String type = artifact.getType(); - String linkText = ""; + String linkText = ""; appendLink( sb, prefix, repo, artifact, linkText ); } + private String getDownloadImage( String type ) + { + String name = DOWNLOAD_IMAGES.get( type ); + return name != null ? name : DEFAULT_DOWNLOAD_IMAGE; + } + private static void appendLink( StringBuffer sb, String prefix, ManagedRepositoryContent repo, ArchivaArtifact artifact, String linkText ) { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-archetype.png b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-archetype.png new file mode 100644 index 000000000..c0a19dac7 Binary files /dev/null and b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-archetype.png differ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-jar.png b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-jar.png index 146e1fd8f..6eb48831d 100644 Binary files a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-jar.png and b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-jar.png differ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-java-source.png b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-java-source.png deleted file mode 100644 index 9660957eb..000000000 Binary files a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-java-source.png and /dev/null differ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-maven-plugin.png b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-maven-plugin.png new file mode 100644 index 000000000..3f27ddb6d Binary files /dev/null and b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-maven-plugin.png differ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-other.png b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-other.png new file mode 100644 index 000000000..cb268e025 Binary files /dev/null and b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-other.png differ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-pom.png b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-pom.png index d0e4c12bf..7ed1db583 100644 Binary files a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-pom.png and b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-pom.png differ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-skin.png b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-skin.png new file mode 100644 index 000000000..0671e0956 Binary files /dev/null and b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download-type-skin.png differ