Updated in order to use setPublic(boolean bool)

Updated icons

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@131398 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-09-15 14:42:20 +00:00
parent 554b237a81
commit 51df7faa73
33 changed files with 776 additions and 870 deletions

View File

@ -17,8 +17,6 @@ import org.gcube.portlets.user.workspace.client.event.AddFolderEvent;
import org.gcube.portlets.user.workspace.client.event.AddFolderEventHandler; import org.gcube.portlets.user.workspace.client.event.AddFolderEventHandler;
import org.gcube.portlets.user.workspace.client.event.AddSmartFolderEvent; import org.gcube.portlets.user.workspace.client.event.AddSmartFolderEvent;
import org.gcube.portlets.user.workspace.client.event.AddSmartFolderEventHandler; import org.gcube.portlets.user.workspace.client.event.AddSmartFolderEventHandler;
import org.gcube.portlets.user.workspace.client.event.BulkCreatorEvent;
import org.gcube.portlets.user.workspace.client.event.BulkCreatorEventHandler;
import org.gcube.portlets.user.workspace.client.event.CompletedFileUploadEvent; import org.gcube.portlets.user.workspace.client.event.CompletedFileUploadEvent;
import org.gcube.portlets.user.workspace.client.event.CompletedFileUploadEventHandler; import org.gcube.portlets.user.workspace.client.event.CompletedFileUploadEventHandler;
import org.gcube.portlets.user.workspace.client.event.CopytemEvent; import org.gcube.portlets.user.workspace.client.event.CopytemEvent;
@ -113,7 +111,6 @@ import org.gcube.portlets.user.workspace.client.view.sharing.DialogShareFolder;
import org.gcube.portlets.user.workspace.client.view.sharing.UserStore; import org.gcube.portlets.user.workspace.client.view.sharing.UserStore;
import org.gcube.portlets.user.workspace.client.view.sharing.permissions.DialogPermission; import org.gcube.portlets.user.workspace.client.view.sharing.permissions.DialogPermission;
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel; import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
import org.gcube.portlets.user.workspace.client.view.windows.BulkCreatorWindow;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart; import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart.AddType; import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart.AddType;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddUrl; import org.gcube.portlets.user.workspace.client.view.windows.DialogAddUrl;
@ -178,19 +175,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public static final GWTWorkspaceServiceAsync rpcWorkspaceService = (GWTWorkspaceServiceAsync) GWT.create(GWTWorkspaceService.class); public static final GWTWorkspaceServiceAsync rpcWorkspaceService = (GWTWorkspaceServiceAsync) GWT.create(GWTWorkspaceService.class);
private ExplorerPanel explorerPanel; private ExplorerPanel explorerPanel;
private final static HandlerManager eventBus = new HandlerManager(null); private final static HandlerManager eventBus = new HandlerManager(null);
private HashMap<EventsTypeEnum, ArrayList<SubscriberInterface>> subscribers = null; private HashMap<EventsTypeEnum, ArrayList<SubscriberInterface>> subscribers = null;
private boolean selectRootItem; private boolean selectRootItem;
// private FileUploader fileUploader;
public static String myLogin; public static String myLogin;
public static String myLoginFirstName; public static String myLoginFirstName;
public static Boolean ckanEditorOrAdmin; public static Boolean ckanEditorOrAdmin;
//PRE-LOAD LIST OF USER FORM LIFERAY //PRE-LOAD LIST OF USER FORM LIFERAY
private UserStore userStore = new UserStore(); private UserStore userStore = new UserStore();
private static AppControllerExplorer singleton; private static AppControllerExplorer singleton;
/** /**
@ -307,7 +299,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
// TODO Auto-generated method stub // TODO Auto-generated method stub
if(getFolderLinkEvent.getSourceFile()!=null){ if(getFolderLinkEvent.getSourceFile()!=null){
GWT.log("getFolderLinkEvent.getSourceFile() "+getFolderLinkEvent.getSourceFile()); GWT.log("getFolderLinkEvent.getSourceFile() "+getFolderLinkEvent.getSourceFile());
DialogGetLink dialog = new DialogGetLink("Copy to clipboard Folder Link: Ctrl+C", getFolderLinkEvent.getSourceFile().getIdentifier(), Link_Type.FOLDER_LINK); DialogGetLink dialog = new DialogGetLink("Copy to clipboard Folder Link: Ctrl+C", getFolderLinkEvent.getSourceFile(), Link_Type.FOLDER_LINK);
dialog.show(); dialog.show();
} }
} }
@ -694,7 +686,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void onGetPublicLink(GetPublicLinkEvent getPublicLinkEvent) { public void onGetPublicLink(GetPublicLinkEvent getPublicLinkEvent) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if(getPublicLinkEvent.getSourceFile()!=null){ if(getPublicLinkEvent.getSourceFile()!=null){
DialogGetLink dialog = new DialogGetLink("Copy to clipboard Public Link: Ctrl+C", getPublicLinkEvent.getSourceFile().getIdentifier(), Link_Type.PUBLIC_LINK); DialogGetLink dialog = new DialogGetLink("Copy to clipboard Public Link: Ctrl+C", getPublicLinkEvent.getSourceFile(), Link_Type.PUBLIC_LINK);
dialog.show(); dialog.show();
} }
} }
@ -735,18 +727,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} }
}); });
eventBus.addHandler(BulkCreatorEvent.TYPE, new BulkCreatorEventHandler() {
@Override
public void onBulkCreator(BulkCreatorEvent bulkCreatorEvent) {
boolean isLoading = BulkCreatorWindow.getInstance().addProgressBar(bulkCreatorEvent.getListBulks());
explorerPanel.setLoadingBulk(isLoading);
}
});
eventBus.addHandler(CopytemEvent.TYPE, new CopytemEventHandler() { eventBus.addHandler(CopytemEvent.TYPE, new CopytemEventHandler() {
@Override @Override
@ -2591,9 +2571,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
params+=ConstantsExplorer.REDIRECTONERROR+"="+windowOpenParam.isRedirectOnError(); params+=ConstantsExplorer.REDIRECTONERROR+"="+windowOpenParam.isRedirectOnError();
windowOpenParam.getBrowserWindow().setUrl(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+params); windowOpenParam.getBrowserWindow().setUrl(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+params);
// com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+params, windowOpenParam.getOption(), "");
} }
}; };

View File

@ -114,23 +114,9 @@ public class ConstantsExplorer {
//FILE MODEL e Smart Folder constants //FILE MODEL e Smart Folder constants
public static final String ROOT = "root"; public static final String ROOT = "root";
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 GRIDCOLUMNTYPE = "Type";
public static final String IDENTIFIER = "identifier";
public static final String FOLDERITEMTYPE = "folderItemType";
public static final String PARENT = "parent";
public static final String ISDIRECTORY = "isDirectory";
public static final String SHAREUSERS = "shareUsers";
public static final String ISSHARED = "isShared";
public static final String LASTMODIFIED = "lastModified";
public static final String DESCRIPTION = "description";
public static final String OWNER = "Owner";
public static final String OWNERFULLNAME = "Owner Name";
public static final String QUERY = "query";
public static final String FOLDERNOTLOAD = "notload"; public static final String FOLDERNOTLOAD = "notload";
public static final String FOLDERLOADED = "loaded"; public static final String FOLDERLOADED = "loaded";
public static final String MARKASREAD = "MARKASREAD"; public static final String MARKASREAD = "MARKASREAD";
@ -140,9 +126,7 @@ public class ConstantsExplorer {
//GRID COLUMNS constants //GRID COLUMNS constants
public static final String GRIDCOLUMNCREATIONDATE = "Creation Date";
public static final String SIZE = "Size";
public static final String EMPTY = "EMPTY";
public static Map<String, String> operations = new HashMap<String, String>(); public static Map<String, String> operations = new HashMap<String, String>();

View File

@ -1,31 +0,0 @@
package org.gcube.portlets.user.workspace.client.event;
import java.util.List;
import org.gcube.portlets.user.workspace.client.model.BulkCreatorModel;
import com.google.gwt.event.shared.GwtEvent;
public class BulkCreatorEvent extends GwtEvent<BulkCreatorEventHandler> {
public static Type<BulkCreatorEventHandler> TYPE = new Type<BulkCreatorEventHandler>();
private List<BulkCreatorModel> listBulks;
public BulkCreatorEvent(List<BulkCreatorModel> listBulks) {
this.listBulks = listBulks;
}
@Override
public Type<BulkCreatorEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(BulkCreatorEventHandler handler) {
handler.onBulkCreator(this);
}
public List<BulkCreatorModel> getListBulks() {
return listBulks;
}
}

View File

@ -1,7 +0,0 @@
package org.gcube.portlets.user.workspace.client.event;
import com.google.gwt.event.shared.EventHandler;
public interface BulkCreatorEventHandler extends EventHandler {
void onBulkCreator(BulkCreatorEvent bulkCreatorEvent);
}

View File

@ -27,16 +27,18 @@ public enum GXTFolderItemTypeEnum implements Serializable {
ANNOTATION("Annotation"), ANNOTATION("Annotation"),
FOLDER("Folder"), FOLDER("Folder"),
GCUBE_ITEM("Gcube Item"), GCUBE_ITEM("Gcube Item"),
SHARED_FOLDER("Shared Folder"); FOLDER_SHARED("Shared Folder"),
FOLDER_PUBLIC("Public Folder"),
FOLDER_SHARED_PUBLIC("Shared and Public Folder");
protected String label; protected String label;
GXTFolderItemTypeEnum(){} GXTFolderItemTypeEnum(){}
GXTFolderItemTypeEnum(String label) GXTFolderItemTypeEnum(String label)
{ {
this.label = label; this.label = label;
} }
public String getLabel() public String getLabel()
{ {

View File

@ -1,102 +0,0 @@
package org.gcube.portlets.user.workspace.client.model;
import java.io.Serializable;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import com.extjs.gxt.ui.client.data.BaseModelData;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class BulkCreatorModel extends BaseModelData implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
// public enum DownloadState implements Serializable {
// ONGOING, FAILED, COMPLETED
// }
public static int ONGOING = 0;
public static int FAILED = 2;
public static int COMPLETED = 1;
public BulkCreatorModel(){
}
public BulkCreatorModel(String identifier, String name, float percentage) {
setIdentifier(identifier);
setName(name);
setPercentage(percentage);
}
/**
* state values: ONGOING = 0; FAILED = -1; COMPLETED = 1;
*
* @param identifier
* @param name
* @param percentage
* @param state
*/
public BulkCreatorModel(String identifier, String name, float percentage, int state, int requestsNumber, int failuresNumber) {
this(identifier,name,percentage);
setState(state);
setRequestsNumber(requestsNumber);
setFailuersNumber(failuresNumber);
}
private void setState(int state) {
set(ConstantsExplorer.DOWNLOADSTATE, state);
}
private void setRequestsNumber(int reqs) {
set(ConstantsExplorer.NUMREQUESTS, reqs);
}
private void setFailuersNumber(int fails) {
set(ConstantsExplorer.NUMFAILS, fails);
}
public void setIdentifier(String identifier) {
set(ConstantsExplorer.IDENTIFIER, identifier);
}
public String getIdentifier(){
return get(ConstantsExplorer.IDENTIFIER);
}
private void setName(String name) {
set(ConstantsExplorer.NAME, name);
}
public String getName() {
return get(ConstantsExplorer.NAME);
}
public void setPercentage(float percentage){
set(ConstantsExplorer.STATUS, percentage);
}
public float getPercentage(){
return (Float)get(ConstantsExplorer.STATUS);
}
public int getState(){
return (Integer)get(ConstantsExplorer.DOWNLOADSTATE);
}
public int getNumRequests(){
return (Integer)get(ConstantsExplorer.NUMREQUESTS);
}
public int getNumFails(){
return (Integer)get(ConstantsExplorer.NUMFAILS);
}
}

View File

@ -2,8 +2,6 @@ package org.gcube.portlets.user.workspace.client.model;
import java.util.Date; import java.util.Date;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
@ -13,7 +11,7 @@ import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
public class FileDetailsModel extends FileGridModel { public class FileDetailsModel extends FileGridModel {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -22,20 +20,20 @@ public class FileDetailsModel extends FileGridModel {
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);
setLastModified(lastModified); setLastModified(lastModified);
setDescription(description); setDescription(description);
// setOwner(owner); // setOwner(owner);
} }
public void setLastModified(Date lastModified) { public void setLastModified(Date lastModified) {
set(ConstantsExplorer.LASTMODIFIED, lastModified); set(FileGridModel.LASTMODIFIED, lastModified);
} }
public String getDescription(){ public String getDescription(){
return get(ConstantsExplorer.DESCRIPTION); return get(FileGridModel.DESCRIPTION);
} }
} }

View File

@ -2,19 +2,25 @@ package org.gcube.portlets.user.workspace.client.model;
import java.util.Date; import java.util.Date;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
/** /**
* The Class FileGridModel. * The Class FileGridModel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Nov 17, 2015 * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Sep 15, 2016
*/ */
public class FileGridModel extends FileModel { public class FileGridModel extends FileModel {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 2851920950408676250L;
public static final String LASTMODIFIED = "lastModified";
public static final String DESCRIPTION = "description";
public static final String SIZE = "Size";
public static final String GRIDCOLUMNCREATIONDATE = "Creation Date";
public static final String EMPTY = "EMPTY";
/** /**
* Instantiates a new file grid model. * Instantiates a new file grid model.
@ -84,7 +90,7 @@ public class FileGridModel extends FileModel {
* the new size * the new size
*/ */
private void setSize(long size) { private void setSize(long size) {
set(ConstantsExplorer.SIZE, size); set(FileGridModel.SIZE, size);
} }
/** /**
@ -93,7 +99,7 @@ public class FileGridModel extends FileModel {
* @return the size * @return the size
*/ */
public long getSize() { public long getSize() {
return (Long) get(ConstantsExplorer.SIZE); return (Long) get(FileGridModel.SIZE);
} }
/** /**
@ -103,7 +109,7 @@ public class FileGridModel extends FileModel {
* the new last modification * the new last modification
*/ */
private void setLastModification(Date lastUpdate) { private void setLastModification(Date lastUpdate) {
set(ConstantsExplorer.LASTMODIFIED, lastUpdate); set(FileGridModel.LASTMODIFIED, lastUpdate);
} }
@ -113,13 +119,13 @@ public class FileGridModel extends FileModel {
* @return the last modification * @return the last modification
*/ */
public Date getLastModification() { public Date getLastModification() {
return (Date) get(ConstantsExplorer.LASTMODIFIED); return (Date) get(FileGridModel.LASTMODIFIED);
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see
* org.gcube.portlets.user.workspace.client.model.FileModel#equals(java. * org.gcube.portlets.user.workspace.client.model.FileModel#equals(java.
* lang.Object) * lang.Object)

View File

@ -12,33 +12,58 @@ import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Image;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class FileModel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Sep 15, 2016
*/ */
public class FileModel extends BaseModelData implements Serializable { public class FileModel extends BaseModelData implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected GXTFolderItemTypeEnum folderItemType; //It's here to serialization don't remove protected GXTFolderItemTypeEnum folderItemType; //It's here to serialization don't remove
protected InfoContactModel infoContacts; protected InfoContactModel infoContacts;
protected boolean isRoot = false; protected boolean isRoot = false;
protected boolean isVreFolder; protected boolean isVreFolder;
protected boolean isSpecialFolder = false; protected boolean isSpecialFolder = false;
protected boolean isPublic = false; // IS IT A PUBLIC FOLDER?
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 = "Shortcut Category";
public static final String PARENT = "parent";
public static final String ISDIRECTORY = "isDirectory";
public static final String ISSHARED = "isShared";
public static final String SHAREUSERS = "shareUsers";
public static final String IDENTIFIER = "identifier";
public static final String FOLDERITEMTYPE = "folderItemType";
public static final String QUERY = "query";
public static final String OWNER = "Owner";
public static final String OWNERFULLNAME = "Owner Name";
/**
* Instantiates a new file model.
*/
protected FileModel(){ protected FileModel(){
} }
/** /**
* * Instantiates a new file model.
* @param identifier *
* @param name * @param identifier the identifier
* @param parent * @param name the name
* @param isDirectory * @param parent the parent
* @param isShared * @param isDirectory the is directory
* @param isShared the is shared
*/ */
public FileModel(String identifier, String name, FileModel parent, boolean isDirectory, boolean isShared) { public FileModel(String identifier, String name, FileModel parent, boolean isDirectory, boolean isShared) {
setIdentifier(identifier); setIdentifier(identifier);
@ -48,12 +73,13 @@ public class FileModel extends BaseModelData implements Serializable {
setShared(isShared); setShared(isShared);
initDefaultProperties(); initDefaultProperties();
} }
/** /**
* USED FOR ATTACHMENTS AND FolderBulkCreator * USED FOR ATTACHMENTS AND FolderBulkCreator.
* @param identifier *
* @param name * @param identifier the identifier
* @param isDirectory * @param name the name
* @param isDirectory the is directory
*/ */
public FileModel(String identifier, String name, boolean isDirectory) { public FileModel(String identifier, String name, boolean isDirectory) {
setIdentifier(identifier); setIdentifier(identifier);
@ -61,38 +87,61 @@ public class FileModel extends BaseModelData implements Serializable {
setIsDirectory(isDirectory); setIsDirectory(isDirectory);
initDefaultProperties(); initDefaultProperties();
} }
/**
* Inits the default properties.
*/
private void initDefaultProperties(){ private void initDefaultProperties(){
setShortcutCategory(""); setShortcutCategory("");
setShareable(true); setShareable(true);
} }
/**
* Sets the shareable.
*
* @param bool the new shareable
*/
public void setShareable(boolean bool) { public void setShareable(boolean bool) {
set(ConstantsExplorer.ISSHAREABLE,bool); set(ConstantsExplorer.ISSHAREABLE,bool);
}
public void setDescription(String description){
set(ConstantsExplorer.DIRECTORYDESCRIPTION, description);
}
public String getDescription(){
return get(ConstantsExplorer.DIRECTORYDESCRIPTION);
}
public boolean isShareable() {
return (Boolean) get(ConstantsExplorer.ISSHAREABLE);
} }
/** /**
* * Sets the description.
* @param identifier *
* @param name * @param description the new description
* @param type */
* @param folderItemTypeEnum public void setDescription(String description){
* @param isDirectory set(ConstantsExplorer.DIRECTORYDESCRIPTION, description);
* @param isShared }
/**
* Gets the description.
*
* @return the description
*/
public String getDescription(){
return get(ConstantsExplorer.DIRECTORYDESCRIPTION);
}
/**
* Checks if is shareable.
*
* @return true, if is shareable
*/
public boolean isShareable() {
return (Boolean) get(ConstantsExplorer.ISSHAREABLE);
}
/**
* Instantiates a new file model.
*
* @param identifier the identifier
* @param name the name
* @param type the type
* @param folderItemTypeEnum the folder item type enum
* @param isDirectory the is directory
* @param isShared the is shared
*/ */
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, boolean isDirectory, boolean isShared) { public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, boolean isDirectory, boolean isShared) {
setIdentifier(identifier); setIdentifier(identifier);
@ -103,179 +152,278 @@ public class FileModel extends BaseModelData implements Serializable {
setShared(isShared); setShared(isShared);
initDefaultProperties(); initDefaultProperties();
} }
/**
* Sets the parent file model.
*
* @param parent the new parent file model
*/
public void setParentFileModel(FileModel parent) { public void setParentFileModel(FileModel parent) {
set(ConstantsExplorer.PARENT,parent); set(PARENT,parent);
} }
/** /**
* Status values * Status values
* ConstantsExplorer.FOLDERNOTLOAD = "notload"; * ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded"; * ConstantsExplorer.FOLDERLOADED = "loaded";
* @param status *
* @param status the new status
*/ */
public void setStatus(String status) { public void setStatus(String status) {
set("status", status); set("status", status);
} }
/**
* Sets the icon.
*/
public void setIcon() { public void setIcon() {
Image icon = (Image) get(ConstantsExplorer.ICON); Image icon = (Image) get(ICON);
AbstractImagePrototype iconAbs; AbstractImagePrototype iconAbs;
if(icon==null) if(icon==null)
iconAbs = getAbstractPrototypeIcon(); iconAbs = getAbstractPrototypeIcon();
else else
return; return;
set(ConstantsExplorer.ICON, iconAbs.createImage()); set(ICON, iconAbs.createImage());
set(ConstantsExplorer.ABSTRACTICON, iconAbs); set(ABSTRACTICON, iconAbs);
}
// public void resetIcons(){
// set(ConstantsExplorer.ICON,null);
// set(ConstantsExplorer.ABSTRACTICON, null);
// }
// public void setOwner(InfoContactModel owner){
// set(ConstantsExplorer.OWNER, owner);
// }
public void setOwnerFullName(String fullName){
set(ConstantsExplorer.OWNERFULLNAME, fullName);
} }
// public InfoContactModel getOwner(){ /**
// return (InfoContactModel) get(ConstantsExplorer.OWNER); * Sets the owner full name.
// } *
* @param fullName the new owner full name
*/
public void setOwnerFullName(String fullName){
set(FileModel.OWNERFULLNAME, fullName);
}
/**
* Gets the owner full name.
*
* @return the owner full name
*/
public String getOwnerFullName(){ public String getOwnerFullName(){
return get(ConstantsExplorer.OWNERFULLNAME); return get(FileModel.OWNERFULLNAME);
} }
/**
* Sets the sharing value.
*
* @param isShared the is shared
* @param listShareUsers the list share users
*/
public void setSharingValue(boolean isShared, List<InfoContactModel> listShareUsers){ public void setSharingValue(boolean isShared, List<InfoContactModel> listShareUsers){
set(ConstantsExplorer.ISSHARED, isShared); set(ISSHARED, isShared);
set(ConstantsExplorer.SHAREUSERS, listShareUsers); set(SHAREUSERS, listShareUsers);
} }
/**
* Gets the list user sharing.
*
* @return the list user sharing
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<InfoContactModel> getListUserSharing(){ public List<InfoContactModel> getListUserSharing(){
return (List<InfoContactModel>) get(ConstantsExplorer.SHAREUSERS); return (List<InfoContactModel>) get(SHAREUSERS);
} }
/**
* Sets the list share user.
*
* @param listShareUsers the new list share user
*/
public void setListShareUser(List<InfoContactModel> listShareUsers){ public void setListShareUser(List<InfoContactModel> listShareUsers){
set(ConstantsExplorer.SHAREUSERS, listShareUsers); set(SHAREUSERS, listShareUsers);
} }
/**
* Checks if is shared.
*
* @return true, if is shared
*/
public boolean isShared(){ public boolean isShared(){
return (Boolean) get(ConstantsExplorer.ISSHARED); return (Boolean) get(ISSHARED);
} }
/**
* Checks if is root.
*
* @return true, if is root
*/
public boolean isRoot(){ public boolean isRoot(){
return isRoot; return isRoot;
} }
/**
* Sets the checks if is root.
*
* @param isRoot the new checks if is root
*/
public void setIsRoot(boolean isRoot){ public void setIsRoot(boolean isRoot){
this.isRoot = isRoot; this.isRoot = isRoot;
} }
/**
* Gets the icon.
*
* @return the icon
*/
public Image getIcon() { public Image getIcon() {
return getAbstractPrototypeIcon().createImage(); return getAbstractPrototypeIcon().createImage();
} }
/**
* Gets the abstract prototype icon.
*
* @return the abstract prototype icon
*/
public AbstractImagePrototype getAbstractPrototypeIcon() { public AbstractImagePrototype getAbstractPrototypeIcon() {
AbstractImagePrototype absImgPr = Resources.getIconTable(); AbstractImagePrototype absImgPr = Resources.getIconTable();
if (!this.isDirectory()) { //IS FILE if (!this.isDirectory()) { //IS FILE
if(this.getType()!=null) if(this.getType()!=null)
absImgPr = Resources.getIconByType(this.getName(), this.getType()); absImgPr = Resources.getIconByType(this.getName(), this.getType());
else else
absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType()); absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType());
}else if(this.isShared()){ //IS A SHARED FOLDER? }else if(this.isShared()){ //IS A SHARED FOLDER?
GWT.log("setting icon is shared: "+this.isShared() + ", this.isVreFolder() "+this.isVreFolder() +", this.isShareable() "+this.isShareable()); GWT.log("setting icon is shared: "+this.isShared() + ", this.isVreFolder() "+this.isVreFolder() +", this.isShareable() "+this.isShareable());
if(this.isVreFolder()) if(this.isVreFolder())
absImgPr = Resources.getIconVREFolder(); absImgPr = Resources.getIconVREFolder();
else{ else{
if(this.isShareable()) //IS ROOT SHARED FOLDER if(this.isShareable()){ //IS ROOT SHARED FOLDER
absImgPr = Resources.getIconSharedFolder(); if(this.isPublic()) //IS PLUBIC
else absImgPr = Resources.getIconFolderSharedPublic();
absImgPr = Resources.getIconFolder(); //IS A DESCENDANT else
absImgPr = Resources.getIconSharedFolder();
}else{ //IS A DESCENDANT
if(this.isPublic()) //IS PLUBIC
Resources.getIconFolderPublic();
else
absImgPr = Resources.getIconFolder(); //IS A PRIVATE FOLDER
}
} }
}else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING }else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING
absImgPr = Resources.getIconLoading2(); absImgPr = Resources.getIconLoading2();
}else{ }else{
//SPECIAL FOLDER? //SPECIAL FOLDER?
if(this.isSpecialFolder()) if(this.isSpecialFolder())
absImgPr = Resources.getIconSpecialFolder(); absImgPr = Resources.getIconSpecialFolder();
else //SIMPLE FOLDER else{ //SIMPLE FOLDER
absImgPr = Resources.getIconFolder(); if(this.isPublic()) //IS PLUBIC
absImgPr = Resources.getIconFolderPublic();
else
absImgPr = Resources.getIconFolder();
}
} }
return absImgPr; return absImgPr;
} }
/**
// public Image getIcon() { * Gets the status.
// return (Image) get(ConstantsExplorer.ICON); *
// } * @return the status
// */
// public AbstractImagePrototype getAbstractPrototypeIcon() {
// if((AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON)==null)
// setIcon();
// return (AbstractImagePrototype) get(ConstantsExplorer.ABSTRACTICON);
// }
public String getStatus() { public String getStatus() {
return get("status"); return get("status");
} }
public void setIsDirectory(boolean flag){
set(ConstantsExplorer.ISDIRECTORY, flag);
}
public void setIdentifier(String identifier) {
set(ConstantsExplorer.IDENTIFIER, identifier);
}
public String getIdentifier(){
return get(ConstantsExplorer.IDENTIFIER);
}
public void setShortcutCategory(String category) {
set(ConstantsExplorer.SHORTCUTCATEGORY, category);
}
public String getShortcutCategory(){
return get(ConstantsExplorer.SHORTCUTCATEGORY).toString();
}
/**
* Sets the checks if is directory.
*
* @param flag the new checks if is directory
*/
public void setIsDirectory(boolean flag){
set(ISDIRECTORY, flag);
}
/**
* Sets the identifier.
*
* @param identifier the new identifier
*/
public void setIdentifier(String identifier) {
set(IDENTIFIER, identifier);
}
/**
* Gets the identifier.
*
* @return the identifier
*/
public String getIdentifier(){
return get(IDENTIFIER);
}
/**
* Sets the shortcut category.
*
* @param category the new shortcut category
*/
public void setShortcutCategory(String category) {
set(SHORTCUTCATEGORY, category);
}
/**
* Gets the shortcut category.
*
* @return the shortcut category
*/
public String getShortcutCategory(){
return get(SHORTCUTCATEGORY).toString();
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) { public void setName(String name) {
set(ConstantsExplorer.NAME, name); set(NAME, name);
} }
/**
* Gets the name.
*
* @return the name
*/
public String getName() { public String getName() {
return get(ConstantsExplorer.NAME); return get(NAME);
} }
/**
* Gets the parent file model.
*
* @return the parent file model
*/
public FileModel getParentFileModel(){ public FileModel getParentFileModel(){
return (FileModel) get(ConstantsExplorer.PARENT); return (FileModel) get(PARENT);
} }
/**
* Checks if is directory.
*
* @return true, if is directory
*/
public boolean isDirectory(){ public boolean isDirectory(){
return (Boolean) get(ConstantsExplorer.ISDIRECTORY); return (Boolean) get(ISDIRECTORY);
} }
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj != null && obj instanceof FileModel) { if (obj != null && obj instanceof FileModel) {
@ -284,54 +432,111 @@ public class FileModel extends BaseModelData implements Serializable {
} }
return super.equals(obj); return super.equals(obj);
} }
/** /**
* Sets the shared.
*
* @param isShared the isShared to set * @param isShared the isShared to set
*/ */
public void setShared(boolean isShared) { public void setShared(boolean isShared) {
set(ConstantsExplorer.ISSHARED, isShared); set(ISSHARED, isShared);
} }
/** /**
* It's: folder, mime type or unknown * It's: folder, mime type or unknown.
* @param type *
* @param type the new type
*/ */
public void setType(String type){ public void setType(String type){
set(ConstantsExplorer.TYPE, type); set(TYPE, type);
} }
/**
* Gets the type.
*
* @return the type
*/
public String getType(){ public String getType(){
return get(ConstantsExplorer.TYPE); return get(TYPE);
} }
/**
* Sets the folder item type.
*
* @param folderItemTypeEnum the new folder item type
*/
public void setFolderItemType(GXTFolderItemTypeEnum folderItemTypeEnum){ public void setFolderItemType(GXTFolderItemTypeEnum folderItemTypeEnum){
set(ConstantsExplorer.FOLDERITEMTYPE, folderItemTypeEnum); set(FOLDERITEMTYPE, folderItemTypeEnum);
} }
/**
* Gets the GXT folder item type.
*
* @return the GXT folder item type
*/
public GXTFolderItemTypeEnum getGXTFolderItemType(){ public GXTFolderItemTypeEnum getGXTFolderItemType(){
return (GXTFolderItemTypeEnum) get(ConstantsExplorer.FOLDERITEMTYPE); return (GXTFolderItemTypeEnum) get(FOLDERITEMTYPE);
} }
/**
* Checks if is vre folder.
*
* @return true, if is vre folder
*/
public boolean isVreFolder() { public boolean isVreFolder() {
return isVreFolder; return isVreFolder;
} }
/**
* Sets the vre folder.
*
* @param isVreFolder the new vre folder
*/
public void setVreFolder(boolean isVreFolder) { public void setVreFolder(boolean isVreFolder) {
this.isVreFolder = isVreFolder; this.isVreFolder = isVreFolder;
} }
/** /**
* @param b * Sets the special folder.
*
* @param bool the new special folder
*/ */
public void setSpecialFolder(boolean bool) { public void setSpecialFolder(boolean bool) {
this.isSpecialFolder = bool; this.isSpecialFolder = bool;
} }
/**
* Checks if is special folder.
*
* @return true, if is special folder
*/
public boolean isSpecialFolder() { public boolean isSpecialFolder() {
return isSpecialFolder; return isSpecialFolder;
} }
/**
* Sets the checks if is public.
*
* @param isPublic the new checks if is public
*/
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
}
/**
* Checks if is public.
*
* @return true, if is public
*/
public boolean isPublic(){
return isPublic;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
@ -356,6 +561,5 @@ public class FileModel extends BaseModelData implements Serializable {
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

@ -2,29 +2,64 @@ package org.gcube.portlets.user.workspace.client.model;
import java.util.Date; import java.util.Date;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class FolderGridModel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Sep 15, 2016
*/ */
public class FolderGridModel extends FileGridModel { public class FolderGridModel extends FileGridModel {
/** /**
* *
*/ */
private static final long serialVersionUID = 8274585443980764897L; private static final long serialVersionUID = 8274585443980764897L;
/**
* Instantiates a new folder grid model.
*/
protected FolderGridModel() { protected FolderGridModel() {
} }
public FolderGridModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared, boolean isVREFolder) { /**
* Instantiates a new folder grid model.
*
* @param identifier the identifier
* @param name the name
* @param path the path
* @param creationDate the creation date
* @param parent the parent
* @param size the size
* @param isDirectory the is directory
* @param isShared the is shared
* @param isVREFolder the is vre folder
* @param isPublic the is public
*/
public FolderGridModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared, boolean isVREFolder, boolean isPublic) {
super(identifier, name, path, creationDate, parent, size, isDirectory, isShared); super(identifier, name, path, creationDate, parent, size, isDirectory, isShared);
super.setVreFolder(isVREFolder); super.setVreFolder(isVREFolder);
super.setIsPublic(isPublic);
} }
public FolderGridModel(String identifier, String name, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared, boolean isVREFolder) { /**
* Instantiates a new folder grid model.
*
* @param identifier the identifier
* @param name the name
* @param creationDate the creation date
* @param parent the parent
* @param size the size
* @param isDirectory the is directory
* @param isShared the is shared
* @param isVREFolder the is vre folder
* @param isPublic the is public
*/
public FolderGridModel(String identifier, String name, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared, boolean isVREFolder, boolean isPublic) {
super(identifier, name, creationDate, parent, size, isDirectory, isShared); super(identifier, name, creationDate, parent, size, isDirectory, isShared);
super.setVreFolder(isVREFolder); super.setVreFolder(isVREFolder);
super.setIsPublic(isPublic);
} }
} }

View File

@ -1,30 +1,60 @@
package org.gcube.portlets.user.workspace.client.model; package org.gcube.portlets.user.workspace.client.model;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class FolderModel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Sep 15, 2016
*/ */
public class FolderModel extends FileModel { public class FolderModel extends FileModel {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* Instantiates a new folder model.
*/
protected FolderModel() { protected FolderModel() {
} }
public FolderModel(String identifier, String name, FileModel parent, boolean isDirectory, boolean isShared, boolean isVreFolder) { /**
* Instantiates a new folder model.
*
* @param identifier the identifier
* @param name the name
* @param parent the parent
* @param isDirectory the is directory
* @param isShared the is shared
* @param isVreFolder the is vre folder
* @param isPublic the is public
*/
public FolderModel(String identifier, String name, FileModel parent, boolean isDirectory, boolean isShared, boolean isVreFolder, boolean isPublic) {
super(identifier, name, parent, isDirectory, isShared); super(identifier, name, parent, isDirectory, isShared);
super.setVreFolder(isVreFolder); super.setVreFolder(isVreFolder);
super.setIsPublic(isPublic);
} }
/**
* Instantiates a new folder model.
* Used for attachments
*
* @param identifier the identifier
* @param name the name
* @param isDirectory the is directory
* @param isVreFolder the is vre folder
*/
public FolderModel(String identifier, String name, boolean isDirectory, boolean isVreFolder) { public FolderModel(String identifier, String name, boolean isDirectory, boolean isVreFolder) {
super(identifier, name, isDirectory); super(identifier, name, isDirectory);
super.setVreFolder(isVreFolder); super.setVreFolder(isVreFolder);
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.model.FileModel#toString()
*/
@Override @Override
public String toString() { public String toString() {
return super.toString(); return super.toString();

View File

@ -2,8 +2,6 @@ package org.gcube.portlets.user.workspace.client.model;
import java.io.Serializable; import java.io.Serializable;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import com.extjs.gxt.ui.client.data.BaseModelData; import com.extjs.gxt.ui.client.data.BaseModelData;
/** /**
@ -13,13 +11,13 @@ import com.extjs.gxt.ui.client.data.BaseModelData;
public class SmartFolderModel extends BaseModelData implements Serializable { public class SmartFolderModel extends BaseModelData implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
SmartFolderModel(){ SmartFolderModel(){
} }
public SmartFolderModel(String id, String name, String query){ public SmartFolderModel(String id, String name, String query){
@ -27,29 +25,29 @@ public class SmartFolderModel extends BaseModelData implements Serializable {
setName(name); setName(name);
setQuery(query); setQuery(query);
} }
public void setIdentifier(String id) { public void setIdentifier(String id) {
set(ConstantsExplorer.IDENTIFIER,id); set(FileModel.IDENTIFIER,id);
} }
private void setName(String name){ private void setName(String name){
set(ConstantsExplorer.NAME, name); set(FileModel.NAME, name);
} }
private void setQuery(String query){ private void setQuery(String query){
set(ConstantsExplorer.QUERY, query); set(FileModel.QUERY, query);
} }
public String getIdentifier() { public String getIdentifier() {
return get(ConstantsExplorer.IDENTIFIER); return get(FileModel.IDENTIFIER);
} }
public String getName(){ public String getName(){
return get(ConstantsExplorer.NAME); return get(FileModel.NAME);
} }
public String getQuery(){ public String getQuery(){
return get(ConstantsExplorer.QUERY); return get(FileModel.QUERY);
} }
} }

View File

@ -254,7 +254,7 @@ public interface Icons extends ClientBundle {
@Source("icons/sharingFolder.png") @Source("icons/sharingFolder.png")
ImageResource shareFolder(); ImageResource shareFolder();
@Source("icons/sharedFolder4.png") @Source("icons/folder_shared.png")
ImageResource sharedFolder(); ImageResource sharedFolder();
@Source("icons/unSharingFolder.gif") @Source("icons/unSharingFolder.gif")
@ -437,7 +437,10 @@ public interface Icons extends ClientBundle {
@Source("icons/datacataloguepublish.png") @Source("icons/datacataloguepublish.png")
ImageResource datacataloguepublish(); ImageResource datacataloguepublish();
@Source("icons/folder_link.png") @Source("icons/folder_public.png")
ImageResource folderLink(); ImageResource folderPublic();
@Source("icons/folder_shared_public.png")
ImageResource folderSharedPublic();
} }

View File

@ -122,6 +122,18 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.information()); return AbstractImagePrototype.create(ICONS.information());
} }
/**
* Gets the icon folder shared public.
*
* @return the icon folder shared public
*/
public static AbstractImagePrototype getIconFolderSharedPublic(){
return AbstractImagePrototype.create(ICONS.folderSharedPublic());
}
/** /**
* Gets the icon information. * Gets the icon information.
* *
@ -190,9 +202,9 @@ public class Resources {
* *
* @return the icon folder link * @return the icon folder link
*/ */
public static AbstractImagePrototype getIconFolderLink(){ public static AbstractImagePrototype getIconFolderPublic(){
return AbstractImagePrototype.create(ICONS.folderLink()); return AbstractImagePrototype.create(ICONS.folderPublic());
} }
@ -1541,8 +1553,14 @@ public class Resources {
*/ */
public static AbstractImagePrototype getIconByType(String name, String type){ public static AbstractImagePrototype getIconByType(String name, String type){
if(type.equals(GXTFolderItemTypeEnum.FOLDER.toString())) /*if(type.equals(GXTFolderItemTypeEnum.FOLDER.toString()))
return Resources.getIconFolder(); return Resources.getIconFolder();
else if(type.equals(GXTFolderItemTypeEnum.FOLDER_PUBLIC.toString()))
return Resources.getIconFolderPublic();
else if(type.equals(GXTFolderItemTypeEnum.FOLDER_SHARED.toString()))
return Resources.getIconSharedFolder();
else if(type.equals(GXTFolderItemTypeEnum.FOLDER_SHARED_PUBLIC.toString()))
return Resources.getIconFolderSharedPublic();*/
//RECOVERING "media type name" from type / media type name [+suffix] //RECOVERING "media type name" from type / media type name [+suffix]
int sl = type.indexOf("/"); int sl = type.indexOf("/");
@ -1551,4 +1569,28 @@ public class Resources {
return Resources.getIconByMediaTypeName(name, mediaTypeName); return Resources.getIconByMediaTypeName(name, mediaTypeName);
} }
/**
* Gets the icon by folder enum.
*
* @param name the name
* @param type the type
* @return the icon by folder enum
*/
public static AbstractImagePrototype getIconByFolderEnum(String name, String type){
if(type.equals(GXTFolderItemTypeEnum.FOLDER.toString()))
return Resources.getIconFolder();
else if(type.equals(GXTFolderItemTypeEnum.FOLDER_PUBLIC.toString()))
return Resources.getIconFolderPublic();
else if(type.equals(GXTFolderItemTypeEnum.FOLDER_SHARED.toString()))
return Resources.getIconSharedFolder();
else if(type.equals(GXTFolderItemTypeEnum.FOLDER_SHARED_PUBLIC.toString()))
return Resources.getIconFolderSharedPublic();
return null;
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

View File

@ -712,5 +712,5 @@ public interface GWTWorkspaceService extends RemoteService{
*/ */
String getMyFirstName(); String getMyFirstName();
PublicLink getFolderLinkForFolderItemId(String itemId, boolean b) throws SessionExpiredException, Exception; PublicLink markFolderAsPublicForFolderItemId(String itemId, boolean b) throws SessionExpiredException, Exception;
} }

View File

@ -140,6 +140,7 @@ public interface GWTWorkspaceServiceAsync {
* Gets the items by search name. * Gets the items by search name.
* *
* @param text the text * @param text the text
* @param folderId the folder id
* @param callback the callback * @param callback the callback
* @return the items by search name * @return the items by search name
*/ */
@ -160,6 +161,7 @@ public interface GWTWorkspaceServiceAsync {
* @param name the name * @param name the name
* @param description the description * @param description the description
* @param query the query * @param query the query
* @param parentId the parent id
* @param callback the callback * @param callback the callback
*/ */
void createSmartFolder(String name, String description, String query, String parentId, AsyncCallback<SmartFolderModel> callback); void createSmartFolder(String name, String description, String query, String parentId, AsyncCallback<SmartFolderModel> callback);
@ -428,8 +430,11 @@ public interface GWTWorkspaceServiceAsync {
void getItemForFileGrid(String itemId, AsyncCallback<FileGridModel> callback); void getItemForFileGrid(String itemId, AsyncCallback<FileGridModel> callback);
/** /**
* @param itemId * Gets the item for file tree.
* @param asyncCallback *
* @param itemId the item id
* @param asyncCallback the async callback
* @return the item for file tree
*/ */
void getItemForFileTree(String itemId,AsyncCallback<FileModel> asyncCallback); void getItemForFileTree(String itemId,AsyncCallback<FileModel> asyncCallback);
@ -470,6 +475,12 @@ public interface GWTWorkspaceServiceAsync {
*/ */
void isSessionExpired(AsyncCallback<Boolean> callback); void isSessionExpired(AsyncCallback<Boolean> callback);
/**
* Delete list items for ids.
*
* @param ids the ids
* @param callback the callback
*/
void deleteListItemsForIds(List<String> ids, void deleteListItemsForIds(List<String> ids,
AsyncCallback<List<GarbageItem>> callback); AsyncCallback<List<GarbageItem>> callback);
@ -686,24 +697,36 @@ public interface GWTWorkspaceServiceAsync {
/** /**
* Allows the user to public onto the data catalogue if he has at least * Allows the user to public onto the data catalogue if he has at least
* the role admin somewhere. * the role admin somewhere.
*
* @param callback the callback
* @return true if he can publish, false otherwise * @return true if he can publish, false otherwise
*/ */
void hasUserRoleAdmin(AsyncCallback<Boolean> callback); void hasUserRoleAdmin(AsyncCallback<Boolean> callback);
/** /**
* Retrieve the username of the user into the session * Retrieve the username of the user into the session.
*
* @param callback the callback
* @return the username of the current user * @return the username of the current user
*/ */
void getUser(AsyncCallback<String> callback); void getUser(AsyncCallback<String> callback);
/**
* Gets the my first name.
*
* @param callback the callback
* @return the my first name
*/
void getMyFirstName(AsyncCallback<String> callback); void getMyFirstName(AsyncCallback<String> callback);
/** /**
* @param itemId * Mark folder as public for folder item id.
* @param b * return the PublicLink in case of setPublic is true, null otherwise
* @param asyncCallback * @param itemId the item id
* @param setPublic the set public
* @param callback the callback
*/ */
void getFolderLinkForFolderItemId( void markFolderAsPublicForFolderItemId(
String itemId, boolean b, AsyncCallback<PublicLink> asyncCallback); String itemId, boolean setPublic, AsyncCallback<PublicLink> callback);
} }

View File

@ -7,7 +7,6 @@ import org.gcube.portlets.user.workspace.client.event.SwitchViewEvent;
import org.gcube.portlets.user.workspace.client.resources.Resources; import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.client.view.smartfolder.SmartFolderPanel; import org.gcube.portlets.user.workspace.client.view.smartfolder.SmartFolderPanel;
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel; import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
import org.gcube.portlets.user.workspace.client.view.windows.BulkCreatorWindow;
import com.extjs.gxt.ui.client.event.BaseEvent; import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent; import com.extjs.gxt.ui.client.event.ButtonEvent;
@ -40,55 +39,56 @@ public class ExplorerPanel extends LayoutContainer {
private boolean isSmartFolderInstanced; private boolean isSmartFolderInstanced;
private boolean isOnlyTreeInstanced; private boolean isOnlyTreeInstanced;
/** /**
* Default instance an async tree to navigate user workspace * Default instance an async tree to navigate user workspace
* @param instancingSmartFolder * @param instancingSmartFolder
* @param instancingMessages * @param instancingMessages
*/ */
public ExplorerPanel(boolean instancingSmartFolder, boolean instancingMessages, boolean selectRootItem) { public ExplorerPanel(boolean instancingSmartFolder, boolean instancingMessages, boolean selectRootItem) {
this.isMessagesInstanced= instancingMessages; this.isMessagesInstanced= instancingMessages;
this.isSmartFolderInstanced = instancingSmartFolder; this.isSmartFolderInstanced = instancingSmartFolder;
setBorders(false); setBorders(false);
initRadioButtons(); initRadioButtons();
initToolBar(); initToolBar();
this.asycTreePanel = new AsyncTreePanel(); this.asycTreePanel = new AsyncTreePanel();
if(isSmartFolderInstanced) if(isSmartFolderInstanced)
this.smartFolderPanel = new SmartFolderPanel(); this.smartFolderPanel = new SmartFolderPanel();
this.expPanel = new ContentPanel(); this.expPanel = new ContentPanel();
this.expPanel.setHeaderVisible(false); this.expPanel.setHeaderVisible(false);
this.expPanel.setTopComponent(toolBar); this.expPanel.setTopComponent(toolBar);
// smartFolderPanel.setVisible(false); // smartFolderPanel.setVisible(false);
// messagesPanel.setVisible(false); // messagesPanel.setVisible(false);
asycTreePanel.setVisible(true); asycTreePanel.setVisible(true);
expPanel.add(asycTreePanel); expPanel.add(asycTreePanel);
// expPanel.add(smartFolderPanel); // expPanel.add(smartFolderPanel);
// expPanel.add(messagesPanel); // expPanel.add(messagesPanel);
if(instancingSmartFolder){ if(instancingSmartFolder){
smartFolderPanel.setVisible(false); smartFolderPanel.setVisible(false);
expPanel.add(smartFolderPanel); expPanel.add(smartFolderPanel);
} }
//BULK //BULK
buttBulk.setIcon(Resources.getIconBulkUpdate()); //REMOVED 2016-09-15 CHECK SVN
buttBulk.setVisible(false); // buttBulk.setIcon(Resources.getIconBulkUpdate());
addListnerOnBulk(); // buttBulk.setVisible(false);
// addListnerOnBulk();
add(expPanel); add(expPanel);
} }
/** /**
* Instance only tree * Instance only tree
* @param instancingOnlyTree * @param instancingOnlyTree
@ -96,7 +96,7 @@ public class ExplorerPanel extends LayoutContainer {
public ExplorerPanel(boolean instancingOnlyTree, boolean selectRootItem) { public ExplorerPanel(boolean instancingOnlyTree, boolean selectRootItem) {
this.isOnlyTreeInstanced = instancingOnlyTree; this.isOnlyTreeInstanced = instancingOnlyTree;
setBorders(false); setBorders(false);
initRadioButtons(); initRadioButtons();
this.asycTreePanel = new AsyncTreePanel(); this.asycTreePanel = new AsyncTreePanel();
@ -106,30 +106,30 @@ public class ExplorerPanel extends LayoutContainer {
// asycTreePanel.setVisible(true); // asycTreePanel.setVisible(true);
expPanel.add(asycTreePanel); expPanel.add(asycTreePanel);
add(expPanel); add(expPanel);
} }
private void addListnerOnBulk() { private void addListnerOnBulk() {
buttBulk.addSelectionListener(new SelectionListener<ButtonEvent>() { buttBulk.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
BulkCreatorWindow.getInstance().show(); // BulkCreatorWindow.getInstance().show();
} }
}); });
} }
public void setLoadingBulk(boolean bool){ public void setLoadingBulk(boolean bool){
buttBulk.setVisible(true); buttBulk.setVisible(true);
if(!bool) if(!bool)
buttBulk.setIcon(Resources.getIconLoadingOff()); buttBulk.setIcon(Resources.getIconLoadingOff());
else else
buttBulk.setIcon(Resources.getIconLoading()); buttBulk.setIcon(Resources.getIconLoading());
toolBar.layout(); toolBar.layout();
} }
@ -146,14 +146,14 @@ public class ExplorerPanel extends LayoutContainer {
radioGroup.add(radioTree); radioGroup.add(radioTree);
// radioSmartFolder.setId(ConstantsExplorer.SMARTFOLDER); // radioSmartFolder.setId(ConstantsExplorer.SMARTFOLDER);
if(isSmartFolderInstanced){ if(isSmartFolderInstanced){
radioSmartFolder.setBoxLabel(ConstantsExplorer.SMARTFOLDER); radioSmartFolder.setBoxLabel(ConstantsExplorer.SMARTFOLDER);
radioSmartFolder.setValueAttribute(ConstantsExplorer.SMARTFOLDER); radioSmartFolder.setValueAttribute(ConstantsExplorer.SMARTFOLDER);
radioGroup.add(radioSmartFolder); radioGroup.add(radioSmartFolder);
} }
if(isMessagesInstanced){ if(isMessagesInstanced){
radioMessages.setBoxLabel(ConstantsExplorer.MESSAGES); radioMessages.setBoxLabel(ConstantsExplorer.MESSAGES);
radioMessages.setValueAttribute(ConstantsExplorer.MESSAGES); radioMessages.setValueAttribute(ConstantsExplorer.MESSAGES);
@ -167,7 +167,7 @@ public class ExplorerPanel extends LayoutContainer {
radioGroup.addListener(Events.Change, new Listener<BaseEvent>() { radioGroup.addListener(Events.Change, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) { public void handleEvent(BaseEvent be) {
Radio selectedRadio = radioGroup.getValue(); Radio selectedRadio = radioGroup.getValue();
// System.out.println("radio value:" +selectedRadio.getValueAttribute()); // System.out.println("radio value:" +selectedRadio.getValueAttribute());
// System.out.println("id" + selectedRadio.getId()); // System.out.println("id" + selectedRadio.getId());
if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.SMARTFOLDER.toString()) == 0) if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.SMARTFOLDER.toString()) == 0)
@ -180,9 +180,9 @@ public class ExplorerPanel extends LayoutContainer {
}); });
} }
private void initToolBar(){ private void initToolBar(){
toolBar.add(radioGroup); toolBar.add(radioGroup);
toolBar.add(buttBulk); toolBar.add(buttBulk);
} }
@ -190,37 +190,37 @@ public class ExplorerPanel extends LayoutContainer {
private void switchView(ViewSwitchType type) { private void switchView(ViewSwitchType type) {
if (type.compareTo(ViewSwitchType.Tree)==0) { if (type.compareTo(ViewSwitchType.Tree)==0) {
if(isSmartFolderInstanced) if(isSmartFolderInstanced)
smartFolderPanel.setVisible(false); smartFolderPanel.setVisible(false);
asycTreePanel.setVisible(true); asycTreePanel.setVisible(true);
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.Tree)); AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.Tree));
// asycTreePanel.setSearch(false); // asycTreePanel.setSearch(false);
} else if (type.compareTo(ViewSwitchType.SmartFolder)==0){ } else if (type.compareTo(ViewSwitchType.SmartFolder)==0){
asycTreePanel.setVisible(false); asycTreePanel.setVisible(false);
smartFolderPanel.unPressedAllToogle(); smartFolderPanel.unPressedAllToogle();
smartFolderPanel.setVisible(true); smartFolderPanel.setVisible(true);
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.SmartFolder)); AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.SmartFolder));
// this.expPanel.setVisible(shortuctsPanel.getElement(), false); // this.expPanel.setVisible(shortuctsPanel.getElement(), false);
// this.expPanel.setVisible(asycTreePanel.getElement(), true); // this.expPanel.setVisible(asycTreePanel.getElement(), true);
} }
else{ else{
asycTreePanel.setVisible(false); asycTreePanel.setVisible(false);
if(isSmartFolderInstanced) if(isSmartFolderInstanced)
smartFolderPanel.setVisible(false); smartFolderPanel.setVisible(false);
} }
} }
public AsyncTreePanel getAsycTreePanel() { public AsyncTreePanel getAsycTreePanel() {

View File

@ -1,6 +1,5 @@
package org.gcube.portlets.user.workspace.client.view.tree; package org.gcube.portlets.user.workspace.client.view.tree;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -53,13 +52,11 @@ import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.AbstractImagePrototype;
/** /**
* The Class AsyncTreePanel. * The Class AsyncTreePanel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Aug 29, 2016 * Sep 15, 2016
*/ */
public class AsyncTreePanel extends LayoutContainer { public class AsyncTreePanel extends LayoutContainer {
@ -84,9 +81,6 @@ public class AsyncTreePanel extends LayoutContainer {
* Aug 29, 2016 * Aug 29, 2016
*/ */
private enum DragType {INSERT, APPEND}; private enum DragType {INSERT, APPEND};
// private int contextMenuPosX = -1;
// private int contextMenuPosY = -1;
private boolean rightClick = false; private boolean rightClick = false;
/** /**
@ -147,7 +141,7 @@ public class AsyncTreePanel extends LayoutContainer {
treePanel.setStateful(false); treePanel.setStateful(false);
treePanel.setDisplayProperty(ConstantsExplorer.NAME); treePanel.setDisplayProperty(FileModel.NAME);
// statefull components need a defined id // statefull components need a defined id
treePanel.setId(TREE_MESSAGE_PANEL_ASYNC); treePanel.setId(TREE_MESSAGE_PANEL_ASYNC);
@ -164,7 +158,8 @@ public class AsyncTreePanel extends LayoutContainer {
return Resources.getIconByFolderItemType(model.getGXTFolderItemType()); return Resources.getIconByFolderItemType(model.getGXTFolderItemType());
} }
if (model.isRoot()) {
if (model.isRoot()) { //IS ROOT?
//ConstantsExplorer.log("getIcon isRoot Model is: "+model); //ConstantsExplorer.log("getIcon isRoot Model is: "+model);
if(AppControllerExplorer.myLoginFirstName==null || AppControllerExplorer.myLoginFirstName.isEmpty()){ if(AppControllerExplorer.myLoginFirstName==null || AppControllerExplorer.myLoginFirstName.isEmpty()){
@ -196,19 +191,35 @@ public class AsyncTreePanel extends LayoutContainer {
if(model.getStatus() == ConstantsExplorer.FOLDERNOTLOAD) if(model.getStatus() == ConstantsExplorer.FOLDERNOTLOAD)
return Resources.getIconLoading2(); return Resources.getIconLoading2();
if(model.isVreFolder()) if(model.isVreFolder()) //IS VRE?
return Resources.getIconVREFolder(); return Resources.getIconVREFolder();
if(model.isSpecialFolder()) if(model.isSpecialFolder()) //IS SPECIAL FOLDER?
return Resources.getIconSpecialFolder(); return Resources.getIconSpecialFolder();
//SHARE ICON //SHARE ICON
if(model.isShared()){ if(model.isShared()){
if(model.isShareable()) if(model.isShareable()){ //IS ROOT SHARED FOLDER
return Resources.getIconSharedFolder(); if(model.isPublic()) //IS PUBLIC
else return Resources.getIconFolderSharedPublic();
return null; //Set default folder icon else
return Resources.getIconSharedFolder();
}else{//IS DESCENDANT
if(model.isPublic()) //IS PLUBIC
return Resources.getIconFolderPublic();
else
return Resources.getIconFolder();
}
} }
if(model.isDirectory()){
if(model.isPublic()) //IS PLUBIC
return Resources.getIconFolderPublic();
else
return Resources.getIconFolder();
}
return null; //Set default folder icon return null; //Set default folder icon
} }
}); });
@ -272,7 +283,7 @@ public class AsyncTreePanel extends LayoutContainer {
/** /**
* Sets the root display name. * Sets the root display name.
* *
* @param model the model * @param root the root
* @param name the name * @param name the name
* @param forceOverwrite the force overwrite * @param forceOverwrite the force overwrite
*/ */
@ -360,7 +371,7 @@ public class AsyncTreePanel extends LayoutContainer {
if(root!=null){ if(root!=null){
store.removeAll(); store.removeAll();
store.insert(root, 0, false); store.insert(root, 0, false);
System.out.println("Root Name: " + store.getRootItems().get(0).get(ConstantsExplorer.NAME)); System.out.println("Root Name: " + store.getRootItems().get(0).get(FileModel.NAME));
treePanel.setExpanded(store.getRootItems().get(0),true); //expand level 1 treePanel.setExpanded(store.getRootItems().get(0),true); //expand level 1
if(selectRootOnLoad) if(selectRootOnLoad)
selectRootItem(); //select root item selectRootItem(); //select root item
@ -676,7 +687,7 @@ public class AsyncTreePanel extends LayoutContainer {
if(be != null && !isSubTreeLoaded){ if(be != null && !isSubTreeLoaded){
GWT.log("***Event beforeExpand Node"); GWT.log("***Event beforeExpand Node");
GWT.log("Expand Folder Model: " + be.getNode().getModel().get(ConstantsExplorer.NAME)); GWT.log("Expand Folder Model: " + be.getNode().getModel().get(FileModel.NAME));
final FolderModel folder = (FolderModel) be.getNode().getModel(); final FolderModel folder = (FolderModel) be.getNode().getModel();
int numChildrenFolder = store.getChildCount(folder); int numChildrenFolder = store.getChildCount(folder);
@ -703,7 +714,7 @@ public class AsyncTreePanel extends LayoutContainer {
TreeNode node = be.getNode(); TreeNode node = be.getNode();
if(node!=null){ if(node!=null){
GWT.log("Menu on: " + node.getModel().get(ConstantsExplorer.NAME)); GWT.log("Menu on: " + node.getModel().get(FileModel.NAME));
GWT.log("node "+ treePanel.findNode(be.getTarget())); GWT.log("node "+ treePanel.findNode(be.getTarget()));
}else{ }else{
GWT.log("Menu on: null"); GWT.log("Menu on: null");
@ -978,7 +989,7 @@ public class AsyncTreePanel extends LayoutContainer {
*/ */
public FileModel getFileModelByIdentifier(String identifier){ public FileModel getFileModelByIdentifier(String identifier){
return treePanel.getStore().findModel(ConstantsExplorer.IDENTIFIER, identifier); return treePanel.getStore().findModel(FileModel.IDENTIFIER, identifier);
} }
/** /**
@ -1039,9 +1050,9 @@ public class AsyncTreePanel extends LayoutContainer {
Record record = treePanel.getStore().getRecord(fileTarget); Record record = treePanel.getStore().getRecord(fileTarget);
if(record!=null){ if(record!=null){
if(extension!= null) if(extension!= null)
record.set(ConstantsExplorer.NAME, newName+extension); record.set(FileModel.NAME, newName+extension);
else else
record.set(ConstantsExplorer.NAME, newName); record.set(FileModel.NAME, newName);
return true; return true;
} }

View File

@ -223,7 +223,7 @@ public class ContextMenuTree {
MenuItem mnFolderLink = new MenuItem(); MenuItem mnFolderLink = new MenuItem();
mnFolderLink.setId(WorkspaceOperation.FOLDER_LINK.getId()); mnFolderLink.setId(WorkspaceOperation.FOLDER_LINK.getId());
mnFolderLink.setText(ConstantsExplorer.MESSAGE_FOLDER_LINK); mnFolderLink.setText(ConstantsExplorer.MESSAGE_FOLDER_LINK);
mnFolderLink.setIcon(Resources.getIconFolderLink()); mnFolderLink.setIcon(Resources.getIconFolderPublic());
mnFolderLink.addSelectionListener(new SelectionListener<MenuEvent>() { mnFolderLink.addSelectionListener(new SelectionListener<MenuEvent>() {
public void componentSelected(MenuEvent ce) { public void componentSelected(MenuEvent ce) {

View File

@ -1,300 +0,0 @@
package org.gcube.portlets.user.workspace.client.view.windows;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.event.DeleteBulkEvent;
import org.gcube.portlets.user.workspace.client.model.BulkCreatorModel;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.WidgetComponent;
import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.user.client.ui.Image;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class BulkCreatorWindow extends Window {
/**
* This is a singleton
*/
private static BulkCreatorWindow instance;
private static ContentPanel cp;
private VerticalPanel vp;
private static HashMap<String, BulkProgressBar> hashProgressBars;
private static HashMap<String, Boolean> hashLoadCompletedNotify;
private static HashMap<String, HorizontalPanel> hashHorizontalPanels;
private static String LASTOPERATION = "Last Operation: ";
private Html lastOperation = new Html(LASTOPERATION);
private LayoutContainer lc;
private static String WINDOWTITLE = "Folder Bulk Creator";
private static String FAILED = "failed";
public static synchronized BulkCreatorWindow getInstance() {
if (instance == null)
instance = new BulkCreatorWindow();
return instance;
}
private BulkCreatorWindow() {
this.setResizable(false);
this.setSize(500, 400);
this.setHeaderVisible(true);
this.setHeading(WINDOWTITLE);
lc = new LayoutContainer();
lc.setStyleAttribute("margin", "10px");
cp = new ContentPanel();
cp.setBodyBorder(true);
cp.setStyleAttribute("padding", "10px");
vp = new VerticalPanel();
cp.setSize(470, 350);
cp.setHeaderVisible(false);
hashProgressBars = new HashMap<String, BulkProgressBar>();
hashHorizontalPanels = new HashMap<String, HorizontalPanel>();
hashLoadCompletedNotify = new HashMap<String, Boolean>();
cp.setScrollMode(Scroll.AUTO);
cp.add(vp);
lc.add(lastOperation);
lc.add(cp);
add(lc);
}
/**
*
* @param listBulks
* @return true if almost one progress bar is ongoing
*/
public boolean addProgressBar(List<BulkCreatorModel> listBulks){
boolean isLoading = false;
for(final BulkCreatorModel bulk : listBulks){
// System.out.println("bulk " + bulk.getIdentifier());
// System.out.println("bulk name " + bulk.getName());
// System.out.println("bulk progress " + bulk.getPercentage());
BulkProgressBar bulkBar = hashProgressBars.get(bulk.getIdentifier());
if(bulkBar!=null){ //is update
// System.out.println("bulkBar.updateProgress "+ bulk.getIdentifier());
// bulkBar.updateProgress(Integer.parseInt(bulk.getStatus()));
setVisibilityCancel(bulk.getIdentifier(),false);
switch (bulk.getState()) {
case 1: // COMPLETED = 1;
lastOperation.setHtml(LASTOPERATION + bulkBar.getProgressText() + " uploading completed");
notifyInfoCompleted(bulk.getIdentifier(), bulkBar.getProgressText());
// new InfoDisplay(infoTitle, bulkBar.getProgressText() + " uploading completed");
bulkBar.getElement().getStyle().setBorderColor("#000000");
bulkBar.updateProgress(100);
setVisibilityCancel(bulk.getIdentifier(),true);
break;
case 0: //ONGOING = 0;
bulkBar.updateProgress((float) getPercentage(bulk.getPercentage()));
isLoading = true;
break;
case 2: //FAILED = 2;
// bulkBar.setSuffixText(FAILED);
bulkBar.getElement().getStyle().setBorderColor("#f00");
bulkBar.updateProgress(getPercentage(bulk.getPercentage()));
if(bulk.getNumFails()==bulk.getNumRequests())
bulkBar.updateText(FAILED);
else
bulkBar.updateText(getPercentage(bulk.getPercentage()) + "% completed with " + bulk.getNumFails() + " of " + bulk.getNumRequests() + " " + FAILED);
if(bulk.getPercentage()>=1){ //it's completed
setVisibilityCancel(bulk.getIdentifier(),true);
lastOperation.setHtml(LASTOPERATION + bulkBar.getProgressText() + " completed with " + FAILED);
notifyInfoCompleted(bulk.getIdentifier(), bulkBar.getProgressText());
}
break;
}
vp.layout();
hashHorizontalPanels.get(bulk.getIdentifier()).layout();
}
else{ //create new horizontal panel that contains new progress bar
HorizontalPanel hp = new HorizontalPanel();
hp.setHorizontalAlign(HorizontalAlignment.CENTER);
hp.setSize(400, 20);
hp.setId(bulk.getIdentifier());
// hp.setItemId(bulk.getIdentifier());
Html nameProgress = new Html(bulk.getName());
nameProgress.setStyleAttribute("margin-right", "5px");
hp.add(nameProgress);
BulkProgressBar bulkPB = new BulkProgressBar(bulk.getIdentifier(), bulk.getName());
hp.add(bulkPB);
final WidgetComponent cancel = new WidgetComponent(new Image(Resources.getImageDelete()));
cancel.setStyleName("img-link");
cancel.setStyleAttribute("margin-left", "5px");
cancel.setId("delete-"+bulk.getIdentifier());
cancel.setItemId("delete-"+bulk.getIdentifier());
cancel.setVisible(false);
hp.add(cancel);
cancel.addListener(Events.OnClick, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
System.out.println("In cancel bulk id " + bulk.getIdentifier());
AppControllerExplorer.getEventBus().fireEvent(new DeleteBulkEvent(bulk.getIdentifier()));
// removeProgress(bulk.getIdentifier());
}
});
new InfoDisplay("Bulk Creator", "Found new " +bulk.getName());
hashHorizontalPanels.put(bulk.getIdentifier(), hp); //add hp into hashHorizontalPanels
hashProgressBars.put(bulk.getIdentifier(), bulkPB); //add bulkPB into hashProgressBars
hashLoadCompletedNotify.put(bulk.getIdentifier(), false); //add false (at load completed event) into hashLoadCompletedNotify
hp.setStyleAttribute("margin", "10px");
vp.add(hp);
}
vp.layout();
}
return isLoading;
// deleteProgressCompleted(progressIdFound);
}
private void notifyInfoCompleted(String pgId, String pgText){
if(!hashLoadCompletedNotify.get(pgId)){
new InfoDisplay(WINDOWTITLE, pgText + " uploading completed");
hashLoadCompletedNotify.put(pgId, true);
}
}
private float getPercentage(float perc){
double percentage = perc*100;
int precision = 10; //keep 1 digits
return (float) Math.floor(percentage * precision +.5)/precision;
}
public void setVisibilityCancel(String hashHPKey, boolean bool){
HorizontalPanel hp = hashHorizontalPanels.get(hashHPKey);
if(hp!=null){
WidgetComponent cancel = (WidgetComponent) hp.getItemByItemId("delete-"+hashHPKey);
if(cancel!=null)
cancel.setVisible(bool);
}
}
public void removeProgress(String hashHPKey) {
vp.remove(hashHorizontalPanels.get(hashHPKey));
lastOperation.setHtml(LASTOPERATION + hashProgressBars.get(hashHPKey).getProgressText() + " delete");
hashProgressBars.remove(hashHPKey); //remove progress bar from hash
hashHorizontalPanels.remove(hashHPKey); //remove hp from hash
hashLoadCompletedNotify.remove(hashHPKey); //remove notify event
vp.layout();
}
@SuppressWarnings("unused")
private void deleteProgressCompleted(List<String> progressIdFound){
List<String> progressIdNotFound = new ArrayList<String>();
for(String key : hashHorizontalPanels.keySet()){
System.out.println("Key " + key );
if(!progressIdFound.contains(key)){ //if key isn't not found - progress is completed so is removed
System.out.println("Key is not present " + key );
BulkProgressBar bulkPB = hashProgressBars.get(key);
lastOperation.setHtml(LASTOPERATION + bulkPB.getProgressText() + " uploading completed");
bulkPB.updateProgress(100);
progressIdNotFound.add(key);
}
}
for(String key : progressIdNotFound){
BulkProgressBar bulkPB = hashProgressBars.get(key);
lastOperation.setHtml(LASTOPERATION + bulkPB.getProgressText() + " uploading completed");
new InfoDisplay("Bulk Creator", bulkPB.getProgressText() + " uploading completed");
// vp.remove(hashHorizontalPanels.get(key)); //remove hp from view
hashProgressBars.remove(key); //remove progress bar from hash
hashHorizontalPanels.remove(key); //remove hp from hash
}
vp.layout();
cp.layout();
}
}

View File

@ -1,7 +1,9 @@
package org.gcube.portlets.user.workspace.client.view.windows; package org.gcube.portlets.user.workspace.client.view.windows;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer; import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.event.RefreshFolderEvent;
import org.gcube.portlets.user.workspace.client.event.SessionExpiredEvent; import org.gcube.portlets.user.workspace.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel; import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import org.gcube.portlets.user.workspace.client.resources.Resources; import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.shared.PublicLink; import org.gcube.portlets.user.workspace.shared.PublicLink;
@ -34,6 +36,7 @@ public class DialogGetLink extends Dialog {
private int widht = 450; private int widht = 450;
private int height = 210; private int height = 210;
private VerticalPanel vp = new VerticalPanel(); private VerticalPanel vp = new VerticalPanel();
private FileModel item;
/** /**
* The Enum Link_Type. * The Enum Link_Type.
@ -47,10 +50,11 @@ public class DialogGetLink extends Dialog {
* Instantiates a new dialog get link. * Instantiates a new dialog get link.
* *
* @param headingTxt the heading txt * @param headingTxt the heading txt
* @param itemId the item id * @param item the item
* @param type the type * @param type the type
*/ */
public DialogGetLink(String headingTxt, final String itemId, Link_Type type) { public DialogGetLink(String headingTxt, final FileModel item, Link_Type type) {
this.item = item;
setButtonAlign(HorizontalAlignment.CENTER); setButtonAlign(HorizontalAlignment.CENTER);
setIcon(Resources.getIconPublicLink()); setIcon(Resources.getIconPublicLink());
vp.setHorizontalAlign(HorizontalAlignment.CENTER); vp.setHorizontalAlign(HorizontalAlignment.CENTER);
@ -92,8 +96,8 @@ public class DialogGetLink extends Dialog {
vp.mask("Getting Public Link..."); vp.mask("Getting Public Link...");
if(itemId!=null && !itemId.isEmpty()){ if(item.getIdentifier()!=null && !item.getIdentifier().isEmpty()){
AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFolderItemId(itemId, true, new AsyncCallback<PublicLink>() { AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFolderItemId(item.getIdentifier(), true, new AsyncCallback<PublicLink>() {
@Override @Override
public void onSuccess(PublicLink publicLink) { public void onSuccess(PublicLink publicLink) {
@ -125,8 +129,8 @@ public class DialogGetLink extends Dialog {
case FOLDER_LINK: case FOLDER_LINK:
vp.mask("Getting Folder Link... checking permissions"); vp.mask("Getting Folder Link... checking permissions");
if(itemId!=null && !itemId.isEmpty()){ if(item.getIdentifier()!=null && !item.getIdentifier().isEmpty()){
AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(itemId, new AsyncCallback<InfoContactModel>() { AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(item.getIdentifier(), new AsyncCallback<InfoContactModel>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -145,7 +149,7 @@ public class DialogGetLink extends Dialog {
vp.unmask(); vp.unmask();
if(result.getLogin().compareToIgnoreCase(AppControllerExplorer.myLogin)==0){ if(result.getLogin().compareToIgnoreCase(AppControllerExplorer.myLogin)==0){
vp.mask("Getting Folder Link... permissions granted"); vp.mask("Getting Folder Link... permissions granted");
allowAccessToFolderLink(itemId); allowAccessToFolderLink(item.getIdentifier());
}else }else
new MessageBoxAlert("Permission Denied", "You have not permission to get Folder Link, you must be owner or administrator to the folder", null); new MessageBoxAlert("Permission Denied", "You have not permission to get Folder Link, you must be owner or administrator to the folder", null);
@ -186,7 +190,7 @@ public class DialogGetLink extends Dialog {
*/ */
private void allowAccessToFolderLink(String folderId){ private void allowAccessToFolderLink(String folderId){
AppControllerExplorer.rpcWorkspaceService.getFolderLinkForFolderItemId(folderId, true, new AsyncCallback<PublicLink>() { AppControllerExplorer.rpcWorkspaceService.markFolderAsPublicForFolderItemId(folderId, true, new AsyncCallback<PublicLink>() {
@Override @Override
public void onSuccess(PublicLink publicLink) { public void onSuccess(PublicLink publicLink) {
@ -194,6 +198,7 @@ public class DialogGetLink extends Dialog {
txtCompleteURL.setValue(publicLink.getCompleteURL()); txtCompleteURL.setValue(publicLink.getCompleteURL());
txtShortURL.setValue(publicLink.getShortURL()); txtShortURL.setValue(publicLink.getShortURL());
selectTxt(); selectTxt();
AppControllerExplorer.getEventBus().fireEvent(new RefreshFolderEvent(item.getParentFileModel(), true, false, false));
} }
@Override @Override

View File

@ -40,7 +40,6 @@ import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryRes
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryShare; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryShare;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUnshare; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUnshare;
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUpdate; import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntryUpdate;
import org.gcube.common.homelibrary.home.workspace.folder.FolderBulkCreator;
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem; import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalImage; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalImage;
@ -56,7 +55,6 @@ import org.gcube.common.homelibrary.home.workspace.usermanager.GCubeGroup;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer; import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategoryItemInterface; import org.gcube.portlets.user.workspace.client.interfaces.GXTCategoryItemInterface;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum; import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
import org.gcube.portlets.user.workspace.client.model.BulkCreatorModel;
import org.gcube.portlets.user.workspace.client.model.FileDetailsModel; import org.gcube.portlets.user.workspace.client.model.FileDetailsModel;
import org.gcube.portlets.user.workspace.client.model.FileGridModel; import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.model.FileModel;
@ -509,7 +507,7 @@ public class GWTWorkspaceBuilder {
logger.trace("workspace name: "+ workspaceRoot.getName()); logger.trace("workspace name: "+ workspaceRoot.getName());
logger.trace("workspace path "+ workspaceRoot.getPath()); logger.trace("workspace path "+ workspaceRoot.getPath());
FolderModel root = new FolderModel(workspaceRoot.getId(),workspaceRoot.getName(),null, true, workspaceRoot.isShared(), false); FolderModel root = new FolderModel(workspaceRoot.getId(),workspaceRoot.getName(),null, true, workspaceRoot.isShared(), false, workspaceRoot.isPublic());
root.setIsRoot(true); root.setIsRoot(true);
return root; return root;
@ -592,7 +590,7 @@ public class GWTWorkspaceBuilder {
fileModel = new FolderModel(item.getId(), name, true, shared.isVreFolder()); fileModel = new FolderModel(item.getId(), name, true, shared.isVreFolder());
fileModel.setShared(true); fileModel.setShared(true);
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString()); fileModel.setType(GXTFolderItemTypeEnum.FOLDER_SHARED.toString());
break; break;
default: default:
@ -680,8 +678,13 @@ public class GWTWorkspaceBuilder {
switch (item.getType()) { switch (item.getType()) {
case FOLDER: case FOLDER:
boolean isPublic = ((WorkspaceFolder) item).isPublic();
fileModel = new FolderModel(item.getId(), item.getName(), parentFolderModel, true, false, false, isPublic);
if(isPublic)
fileModel.setType(GXTFolderItemTypeEnum.FOLDER_PUBLIC.toString());
else
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileModel = new FolderModel(item.getId(), item.getName(), parentFolderModel, true, false, false);
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString()); fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileModel.setShareable(true); fileModel.setShareable(true);
fileModel.setDescription(item.getDescription()); fileModel.setDescription(item.getDescription());
@ -697,16 +700,14 @@ public class GWTWorkspaceBuilder {
case SHARED_FOLDER: case SHARED_FOLDER:
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item; WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item;
/* isPublic = ((WorkspaceFolder) shared).isPublic();
logger.debug("******START");
logger.debug("wsFolder.isShared(): "+shared.isShared());
logger.debug("wsFolder.getType().equals(WorkspaceItemType.SHARED_FOLDER): "+shared.getType().equals(WorkspaceItemType.SHARED_FOLDER));
logger.debug("shared.isVreFolder(): "+shared.isVreFolder());
logger.debug("*******END");
*/
String name = shared.isVreFolder()?shared.getDisplayName():item.getName(); String name = shared.isVreFolder()?shared.getDisplayName():item.getName();
fileModel = new FolderModel(item.getId(), name, parentFolderModel, true, true, shared.isVreFolder()); fileModel = new FolderModel(item.getId(), name, parentFolderModel, true, true, shared.isVreFolder(), isPublic);
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString()); if(isPublic)
fileModel.setType(GXTFolderItemTypeEnum.FOLDER_SHARED_PUBLIC.toString());
else
fileModel.setType(GXTFolderItemTypeEnum.FOLDER_SHARED.toString());
fileModel.setShareable(true); fileModel.setShareable(true);
fileModel.setDescription(item.getDescription()); fileModel.setDescription(item.getDescription());
break; break;
@ -762,7 +763,7 @@ public class GWTWorkspaceBuilder {
switch (item.getType()) { switch (item.getType()) {
case FOLDER: case FOLDER:
fileGridModel = new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModified()), parentFileModel, -1, true, false,false); fileGridModel = new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModified()), parentFileModel, -1, true, false,false, false);
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString()); fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_FOLDERS); fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_FOLDERS);
fileGridModel.setShareable(true); fileGridModel.setShareable(true);
@ -776,8 +777,8 @@ public class GWTWorkspaceBuilder {
case SHARED_FOLDER: case SHARED_FOLDER:
//ATTENTION: SEARCH ITEM IS NOT CASTABLE AT WorkspaceSharedFolder //ATTENTION: SEARCH ITEM IS NOT CASTABLE AT WorkspaceSharedFolder
fileGridModel = new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModified()), parentFileModel, -1, true, true, item.isVreFolder()); fileGridModel = new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModified()), parentFileModel, -1, true, true, item.isVreFolder(), false);
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString()); fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER_SHARED.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_SHARED_FOLDERS); fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_SHARED_FOLDERS);
fileGridModel.setShareable(true); fileGridModel.setShareable(true);
break; break;
@ -853,8 +854,13 @@ public class GWTWorkspaceBuilder {
switch (item.getType()) { switch (item.getType()) {
case FOLDER: case FOLDER:
fileGridModel = new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModificationTime()), parentFileModel, -1, true, false,false); boolean isPublic = ((WorkspaceFolder)item).isPublic();
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString()); fileGridModel = new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModificationTime()), parentFileModel, -1, true, false,false, isPublic);
if(isPublic)
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER_PUBLIC.toString());
else
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_FOLDERS); fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_FOLDERS);
fileGridModel.setShareable(true); fileGridModel.setShareable(true);
fileGridModel.setDescription(item.getDescription()); fileGridModel.setDescription(item.getDescription());
@ -868,9 +874,15 @@ public class GWTWorkspaceBuilder {
case SHARED_FOLDER: case SHARED_FOLDER:
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item; WorkspaceSharedFolder shared = (WorkspaceSharedFolder) item;
isPublic = ((WorkspaceFolder)shared).isPublic();
String name = shared.isVreFolder()?shared.getDisplayName():item.getName(); String name = shared.isVreFolder()?shared.getDisplayName():item.getName();
fileGridModel = new FolderGridModel(item.getId(), name, toDate(item.getLastModificationTime()), parentFileModel, -1, true, true, shared.isVreFolder()); fileGridModel = new FolderGridModel(item.getId(), name, toDate(item.getLastModificationTime()), parentFileModel, -1, true, true, shared.isVreFolder(), isPublic);
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
if(isPublic)
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER_SHARED_PUBLIC.toString());
else
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER_SHARED.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_SHARED_FOLDERS); fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_SHARED_FOLDERS);
fileGridModel.setShareable(true); fileGridModel.setShareable(true);
fileGridModel.setDescription(item.getDescription()); fileGridModel.setDescription(item.getDescription());
@ -1227,7 +1239,7 @@ public class GWTWorkspaceBuilder {
// }else // }else
// name = wsFolder.getName(); // name = wsFolder.getName();
FolderModel folder = new FolderModel(wsFolder.getId(), name, parent, true, wsFolder.isShared(), false); FolderModel folder = new FolderModel(wsFolder.getId(), name, parent, true, wsFolder.isShared(), false, wsFolder.isPublic());
folder.setShareable(true); folder.setShareable(true);
folder.setDescription(wsFolder.getDescription()); folder.setDescription(wsFolder.getDescription());
// folder.setOwner(wsFolder.getOwner()); // folder.setOwner(wsFolder.getOwner());
@ -1281,7 +1293,7 @@ public class GWTWorkspaceBuilder {
logger.debug("Name is: "+name); logger.debug("Name is: "+name);
FolderModel folder = new FolderModel(wsFolder.getId(), name, parent, true, wsFolder.isShared(), false); FolderModel folder = new FolderModel(wsFolder.getId(), name, parent, true, wsFolder.isShared(), false, wsFolder.isPublic());
folder.setShareable(true); folder.setShareable(true);
folder.setIsRoot(wsFolder.isRoot()); folder.setIsRoot(wsFolder.isRoot());
folder.setDescription(wsFolder.getDescription()); folder.setDescription(wsFolder.getDescription());
@ -1624,39 +1636,39 @@ public class GWTWorkspaceBuilder {
return new InfoContactModel(); return new InfoContactModel();
} }
/** // /**
* Builds the gxt list bulk creator model. // * Builds the gxt list bulk creator model.
* // *
* @param listFBC the list fbc // * @param listFBC the list fbc
* @return the list // * @return the list
* @throws InternalErrorException the internal error exception // * @throws InternalErrorException the internal error exception
*/ // */
public List<BulkCreatorModel> buildGXTListBulkCreatorModel(List<FolderBulkCreator> listFBC) throws InternalErrorException { // public List<BulkCreatorModel> buildGXTListBulkCreatorModel(List<FolderBulkCreator> listFBC) throws InternalErrorException {
//
List<BulkCreatorModel> listBulkCreatorModel = new ArrayList<BulkCreatorModel>(); // List<BulkCreatorModel> listBulkCreatorModel = new ArrayList<BulkCreatorModel>();
//
for (FolderBulkCreator item : listFBC){ // for (FolderBulkCreator item : listFBC){
//
BulkCreatorModel bulk; // BulkCreatorModel bulk;
//
if(item.getStatus()<1) // if(item.getStatus()<1)
bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.ONGOING, item.getNumberOfRequests(), item.getFailures()); // bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.ONGOING, item.getNumberOfRequests(), item.getFailures());
else{//status = 1 // else{//status = 1
//
int failures = item.getFailures(); // int failures = item.getFailures();
//
if(failures==0) // if(failures==0)
bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.COMPLETED, item.getNumberOfRequests(), item.getFailures()); // bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.COMPLETED, item.getNumberOfRequests(), item.getFailures());
else // else
if(failures<item.getNumberOfRequests()) // if(failures<item.getNumberOfRequests())
bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.FAILED, item.getNumberOfRequests(), item.getFailures()); // bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.FAILED, item.getNumberOfRequests(), item.getFailures());
else // else
bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.FAILED, item.getNumberOfRequests(), item.getFailures()); // bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.FAILED, item.getNumberOfRequests(), item.getFailures());
} // }
listBulkCreatorModel.add(bulk); // listBulkCreatorModel.add(bulk);
} // }
return listBulkCreatorModel; // return listBulkCreatorModel;
} // }
/** /**

View File

@ -3441,9 +3441,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} }
/** /**
* Retrieve an instance of the library for the scope * Retrieve an instance of the library for the scope.
*
* @param scope if it is null it is evaluated from the session * @param scope if it is null it is evaluated from the session
* @return * @return the ckan utils obj
*/ */
public CKanUtils getCkanUtilsObj(String scope){ public CKanUtils getCkanUtilsObj(String scope){
HttpSession httpSession = this.getThreadLocalRequest().getSession(); HttpSession httpSession = this.getThreadLocalRequest().getSession();
@ -3459,6 +3460,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return instance; return instance;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#hasUserRoleAdmin()
*/
@Override @Override
public boolean hasUserRoleAdmin() { public boolean hasUserRoleAdmin() {
HttpSession httpSession = this.getThreadLocalRequest().getSession(); HttpSession httpSession = this.getThreadLocalRequest().getSession();
@ -3517,6 +3521,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return role; return role;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getUser()
*/
@Override @Override
public String getUser() { public String getUser() {
HttpSession httpSession = this.getThreadLocalRequest().getSession(); HttpSession httpSession = this.getThreadLocalRequest().getSession();
@ -3525,20 +3532,22 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} }
/** /**
* Builds a string made of key + scope * Builds a string made of key + scope.
* @param key *
* @param scope * @param key the key
* @return * @param scope the scope
* @return the string
*/ */
public static String concatenateSessionKeyScope(String key, String scope){ public static String concatenateSessionKeyScope(String key, String scope){
return key.concat(scope); return key.concat(scope);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getFolderLinkForFolderItemId(java.lang.String, boolean) * @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#markFolderAsPublicForFolderItemId(java.lang.String, boolean)
*/ */
@Override @Override
public PublicLink getFolderLinkForFolderItemId(String itemId, boolean b) throws SessionExpiredException, Exception { public PublicLink markFolderAsPublicForFolderItemId(String itemId, boolean setPublic) throws SessionExpiredException, Exception {
if(isSessionExpired()) if(isSessionExpired())
throw new SessionExpiredException(); throw new SessionExpiredException();
@ -3548,21 +3557,27 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
WorkspaceItem item = workspace.getItem(itemId); WorkspaceItem item = workspace.getItem(itemId);
if(item instanceof WorkspaceFolder){ if(item instanceof WorkspaceFolder){
WorkspaceFolder folder = (WorkspaceFolder) item; WorkspaceFolder folder = (WorkspaceFolder) item;
String folderId = folder.getPublicLink(false); if(setPublic){
workspaceLogger.info("HL returning folder link id: "+folderId); folder.setPublic(true);
ApplicationProfileReader apReader = new ApplicationProfileReader("Workspace-Explorer-App", "org.gcube.portlets.user.workspaceexplorerapp.server.WorkspaceExplorerAppServiceImpl"); String folderId = item.getId();
ApplicationProfile ap = apReader.readProfileFromInfrastrucure(); workspaceLogger.info("HL returning folder link id: "+folderId);
workspaceLogger.info("Application profile returning url: "+ap.getUrl()); ApplicationProfileReader apReader = new ApplicationProfileReader("Workspace-Explorer-App", "org.gcube.portlets.user.workspaceexplorerapp.server.WorkspaceExplorerAppServiceImpl");
String folderLink = ap.getUrl()+"?folderId="+folderId; ApplicationProfile ap = apReader.readProfileFromInfrastrucure();
String shortURL = null; workspaceLogger.info("Application profile returning url: "+ap.getUrl());
try{ String folderLink = ap.getUrl()+"?folderId="+folderId;
shortURL = getShortUrl(folderLink); String shortURL = null;
shortURL = shortURL!=null?shortURL:"not available"; try{
}catch(Exception e){ shortURL = getShortUrl(folderLink);
workspaceLogger.warn("Short url error, skipping"); shortURL = shortURL!=null?shortURL:"not available";
shortURL = "not available"; }catch(Exception e){
workspaceLogger.warn("Short url error, skipping");
shortURL = "not available";
}
return new PublicLink(folderLink, shortURL);
}else{
folder.setPublic(false);
return null;
} }
return new PublicLink(folderLink, shortURL);
}else }else
throw new NoGcubeItemTypeException("The item is not a Gcube Item"); throw new NoGcubeItemTypeException("The item is not a Gcube Item");

View File

@ -5,7 +5,6 @@ import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.gcube.datacatalogue.ckanutillibrary.CKanUtils; import org.gcube.datacatalogue.ckanutillibrary.CKanUtils;
import org.gcube.datacatalogue.ckanutillibrary.CKanUtilsImpl;
import org.gcube.datacatalogue.ckanutillibrary.models.RolesIntoOrganization; import org.gcube.datacatalogue.ckanutillibrary.models.RolesIntoOrganization;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel; import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl; import org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl;
@ -302,10 +301,12 @@ public class UserUtil {
// get the orgs of the user // get the orgs of the user
List<CkanOrganization> ckanOrgs = ckanUtils.getOrganizationsByUser(username); List<CkanOrganization> ckanOrgs = ckanUtils.getOrganizationsByUser(username);
for (CkanOrganization ckanOrganization : ckanOrgs) { for (CkanOrganization ckanOrganization : ckanOrgs) {
if(ckanOrganization.getName().equals(gCubeGroupName.toLowerCase()) || ckanOrganization.getName().equals(CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT)){ /*TODO @COSTANTINO MUST CHECK*/
orgsInWhichAdminRole.add(new OrganizationBean(ckanOrganization.getTitle(), ckanOrganization.getName()));
break; //if(ckanOrganization.getName().equals(gCubeGroupName.toLowerCase()) || ckanOrganization.getName().equals(CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT)){
} // orgsInWhichAdminRole.add(new OrganizationBean(ckanOrganization.getTitle(), ckanOrganization.getName()));
// break;
//}
} }
} }
}else }else