[MRM-1096] [MRM-989] fix plugin download type, add default for other types such as javadoc, clean all icons
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@756883 13f79535-47bb-0310-9956-ffa450edef68
|
@ -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<String, String> DOWNLOAD_IMAGES = new HashMap<String,String>();
|
||||
|
||||
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 = "<img src=\"" + req.getContextPath() + "/images/download-type-" + type + ".png\" />";
|
||||
String linkText = "<img src=\"" + req.getContextPath() + "/images/" + getDownloadImage( type ) + "\" />";
|
||||
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 )
|
||||
{
|
||||
|
|
After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 969 B After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 969 B |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 946 B After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.7 KiB |