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() {
}
// 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);

View File

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

View File

@ -134,17 +134,14 @@ public class AsyncTreePanel extends LayoutContainer {
treePanel.setIconProvider(new ModelIconProvider<FileModel>() {
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
}
});

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.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;

View File

@ -65,6 +65,17 @@ public class DialogGetInfo extends Dialog {
textFieldSetValue(txtName,fileModel.getName());
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.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<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;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.framework.core.session.ASLSession;