bug fixed icons

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@71868 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-03-28 09:40:56 +00:00
parent 568a838682
commit c0bf5198bb
5 changed files with 58 additions and 35 deletions

View File

@ -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);
}

View File

@ -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)");

View File

@ -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");
}

View File

@ -59,7 +59,7 @@ public class DialogGetInfo extends Dialog {
setWidth(widthDialog);
setResizable(false);
setButtons(Dialog.OK);
txtName = new TextField<String>();
txtName.setFieldLabel("Name");
txtName.setReadOnly(true);
@ -149,7 +149,7 @@ public class DialogGetInfo extends Dialog {
});
System.out.println("fileModel in getinfo "+fileModel);
this.show();
}

View File

@ -244,7 +244,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
@Override
public List<FileGridModel> 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.");
}