From d95451266f0c158cdc0bc63cb7834d53172ac0cd Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Tue, 14 Jul 2015 13:45:34 +0000 Subject: [PATCH] 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 --- .../workspace/client/model/FileModel.java | 2 +- .../workspace/client/resources/Icons.java | 9 ++-- .../workspace/client/resources/Resources.java | 41 ++++++++++++++++-- .../client/resources/icons/archive-icon.png | Bin 0 -> 866 bytes .../workspace/client/resources/icons/java.gif | Bin 0 -> 554 bytes .../client/resources/icons/mime/java.gif | Bin 642 -> 0 bytes .../client/view/tree/AsyncTreePanel.java | 2 +- 7 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/archive-icon.png create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/java.gif delete mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/mime/java.gif diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java index 03eee25..0a62786 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java @@ -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()); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java index f17b011..e5f993f 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java @@ -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(); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java index 754c5b8..1946f84 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.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); } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/archive-icon.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/archive-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1c81c0a2fb3350cf8ed343052b8a849d23bb2461 GIT binary patch literal 866 zcmV-o1D*VdP)ukPyV>eqCQGnr{Rah%wOh!G-!NGya13XZtYUMOx8j3#QB|GBP$AopQ;x=+tpxVtmJc_zWDlw{cXV7ndO>o*~9aP8ijys#8iKE9F!;?6z3X z2~^f=Cd2BDDf+!GdYw%)_8&+AzMo)g$N-;x@TO5J$vR~MS)F1IBn&z?nN^BHMT0m2 zumy1W7aJYHv zwocxAr+M-I+RXED=p$cd71_E5%)unovc{_WsRQ3*tBnE_iWSxYhnR9Ww`LqBjXg7s zM;7Oo4?p>6b9Sz#@I1E-$d{Pa&`kl8;5Y%vm_uu`d+TfCm({lEo=M-r(~s|yTJ8SA z{)Jt~mYzBEYEB#%X*7aTtg_2wr4=K_`1|_Cm2ZDsUmZpC{QOL1>*5c;kIB6+>(If6 z#MbRz{lWV5(dV8z_*%WbTeB^b{`}|FOPBw+wi?Cb@Ak}V?%MaijsN!=?~Nx8JRo%X s*4%xS{0pY#txuH-zy7p-&EF~aU*$-7)|>~CI{*Lx07*qoM6N<$f>p$&^#A|> literal 0 HcmV?d00001 diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/java.gif b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/java.gif new file mode 100644 index 0000000000000000000000000000000000000000..a72a208dd61881f76284a7e5342bcf58f9d89366 GIT binary patch literal 554 zcmZ?wbhEHb6krfwI2O&oAgOklf#C)N!z~7e2Mi1k85kHG{2y~OJmFz@#>>Ft7Rcru z^IU{MCNfJpI$J6xMeV}*XstQC3lRuwH;U$c5^&FXEnYj(D++S;~$=dbDE zJsWm?otHRk`@vZ|4lmewVBx`&zcv=GI()k3+UE_Yul(3M@&BRHomX!EJvM*e<(t3G zubKby|KDrtZr!2%dvv=Nnxc~OUv$ya6zP$DK^_{05KK*-h_ua=2 zPrv+l^X1!{uirm@`~LaI&)2{Hef{y{*AF26_3QWVpMU=R`t$eypYQ+w{{8>|&wu&? z#h)yU3=H)QI>3Mj#)tp|1ABWzbW?M)jeAQ+hm3h=uNOyeryWbQvem>UW7cSPj~UUC zOwpVX^P700nVptJ>*zT%&M=AgjJAjpZ;}n_P-8GLw3Ref^p580bk%aP5A+F+4&d$d z6H*ct6V?n9oT%y$;%hm>EZSOtpHC#TDZGW7P2a!8(LhDJL&Hc;N?Jie-fxS6l7;|- FH2_x4NL~N{ literal 0 HcmV?d00001 diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/mime/java.gif b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/mime/java.gif deleted file mode 100644 index e3ef5566b2ddc734ff93548f9ab9ab0d4df5a56a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 642 zcmZ?wbhEHb6krfwc*el+?c28}Po6w}{P^qFuXpa;dHM3?{rmSHJa`aUHRbKww}1Zp zdG_qt%PQeluU_4|ckkiDha2`D?OeFEddiBsckg^5siP!<1DU zwr)Fga>DXmCB2K%TW0_I^((BX-9M)>rM54lZEkF3-|gGCZ#;at>B!}X%E=KW?M<`S z=d{m$@#4j_HT&Pcf4^bx@mD)K+ZSxoyXW=A zT`x*`o<4p0x>fDnyLT_^q}u1Md(x!xrq5#bnq7|`J&LQH_FzN9s}{8ldyiecdiBH2 zBeAv9JLau_*<~DAIr-YPYcIAm#n(-Lv3JVq-N)a&dGqt<&%b~F{{HRmy z{`}#?hwtCN+r|{l-+JQt^XCjS28usfz&7ZBNKl+Ou-|V`Q;%zDZEI0i)8^x36&B`m zbmL<(H+5mr7Gw>b8yan3t7pYLmsL zqmD)MoH!YMj8RA>GMl{Vykiy@lL-m` z9xfkc>BRgaL?)z$(IKFFihTS6nTt*zy1V%Jw|OkN^yDC)RtSsEhmQ-K*_e366e5fc zu{8-gyBMvUz<6Xb10!FB!$X$Vc4pTGnFWkZO^jl}NePl(BHqkeY#I&%7niQQyxiB- JfrEv?8UW687WDuC diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java index 47a112a..0f6bc4c 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/AsyncTreePanel.java @@ -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()); }