diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index 0388ffd..1f3b78f 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -921,7 +921,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt @Override public void onSuccess(Boolean result) { - //Timer is used for chrome + //Timer is used as work around to chrome and safari browser Timer t = new Timer() { public void run() { @@ -934,7 +934,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } }; - // Schedule the timer to run once every second, 1000 ms. + // Schedule the timer to run after 250 ms. t.schedule(250); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java index 63cdc09..aa60386 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java @@ -98,6 +98,7 @@ public class ConstantsExplorer { public static final String NAME = "Name"; public static final String TYPE = "Type"; public static final String ICON = "Icon"; + public static final String ABSTRACTICON = "Abstract Icon"; public static final String SHORTCUTCATEGORY = "Category"; // public static final String GRIDCOLUMNTYPE = "Type"; public static final String IDENTIFIER = "identifier"; @@ -172,7 +173,7 @@ public class ConstantsExplorer { public static final String ID = "id"; public static final String ATTACHS = "Attachs"; public static final Object NONE = "None"; - public static final String ABSTRACTICON = "Abstract Icon"; + public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)"); 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 d1e83db..8f9c0ee 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 @@ -118,33 +118,22 @@ public class FileModel extends BaseModelData implements Serializable { public void setIcon() { - AbstractImagePrototype absImgPr = Resources.getIconTable(); + Image icon = (Image) get(ConstantsExplorer.ICON); + AbstractImagePrototype iconAbs; + if(icon==null) + iconAbs = getAbstractPrototypeIcon(); + else + return; - if (!this.isDirectory()) { //IS FILE - if(this.getType()!=null) - absImgPr = Resources.getIconByType(this.getType()); - else - absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType()); - - }else if(this.isShared()){ //SHARED ITEM? - - if(this.isShareable()) //IS ROOT SHARED FOLDER - absImgPr = Resources.getIconSharedFolder(); - else - absImgPr = Resources.getIconFolder(); //IS A DESCENDANT - - - }else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING - absImgPr = Resources.getIconLoading2(); - - }else{//SIMPLE FOLDER - absImgPr = Resources.getIconFolder(); - } - - set(ConstantsExplorer.ICON, absImgPr.createImage()); - set(ConstantsExplorer.ABSTRACTICON, absImgPr); + set(ConstantsExplorer.ICON, iconAbs.createImage()); + set(ConstantsExplorer.ABSTRACTICON, iconAbs); } +// public void resetIcons(){ +// set(ConstantsExplorer.ICON,null); +// set(ConstantsExplorer.ABSTRACTICON, null); +// } + public void setOwner(InfoContactModel owner){ set(ConstantsExplorer.OWNER, owner); } @@ -190,16 +179,50 @@ public class FileModel extends BaseModelData implements Serializable { public Image getIcon() { - return (Image) get(ConstantsExplorer.ICON); + return getAbstractPrototypeIcon().createImage(); } public AbstractImagePrototype getAbstractPrototypeIcon() { - if((AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON)==null) - setIcon(); - return (AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON); + + AbstractImagePrototype absImgPr = Resources.getIconTable(); + + if (!this.isDirectory()) { //IS FILE + if(this.getType()!=null) + absImgPr = Resources.getIconByType(this.getType()); + else + absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType()); + + }else if(this.isShared()){ //SHARED ITEM? + + if(this.isShareable()) //IS ROOT SHARED FOLDER + absImgPr = Resources.getIconSharedFolder(); + else + absImgPr = Resources.getIconFolder(); //IS A DESCENDANT + + + }else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING + absImgPr = Resources.getIconLoading2(); + + }else{//SIMPLE FOLDER + absImgPr = Resources.getIconFolder(); + } + + return absImgPr; } + +// public Image getIcon() { +// return (Image) get(ConstantsExplorer.ICON); +// } +// +// public AbstractImagePrototype getAbstractPrototypeIcon() { +// if((AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON)==null) +// setIcon(); +// return (AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON); +// } + + public String getStatus() { return get("status"); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java index 5f4dd74..5ab6fc2 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java @@ -59,7 +59,7 @@ public class DialogGetInfo extends Dialog { setWidth(widthDialog); setResizable(false); setButtons(Dialog.OK); - + txtName = new TextField(); txtName.setFieldLabel("Name"); txtName.setReadOnly(true); @@ -149,7 +149,7 @@ public class DialogGetInfo extends Dialog { }); - + System.out.println("fileModel in getinfo "+fileModel); this.show(); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java index ad31421..512fa8a 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java @@ -244,7 +244,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT @Override public List getFolderChildrenForFileGrid(FileModel folder) throws Exception { - Workspace workspace; try { @@ -279,7 +278,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT } catch (Exception e) { workspaceLogger.error("Error in server During items retrieving", e); // workspaceLogger.trace("Error in server During items retrieving " + e); - + e.printStackTrace(); //GWT can't serialize all exceptions throw new Exception("Error during item loading, please contact the support."); }