From 1efcd00cd8cd3b00270e8484a04eca2fc1bca7dc Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Tue, 26 Mar 2013 10:41:25 +0000 Subject: [PATCH] get icon in get info fixed git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@71773 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/model/FileDetailsModel.java | 7 --- .../workspace/client/model/FileModel.java | 18 +++---- .../client/view/tree/AsyncTreePanel.java | 9 +--- .../client/view/tree/ContextMenuTree.java | 4 -- .../client/view/windows/DialogGetInfo.java | 47 ++++++++++++++++++- .../notifications/NotificationsProducer.java | 1 - 6 files changed, 57 insertions(+), 29 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java index d543f16..484829c 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java @@ -19,13 +19,6 @@ public class FileDetailsModel extends FileGridModel { protected FileDetailsModel() { } -// public FileDetailsModel(String identifier, String name, String path, String creationDate, String parent, String size, boolean isDirectory, String lastModified, String description) { -// super(identifier, name, path, creationDate, parent, size, isDirectory); -// -// this.setDescription(description); -// this.setLastModified(lastModified); -// } - public FileDetailsModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, String description, Date lastModified, InfoContactModel owner, boolean isShared) { super(identifier,name,path,creationDate,parent,size,isDirectory, isShared); 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 5487e10..d1e83db 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,17 +118,15 @@ public class FileModel extends BaseModelData implements Serializable { public void setIcon() { - AbstractImagePrototype absImgPr = null; + AbstractImagePrototype absImgPr = Resources.getIconTable(); - if (!this.isDirectory()) { + if (!this.isDirectory()) { //IS FILE if(this.getType()!=null) absImgPr = Resources.getIconByType(this.getType()); -// absImgPr = Resources.getImageCancel(); else absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType()); - } - //SHARED FOLDER - else if(this.isShared()){ + + }else if(this.isShared()){ //SHARED ITEM? if(this.isShareable()) //IS ROOT SHARED FOLDER absImgPr = Resources.getIconSharedFolder(); @@ -136,8 +134,10 @@ public class FileModel extends BaseModelData implements Serializable { absImgPr = Resources.getIconFolder(); //IS A DESCENDANT - } - else{//SIMPLE FOLDER + }else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING + absImgPr = Resources.getIconLoading2(); + + }else{//SIMPLE FOLDER absImgPr = Resources.getIconFolder(); } @@ -194,6 +194,8 @@ public class FileModel extends BaseModelData implements Serializable { } public AbstractImagePrototype getAbstractPrototypeIcon() { + if((AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON)==null) + setIcon(); return (AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON); } 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 a35e525..c41110c 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 @@ -134,17 +134,14 @@ public class AsyncTreePanel extends LayoutContainer { treePanel.setIconProvider(new ModelIconProvider() { public AbstractImagePrototype getIcon(FileModel model) { -// if (!(model instanceof FolderModel)) { +// model.setIcon(); if (!model.isDirectory()) { -// String ext = model.getName().substring(model.getName().lastIndexOf(".") + 1); if(model.getType()!=null) -// System.out.println("Mime Type:" + model.getMimeType()); return Resources.getIconByType(model.getType()); return Resources.getIconByFolderItemType(model.getGXTFolderItemType()); } - - + if(model.getStatus() == ConstantsExplorer.FOLDERNOTLOAD) return Resources.getIconLoading2(); @@ -155,8 +152,6 @@ public class AsyncTreePanel extends LayoutContainer { else return null; //Set default folder icon } - -// return Resources.getIconFolder(); return null; //Set default folder icon } }); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java index 63f7a86..13cff11 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java @@ -26,12 +26,8 @@ import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent; import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.resources.Resources; -import com.extjs.gxt.ui.client.Style.ButtonArrowAlign; -import com.extjs.gxt.ui.client.Style.ButtonScale; -import com.extjs.gxt.ui.client.Style.IconAlign; import com.extjs.gxt.ui.client.event.MenuEvent; import com.extjs.gxt.ui.client.event.SelectionListener; -import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.menu.Menu; import com.extjs.gxt.ui.client.widget.menu.MenuItem; import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem; 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 ad8d048..cd579ff 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 @@ -65,6 +65,17 @@ public class DialogGetInfo extends Dialog { textFieldSetValue(txtName,fileModel.getName()); add(txtName); + txtLocation = new TextField(); + txtLocation.setFieldLabel("Location"); + txtLocation.setReadOnly(true); + + if(fileModel.isRoot()) + txtLocation.setValue("/"); + else + loadLocation(fileModel.getIdentifier()); + + add(txtLocation); + txtType = new TextField(); txtType.setFieldLabel("Type"); txtType.setReadOnly(true); @@ -116,7 +127,7 @@ public class DialogGetInfo extends Dialog { textAreaSharedWith.setFieldLabel("Shared with"); textAreaSharedWith.setHeight(heightTextArea); textAreaSharedWith.setReadOnly(true); - getListSharedContacts(fileModel.getIdentifier()); + loadListSharedContacts(fileModel.getIdentifier()); add(textAreaSharedWith); } @@ -206,7 +217,7 @@ public class DialogGetInfo extends Dialog { }); } - private void getListSharedContacts(String sharedId){ + private void loadListSharedContacts(String sharedId){ textAreaSharedWith.mask(); @@ -247,6 +258,38 @@ public class DialogGetInfo extends Dialog { }else return ""; } + + private void loadLocation(String itemId){ + + txtLocation.mask(); + AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemId, new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + GWT.log("failure get list parents by item identifier "+caught); + txtLocation.unmask(); + } + + @Override + public void onSuccess(List result) { + + String location=""; + + if(result!=null){ + + for (FileModel fileModel : result) { + location+="/"+fileModel.getName(); + } + } + if(location.isEmpty()) + location ="/"; + + txtLocation.setValue(location); + txtLocation.unmask(); + } + }); + + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java b/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java index 6f5acbd..48937ff 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/notifications/NotificationsProducer.java @@ -3,7 +3,6 @@ */ package org.gcube.portlets.user.workspace.server.notifications; -import java.util.HashMap; import java.util.List; import org.gcube.application.framework.core.session.ASLSession;