224: Workspace: reinforce the set of icons for recognised items
Task-Url: https://support.d4science.org/issues/show/224 Added icons: X_BZIP = "x-bzip"; RAR = "x-rar-compressed"; GZIP = "gzip"; WAR ="x-tika-java-web-archive"; git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@117229 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6959784098
commit
d95451266f
|
@ -192,7 +192,7 @@ public class FileModel extends BaseModelData implements Serializable {
|
|||
|
||||
if (!this.isDirectory()) { //IS FILE
|
||||
if(this.getType()!=null)
|
||||
absImgPr = Resources.getIconByType(this.getType());
|
||||
absImgPr = Resources.getIconByType(this.getName(), this.getType());
|
||||
else
|
||||
absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType());
|
||||
|
||||
|
|
|
@ -38,9 +38,6 @@ public interface Icons extends ClientBundle {
|
|||
@Source("icons/mime/ico_htm.gif")
|
||||
ImageResource html();
|
||||
|
||||
@Source("icons/mime/java.gif")
|
||||
ImageResource java();
|
||||
|
||||
@Source("icons/mime/doc.gif")
|
||||
ImageResource doc();
|
||||
|
||||
|
@ -400,5 +397,11 @@ public interface Icons extends ClientBundle {
|
|||
|
||||
@Source("icons/zip.gif")
|
||||
ImageResource zip();
|
||||
|
||||
@Source("icons/archive-icon.png")
|
||||
ImageResource archive();
|
||||
|
||||
@Source("icons/java.gif")
|
||||
ImageResource java();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,10 +42,18 @@ public class Resources {
|
|||
private static final String ODP = "vnd.oasis.opendocument.presentation";
|
||||
private static final String XTEX = "x-tex";
|
||||
private static final String ZIP = "zip";
|
||||
private static final String SEVEN_ZIP = "x-7z-compressed";
|
||||
private static final String POSTSCRIPT = "postscript";
|
||||
private static final String DVI = "x-dvi";
|
||||
private static final String X_SH = "x-sh";
|
||||
private static final String X_SHELLSCRIPT = "x-shellscript";
|
||||
|
||||
private static final String X_BZIP = "x-bzip";
|
||||
private static final String RAR = "x-rar-compressed";
|
||||
private static final String GZIP = "gzip";
|
||||
|
||||
private static final String WAR ="x-tika-java-web-archive";
|
||||
|
||||
/**
|
||||
* Gets the cloud drive icon.
|
||||
*
|
||||
|
@ -147,6 +155,17 @@ public class Resources {
|
|||
return AbstractImagePrototype.create(ICONS.undo());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the icon archive.
|
||||
*
|
||||
* @return the icon archive
|
||||
*/
|
||||
public static AbstractImagePrototype getIconArchive(){
|
||||
|
||||
return AbstractImagePrototype.create(ICONS.archive());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the icon link.
|
||||
*
|
||||
|
@ -1274,13 +1293,15 @@ public class Resources {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the icon by media type name.
|
||||
*
|
||||
* @param name the name
|
||||
* @param mediaTypeName the media type name
|
||||
* @return the icon by media type name
|
||||
*/
|
||||
public static AbstractImagePrototype getIconByMediaTypeName(String mediaTypeName) {
|
||||
public static AbstractImagePrototype getIconByMediaTypeName(String name, String mediaTypeName) {
|
||||
|
||||
if (MPEG.equals(mediaTypeName) || SWF.equals(mediaTypeName) || FLV.equals(mediaTypeName) || AVI.equals(mediaTypeName)) {
|
||||
return Resources.getIconMovie();
|
||||
|
@ -1316,7 +1337,12 @@ public class Resources {
|
|||
return Resources.getIconOdp();
|
||||
}else if (mediaTypeName.contains(EXCEL) || mediaTypeName.contains(XSLX)) {
|
||||
return Resources.getIconExcel();
|
||||
}else if (mediaTypeName.contains(ZIP)) {
|
||||
}else if (mediaTypeName.contains(ZIP) || mediaTypeName.contains(SEVEN_ZIP)) {
|
||||
int fe = name.lastIndexOf(".");
|
||||
String fileExtension = name.substring(fe+1, name.length());
|
||||
if(fileExtension.compareTo("jar")==0)
|
||||
return Resources.getIconJava();
|
||||
|
||||
return Resources.getIconZip();
|
||||
}else if (mediaTypeName.contains(DVI)) {
|
||||
return Resources.getIconDvi();
|
||||
|
@ -1326,6 +1352,10 @@ public class Resources {
|
|||
return Resources.getIconXTex();
|
||||
}else if (mediaTypeName.contains(POSTSCRIPT)) {
|
||||
return Resources.getIconPostscript();
|
||||
}else if (mediaTypeName.contains(RAR) || mediaTypeName.contains(GZIP) || mediaTypeName.contains(X_BZIP)) {
|
||||
return Resources.getIconArchive();
|
||||
}else if (mediaTypeName.contains(WAR)) {
|
||||
return Resources.getIconJava();
|
||||
}
|
||||
return Resources.getIconTable();
|
||||
}
|
||||
|
@ -1384,13 +1414,15 @@ public class Resources {
|
|||
return Resources.getIconTable();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the icon by type.
|
||||
*
|
||||
* @param name the name
|
||||
* @param type the type
|
||||
* @return the icon by type
|
||||
*/
|
||||
public static AbstractImagePrototype getIconByType(String type){
|
||||
public static AbstractImagePrototype getIconByType(String name, String type){
|
||||
|
||||
if(type.equals(GXTFolderItemTypeEnum.FOLDER.toString()))
|
||||
return Resources.getIconFolder();
|
||||
|
@ -1398,7 +1430,8 @@ public class Resources {
|
|||
//RECOVERING "mediat type name" from type / media type name [+suffix]
|
||||
int sl = type.indexOf("/");
|
||||
String mediaTypeName = type.substring(sl+1, type.length());
|
||||
return Resources.getIconByMediaTypeName(mediaTypeName);
|
||||
|
||||
return Resources.getIconByMediaTypeName(name, mediaTypeName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 866 B |
Binary file not shown.
After Width: | Height: | Size: 554 B |
Binary file not shown.
Before Width: | Height: | Size: 642 B |
|
@ -145,7 +145,7 @@ public class AsyncTreePanel extends LayoutContainer {
|
|||
// model.setIcon();
|
||||
if (!model.isDirectory()) {
|
||||
if(model.getType()!=null)
|
||||
return Resources.getIconByType(model.getType());
|
||||
return Resources.getIconByType(model.getName(), model.getType());
|
||||
|
||||
return Resources.getIconByFolderItemType(model.getGXTFolderItemType());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue