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
This commit is contained in:
Francesco Mangiacrapa 2013-03-26 10:41:25 +00:00
parent 50efbef1c7
commit 1efcd00cd8
6 changed files with 57 additions and 29 deletions

View File

@ -19,13 +19,6 @@ public class FileDetailsModel extends FileGridModel {
protected FileDetailsModel() { 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) { 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); super(identifier,name,path,creationDate,parent,size,isDirectory, isShared);

View File

@ -118,17 +118,15 @@ public class FileModel extends BaseModelData implements Serializable {
public void setIcon() { public void setIcon() {
AbstractImagePrototype absImgPr = null; AbstractImagePrototype absImgPr = Resources.getIconTable();
if (!this.isDirectory()) { if (!this.isDirectory()) { //IS FILE
if(this.getType()!=null) if(this.getType()!=null)
absImgPr = Resources.getIconByType(this.getType()); absImgPr = Resources.getIconByType(this.getType());
// absImgPr = Resources.getImageCancel();
else else
absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType()); absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType());
}
//SHARED FOLDER }else if(this.isShared()){ //SHARED ITEM?
else if(this.isShared()){
if(this.isShareable()) //IS ROOT SHARED FOLDER if(this.isShareable()) //IS ROOT SHARED FOLDER
absImgPr = Resources.getIconSharedFolder(); absImgPr = Resources.getIconSharedFolder();
@ -136,8 +134,10 @@ public class FileModel extends BaseModelData implements Serializable {
absImgPr = Resources.getIconFolder(); //IS A DESCENDANT absImgPr = Resources.getIconFolder(); //IS A DESCENDANT
} }else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING
else{//SIMPLE FOLDER absImgPr = Resources.getIconLoading2();
}else{//SIMPLE FOLDER
absImgPr = Resources.getIconFolder(); absImgPr = Resources.getIconFolder();
} }
@ -194,6 +194,8 @@ public class FileModel extends BaseModelData implements Serializable {
} }
public AbstractImagePrototype getAbstractPrototypeIcon() { public AbstractImagePrototype getAbstractPrototypeIcon() {
if((AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON)==null)
setIcon();
return (AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON); return (AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON);
} }

View File

@ -134,17 +134,14 @@ public class AsyncTreePanel extends LayoutContainer {
treePanel.setIconProvider(new ModelIconProvider<FileModel>() { treePanel.setIconProvider(new ModelIconProvider<FileModel>() {
public AbstractImagePrototype getIcon(FileModel model) { public AbstractImagePrototype getIcon(FileModel model) {
// if (!(model instanceof FolderModel)) { // model.setIcon();
if (!model.isDirectory()) { if (!model.isDirectory()) {
// String ext = model.getName().substring(model.getName().lastIndexOf(".") + 1);
if(model.getType()!=null) if(model.getType()!=null)
// System.out.println("Mime Type:" + model.getMimeType());
return Resources.getIconByType(model.getType()); return Resources.getIconByType(model.getType());
return Resources.getIconByFolderItemType(model.getGXTFolderItemType()); return Resources.getIconByFolderItemType(model.getGXTFolderItemType());
} }
if(model.getStatus() == ConstantsExplorer.FOLDERNOTLOAD) if(model.getStatus() == ConstantsExplorer.FOLDERNOTLOAD)
return Resources.getIconLoading2(); return Resources.getIconLoading2();
@ -155,8 +152,6 @@ public class AsyncTreePanel extends LayoutContainer {
else else
return null; //Set default folder icon return null; //Set default folder icon
} }
// return Resources.getIconFolder();
return null; //Set default folder icon return null; //Set default folder icon
} }
}); });

View File

@ -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.model.FileModel;
import org.gcube.portlets.user.workspace.client.resources.Resources; 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.MenuEvent;
import com.extjs.gxt.ui.client.event.SelectionListener; 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.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem; import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem; import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;

View File

@ -65,6 +65,17 @@ public class DialogGetInfo extends Dialog {
textFieldSetValue(txtName,fileModel.getName()); textFieldSetValue(txtName,fileModel.getName());
add(txtName); add(txtName);
txtLocation = new TextField<String>();
txtLocation.setFieldLabel("Location");
txtLocation.setReadOnly(true);
if(fileModel.isRoot())
txtLocation.setValue("/");
else
loadLocation(fileModel.getIdentifier());
add(txtLocation);
txtType = new TextField<String>(); txtType = new TextField<String>();
txtType.setFieldLabel("Type"); txtType.setFieldLabel("Type");
txtType.setReadOnly(true); txtType.setReadOnly(true);
@ -116,7 +127,7 @@ public class DialogGetInfo extends Dialog {
textAreaSharedWith.setFieldLabel("Shared with"); textAreaSharedWith.setFieldLabel("Shared with");
textAreaSharedWith.setHeight(heightTextArea); textAreaSharedWith.setHeight(heightTextArea);
textAreaSharedWith.setReadOnly(true); textAreaSharedWith.setReadOnly(true);
getListSharedContacts(fileModel.getIdentifier()); loadListSharedContacts(fileModel.getIdentifier());
add(textAreaSharedWith); add(textAreaSharedWith);
} }
@ -206,7 +217,7 @@ public class DialogGetInfo extends Dialog {
}); });
} }
private void getListSharedContacts(String sharedId){ private void loadListSharedContacts(String sharedId){
textAreaSharedWith.mask(); textAreaSharedWith.mask();
@ -248,6 +259,38 @@ public class DialogGetInfo extends Dialog {
return ""; return "";
} }
private void loadLocation(String itemId){
txtLocation.mask();
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemId, new AsyncCallback<List<FileModel>>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("failure get list parents by item identifier "+caught);
txtLocation.unmask();
}
@Override
public void onSuccess(List<FileModel> result) {
String location="";
if(result!=null){
for (FileModel fileModel : result) {
location+="/"+fileModel.getName();
}
}
if(location.isEmpty())
location ="/";
txtLocation.setValue(location);
txtLocation.unmask();
}
});
}
} }

View File

@ -3,7 +3,6 @@
*/ */
package org.gcube.portlets.user.workspace.server.notifications; package org.gcube.portlets.user.workspace.server.notifications;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.ASLSession;