ref 13226:StorageHub - Update workspace-sharing-widget to SH

https://support.d4science.org/issues/13226

Updated to StorageHub

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@177233 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-02-22 11:37:09 +00:00
parent 25b3e96391
commit f3c41d67ac
7 changed files with 501 additions and 472 deletions

View File

@ -115,13 +115,11 @@ public interface GWTWorkspaceServiceAsync {
void createFolder(String nameFolder, String description, FileModel parent, AsyncCallback<FolderModel> callback);
/**
* Gets the details file.
*
* @param item
* the item
* @param callback
* the callback
* @return the details file
* file details model
*/
void getDetailsFile(FileModel item, AsyncCallback<FileDetailsModel> callback);
@ -308,8 +306,6 @@ public interface GWTWorkspaceServiceAsync {
*/
void getTimeSeriesById(String identifier, AsyncCallback<GWTWorkspaceItem> callback);
/**
* Gets the list parents by item identifier.
*
@ -514,7 +510,6 @@ public interface GWTWorkspaceServiceAsync {
*/
void moveItems(List<String> ids, String destinationId, AsyncCallback<WorkspaceOperationResult> callback);
/**
* Gets the my login.
*
@ -525,7 +520,6 @@ public interface GWTWorkspaceServiceAsync {
*/
void getMyLogin(String currentPortletUrl, AsyncCallback<UserBean> callback);
/**
* Gets the trash content.
*
@ -557,7 +551,6 @@ public interface GWTWorkspaceServiceAsync {
void executeOperationOnTrash(List<String> listTrashItemIds, WorkspaceTrashOperation operation,
AsyncCallback<TrashOperationContent> callback);
/**
* Gets the user workspace total items.
*
@ -584,7 +577,6 @@ public interface GWTWorkspaceServiceAsync {
*/
void getItemDescriptionById(String identifier, AsyncCallback<String> callback);
/**
* Load gcube item properties.
*

View File

@ -37,11 +37,15 @@ public class ExplorerPanel extends LayoutContainer {
private boolean isSmartFolderInstanced;
private boolean isOnlyTreeInstanced;
/**
* Default instance an async tree to navigate user workspace
*
* @param instancingSmartFolder
* instancing smart folder
* @param instancingMessages
* instancing messages
* @param selectRootItem
* select root
*/
public ExplorerPanel(boolean instancingSmartFolder, boolean instancingMessages, boolean selectRootItem) {
@ -56,7 +60,6 @@ public class ExplorerPanel extends LayoutContainer {
this.expPanel = new ContentPanel();
this.expPanel.setHeaderVisible(false);
// smartFolderPanel.setVisible(false);
// messagesPanel.setVisible(false);
asycTreePanel.setVisible(true);
@ -64,8 +67,6 @@ public class ExplorerPanel extends LayoutContainer {
// expPanel.add(smartFolderPanel);
// expPanel.add(messagesPanel);
// BULK
// REMOVED 2016-09-15 CHECK SVN
// buttBulk.setIcon(Resources.getIconBulkUpdate());
@ -75,10 +76,13 @@ public class ExplorerPanel extends LayoutContainer {
add(expPanel);
}
/**
* Instance only tree
*
* @param instancingOnlyTree
* only tree
* @param selectRootItem
* select root item
*/
public ExplorerPanel(boolean instancingOnlyTree, boolean selectRootItem) {
@ -116,7 +120,6 @@ public class ExplorerPanel extends LayoutContainer {
else
buttBulk.setIcon(Resources.getIconLoading());
toolBar.layout();
}
@ -155,7 +158,8 @@ public class ExplorerPanel extends LayoutContainer {
public void handleEvent(BaseEvent be) {
Radio selectedRadio = radioGroup.getValue();
// System.out.println("radio value:" +selectedRadio.getValueAttribute());
// System.out.println("radio value:"
// +selectedRadio.getValueAttribute());
// System.out.println("id" + selectedRadio.getId());
if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.SMARTFOLDER.toString()) == 0)
switchView(ViewSwitchType.SmartFolder);
@ -178,8 +182,6 @@ public class ExplorerPanel extends LayoutContainer {
if (type.compareTo(ViewSwitchType.Tree) == 0) {
asycTreePanel.setVisible(true);
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.Tree));
// asycTreePanel.setSearch(false);
@ -187,19 +189,14 @@ public class ExplorerPanel extends LayoutContainer {
} else if (type.compareTo(ViewSwitchType.SmartFolder) == 0) {
asycTreePanel.setVisible(false);
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.SmartFolder));
// this.expPanel.setVisible(shortuctsPanel.getElement(), false);
// this.expPanel.setVisible(asycTreePanel.getElement(), true);
}
else{
} else {
asycTreePanel.setVisible(false);
}
}
@ -208,27 +205,22 @@ public class ExplorerPanel extends LayoutContainer {
return asycTreePanel;
}
public boolean isSmartFolderInstanced() {
return isSmartFolderInstanced;
}
public void setMessagesInstanced(boolean isMessagesInstanced) {
this.isMessagesInstanced = isMessagesInstanced;
}
public void setSmartFolderInstanced(boolean isSmartFolderInstanced) {
this.isSmartFolderInstanced = isSmartFolderInstanced;
}
public boolean isOnlyTreeInstanced() {
return isOnlyTreeInstanced;
}
public void setOnlyTreeInstanced(boolean isOnlyTreeInstanced) {
this.isOnlyTreeInstanced = isOnlyTreeInstanced;
}

View File

@ -34,14 +34,10 @@ import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
/**
* The Class DialogShareFolder.
*
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
* Jul 10, 2017
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jul 10, 2017
*/
public class DialogShareFolder extends Dialog {
@ -62,12 +58,17 @@ public class DialogShareFolder extends Dialog {
/**
* Use to modify a shared folder or share an existing folder.
*
* @param folderParentName the folder parent name
* @param folder the folder
* @param eventBus the event bus
* @param userStore the user store
* @param folderParentName
* the folder parent name
* @param folder
* the folder
* @param eventBus
* the event bus
* @param userStore
* the user store
*/
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus, UserStore userStore) {
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus,
UserStore userStore) {
initUserStore(userStore);
initLayout(folderParentName);
this.parentFolder = folder;
@ -129,7 +130,8 @@ public class DialogShareFolder extends Dialog {
public void onSuccess(List<WorkspaceACL> result) {
permission = new PanelTogglePermission(result);
//ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM HL
// ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM
// HL
if (folder.isShared())
selectAclForFolder(folder);
@ -206,7 +208,8 @@ public class DialogShareFolder extends Dialog {
/**
* Inits the user store.
*
* @param userStore the user store
* @param userStore
* the user store
*/
private void initUserStore(UserStore userStore) {
this.userStore = userStore;
@ -216,7 +219,8 @@ public class DialogShareFolder extends Dialog {
/**
* Update recipient of share.
*
* @param listContacts the list contacts
* @param listContacts
* the list contacts
*/
private void updateRecipientOfShare(List<InfoContactModel> listContacts) {
suggestPanel.resetItemSelected();
@ -225,22 +229,25 @@ public class DialogShareFolder extends Dialog {
if (!isShareOwner(contact)) // skip owner
suggestPanel.addRecipient(contact.getName(), true);
else
suggestPanel.addRecipient(contact.getName(), false); //owner is not deletable
suggestPanel.addRecipient(contact.getName(), false); // owner
// is
// not
// deletable
}
}
}
/**
* Fill recipient already shared.
*
* @param folderId the folder id
* @param lc the lc
* @param folderId
* the folder id
* @param lc
* the lc
*/
private void fillRecipientAlreadyShared(String folderId, final LayoutContainer lc) {
userStore.getListSharedUserByFolderId(folderId,
new AsyncCallback<List<InfoContactModel>>() {
userStore.getListSharedUserByFolderId(folderId, new AsyncCallback<List<InfoContactModel>>() {
@Override
public void onSuccess(List<InfoContactModel> listContacts) {
@ -263,16 +270,22 @@ public class DialogShareFolder extends Dialog {
/**
* Permission control.
*
* @param owner the owner
* @param showAlert the show alert
* @param owner
* the owner
* @param showAlert
* the show alert
*/
private void permissionControl(String owner, boolean showAlert) {
GWT.log("Permission control compare between owner: "+owner +" and my login: "+AppControllerExplorer.myLogin);
GWT.log("Permission control compare between owner: " + owner + " and my login: "
+ AppControllerExplorer.myLogin);
if (AppControllerExplorer.myLogin.compareToIgnoreCase(owner) != 0) {
enableFormDialog(false);
if (showAlert)
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not owner of \""+txtName.getValue()+"\"", null);
new MessageBoxAlert("Permission denied",
"You have no permissions to change sharing. You are not owner of \"" + txtName.getValue()
+ "\"",
null);
} else {
enableFormDialog(true);
}
@ -281,7 +294,8 @@ public class DialogShareFolder extends Dialog {
/**
* Enable form dialog.
*
* @param bool the bool
* @param bool
* the bool
*/
private void enableFormDialog(boolean bool) {
getButtonById(Dialog.OK).setEnabled(bool);
@ -304,7 +318,8 @@ public class DialogShareFolder extends Dialog {
/**
* Inits the layout.
*
* @param folderParentName the folder parent name
* @param folderParentName
* the folder parent name
*/
public void initLayout(String folderParentName) {
FormLayout layout = new FormLayout();
@ -324,9 +339,12 @@ public class DialogShareFolder extends Dialog {
/**
* Use to create a new shared folder.
*
* @param folderParentName the folder parent name
* @param eventBus the event bus
* @param userStore the user store
* @param folderParentName
* the folder parent name
* @param eventBus
* the event bus
* @param userStore
* the user store
*/
public DialogShareFolder(String folderParentName, HandlerManager eventBus, UserStore userStore) {
initUserStore(userStore);
@ -404,7 +422,6 @@ public class DialogShareFolder extends Dialog {
this.show();
}
/**
* Gets the shared list users.
*
@ -415,7 +432,6 @@ public class DialogShareFolder extends Dialog {
return suggestPanel.getSelectedUser();
}
/**
* Adds the listners.
*/
@ -429,7 +445,6 @@ public class DialogShareFolder extends Dialog {
}
});
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
@ -446,7 +461,8 @@ public class DialogShareFolder extends Dialog {
final MultiDragContact multiDrag = new MultiDragContact();
multiDrag.show();
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
List<InfoContactModel> exclusiveContacts = userStore
.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
multiDrag.addSourceContacts(exclusiveContacts);
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
@ -478,26 +494,27 @@ public class DialogShareFolder extends Dialog {
});
}
/**
* Checks if is share owner.
*
* @param infoContactModel the info contact model
* @param infoContactModel
* the info contact model
* @return true, if is share owner
*/
public boolean isShareOwner(InfoContactModel infoContactModel) {
if(infoContactModel!=null && shareOwner!=null && InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner)==0)
if (infoContactModel != null && shareOwner != null
&& InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner) == 0)
return true;
return false;
}
/**
* List already shared contains.
*
* @param contact the contact
* @param contact
* the contact
* @return true, if successful
*/
private boolean listAlreadySharedContains(InfoContactModel contact) {
@ -559,7 +576,8 @@ public class DialogShareFolder extends Dialog {
/**
* Checks if is valid form.
*
* @param displayAlert the display alert
* @param displayAlert
* the display alert
* @return true, if is valid form
*/
public boolean isValidForm(boolean displayAlert) {
@ -596,11 +614,13 @@ public class DialogShareFolder extends Dialog {
/**
* Select acl for folder.
*
* @param folder the folder
* @param folder
* the folder
*/
private void selectAclForFolder(FileModel folder) {
GWT.log("Loading ACL to: " + folder);
WorkspaceSharingServiceAsync.INSTANCE.getACLsForSharedFolderId(folder.getIdentifier(), new AsyncCallback<WorkspaceACL>() {
WorkspaceSharingServiceAsync.INSTANCE.getACLsForSharedFolderId(folder.getIdentifier(),
new AsyncCallback<WorkspaceACL>() {
@Override
public void onFailure(Throwable arg0) {
@ -622,18 +642,23 @@ public class DialogShareFolder extends Dialog {
/**
* Gets the users managers.
*
* @param sharedFolderId the shared folder id
* @param callback the callback
* @return the users managers
*
* @param sharedFolderId
* share folder id
* @param callback
* list of contacts
*/
public void getUsersManagers(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback) {
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId,
new AsyncCallback<List<InfoContactModel>>() {
@Override
public void onFailure(Throwable arg0) {
GWT.log("an error occured in getting user managers by Id "+sharedFolderId + " "+arg0.getMessage());
new MessageBoxAlert("Alert", "Sorry, an error occurred on getting users managers, try again later",null);
GWT.log("an error occured in getting user managers by Id " + sharedFolderId + " "
+ arg0.getMessage());
new MessageBoxAlert("Alert",
"Sorry, an error occurred on getting users managers, try again later", null);
}
@ -645,20 +670,23 @@ public class DialogShareFolder extends Dialog {
});
}
/**
* Permission control.
*
* @param listManagers the list managers
* @param showAlert the show alert
* @param folder the folder
* @param listManagers
* the list managers
* @param showAlert
* the show alert
* @param folder
* the folder
*/
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert, FileModel folder) {
boolean permissionsOk = false;
for (InfoContactModel infoContactModel : listManagers) {
GWT.log("DialogPermission control compare between : "+infoContactModel.getLogin() +" and my login: "+AppControllerExplorer.myLogin);
GWT.log("DialogPermission control compare between : " + infoContactModel.getLogin() + " and my login: "
+ AppControllerExplorer.myLogin);
if (AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin()) == 0) {
permissionsOk = true;
break;
@ -671,7 +699,10 @@ public class DialogShareFolder extends Dialog {
} else {
enableFormDialog(false);
if (showAlert)
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not manager of \""+folder.getName()+"\"", null);
new MessageBoxAlert("Permission denied",
"You have no permissions to change sharing. You are not manager of \"" + folder.getName()
+ "\"",
null);
}
}

View File

@ -63,6 +63,9 @@ public class DialogPermission extends Dialog {
/**
* Use to set permission to VRE Folder
*
* @param folder
* folder
*/
public DialogPermission(FileModel folder) {
@ -74,7 +77,6 @@ public class DialogPermission extends Dialog {
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
hpPermission.mask("Checking authorization");
AsyncCallback<List<InfoContactModel>> callback = new AsyncCallback<List<InfoContactModel>>() {
@Override
@ -124,8 +126,7 @@ public class DialogPermission extends Dialog {
public void addListners() {
this.getButtonById(Dialog.CANCEL).addSelectionListener(
new SelectionListener<ButtonEvent>() {
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
@ -133,8 +134,7 @@ public class DialogPermission extends Dialog {
}
});
this.getButtonById(Dialog.OK).addSelectionListener(
new SelectionListener<ButtonEvent>() {
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
@ -142,7 +142,8 @@ public class DialogPermission extends Dialog {
INSTANCE.mask("Changing permissions");
if (folder != null && getSelectedACL().getId() != null) {
WorkspaceSharingServiceAsync.INSTANCE.updateACLForVREbyGroupName(folder.getIdentifier(), getSelectedACL().getId(), new AsyncCallback<Void>() {
WorkspaceSharingServiceAsync.INSTANCE.updateACLForVREbyGroupName(folder.getIdentifier(),
getSelectedACL().getId(), new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
@ -154,9 +155,11 @@ public class DialogPermission extends Dialog {
public void onSuccess(Void result) {
INSTANCE.unmask();
INSTANCE.hide();
new InfoDisplay("Permission updated", "The permissions have been changed correctly");
new InfoDisplay("Permission updated",
"The permissions have been changed correctly");
AppControllerExplorer.getEventBus().fireEvent(new UpdatedVREPermissionEvent(folder.getIdentifier()));
AppControllerExplorer.getEventBus()
.fireEvent(new UpdatedVREPermissionEvent(folder.getIdentifier()));
}
});
}
@ -165,13 +168,13 @@ public class DialogPermission extends Dialog {
}
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert) {
boolean permissionsOk = false;
for (InfoContactModel infoContactModel : listManagers) {
GWT.log("DialogPermission control compare between : "+infoContactModel.getLogin() +" and my login: "+AppControllerExplorer.myLogin);
GWT.log("DialogPermission control compare between : " + infoContactModel.getLogin() + " and my login: "
+ AppControllerExplorer.myLogin);
if (AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin()) == 0) {
permissionsOk = true;
break;
@ -184,7 +187,10 @@ public class DialogPermission extends Dialog {
} else {
enableFormDialog(false);
if (showAlert)
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not manager of \""+folder.getName()+"\"", null);
new MessageBoxAlert("Permission denied",
"You have no permissions to change sharing. You are not manager of \"" + folder.getName()
+ "\"",
null);
}
}
@ -198,12 +204,15 @@ public class DialogPermission extends Dialog {
public void getUsersManagers(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback) {
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId,
new AsyncCallback<List<InfoContactModel>>() {
@Override
public void onFailure(Throwable arg0) {
GWT.log("an error occured in getting user managers by Id "+sharedFolderId + " "+arg0.getMessage());
new MessageBoxAlert("Alert", "Sorry, an error occurred on getting users managers, try again later",null);
GWT.log("an error occured in getting user managers by Id " + sharedFolderId + " "
+ arg0.getMessage());
new MessageBoxAlert("Alert",
"Sorry, an error occurred on getting users managers, try again later", null);
}

View File

@ -26,8 +26,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The Class DialogEditProperties.
*
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
* Jun 11, 2015
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jun 11, 2015
*/
public class DialogEditProperties extends Dialog {
@ -41,8 +40,10 @@ public class DialogEditProperties extends Dialog{
/**
* Instantiates a new dialog edit properties.
*
* @param itemId
* the item id
* @param item
* FileModel
* @param command
* Command
*/
public DialogEditProperties(FileModel item, Command command) {
this.item = item;
@ -73,8 +74,9 @@ public class DialogEditProperties extends Dialog{
});
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see com.extjs.gxt.ui.client.widget.Window#show()
*/
@Override
@ -100,7 +102,8 @@ public class DialogEditProperties extends Dialog{
String value = field.getValue() != null ? field.getValue() : "";
prp.put(field.getFieldLabel(), value);
}
AppControllerExplorer.rpcWorkspaceService.setGcubeItemProperties(item.getIdentifier(), prp, new AsyncCallback<Void>() {
AppControllerExplorer.rpcWorkspaceService.setGcubeItemProperties(item.getIdentifier(), prp,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
@ -118,10 +121,10 @@ public class DialogEditProperties extends Dialog{
}
private void loadGcubeItemProperties() {
// mask("Loading properties...");
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(), new AsyncCallback<Map<String,String>>() {
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(),
new AsyncCallback<Map<String, String>>() {
@Override
public void onSuccess(Map<String, String> result) {

View File

@ -12,12 +12,14 @@ public class InfoDisplay extends Info{
/**
*
* @param title
* title
* @param text
* @param milliseconds - The time in milliseconds to display a message (defaults to 2500).
* text
* @param milliseconds
* milliseconds
*/
public InfoDisplay(String title, String text, int milliseconds) {
InfoConfig config = new InfoConfig(title, text);
config.display = milliseconds;

View File

@ -1,19 +1,17 @@
package org.gcube.portlets.user.workspace.client.view.windows;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
* Jun 25, 2013
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jun 25, 2013
*
*/
public class InfoDisplayMessage extends InfoDisplay {
/**
* @param title
* message title
* @param text
* message text
*/
public InfoDisplayMessage(String title, String text) {
super(title, text);
@ -21,7 +19,9 @@ public class InfoDisplayMessage extends InfoDisplay{
/**
* @param title
* message title
* @param text
* message text
*/
public InfoDisplayMessage(String title, String text, int milliseconds) {
super(title, text, milliseconds);