ref 17169: Selection of users in the Sharing panel
https://support.d4science.org/issues/17169 Added support to admins discovery by VREs git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@181337 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
600dddc376
commit
2bebec9b84
|
@ -31,5 +31,14 @@
|
||||||
<!-- Specify the paths for translatable code -->
|
<!-- Specify the paths for translatable code -->
|
||||||
<source path='client' />
|
<source path='client' />
|
||||||
<source path='shared' />
|
<source path='shared' />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <inherits name="com.google.gwt.logging.Logging" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.logLevel" value="SEVERE" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.enabled" value="TRUE" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.consoleHandler" value="ENABLED"/> -->
|
||||||
|
<!-- <set-property name="gwt.logging.firebugHandler" value="ENABLED" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.popupHandler" value="ENABLED" /> -->
|
||||||
|
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.gcube.portlets.widgets.workspacesharingwidget.client.permissions.Mess
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.permissions.PanelTogglePermission;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.permissions.PanelTogglePermission;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.UserStore;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.UserStore;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.DialogMultiDragContact;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.DialogMultiDragContact;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiDragContact;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.MultiDragContact;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
||||||
|
|
||||||
|
@ -42,9 +42,7 @@ public class MultiDragContactsEditPermissions {
|
||||||
|
|
||||||
private UserStore userStore = new UserStore();
|
private UserStore userStore = new UserStore();
|
||||||
private ConstantsSharing.LOAD_CONTACTS_AS loadContactAs;
|
private ConstantsSharing.LOAD_CONTACTS_AS loadContactAs;
|
||||||
private DialogMultiDragContact dialogMultiDragContact = new DialogMultiDragContact(
|
private DialogMultiDragContact dialogMultiDragContact;
|
||||||
MultiDragConstants.HEADING_DIALOG, MultiDragConstants.ALL_CONTACTS_LEFT_LIST,
|
|
||||||
MultiDragConstants.SHARE_WITH_RIGHT_LIST, false, false);
|
|
||||||
private List<InfoContactModel> sources = new ArrayList<InfoContactModel>();
|
private List<InfoContactModel> sources = new ArrayList<InfoContactModel>();
|
||||||
private boolean hiddenMySelf;
|
private boolean hiddenMySelf;
|
||||||
private String workspaceItemId;
|
private String workspaceItemId;
|
||||||
|
@ -54,6 +52,9 @@ public class MultiDragContactsEditPermissions {
|
||||||
|
|
||||||
public MultiDragContactsEditPermissions(ConstantsSharing.LOAD_CONTACTS_AS load, final String workspaceItemId,
|
public MultiDragContactsEditPermissions(ConstantsSharing.LOAD_CONTACTS_AS load, final String workspaceItemId,
|
||||||
boolean hiddenMySelf) {
|
boolean hiddenMySelf) {
|
||||||
|
dialogMultiDragContact= new DialogMultiDragContact(
|
||||||
|
MultiDragConstants.HEADING_DIALOG, MultiDragConstants.ALL_CONTACTS_LEFT_LIST,
|
||||||
|
MultiDragConstants.SHARE_WITH_RIGHT_LIST, false, false,hiddenMySelf);
|
||||||
initMultiDrag(load, workspaceItemId, hiddenMySelf);
|
initMultiDrag(load, workspaceItemId, hiddenMySelf);
|
||||||
|
|
||||||
// dialog = super.getDialogMultiDragContact();
|
// dialog = super.getDialogMultiDragContact();
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.workspacesharingwidget.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.admin.DialogMultiDragContactAdmin;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Francesco Mangiacrapa Jul 30, 2014
|
||||||
|
*
|
||||||
|
* A simple multi drag dialog to manage users administrators of a
|
||||||
|
* workspace item
|
||||||
|
*/
|
||||||
|
public class MultiDragWorkspaceContactAdmin {
|
||||||
|
|
||||||
|
private DialogMultiDragContactAdmin dialogMultiDragContactAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load administrators or shared users to workspace item id
|
||||||
|
*
|
||||||
|
* @param workspaceItemId
|
||||||
|
* Item id
|
||||||
|
*
|
||||||
|
* @param workspaceItemId
|
||||||
|
*/
|
||||||
|
public MultiDragWorkspaceContactAdmin(String workspaceItemId) {
|
||||||
|
GWT.log("MultiDragWorkspaceContactAdmin(): "+workspaceItemId);
|
||||||
|
try {
|
||||||
|
dialogMultiDragContactAdmin = new DialogMultiDragContactAdmin(MultiDragConstants.HEADING_DIALOG,
|
||||||
|
MultiDragConstants.ALL_CONTACTS_LEFT_LIST, MultiDragConstants.SHARE_WITH_RIGHT_LIST, workspaceItemId);
|
||||||
|
} catch (Throwable e){
|
||||||
|
GWT.log("Error in MultiDragWorkspaceContactAdmin(): "+e.getLocalizedMessage(),e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the multi drag DialogMultiDragContact
|
||||||
|
*/
|
||||||
|
public DialogMultiDragContactAdmin getDialogMultiDragContact() {
|
||||||
|
return dialogMultiDragContactAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
dialogMultiDragContactAdmin.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InfoContactModel> getTargetContacts() {
|
||||||
|
return dialogMultiDragContactAdmin.getMultiDrag().getTargetListContactWithMyLogin();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.UserStore;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.UserStore;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.DialogMultiDragContact;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.DialogMultiDragContact;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
|
@ -18,19 +18,14 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa Jul 30, 2014
|
* @author Francesco Mangiacrapa Jul 30, 2014
|
||||||
*
|
*
|
||||||
* A simple multi drag dialog to manage users (shared or administrators)
|
* A simple multi drag dialog to manage users administrators
|
||||||
* of a workspace item
|
* of a workspace item
|
||||||
*/
|
*/
|
||||||
public class SimpleMultiDragWorkspaceContact {
|
public class MultiDragWorkspaceContactUser {
|
||||||
|
|
||||||
private UserStore userStore = new UserStore();
|
private UserStore userStore = new UserStore();
|
||||||
private ConstantsSharing.LOAD_CONTACTS_AS loadContactAs;
|
private DialogMultiDragContact dialogMultiDragContactSimple;
|
||||||
private DialogMultiDragContact dialogMultiDragContact = new DialogMultiDragContact(
|
|
||||||
MultiDragConstants.HEADING_DIALOG, MultiDragConstants.ALL_CONTACTS_LEFT_LIST,
|
|
||||||
MultiDragConstants.SHARE_WITH_RIGHT_LIST, false, false);
|
|
||||||
private List<InfoContactModel> targets = new ArrayList<InfoContactModel>();
|
private List<InfoContactModel> targets = new ArrayList<InfoContactModel>();
|
||||||
private boolean readGroupsFromPortal;
|
|
||||||
private boolean readGroupsFromHL;
|
|
||||||
private boolean hiddenMySelf;
|
private boolean hiddenMySelf;
|
||||||
private String workspaceItemId;
|
private String workspaceItemId;
|
||||||
private String myLogin;
|
private String myLogin;
|
||||||
|
@ -39,36 +34,29 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
/**
|
/**
|
||||||
* Load administrators or shared users to workspace item id
|
* Load administrators or shared users to workspace item id
|
||||||
*
|
*
|
||||||
* @param load
|
|
||||||
* if LOAD_CONTACTS_AS.SHARED_USER loads target users from Shared
|
|
||||||
* Users if LOAD_CONTACTS_AS.ADMINISTRATOR loads target users
|
|
||||||
* from Administrators
|
|
||||||
*
|
*
|
||||||
* @param workspaceItemId
|
* @param workspaceItemId
|
||||||
* Item id
|
* Item id
|
||||||
* @param readGroupsFromHL
|
|
||||||
* Groups
|
|
||||||
* @param readGroupsFromPortal
|
|
||||||
* Portal
|
|
||||||
* @param hiddenMySelf
|
* @param hiddenMySelf
|
||||||
* if true the login read from ASL is hidden (so it's not
|
* if true the login read from ASL is hidden (so it's not
|
||||||
* removable to target users), the login returned anyway among
|
* removable to target users), the login returned anyway among
|
||||||
* the target users
|
* the target users
|
||||||
*/
|
*/
|
||||||
public SimpleMultiDragWorkspaceContact(ConstantsSharing.LOAD_CONTACTS_AS load, String workspaceItemId,
|
public MultiDragWorkspaceContactUser(String workspaceItemId,
|
||||||
final boolean readGroupsFromHL, final boolean readGroupsFromPortal, final boolean hiddenMySelf) {
|
final boolean hiddenMySelf) {
|
||||||
this.loadContactAs = load;
|
|
||||||
this.readGroupsFromHL = readGroupsFromHL;
|
|
||||||
this.readGroupsFromPortal = readGroupsFromPortal;
|
|
||||||
this.hiddenMySelf = hiddenMySelf;
|
|
||||||
this.workspaceItemId = workspaceItemId;
|
this.workspaceItemId = workspaceItemId;
|
||||||
|
dialogMultiDragContactSimple=new DialogMultiDragContact(
|
||||||
|
MultiDragConstants.HEADING_DIALOG, MultiDragConstants.ALL_CONTACTS_LEFT_LIST,
|
||||||
|
MultiDragConstants.SHARE_WITH_RIGHT_LIST, false, false, hiddenMySelf);
|
||||||
|
|
||||||
if (hiddenMySelf)
|
if (hiddenMySelf)
|
||||||
loadMyLogin(true);
|
loadMyLogin(true);
|
||||||
else
|
else
|
||||||
loadSharedContacts();
|
loadSharedContacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadMyLogin(final boolean loadContacts) {
|
private void loadMyLogin(final boolean loadContacts) {
|
||||||
|
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getMyLogin(new AsyncCallback<String>() {
|
WorkspaceSharingServiceAsync.INSTANCE.getMyLogin(new AsyncCallback<String>() {
|
||||||
|
@ -96,31 +84,7 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
*/
|
*/
|
||||||
private void loadSharedContacts() {
|
private void loadSharedContacts() {
|
||||||
|
|
||||||
switch (loadContactAs) {
|
|
||||||
|
|
||||||
case ADMINISTRATOR:
|
|
||||||
|
|
||||||
// LOADING LIST OF ALREADY SHARED USER
|
|
||||||
userStore.getAdministratorsByFolderId(workspaceItemId, new AsyncCallback<List<InfoContactModel>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
GWT.log("Error on loading admnistrators");
|
|
||||||
MessageBox.alert("Error on loading admnistrators", caught.getMessage(), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
|
||||||
GWT.log("Returned " + result.size() + " admin/s");
|
|
||||||
fillMultiDrag(result);
|
|
||||||
loadAllContacts(readGroupsFromHL, readGroupsFromPortal);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHARED_USER:
|
|
||||||
|
|
||||||
// LOADING LIST OF ALREADY SHARED USER
|
// LOADING LIST OF ALREADY SHARED USER
|
||||||
userStore.getListSharedUserByFolderId(workspaceItemId, new AsyncCallback<List<InfoContactModel>>() {
|
userStore.getListSharedUserByFolderId(workspaceItemId, new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
@ -129,7 +93,7 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
GWT.log("Returned " + result.size() + " contact/s");
|
GWT.log("Returned " + result.size() + " contact/s");
|
||||||
fillMultiDrag(result);
|
fillMultiDrag(result);
|
||||||
loadAllContacts(readGroupsFromHL, readGroupsFromPortal);
|
loadAllContacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -140,24 +104,10 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
|
|
||||||
loadAllContacts(readGroupsFromHL, readGroupsFromPortal);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addTargetContact(List<InfoContactModel> listContacts) {
|
|
||||||
if (listContacts != null) {
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
|
||||||
dialogMultiDragContact.getMultiDrag().addTargetContact(infoContactModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void fillMultiDrag(List<InfoContactModel> result) {
|
private void fillMultiDrag(List<InfoContactModel> result) {
|
||||||
|
|
||||||
GWT.log("Filling multi-drag..");
|
GWT.log("Filling multi-drag..");
|
||||||
|
@ -169,7 +119,7 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
myContact = infoContactModel;
|
myContact = infoContactModel;
|
||||||
GWT.log("Skipping myLogin as: " + myContact);
|
GWT.log("Skipping myLogin as: " + myContact);
|
||||||
} else {
|
} else {
|
||||||
dialogMultiDragContact.getMultiDrag().addTargetContact(infoContactModel);
|
dialogMultiDragContactSimple.getMultiDrag().addTargetContact(infoContactModel);
|
||||||
targets.add(infoContactModel);
|
targets.add(infoContactModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +129,7 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
/**
|
/**
|
||||||
* Load all contacts
|
* Load all contacts
|
||||||
*/
|
*/
|
||||||
private void loadAllContacts(boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
private void loadAllContacts() {
|
||||||
userStore.getListContact(addSourceContacts, false);
|
userStore.getListContact(addSourceContacts, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,9 +149,25 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
if (result != null && result.size() > 0) {
|
if (result != null && result.size() > 0) {
|
||||||
if (hiddenMySelf)
|
if (hiddenMySelf)
|
||||||
contactTargets.add(myContact);
|
contactTargets.add(myContact);
|
||||||
|
|
||||||
|
|
||||||
|
AsyncCallback<List<InfoContactModel>> callback=new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(contactTargets);
|
@Override
|
||||||
dialogMultiDragContact.getMultiDrag().addSourceContacts(exclusiveContacts);
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error retrieving contacts: "+caught,caught);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Contact List retrieved");
|
||||||
|
dialogMultiDragContactSimple.getMultiDrag().addSourceContacts(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
userStore.getExclusiveContactsFromAllContact(contactTargets,callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -211,16 +177,16 @@ public class SimpleMultiDragWorkspaceContact {
|
||||||
* @return the multi drag DialogMultiDragContact
|
* @return the multi drag DialogMultiDragContact
|
||||||
*/
|
*/
|
||||||
public DialogMultiDragContact getDialogMultiDragContact() {
|
public DialogMultiDragContact getDialogMultiDragContact() {
|
||||||
return dialogMultiDragContact;
|
return dialogMultiDragContactSimple;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
dialogMultiDragContact.show();
|
dialogMultiDragContactSimple.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<InfoContactModel> getTargetContacts() {
|
public List<InfoContactModel> getTargetContacts() {
|
||||||
return dialogMultiDragContact.getMultiDrag().getTargetListContact();
|
return dialogMultiDragContactSimple.getMultiDrag().getTargetListContact();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InfoContactModel> getTargetContactsWithMyLogin() {
|
public List<InfoContactModel> getTargetContactsWithMyLogin() {
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.widgets.workspacesharingwidget.client;
|
package org.gcube.portlets.widgets.workspacesharingwidget.client;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiDragContact;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.MultiDragContact;
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||||
|
|
|
@ -87,8 +87,8 @@ public class WorkspaceSharingWidgetEntryPoint implements EntryPoint {
|
||||||
|
|
||||||
private void showSimpleMultiDrag() {
|
private void showSimpleMultiDrag() {
|
||||||
|
|
||||||
final SimpleMultiDragWorkspaceContact multiDragContact = new SimpleMultiDragWorkspaceContact(
|
final MultiDragWorkspaceContactUser multiDragContact = new MultiDragWorkspaceContactUser(
|
||||||
ConstantsSharing.LOAD_CONTACTS_AS.SHARED_USER, ITEMID, true, false, true);
|
ITEMID, true);
|
||||||
|
|
||||||
Button openSharingWindow = new Button("Show Simple Multi Drag", new ClickHandler() {
|
Button openSharingWindow = new Button("Show Simple Multi Drag", new ClickHandler() {
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
|
@ -6,9 +6,9 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.AllowAccess;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.UserVRE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
@ -26,9 +26,9 @@ public interface WorkspaceSharingService extends RemoteService {
|
||||||
|
|
||||||
List<InfoContactModel> getUsersByKeyword(String keyword) throws Exception;
|
List<InfoContactModel> getUsersByKeyword(String keyword) throws Exception;
|
||||||
|
|
||||||
List<GGroup> getVREList() throws Exception;
|
List<UserVRE> getUserVREList() throws Exception;
|
||||||
|
|
||||||
List<InfoContactModel> getAllContactsByVRE(GGroup gGroup) throws Exception;
|
List<InfoContactModel> getAllContactsByVRE(UserVRE gGroup) throws Exception;
|
||||||
|
|
||||||
List<InfoContactModel> getListUserSharedByFolderSharedId(String folderSharedId) throws Exception;
|
List<InfoContactModel> getListUserSharedByFolderSharedId(String folderSharedId) throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.AllowAccess;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.UserVRE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -23,9 +23,9 @@ public interface WorkspaceSharingServiceAsync {
|
||||||
|
|
||||||
void getUsersByKeyword(String keyword, AsyncCallback<List<InfoContactModel>> callback);
|
void getUsersByKeyword(String keyword, AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
void getVREList(AsyncCallback<List<GGroup>> callback);
|
void getUserVREList(AsyncCallback<List<UserVRE>> callback);
|
||||||
|
|
||||||
void getAllContactsByVRE(GGroup gGroup, AsyncCallback<List<InfoContactModel>> callback);
|
void getAllContactsByVRE(UserVRE gGroup, AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
void getListUserSharedByFolderSharedId(String folderSharedId, AsyncCallback<List<InfoContactModel>> callback);
|
void getListUserSharedByFolderSharedId(String folderSharedId, AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ public interface ContactFetcher {
|
||||||
|
|
||||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
|
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser);
|
|
||||||
|
|
||||||
public void getOwner(String sharedFolderId, AsyncCallback<InfoContactModel> callback);
|
public void getOwner(String sharedFolderId, AsyncCallback<InfoContactModel> callback);
|
||||||
|
|
||||||
public void getInfoContactModelsFromCredential(List<CredentialModel> listAlreadySharedContact,
|
public void getInfoContactModelsFromCredential(List<CredentialModel> listAlreadySharedContact,
|
||||||
|
@ -22,4 +20,7 @@ public interface ContactFetcher {
|
||||||
|
|
||||||
public void getAdministratorsByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
|
public void getAdministratorsByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
|
public void getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser,
|
||||||
|
AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import java.util.List;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.WorkspaceSharingController;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.WorkspaceSharingController;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.permissions.PanelTogglePermission;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.permissions.PanelTogglePermission;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.DialogMultiDragContact;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiDragContact;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiValuePanel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiValuePanel;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.DialogMultiDragContact;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.MultiDragContact;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
@ -329,10 +329,27 @@ public class DialogShareWItem extends Dialog {
|
||||||
final DialogMultiDragContact dialog = new DialogMultiDragContact(true, true);
|
final DialogMultiDragContact dialog = new DialogMultiDragContact(true, true);
|
||||||
final MultiDragContact multiDrag = dialog.getMultiDrag();
|
final MultiDragContact multiDrag = dialog.getMultiDrag();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
AsyncCallback<List<InfoContactModel>> callback=new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error retrieving contacts: "+caught,caught);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Contact List retrieved: ");
|
||||||
|
multiDrag.addSourceContacts(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser(),callback);
|
||||||
|
|
||||||
|
|
||||||
List<InfoContactModel> exclusiveContacts = userStore
|
|
||||||
.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
|
||||||
multiDrag.addSourceContacts(exclusiveContacts);
|
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
||||||
if (!listAlreadyShared.contains(infoContactModel))
|
if (!listAlreadyShared.contains(infoContactModel))
|
||||||
|
|
|
@ -9,9 +9,9 @@ import java.util.List;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.SmartConstants;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.SmartConstants;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.DialogMultiDragContact;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiDragContact;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiValuePanel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.MultiValuePanel;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.DialogMultiDragContact;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user.MultiDragContact;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
@ -26,6 +26,7 @@ import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
@ -36,10 +37,9 @@ import com.google.gwt.user.client.ui.Label;
|
||||||
/**
|
/**
|
||||||
* The Class SmartShare.
|
* The Class SmartShare.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa
|
* @author Francesco Mangiacrapa Mar 3, 2014
|
||||||
* Mar 3, 2014
|
|
||||||
*/
|
*/
|
||||||
public class SmartShare extends Dialog implements SmartDialogInterface{
|
public class SmartShare extends Dialog implements SmartDialogInterface {
|
||||||
|
|
||||||
private TextField<String> txtName;
|
private TextField<String> txtName;
|
||||||
private FileModel fileToShare = null;
|
private FileModel fileToShare = null;
|
||||||
|
@ -49,19 +49,20 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
private boolean readGroupsFromHL;
|
private boolean readGroupsFromHL;
|
||||||
private boolean readGroupsFromPortal;
|
private boolean readGroupsFromPortal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SmartShare base constructor by default does not retrieve groupss.
|
* SmartShare base constructor by default does not retrieve groupss.
|
||||||
*/
|
*/
|
||||||
public SmartShare() {
|
public SmartShare() {
|
||||||
this(false, false);
|
this(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new smart share.
|
* Instantiates a new smart share.
|
||||||
*
|
*
|
||||||
* @param readGroupsFromHL - if true read group names from HL
|
* @param readGroupsFromHL
|
||||||
* @param readGroupsFromPortal - if true read group names from Portal (as VRE)
|
* - if true read group names from HL
|
||||||
|
* @param readGroupsFromPortal
|
||||||
|
* - if true read group names from Portal (as VRE)
|
||||||
*/
|
*/
|
||||||
public SmartShare(boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
public SmartShare(boolean readGroupsFromHL, boolean readGroupsFromPortal) {
|
||||||
this.readGroupsFromHL = readGroupsFromHL;
|
this.readGroupsFromHL = readGroupsFromHL;
|
||||||
|
@ -70,7 +71,7 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
initLayout();
|
initLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>() {
|
||||||
|
|
||||||
private static final long serialVersionUID = -610980920163628336L;
|
private static final long serialVersionUID = -610980920163628336L;
|
||||||
|
|
||||||
|
@ -80,101 +81,104 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
|
|
||||||
if(o==null)
|
if (o == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
InfoContactModel contact = (InfoContactModel) o;
|
InfoContactModel contact = (InfoContactModel) o;
|
||||||
|
|
||||||
for (int i = 0; i < listAlreadyShared.size(); i++){
|
for (int i = 0; i < listAlreadyShared.size(); i++) {
|
||||||
if (contact.getName().compareTo(listAlreadyShared.get(i).getName())==0)
|
if (contact.getName().compareTo(listAlreadyShared.get(i).getName()) == 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to modify a shared folder or share an existing folder.
|
* Use to modify a shared folder or share an existing folder.
|
||||||
*
|
*
|
||||||
* @param fileModel the file model
|
* @param fileModel
|
||||||
* @param listAlreadySharedContact the list already shared contact
|
* the file model
|
||||||
|
* @param listAlreadySharedContact
|
||||||
|
* the list already shared contact
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void updateSharingDialog(FileModel fileModel, List<CredentialModel> listAlreadySharedContact){
|
public void updateSharingDialog(FileModel fileModel, List<CredentialModel> listAlreadySharedContact) {
|
||||||
this.fileToShare = fileModel;
|
this.fileToShare = fileModel;
|
||||||
String heading;
|
String heading;
|
||||||
if(SmartConstants.HEADER_TITLE==null){
|
if (SmartConstants.HEADER_TITLE == null) {
|
||||||
heading = "Share";
|
heading = "Share";
|
||||||
if(fileModel.isDirectory())
|
if (fileModel.isDirectory())
|
||||||
heading+=" folder: ";
|
heading += " folder: ";
|
||||||
else
|
else
|
||||||
heading+= " : ";
|
heading += " : ";
|
||||||
|
|
||||||
setHeading(heading+fileModel.getName());
|
setHeading(heading + fileModel.getName());
|
||||||
}else
|
} else
|
||||||
setHeading(SmartConstants.HEADER_TITLE);
|
setHeading(SmartConstants.HEADER_TITLE);
|
||||||
|
|
||||||
txtName = new TextField<String>();
|
txtName = new TextField<String>();
|
||||||
txtName.setAllowBlank(false);
|
txtName.setAllowBlank(false);
|
||||||
txtName.setValue(fileModel.getName());
|
txtName.setValue(fileModel.getName());
|
||||||
txtName.setReadOnly(true);
|
txtName.setReadOnly(true);
|
||||||
txtName.setAutoValidate(true);
|
txtName.setAutoValidate(true);
|
||||||
|
|
||||||
if(SmartConstants.ITEM_NAME!=null)
|
if (SmartConstants.ITEM_NAME != null)
|
||||||
txtName.setFieldLabel(SmartConstants.ITEM_NAME);
|
txtName.setFieldLabel(SmartConstants.ITEM_NAME);
|
||||||
|
|
||||||
|
final LayoutContainer lc = new LayoutContainer();
|
||||||
|
lc.setStyleAttribute("margin-top", "10px");
|
||||||
|
lc.setStyleAttribute("margin-bottom", "10px");
|
||||||
|
lc.setSize(480, 50);
|
||||||
|
|
||||||
final LayoutContainer lc = new LayoutContainer();
|
final FlexTable flexTable = new FlexTable();
|
||||||
lc.setStyleAttribute("margin-top", "10px");
|
flexTable.setStyleName("userssuggest");
|
||||||
lc.setStyleAttribute("margin-bottom", "10px");
|
Label labelShareWith = new Label("");
|
||||||
lc.setSize(480, 50);
|
if (SmartConstants.SHARE_WITH_USERS != null)
|
||||||
|
labelShareWith.setText(SmartConstants.SHARE_WITH_USERS);
|
||||||
|
|
||||||
final FlexTable flexTable = new FlexTable();
|
flexTable.setWidget(0, 0, labelShareWith);
|
||||||
flexTable.setStyleName("userssuggest");
|
flexTable.setWidget(0, 1, suggestPanel);
|
||||||
Label labelShareWith = new Label("");
|
|
||||||
if(SmartConstants.SHARE_WITH_USERS!=null)
|
|
||||||
labelShareWith.setText(SmartConstants.SHARE_WITH_USERS);
|
|
||||||
|
|
||||||
flexTable.setWidget(0, 0, labelShareWith);
|
buttonMultiDrag.setStyleName("wizardButton");
|
||||||
flexTable.setWidget(0, 1, suggestPanel);
|
|
||||||
|
|
||||||
buttonMultiDrag.setStyleName("wizardButton");
|
Label labelAddMore = new Label("");
|
||||||
|
if (SmartConstants.ADD_MORE != null)
|
||||||
|
labelAddMore.setText(SmartConstants.ADD_MORE);
|
||||||
|
|
||||||
Label labelAddMore = new Label("");
|
flexTable.setWidget(1, 0, labelAddMore);
|
||||||
if(SmartConstants.ADD_MORE!=null)
|
flexTable.setWidget(1, 1, buttonMultiDrag);
|
||||||
labelAddMore.setText(SmartConstants.ADD_MORE);
|
|
||||||
|
|
||||||
flexTable.setWidget(1, 0, labelAddMore);
|
if (listAlreadySharedContact != null && listAlreadySharedContact.size() > 0) {
|
||||||
flexTable.setWidget(1, 1, buttonMultiDrag);
|
|
||||||
|
|
||||||
if(listAlreadySharedContact!=null && listAlreadySharedContact.size()>0){
|
userStore.getInfoContactModelsFromCredential(listAlreadySharedContact,
|
||||||
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
userStore.getInfoContactModelsFromCredential(listAlreadySharedContact, new AsyncCallback<List<InfoContactModel>>() {
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
for (InfoContactModel infoContactModel : result) {
|
||||||
|
// String name =
|
||||||
|
// infoContactModel.getName()!=null &&
|
||||||
|
// !infoContactModel.getName().isEmpty()?infoContactModel.getName():infoContactModel.getLogin();
|
||||||
|
listAlreadyShared.add(infoContactModel);
|
||||||
|
suggestPanel.addRecipient(infoContactModel, false);
|
||||||
|
layout();
|
||||||
|
}
|
||||||
|
lc.unmask();
|
||||||
|
lc.layout();
|
||||||
|
layout();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onFailure(Throwable caught) {
|
||||||
for (InfoContactModel infoContactModel : result) {
|
lc.unmask();
|
||||||
//String name = infoContactModel.getName()!=null && !infoContactModel.getName().isEmpty()?infoContactModel.getName():infoContactModel.getLogin();
|
}
|
||||||
listAlreadyShared.add(infoContactModel);
|
});
|
||||||
suggestPanel.addRecipient(infoContactModel,false);
|
}
|
||||||
layout();
|
|
||||||
}
|
|
||||||
lc.unmask();
|
|
||||||
lc.layout();
|
|
||||||
layout();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
lc.add(flexTable);
|
||||||
public void onFailure(Throwable caught) {
|
setFocusWidget(suggestPanel.getBox());
|
||||||
lc.unmask();
|
add(txtName);
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
lc.add(flexTable);
|
|
||||||
setFocusWidget(suggestPanel.getBox());
|
|
||||||
add(txtName);
|
|
||||||
add(lc);
|
add(lc);
|
||||||
addListeners();
|
addListeners();
|
||||||
|
|
||||||
|
@ -192,30 +196,29 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
/**
|
/**
|
||||||
* Inits the layout.
|
* Inits the layout.
|
||||||
*/
|
*/
|
||||||
private void initLayout(){
|
private void initLayout() {
|
||||||
FormLayout layout = new FormLayout();
|
FormLayout layout = new FormLayout();
|
||||||
layout.setLabelWidth(90);
|
layout.setLabelWidth(90);
|
||||||
layout.setDefaultWidth(380);
|
layout.setDefaultWidth(380);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
setScrollMode(Scroll.AUTOY);
|
setScrollMode(Scroll.AUTOY);
|
||||||
setBodyStyle("padding: 9px; background: none");
|
setBodyStyle("padding: 9px; background: none");
|
||||||
setWidth(ConstantsSharing.WIDTH_DIALOG);
|
setWidth(ConstantsSharing.WIDTH_DIALOG);
|
||||||
setHeight(ConstantsSharing.HEIGHT_DIALOG);
|
setHeight(ConstantsSharing.HEIGHT_DIALOG);
|
||||||
setResizable(true);
|
setResizable(true);
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
setIcon(Resources.getIconShare());
|
setIcon(Resources.getIconShare());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the shared list users.
|
* Gets the shared list users.
|
||||||
*
|
*
|
||||||
* @return the selected contacts (as InfoContactModel)
|
* @return the selected contacts (as InfoContactModel)
|
||||||
*/
|
*/
|
||||||
public List<InfoContactModel> getSharedListUsers() {
|
public List<InfoContactModel> getSharedListUsers() {
|
||||||
// printSelectedUser();
|
// printSelectedUser();
|
||||||
|
|
||||||
List<InfoContactModel> contacts = new ArrayList<InfoContactModel>();
|
List<InfoContactModel> contacts = new ArrayList<InfoContactModel>();
|
||||||
|
|
||||||
|
@ -228,7 +231,6 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
return contacts;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the shared list users credential.
|
* Gets the shared list users credential.
|
||||||
*
|
*
|
||||||
|
@ -241,7 +243,7 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
for (InfoContactModel wsuser : suggestPanel.getSelectedUser()) {
|
for (InfoContactModel wsuser : suggestPanel.getSelectedUser()) {
|
||||||
CredentialModel credential = wsuser.getReferenceCredential();
|
CredentialModel credential = wsuser.getReferenceCredential();
|
||||||
|
|
||||||
if(credential==null)
|
if (credential == null)
|
||||||
credential = new CredentialModel(null, "UNKWNOWN LOGIN", wsuser.isGroup());
|
credential = new CredentialModel(null, "UNKWNOWN LOGIN", wsuser.isGroup());
|
||||||
|
|
||||||
toReturn.add(credential);
|
toReturn.add(credential);
|
||||||
|
@ -252,17 +254,18 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
/**
|
/**
|
||||||
* Gets the credential model from info contact model.
|
* Gets the credential model from info contact model.
|
||||||
*
|
*
|
||||||
* @param infoContact the info contact
|
* @param infoContact
|
||||||
|
* the info contact
|
||||||
* @return the credential model from info contact model
|
* @return the credential model from info contact model
|
||||||
*/
|
*/
|
||||||
private CredentialModel getCredentialModelFromInfoContactModel(InfoContactModel infoContact){
|
private CredentialModel getCredentialModelFromInfoContactModel(InfoContactModel infoContact) {
|
||||||
|
|
||||||
if(infoContact==null)
|
if (infoContact == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(infoContact.getReferenceCredential()==null){
|
if (infoContact.getReferenceCredential() == null) {
|
||||||
return new CredentialModel(null, infoContact.getLogin(), infoContact.isGroup());
|
return new CredentialModel(null, infoContact.getLogin(), infoContact.isGroup());
|
||||||
}else if(infoContact.getReferenceCredential()!=null)
|
} else if (infoContact.getReferenceCredential() != null)
|
||||||
return infoContact.getReferenceCredential();
|
return infoContact.getReferenceCredential();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -272,9 +275,9 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
/**
|
/**
|
||||||
* Adds the listeners.
|
* Adds the listeners.
|
||||||
*/
|
*/
|
||||||
public void addListeners(){
|
public void addListeners() {
|
||||||
|
|
||||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
@ -282,29 +285,43 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
if(isValidForm(false))
|
if (isValidForm(false))
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonMultiDrag.addClickHandler(new ClickHandler() {
|
buttonMultiDrag.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
final DialogMultiDragContact dialog = new DialogMultiDragContact(true,true);
|
final DialogMultiDragContact dialog = new DialogMultiDragContact(true, true);
|
||||||
final MultiDragContact multiDrag = dialog.getMultiDrag();
|
final MultiDragContact multiDrag = dialog.getMultiDrag();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
// printSelectedUser();
|
AsyncCallback<List<InfoContactModel>> callback = new AsyncCallback<List<InfoContactModel>>() {
|
||||||
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
|
||||||
multiDrag.addSourceContacts(exclusiveContacts);
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error retrieving contacts: " + caught, caught);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Contact List retrieved: ");
|
||||||
|
multiDrag.addSourceContacts(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser(), callback);
|
||||||
|
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
||||||
if(!listAlreadyShared.contains(infoContactModel))
|
if (!listAlreadyShared.contains(infoContactModel))
|
||||||
multiDrag.addTargetContact(infoContactModel);
|
multiDrag.addTargetContact(infoContactModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,14 +334,15 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
initSuggestContacts();
|
initSuggestContacts();
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
||||||
suggestPanel.addRecipient(infoContactModel,true);
|
suggestPanel.addRecipient(infoContactModel, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
// for (InfoContactModel infoContactModel :
|
||||||
//
|
// multiDrag.getTargetListContact()) {
|
||||||
// if(!listAlreadySharedContains(infoContactModel))
|
//
|
||||||
// suggestPanel.addRecipient(infoContactModel.getName(),true);
|
// if(!listAlreadySharedContains(infoContactModel))
|
||||||
// }
|
// suggestPanel.addRecipient(infoContactModel.getName(),true);
|
||||||
|
// }
|
||||||
|
|
||||||
suggestPanel.boxSetFocus();
|
suggestPanel.boxSetFocus();
|
||||||
}
|
}
|
||||||
|
@ -336,37 +354,38 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
/**
|
/**
|
||||||
* List already shared contains.
|
* List already shared contains.
|
||||||
*
|
*
|
||||||
* @param contact the contact
|
* @param contact
|
||||||
|
* the contact
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
private boolean listAlreadySharedContains(InfoContactModel contact){
|
private boolean listAlreadySharedContains(InfoContactModel contact) {
|
||||||
|
|
||||||
if(contact==null)
|
if (contact == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (InfoContactModel ct : listAlreadyShared) {
|
for (InfoContactModel ct : listAlreadyShared) {
|
||||||
if(ct.getLogin().compareTo(contact.getLogin())==0){
|
if (ct.getLogin().compareTo(contact.getLogin()) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//DEBUG
|
// DEBUG
|
||||||
/**
|
/**
|
||||||
* Prints the selected user.
|
* Prints the selected user.
|
||||||
*/
|
*/
|
||||||
/*private void printSelectedUser(){
|
/*
|
||||||
|
* private void printSelectedUser(){
|
||||||
GWT.log("SELETECTED USERS: ");
|
*
|
||||||
for (InfoContactModel contact : suggestPanel.getSelectedUser())
|
* GWT.log("SELETECTED USERS: "); for (InfoContactModel contact :
|
||||||
GWT.log(contact.toString());
|
* suggestPanel.getSelectedUser()) GWT.log(contact.toString()); }
|
||||||
}*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the suggest contacts.
|
* Inits the suggest contacts.
|
||||||
*/
|
*/
|
||||||
private void initSuggestContacts(){
|
private void initSuggestContacts() {
|
||||||
|
|
||||||
suggestPanel.resetItemSelected();
|
suggestPanel.resetItemSelected();
|
||||||
|
|
||||||
|
@ -375,35 +394,38 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable confirm button.
|
* Enable confirm button.
|
||||||
*
|
*
|
||||||
* @param enabled the enabled
|
* @param enabled
|
||||||
|
* the enabled
|
||||||
*/
|
*/
|
||||||
public void enableConfirmButton(boolean enabled){
|
public void enableConfirmButton(boolean enabled) {
|
||||||
this.getButtonById(Dialog.OK).setEnabled(enabled);
|
this.getButtonById(Dialog.OK).setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the as error.
|
* Sets the as error.
|
||||||
*
|
*
|
||||||
* @param message the new as error
|
* @param message
|
||||||
|
* the new as error
|
||||||
*/
|
*/
|
||||||
public void setAsError(String message){
|
public void setAsError(String message) {
|
||||||
enableFormDialog(false);
|
enableFormDialog(false);
|
||||||
this.add(new Html("<br/> <p style=\"color:red; font-family:verdana, arial; font-size:14px;\">"+message+"</p>"));
|
this.add(new Html(
|
||||||
|
"<br/> <p style=\"color:red; font-family:verdana, arial; font-size:14px;\">" + message + "</p>"));
|
||||||
this.layout();
|
this.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable form dialog.
|
* Enable form dialog.
|
||||||
*
|
*
|
||||||
* @param bool the bool
|
* @param bool
|
||||||
|
* the bool
|
||||||
*/
|
*/
|
||||||
private void enableFormDialog(boolean bool){
|
private void enableFormDialog(boolean bool) {
|
||||||
getButtonById(Dialog.OK).setEnabled(bool);
|
getButtonById(Dialog.OK).setEnabled(bool);
|
||||||
buttonMultiDrag.setEnabled(bool);
|
buttonMultiDrag.setEnabled(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -418,20 +440,21 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
/**
|
/**
|
||||||
* Checks if is valid form.
|
* Checks if is valid form.
|
||||||
*
|
*
|
||||||
* @param displayAlert in case of error
|
* @param displayAlert
|
||||||
|
* in case of error
|
||||||
* @return true, if is valid form
|
* @return true, if is valid form
|
||||||
*/
|
*/
|
||||||
public boolean isValidForm(boolean displayAlert){
|
public boolean isValidForm(boolean displayAlert) {
|
||||||
|
|
||||||
if(!txtName.isValid()){
|
if (!txtName.isValid()) {
|
||||||
if(displayAlert)
|
if (displayAlert)
|
||||||
MessageBox.alert("Attention", "Name must not be empty", null);
|
MessageBox.alert("Attention", "Name must not be empty", null);
|
||||||
txtName.focus();
|
txtName.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getSharedListUsers().size()==0){
|
if (getSharedListUsers().size() == 0) {
|
||||||
if(displayAlert)
|
if (displayAlert)
|
||||||
MessageBox.alert("Attention", SmartConstants.ERROR_NO_USER_SELECTED, null);
|
MessageBox.alert("Attention", SmartConstants.ERROR_NO_USER_SELECTED, null);
|
||||||
suggestPanel.boxSetFocus();
|
suggestPanel.boxSetFocus();
|
||||||
return false;
|
return false;
|
||||||
|
@ -439,7 +462,6 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is read groups from hl.
|
* Checks if is read groups from hl.
|
||||||
*
|
*
|
||||||
|
@ -449,7 +471,6 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
|
||||||
return readGroupsFromHL;
|
return readGroupsFromHL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is read groups from portal.
|
* Checks if is read groups from portal.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,156 +13,198 @@ import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa
|
* @author Francesco Mangiacrapa
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class UserStore implements ContactFetcher{
|
public class UserStore implements ContactFetcher {
|
||||||
|
|
||||||
public static List<InfoContactModel> listAllContact = null;
|
private static List<InfoContactModel> listAllContact = new ArrayList<InfoContactModel>();;
|
||||||
|
|
||||||
|
// public boolean syncronizeCleanSharedUser = false;
|
||||||
|
|
||||||
// public boolean syncronizeCleanSharedUser = false;
|
|
||||||
|
|
||||||
public UserStore() {
|
public UserStore() {
|
||||||
loadAllUsersFromServer();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadSharedUserBySharedFolderId(final String sharedFolderId,
|
||||||
|
final AsyncCallback<List<InfoContactModel>> callback) {
|
||||||
|
|
||||||
|
// comboSharedUsers.mask("Loading users");
|
||||||
|
|
||||||
|
WorkspaceSharingController.rpcWorkspaceSharingService.getListUserSharedByFolderSharedId(sharedFolderId,
|
||||||
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
MessageBox.alert("Error",
|
||||||
|
ConstantsSharing.SERVER_ERROR + " retrieving user. " + ConstantsSharing.TRY_AGAIN,
|
||||||
|
null);
|
||||||
|
callback.onFailure(caught);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Get List user shared loaded " + result.size() + " contacts from server for "
|
||||||
|
+ sharedFolderId);
|
||||||
|
callback.onSuccess(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback){
|
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback) {
|
||||||
loadSharedUserBySharedFolderId(sharedFolderId, callback);
|
loadSharedUserBySharedFolderId(sharedFolderId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadAllUsersFromServer(){
|
|
||||||
|
|
||||||
listAllContact = new ArrayList<InfoContactModel>();
|
|
||||||
|
|
||||||
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContacts(new AsyncCallback<List<InfoContactModel>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
|
||||||
GWT.log("Get all contacts loaded "+result.size() + " contacts from server");
|
|
||||||
listAllContact = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
MessageBox.alert("Error", ConstantsSharing.SERVER_ERROR +" retrieving user " + ConstantsSharing.TRY_AGAIN, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadSharedUserBySharedFolderId(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback){
|
|
||||||
|
|
||||||
// comboSharedUsers.mask("Loading users");
|
|
||||||
|
|
||||||
WorkspaceSharingController.rpcWorkspaceSharingService.getListUserSharedByFolderSharedId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
MessageBox.alert("Error", ConstantsSharing.SERVER_ERROR +" retrieving user. " + ConstantsSharing.TRY_AGAIN, null);
|
|
||||||
callback.onFailure(caught);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
|
||||||
GWT.log("Get List user shared loaded "+result.size() + " contacts from server for "+sharedFolderId);
|
|
||||||
callback.onSuccess(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser){
|
public void getExclusiveContactsFromAllContact(final List<InfoContactModel> listSharedUser,
|
||||||
|
final AsyncCallback<List<InfoContactModel>> callback) {
|
||||||
List<InfoContactModel> listExclusiveContact = new ArrayList<InfoContactModel>(listAllContact);
|
if (listAllContact == null || listAllContact.isEmpty()) {
|
||||||
for (InfoContactModel contact : listSharedUser) {
|
WorkspaceSharingController.rpcWorkspaceSharingService
|
||||||
if(listAllContact.contains(contact)){
|
.getAllContacts(new AsyncCallback<List<InfoContactModel>>() {
|
||||||
listExclusiveContact.remove(contact);
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Get all contacts loaded " + result.size() + " contacts from server");
|
||||||
|
listAllContact = result;
|
||||||
|
List<InfoContactModel> listExclusiveContact = new ArrayList<InfoContactModel>(
|
||||||
|
listAllContact);
|
||||||
|
for (InfoContactModel contact : listSharedUser) {
|
||||||
|
if (listExclusiveContact.contains(contact)) {
|
||||||
|
listExclusiveContact.remove(contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback.onSuccess(listExclusiveContact);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
MessageBox.alert("Error",
|
||||||
|
ConstantsSharing.SERVER_ERROR + " retrieving user " + ConstantsSharing.TRY_AGAIN,
|
||||||
|
null);
|
||||||
|
callback.onFailure(new Throwable("Error retrieving users!"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
List<InfoContactModel> listExclusiveContact = new ArrayList<InfoContactModel>(listAllContact);
|
||||||
|
for (InfoContactModel contact : listSharedUser) {
|
||||||
|
if (listAllContact.contains(contact)) {
|
||||||
|
listExclusiveContact.remove(contact);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
callback.onSuccess(listExclusiveContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
return listExclusiveContact;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getOwner(final String sharedFolderId,final AsyncCallback<InfoContactModel> callback) {
|
public void getOwner(final String sharedFolderId, final AsyncCallback<InfoContactModel> callback) {
|
||||||
|
|
||||||
WorkspaceSharingController.rpcWorkspaceSharingService.getOwnerByItemId(sharedFolderId, new AsyncCallback<InfoContactModel>() {
|
|
||||||
|
|
||||||
@Override
|
WorkspaceSharingController.rpcWorkspaceSharingService.getOwnerByItemId(sharedFolderId,
|
||||||
public void onFailure(Throwable caught) {
|
new AsyncCallback<InfoContactModel>() {
|
||||||
GWT.log("an error occured in get Owner by Id "+sharedFolderId + " "+caught.getMessage());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(InfoContactModel result) {
|
public void onFailure(Throwable caught) {
|
||||||
callback.onSuccess(result);
|
GWT.log("an error occured in get Owner by Id " + sharedFolderId + " " + caught.getMessage());
|
||||||
|
callback.onFailure(caught);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(InfoContactModel result) {
|
||||||
|
callback.onSuccess(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getInfoContactModelsFromCredential(List<CredentialModel> listAlreadySharedContact, final AsyncCallback<List<InfoContactModel>> callback){
|
public void getInfoContactModelsFromCredential(List<CredentialModel> listAlreadySharedContact,
|
||||||
|
final AsyncCallback<List<InfoContactModel>> callback) {
|
||||||
WorkspaceSharingController.rpcWorkspaceSharingService.getInfoContactModelsFromCredential(listAlreadySharedContact, new AsyncCallback<List<InfoContactModel>>() {
|
|
||||||
|
|
||||||
@Override
|
WorkspaceSharingController.rpcWorkspaceSharingService.getInfoContactModelsFromCredential(
|
||||||
public void onFailure(Throwable caught) {
|
listAlreadySharedContact, new AsyncCallback<List<InfoContactModel>>() {
|
||||||
GWT.log("an error occured ingetInfoContactModelsFromCredential "+caught.getMessage());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onFailure(Throwable caught) {
|
||||||
callback.onSuccess(result);
|
GWT.log("an error occured ingetInfoContactModelsFromCredential " + caught.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
callback.onSuccess(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.ContactFetcher#getListContact(com.google.gwt.user.client.rpc.AsyncCallback, boolean, boolean, boolean)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.
|
||||||
|
* ContactFetcher#getListContact(com.google.gwt.user.client.rpc.
|
||||||
|
* AsyncCallback, boolean, boolean, boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback,boolean reloadList) {
|
public void getListContact(final AsyncCallback<List<InfoContactModel>> callback, boolean reloadList) {
|
||||||
|
|
||||||
if(listAllContact==null||listAllContact.isEmpty()){
|
if (listAllContact == null || listAllContact.isEmpty() || reloadList) {
|
||||||
callback.onFailure(new Throwable("Error retrieving all users!"));
|
WorkspaceSharingController.rpcWorkspaceSharingService
|
||||||
|
.getAllContacts(new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Get all contacts loaded " + result.size() + " contacts from server");
|
||||||
|
listAllContact = result;
|
||||||
|
callback.onSuccess(listAllContact);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
MessageBox.alert("Error",
|
||||||
|
ConstantsSharing.SERVER_ERROR + " retrieving user " + ConstantsSharing.TRY_AGAIN,
|
||||||
|
null);
|
||||||
|
callback.onFailure(new Throwable("Error retrieving users!"));
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
callback.onSuccess(listAllContact);
|
callback.onSuccess(listAllContact);
|
||||||
}
|
}
|
||||||
//if(reloadList || listAllContact==null)
|
|
||||||
// loadAllUsersFromServer(callback);
|
|
||||||
// else
|
|
||||||
// callback.onSuccess(listAllContact);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.ContactFetcher#getAdministratorsByFolderId(java.lang.String, com.google.gwt.user.client.rpc.AsyncCallback)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.
|
||||||
|
* ContactFetcher#getAdministratorsByFolderId(java.lang.String,
|
||||||
|
* com.google.gwt.user.client.rpc.AsyncCallback)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void getAdministratorsByFolderId(String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback) {
|
public void getAdministratorsByFolderId(String sharedFolderId,
|
||||||
|
final AsyncCallback<List<InfoContactModel>> callback) {
|
||||||
if(sharedFolderId==null || sharedFolderId.isEmpty())
|
|
||||||
|
if (sharedFolderId == null || sharedFolderId.isEmpty())
|
||||||
return;
|
return;
|
||||||
WorkspaceSharingController.rpcWorkspaceSharingService.getAdministratorsByFolderId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
|
WorkspaceSharingController.rpcWorkspaceSharingService.getAdministratorsByFolderId(sharedFolderId,
|
||||||
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
callback.onFailure(caught);
|
callback.onFailure(caught);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
callback.onSuccess(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
|
||||||
callback.onSuccess(result);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,163 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.admin;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
||||||
|
|
||||||
|
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||||
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||||
|
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||||
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
|
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||||
|
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Francesco Mangiacrapa Jan 27, 2015
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DialogMultiDragContactAdmin extends Dialog {
|
||||||
|
|
||||||
|
private static final String GROUP_DRAGGING_CONTACTS = "Group dragging contacts";
|
||||||
|
private static final int HEIGHT_DIALOG = 542;
|
||||||
|
private static final int WIDTH_DIALOG = 620;
|
||||||
|
|
||||||
|
|
||||||
|
private String txtHelp = "Drag one or more contacts from the left (All Contacts) to the right (Share with) to add users in your sharing list.";
|
||||||
|
private String titleHelp = "Group dragging action";
|
||||||
|
|
||||||
|
// private boolean hideOnPressOkButton=false;
|
||||||
|
private MultiDragContactAdmin multiDragContactAdmin;
|
||||||
|
// private boolean visibleTextArea=false;
|
||||||
|
|
||||||
|
private ToolBar toolBar;
|
||||||
|
private String headTitle;
|
||||||
|
|
||||||
|
private LayoutContainer lcTop = new LayoutContainer();
|
||||||
|
private LayoutContainer lcMiddle = new LayoutContainer();
|
||||||
|
private LayoutContainer lcBottom = new LayoutContainer();
|
||||||
|
|
||||||
|
public DialogMultiDragContactAdmin(String headTitle, String leftListContactsTitle, String rightListContactsTitle,
|
||||||
|
String workspaceItemId) {
|
||||||
|
|
||||||
|
GWT.log("DialogMultiDragContactAdmin()");
|
||||||
|
try {
|
||||||
|
this.headTitle = headTitle;
|
||||||
|
this.multiDragContactAdmin = new MultiDragContactAdmin(leftListContactsTitle, rightListContactsTitle,
|
||||||
|
workspaceItemId);
|
||||||
|
init();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
GWT.log("Error in DialogMultiDragContactAdmin()" + e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showToolBar(boolean bool) {
|
||||||
|
this.toolBar.setVisible(bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
if (headTitle == null)
|
||||||
|
this.setHeading(GROUP_DRAGGING_CONTACTS);
|
||||||
|
else
|
||||||
|
this.setHeading(headTitle);
|
||||||
|
|
||||||
|
setId(DialogMultiDragContactAdmin.class.getName() + Random.nextInt());
|
||||||
|
setSize(WIDTH_DIALOG, HEIGHT_DIALOG);
|
||||||
|
setResizable(false);
|
||||||
|
setMaximizable(false);
|
||||||
|
setIcon(Resources.getIconUsers());
|
||||||
|
setModal(true);
|
||||||
|
// setScrollMode(Scroll.AUTOY);
|
||||||
|
|
||||||
|
// setResizable(true);
|
||||||
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
|
setButtons(Dialog.OKCANCEL);
|
||||||
|
|
||||||
|
toolBar = new ToolBar();
|
||||||
|
Button buttonHelp = new Button();
|
||||||
|
buttonHelp.setIcon(Resources.getIconInfo());
|
||||||
|
|
||||||
|
buttonHelp.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
MessageBox.info(titleHelp, txtHelp, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
toolBar.add(buttonHelp);
|
||||||
|
setTopComponent(toolBar);
|
||||||
|
|
||||||
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lcMiddle.add(multiDragContactAdmin);
|
||||||
|
add(lcTop);
|
||||||
|
add(lcMiddle);
|
||||||
|
add(lcBottom);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiDragContactAdmin getMultiDrag() {
|
||||||
|
return multiDragContactAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeadTitle() {
|
||||||
|
return headTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTxtHelp() {
|
||||||
|
return txtHelp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitleHelp() {
|
||||||
|
return titleHelp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToolBar getToolBar() {
|
||||||
|
return toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtHelp(String txtHelp) {
|
||||||
|
this.txtHelp = txtHelp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitleHelp(String titleHelp) {
|
||||||
|
this.titleHelp = titleHelp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToolBar(ToolBar toolBar) {
|
||||||
|
this.toolBar = toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayoutContainer getLcTop() {
|
||||||
|
return lcTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayoutContainer getLcMiddle() {
|
||||||
|
return lcMiddle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayoutContainer getLcBottom() {
|
||||||
|
return lcBottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,697 @@
|
||||||
|
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.admin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.WorkspaceSharingController;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.UserVRE;
|
||||||
|
|
||||||
|
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||||
|
import com.extjs.gxt.ui.client.Style.Orientation;
|
||||||
|
import com.extjs.gxt.ui.client.Style.SortDir;
|
||||||
|
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
|
||||||
|
import com.extjs.gxt.ui.client.dnd.GridDragSource;
|
||||||
|
import com.extjs.gxt.ui.client.dnd.GridDropTarget;
|
||||||
|
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||||
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
|
import com.extjs.gxt.ui.client.event.Events;
|
||||||
|
import com.extjs.gxt.ui.client.event.Listener;
|
||||||
|
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
||||||
|
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
||||||
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
|
import com.extjs.gxt.ui.client.store.ListStore;
|
||||||
|
import com.extjs.gxt.ui.client.store.Store;
|
||||||
|
import com.extjs.gxt.ui.client.store.StoreSorter;
|
||||||
|
import com.extjs.gxt.ui.client.util.Margins;
|
||||||
|
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||||
|
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
||||||
|
import com.extjs.gxt.ui.client.widget.Label;
|
||||||
|
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||||
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
|
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
||||||
|
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||||
|
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
||||||
|
import com.extjs.gxt.ui.client.widget.form.StoreFilterField;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
||||||
|
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
|
||||||
|
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
||||||
|
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
||||||
|
import com.extjs.gxt.ui.client.widget.tips.QuickTip;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.Random;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa Jan 27, 2015
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MultiDragContactAdmin extends ContentPanel {
|
||||||
|
|
||||||
|
//
|
||||||
|
private String leftListContactsTitle;
|
||||||
|
private String rightListContactsTitle;
|
||||||
|
private String workspaceItemId;
|
||||||
|
|
||||||
|
private String myLogin;
|
||||||
|
private InfoContactModel myContact;
|
||||||
|
private List<InfoContactModel> targetContact;
|
||||||
|
private List<UserVRE> vresList;
|
||||||
|
private HashMap<UserVRE, List<InfoContactModel>> contactsMap;
|
||||||
|
//
|
||||||
|
private static final String ALL_CONTACTS = "All Contacts";
|
||||||
|
private static final String SHARE_WITH = "Share with...";
|
||||||
|
|
||||||
|
//
|
||||||
|
private static final int HEIGHT_VRE_PANEL = 40;
|
||||||
|
private static final int WIDTH_VRE_PANEL = 597;
|
||||||
|
private static final int HEIGHT_CONTACTS_PANEL = 400;
|
||||||
|
private static final int WIDTH_CONTACTS_PANEL = 597;
|
||||||
|
|
||||||
|
private static final int HEIGHT_GRID = 310;
|
||||||
|
|
||||||
|
private static final int PADDING = 5;
|
||||||
|
|
||||||
|
//
|
||||||
|
private GridDropTarget dropSource;
|
||||||
|
private GridDropTarget dropTarget;
|
||||||
|
private ListStore<InfoContactModel> storeSource = new ListStore<InfoContactModel>();
|
||||||
|
private ListStore<InfoContactModel> storeTarget = new ListStore<InfoContactModel>();
|
||||||
|
private Grid<InfoContactModel> gridAllContacts;
|
||||||
|
private Grid<InfoContactModel> gridShareWith;
|
||||||
|
|
||||||
|
private Button buttonSelectedLeft;
|
||||||
|
private Button buttonSelectedRight;
|
||||||
|
private Button buttonAllRight;
|
||||||
|
private Button buttonAllLeft;
|
||||||
|
|
||||||
|
private Label labelAllContacts;
|
||||||
|
private Label labelShareWith;
|
||||||
|
private ComboBox<UserVRE> vreListCombo;
|
||||||
|
private ListStore<UserVRE> vreListStore;
|
||||||
|
|
||||||
|
public MultiDragContactAdmin(String leftListContactsTitle, String rightListContactsTitle, String workspaceItemId) {
|
||||||
|
super();
|
||||||
|
GWT.log("MultiDragContactAdmin()");
|
||||||
|
this.leftListContactsTitle = leftListContactsTitle;
|
||||||
|
this.rightListContactsTitle = rightListContactsTitle;
|
||||||
|
this.workspaceItemId = workspaceItemId;
|
||||||
|
this.contactsMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
init();
|
||||||
|
create();
|
||||||
|
retrieveMyLogin();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
GWT.log("Error in MultiDragContactAdmin: " + e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
GWT.log("MultiDragContactAdmin Init");
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
|
// setStyleAttribute("margin", "10px");
|
||||||
|
setBodyStyle("padding: " + PADDING + "px; background: none");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveMyLogin() {
|
||||||
|
WorkspaceSharingServiceAsync.INSTANCE.getMyLogin(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error retrieving my login");
|
||||||
|
myLogin = null;
|
||||||
|
retrieveListOfAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
GWT.log("My login is: " + result);
|
||||||
|
myLogin = result;
|
||||||
|
retrieveListOfAdmin();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveListOfAdmin() {
|
||||||
|
WorkspaceSharingController.rpcWorkspaceSharingService.getAdministratorsByFolderId(workspaceItemId,
|
||||||
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error retrieving administrators for workspaceItemId: " + workspaceItemId);
|
||||||
|
targetContact = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Administrators for folder retrieved");
|
||||||
|
if (myLogin != null && !myLogin.isEmpty()) {
|
||||||
|
for (InfoContactModel infoContactModel : result) {
|
||||||
|
if (infoContactModel.getLogin().compareTo(myLogin) == 0) {
|
||||||
|
myContact = infoContactModel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myContact != null) {
|
||||||
|
result.remove(myContact);
|
||||||
|
targetContact = result;
|
||||||
|
} else {
|
||||||
|
targetContact = result;
|
||||||
|
}
|
||||||
|
storeTarget.removeAll();
|
||||||
|
storeTarget.add(targetContact);
|
||||||
|
storeTarget.commitChanges();
|
||||||
|
retrieveVREs();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveVREs() {
|
||||||
|
GWT.log("MultiDragContactAdmin load VREs");
|
||||||
|
WorkspaceSharingController.rpcWorkspaceSharingService.getUserVREList(new AsyncCallback<List<UserVRE>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error retrieving VRE for user: " + caught.getLocalizedMessage(), caught);
|
||||||
|
MessageBox.alert("Error",
|
||||||
|
ConstantsSharing.SERVER_ERROR + " retrieving VREs " + ConstantsSharing.TRY_AGAIN, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<UserVRE> result) {
|
||||||
|
try {
|
||||||
|
if (result != null && !result.isEmpty()) {
|
||||||
|
GWT.log("Get all VREs loaded " + result.size() + " from server");
|
||||||
|
vresList = result;
|
||||||
|
vreListStore.removeAll();
|
||||||
|
vreListStore.add(vresList);
|
||||||
|
vreListStore.commitChanges();
|
||||||
|
vreListCombo.setValue(vresList.get(0));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
GWT.log("No VREs found from server");
|
||||||
|
MessageBox.alert("Attention", "No VREs found " + ConstantsSharing.TRY_AGAIN, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
GWT.log("Error ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create() {
|
||||||
|
GWT.log("MultiDragContactAdmin Create Start");
|
||||||
|
// SORTING STORE
|
||||||
|
GWT.log("Create VREPanel");
|
||||||
|
// VRE
|
||||||
|
final ContentPanel vrePanel = new ContentPanel();
|
||||||
|
vrePanel.setId("vre-panel-share-admin" + Random.nextInt());
|
||||||
|
vrePanel.setSize(WIDTH_VRE_PANEL, HEIGHT_VRE_PANEL);
|
||||||
|
vrePanel.setHeaderVisible(false);
|
||||||
|
vrePanel.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// VRE Select
|
||||||
|
vreListStore = new ListStore<UserVRE>();
|
||||||
|
|
||||||
|
vreListCombo = new ComboBox<UserVRE>();
|
||||||
|
vreListCombo.setStore(vreListStore);
|
||||||
|
vreListCombo.setDisplayField(UserVRE.GROUP_NAME);
|
||||||
|
vreListCombo.setWidth(554);
|
||||||
|
vreListCombo.setAllowBlank(false);
|
||||||
|
|
||||||
|
vreListCombo.addSelectionChangedListener(new SelectionChangedListener<UserVRE>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectionChanged(SelectionChangedEvent<UserVRE> selected) {
|
||||||
|
retrieveContactList(selected.getSelectedItem());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FlexTable vreLayout = new FlexTable();
|
||||||
|
vreLayout.setCellSpacing(6);
|
||||||
|
vreLayout.setWidth("565px");
|
||||||
|
// FlexCellFormatter cellFormatter = vreLayout.getFlexCellFormatter();
|
||||||
|
Label vreLabel = new Label("VRE:");
|
||||||
|
vreLabel.setStyleAttribute("padding", "5px");
|
||||||
|
vreLayout.setWidget(0, 0, vreLabel);
|
||||||
|
vreLayout.setWidget(0, 1, vreListCombo);
|
||||||
|
vrePanel.add(vreLayout);
|
||||||
|
|
||||||
|
add(vrePanel);
|
||||||
|
|
||||||
|
//
|
||||||
|
GWT.log("MultiDragContactAdmin Create Grids Panel");
|
||||||
|
setGropUserStoreSorter(storeSource);
|
||||||
|
setGropUserStoreSorter(storeTarget);
|
||||||
|
|
||||||
|
final ContentPanel cp = new ContentPanel();
|
||||||
|
cp.setId("All-Contacts-Share-Contacts-" + Random.nextInt());
|
||||||
|
cp.setSize(WIDTH_CONTACTS_PANEL, HEIGHT_CONTACTS_PANEL);
|
||||||
|
cp.setHeaderVisible(false);
|
||||||
|
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
||||||
|
|
||||||
|
final VerticalPanel vpAllContacts = new VerticalPanel();
|
||||||
|
vpAllContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
|
|
||||||
|
labelAllContacts = new Label(ALL_CONTACTS);
|
||||||
|
setLeftListContactsTitle(leftListContactsTitle);
|
||||||
|
vpAllContacts.add(labelAllContacts);
|
||||||
|
|
||||||
|
gridAllContacts = new Grid<InfoContactModel>(storeSource, createColumnModel());
|
||||||
|
|
||||||
|
storeSource.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
storeSource.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
|
||||||
|
storeTarget.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
storeTarget.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
|
||||||
|
final StoreFilterField<InfoContactModel> filter = new StoreFilterField<InfoContactModel>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean doSelect(Store<InfoContactModel> store, InfoContactModel parent, InfoContactModel record,
|
||||||
|
String property, String filter) {
|
||||||
|
|
||||||
|
String name = record.getName();
|
||||||
|
name = name.toLowerCase();
|
||||||
|
if (name.contains(filter.toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
filter.setEmptyText("Filter All Contacts");
|
||||||
|
HorizontalPanel hp = new HorizontalPanel();
|
||||||
|
hp.setStyleAttribute("padding-top", "5px");
|
||||||
|
hp.setStyleAttribute("padding-bottom", "5px");
|
||||||
|
hp.add(filter);
|
||||||
|
filter.bind(storeSource);
|
||||||
|
|
||||||
|
gridAllContacts.setHeight(HEIGHT_GRID);
|
||||||
|
gridAllContacts.setBorders(false);
|
||||||
|
gridAllContacts.getView().setAutoFill(true);
|
||||||
|
// gridAllContacts.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
||||||
|
gridAllContacts.setBorders(true);
|
||||||
|
|
||||||
|
vpAllContacts.add(hp);
|
||||||
|
vpAllContacts.add(gridAllContacts);
|
||||||
|
|
||||||
|
RowData rowData = new RowData(.4, 1);
|
||||||
|
rowData.setMargins(new Margins(6));
|
||||||
|
cp.add(vpAllContacts, rowData);
|
||||||
|
|
||||||
|
rowData = new RowData(.2, 1);
|
||||||
|
rowData.setMargins(new Margins(6));
|
||||||
|
LayoutContainer lc = createMoveContactsContainer();
|
||||||
|
cp.add(lc, rowData);
|
||||||
|
|
||||||
|
rowData = new RowData(.4, 1);
|
||||||
|
rowData.setMargins(new Margins(6, 6, 6, 0));
|
||||||
|
|
||||||
|
final VerticalPanel vpShareWith = new VerticalPanel();
|
||||||
|
vpShareWith.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
|
|
||||||
|
labelShareWith = new Label(SHARE_WITH);
|
||||||
|
setRightListContactsTitle(rightListContactsTitle);
|
||||||
|
vpShareWith.add(labelShareWith);
|
||||||
|
|
||||||
|
gridShareWith = new Grid<InfoContactModel>(storeTarget, createColumnModel());
|
||||||
|
|
||||||
|
final StoreFilterField<InfoContactModel> filter2 = new StoreFilterField<InfoContactModel>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean doSelect(Store<InfoContactModel> store, InfoContactModel parent, InfoContactModel record,
|
||||||
|
String property, String filter) {
|
||||||
|
|
||||||
|
String name = record.getName();
|
||||||
|
name = name.toLowerCase();
|
||||||
|
if (name.contains(filter.toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// filter.setFieldLabel("Filter Contacts");
|
||||||
|
// filter2.setWidth(247);
|
||||||
|
filter2.setEmptyText("Filter Share with");
|
||||||
|
|
||||||
|
hp = new HorizontalPanel();
|
||||||
|
hp.setStyleAttribute("padding-top", "5px");
|
||||||
|
hp.setStyleAttribute("padding-bottom", "5px");
|
||||||
|
hp.add(filter2);
|
||||||
|
filter2.bind(storeTarget);
|
||||||
|
|
||||||
|
gridShareWith.setHeight(HEIGHT_GRID);
|
||||||
|
gridShareWith.setBorders(false);
|
||||||
|
gridShareWith.getView().setAutoFill(true);
|
||||||
|
// gridShareWith.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
||||||
|
gridShareWith.setBorders(true);
|
||||||
|
vpShareWith.add(hp);
|
||||||
|
vpShareWith.add(gridShareWith);
|
||||||
|
|
||||||
|
cp.add(vpShareWith, rowData);
|
||||||
|
|
||||||
|
new GridDragSource(gridAllContacts);
|
||||||
|
new GridDragSource(gridShareWith);
|
||||||
|
|
||||||
|
dropSource = new GridDropTarget(gridAllContacts);
|
||||||
|
dropSource.setAllowSelfAsSource(false);
|
||||||
|
|
||||||
|
dropTarget = new GridDropTarget(gridShareWith);
|
||||||
|
dropTarget.setAllowSelfAsSource(false);
|
||||||
|
|
||||||
|
add(cp);
|
||||||
|
|
||||||
|
cp.addListener(Events.Render, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(BaseEvent be) {
|
||||||
|
GWT.log("MultiDragContactAdmin CP Render Called");
|
||||||
|
int width = gridAllContacts.getWidth();
|
||||||
|
filter.setWidth(width - 2);
|
||||||
|
filter2.setWidth(width - 2);
|
||||||
|
gridAllContacts.setWidth(width);
|
||||||
|
vpAllContacts.setWidth(width + 7);
|
||||||
|
gridShareWith.setWidth(width);
|
||||||
|
vpShareWith.setWidth(width + 10);
|
||||||
|
vpShareWith.layout();
|
||||||
|
vpAllContacts.layout();
|
||||||
|
cp.layout();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// needed to enable quicktips (qtitle for the heading and qtip for the
|
||||||
|
// content) that are setup in the change GridCellRenderer
|
||||||
|
new QuickTip(gridAllContacts);
|
||||||
|
GWT.log("MultiDragContactAdmin view Created");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
private void retrieveContactList(final UserVRE userVRE) {
|
||||||
|
|
||||||
|
if (!contactsMap.isEmpty() && contactsMap.containsKey(userVRE)) {
|
||||||
|
List<InfoContactModel> contacts=contactsMap.get(userVRE);
|
||||||
|
updateStoreSource(contacts);
|
||||||
|
} else {
|
||||||
|
GWT.log("MultiDragContactAdmin retrieve contacts list");
|
||||||
|
WorkspaceSharingController.rpcWorkspaceSharingService.getAllContactsByVRE(userVRE,
|
||||||
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable e) {
|
||||||
|
GWT.log("Error retrieving all contacts by VRE: " + e.getLocalizedMessage(), e);
|
||||||
|
MessageBox.alert("Error", ConstantsSharing.SERVER_ERROR
|
||||||
|
+ " retrieving Contacts in this VRE " + ConstantsSharing.TRY_AGAIN, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Contacts retrieved from server");
|
||||||
|
contactsMap.put(userVRE, result);
|
||||||
|
updateStoreSource(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStoreSource(List<InfoContactModel> result) {
|
||||||
|
GWT.log("Update SourceStore");
|
||||||
|
storeSource.removeAll();
|
||||||
|
result.removeAll(storeTarget.getModels());
|
||||||
|
result.remove(myContact);
|
||||||
|
storeSource.add(result);
|
||||||
|
storeSource.commitChanges();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private LayoutContainer createMoveContactsContainer() {
|
||||||
|
|
||||||
|
LayoutContainer lc = new LayoutContainer();
|
||||||
|
lc.setLayout(new CenterLayout());
|
||||||
|
VerticalPanel vp1 = new VerticalPanel();
|
||||||
|
vp1.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
|
vp1.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
|
|
||||||
|
buttonSelectedLeft = new Button();
|
||||||
|
buttonSelectedLeft.setIcon(Resources.getSelectedLeft());
|
||||||
|
buttonSelectedLeft.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'");
|
||||||
|
buttonSelectedLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
List<InfoContactModel> selectedItems = gridAllContacts.getSelectionModel().getSelectedItems();
|
||||||
|
|
||||||
|
if (selectedItems != null && selectedItems.size() > 0) {
|
||||||
|
|
||||||
|
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
||||||
|
storeTarget.add(extendedInfoContactModel);
|
||||||
|
storeSource.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonSelectedRight = new Button();
|
||||||
|
buttonSelectedRight.setIcon(Resources.getSelectedRight());
|
||||||
|
buttonSelectedRight.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
|
||||||
|
|
||||||
|
buttonSelectedRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
List<InfoContactModel> selectedItems = gridShareWith.getSelectionModel().getSelectedItems();
|
||||||
|
|
||||||
|
if (selectedItems != null && selectedItems.size() > 0) {
|
||||||
|
|
||||||
|
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
||||||
|
storeSource.add(extendedInfoContactModel);
|
||||||
|
storeTarget.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonAllLeft = new Button();
|
||||||
|
buttonAllLeft.setIcon(Resources.getAllLeft());
|
||||||
|
buttonAllLeft.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
|
||||||
|
|
||||||
|
buttonAllLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
if (storeSource != null && storeSource.getCount() > 0) {
|
||||||
|
for (InfoContactModel extendedInfoContactModel : storeSource.getModels()) {
|
||||||
|
storeTarget.add(extendedInfoContactModel);
|
||||||
|
storeSource.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonAllRight = new Button();
|
||||||
|
buttonAllRight.setIcon(Resources.getAllRight());
|
||||||
|
buttonAllRight.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
|
||||||
|
|
||||||
|
buttonAllRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
if (storeTarget != null && storeTarget.getCount() > 0) {
|
||||||
|
for (InfoContactModel extendedInfoContactModel : storeTarget.getModels()) {
|
||||||
|
storeSource.add(extendedInfoContactModel);
|
||||||
|
storeTarget.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
vp1.add(buttonSelectedLeft);
|
||||||
|
vp1.add(buttonAllLeft);
|
||||||
|
vp1.add(buttonSelectedRight);
|
||||||
|
vp1.add(buttonAllRight);
|
||||||
|
|
||||||
|
lc.add(vp1);
|
||||||
|
|
||||||
|
vp1.addListener(Events.Render, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(BaseEvent be) {
|
||||||
|
buttonSelectedLeft.el().setStyleAttribute("margin-top", "40px");
|
||||||
|
buttonAllLeft.el().setStyleAttribute("margin-top", "5px");
|
||||||
|
buttonSelectedRight.el().setStyleAttribute("margin-top", "20px");
|
||||||
|
buttonAllRight.el().setStyleAttribute("margin", "5px");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return lc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ColumnModel createColumnModel() {
|
||||||
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||||
|
|
||||||
|
ColumnConfig icon = new ColumnConfig("Icon", "", 25);
|
||||||
|
configs.add(icon);
|
||||||
|
|
||||||
|
ColumnConfig columnConfigDisplayName = new ColumnConfig(InfoContactModel.FULLNAME, "Name", 150);
|
||||||
|
configs.add(columnConfigDisplayName);
|
||||||
|
|
||||||
|
ColumnConfig type = new ColumnConfig(InfoContactModel.ISGROUP, "Type", 50);
|
||||||
|
configs.add(type);
|
||||||
|
|
||||||
|
GridCellRenderer<InfoContactModel> iconRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
|
@Override
|
||||||
|
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
||||||
|
if (model.isGroup()) {
|
||||||
|
return Resources.getIconGroup().getHTML();
|
||||||
|
} else {
|
||||||
|
return Resources.getIconUser().getHTML();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
icon.setRenderer(iconRender);
|
||||||
|
|
||||||
|
GridCellRenderer<InfoContactModel> displayNameCellRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
|
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
||||||
|
|
||||||
|
if (model != null) {
|
||||||
|
|
||||||
|
String value = model.get(property);
|
||||||
|
if (value != null) {
|
||||||
|
return "<span qtitle='' qtip='" + model.getLogin() + "'>" + value + "</span>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
columnConfigDisplayName.setRenderer(displayNameCellRender);
|
||||||
|
|
||||||
|
GridCellRenderer<InfoContactModel> typeRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
|
@Override
|
||||||
|
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
||||||
|
Boolean isGroup = (Boolean) model.get(property);
|
||||||
|
String color = "#0F4FA8";
|
||||||
|
String val = "";
|
||||||
|
if (isGroup) {
|
||||||
|
val = "Group";
|
||||||
|
color = "#05316D";
|
||||||
|
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
||||||
|
} else {
|
||||||
|
val = "User";
|
||||||
|
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
type.setRenderer(typeRender);
|
||||||
|
return new ColumnModel(configs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InfoContactModel> getTargetListContactWithMyLogin() {
|
||||||
|
List<InfoContactModel> target = new ArrayList<>();
|
||||||
|
target.addAll(storeTarget.getModels());
|
||||||
|
target.add(myContact);
|
||||||
|
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGropUserStoreSorter(ListStore<InfoContactModel> store) {
|
||||||
|
|
||||||
|
// Sorting files
|
||||||
|
store.setStoreSorter(new StoreSorter<InfoContactModel>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Store<InfoContactModel> store, InfoContactModel m1, InfoContactModel m2,
|
||||||
|
String property) {
|
||||||
|
boolean m1Group = m1.isGroup();
|
||||||
|
boolean m2Group = m2.isGroup();
|
||||||
|
|
||||||
|
if (m1Group && !m2Group) {
|
||||||
|
return -1;
|
||||||
|
} else if (!m1Group && m2Group) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m1.getName().compareToIgnoreCase(m2.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// public void setHeadTitle(String headTitle){
|
||||||
|
// this.headTitle = headTitle;
|
||||||
|
//
|
||||||
|
// if(headTitle==null)
|
||||||
|
// this.setHeading(GROUP_DRAGGING_CONTACTS);
|
||||||
|
// else
|
||||||
|
// this.setHeading(headTitle);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public void setLeftListContactsTitle(String leftListContactsTitle) {
|
||||||
|
this.leftListContactsTitle = leftListContactsTitle;
|
||||||
|
|
||||||
|
if (leftListContactsTitle == null)
|
||||||
|
labelAllContacts.setText(ALL_CONTACTS);
|
||||||
|
else
|
||||||
|
labelAllContacts.setText(leftListContactsTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRightListContactsTitle(String rightListContactsTitle) {
|
||||||
|
this.rightListContactsTitle = rightListContactsTitle;
|
||||||
|
|
||||||
|
if (rightListContactsTitle == null)
|
||||||
|
labelShareWith.setText(SHARE_WITH);
|
||||||
|
else
|
||||||
|
labelShareWith.setText(rightListContactsTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLeftListContactsTitle() {
|
||||||
|
return leftListContactsTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public String getHeadTitle() {
|
||||||
|
// return headTitle;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public String getRightListContactsTitle() {
|
||||||
|
return rightListContactsTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -140,7 +140,7 @@ public class MultiValuePanel extends Composite {
|
||||||
if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) {
|
if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) {
|
||||||
final ListItem displayItem = new ListItem();
|
final ListItem displayItem = new ListItem();
|
||||||
displayItem.setStyleName("multivalue-panel-token-ws");
|
displayItem.setStyleName("multivalue-panel-token-ws");
|
||||||
Paragraph p = new Paragraph(itemBox.getValue());
|
Paragraph p = new Paragraph(suggest.getInfoContactModel().getName());
|
||||||
|
|
||||||
Span span = new Span("x");
|
Span span = new Span("x");
|
||||||
span.addClickHandler(new ClickHandler() {
|
span.addClickHandler(new ClickHandler() {
|
||||||
|
@ -153,10 +153,10 @@ public class MultiValuePanel extends Composite {
|
||||||
displayItem.add(span);
|
displayItem.add(span);
|
||||||
|
|
||||||
// original value of the item selected
|
// original value of the item selected
|
||||||
GWT.log("Adding selected item '" + itemBox.getValue());
|
GWT.log("Adding selected user '" + suggest.getInfoContactModel().getName());
|
||||||
// itemsSelected.add(itemBox.getValue());
|
// itemsSelected.add(itemBox.getValue());
|
||||||
// GWT.log("Total: " + itemsSelected);
|
// GWT.log("Total: " + itemsSelected);
|
||||||
users.put(itemBox.getValue(), suggest.getInfoContactModel());
|
users.put(suggest.getInfoContactModel().getName(), suggest.getInfoContactModel());
|
||||||
|
|
||||||
list.insert(displayItem, list.getWidgetCount() - 1);
|
list.insert(displayItem, list.getWidgetCount() - 1);
|
||||||
itemBox.setValue("");
|
itemBox.setValue("");
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest;
|
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing.LOAD_CONTACTS_AS;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ public class DialogMultiDragContact extends Dialog{
|
||||||
private LayoutContainer lcMiddle = new LayoutContainer();
|
private LayoutContainer lcMiddle = new LayoutContainer();
|
||||||
private LayoutContainer lcBottom = new LayoutContainer();
|
private LayoutContainer lcBottom = new LayoutContainer();
|
||||||
|
|
||||||
public DialogMultiDragContact(String headTitle, String leftListContactsTitle, String rightListContactsTitle, boolean visibleAlreadyShared, boolean hideOnPressOk) {
|
public DialogMultiDragContact(String headTitle, String leftListContactsTitle, String rightListContactsTitle, boolean visibleAlreadyShared, boolean hideOnPressOk, boolean hiddenMySelf) {
|
||||||
this.multiDragContact = new MultiDragContact(leftListContactsTitle, rightListContactsTitle, visibleAlreadyShared);
|
this.multiDragContact = new MultiDragContact(leftListContactsTitle, rightListContactsTitle, visibleAlreadyShared);
|
||||||
this.hideOnPressOkButton = hideOnPressOk;
|
this.hideOnPressOkButton = hideOnPressOk;
|
||||||
this.visibleTextArea = visibleAlreadyShared;
|
this.visibleTextArea = visibleAlreadyShared;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest;
|
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.user;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -45,19 +45,17 @@ import com.google.gwt.user.client.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa
|
* @author Francesco Mangiacrapa Jan 27, 2015
|
||||||
* Jan 27, 2015
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MultiDragContact extends ContentPanel {
|
public class MultiDragContact extends ContentPanel {
|
||||||
|
|
||||||
|
|
||||||
private static final int HEIGHT_CP = 375;
|
private static final int HEIGHT_CP = 375;
|
||||||
private static final String ALL_CONTACTS = "All Contacts";
|
private static final String ALL_CONTACTS = "All Contacts";
|
||||||
private static final String SHARE_WITH = "Share with...";
|
private static final String SHARE_WITH = "Share with...";
|
||||||
|
|
||||||
public static final int WIDTH_CP = 597;
|
public static final int WIDTH_CP = 597;
|
||||||
// private static final int HEIGHT_DIALOG = 542;
|
// private static final int HEIGHT_DIALOG = 542;
|
||||||
public static final int HEIGHT_GRID = 310;
|
public static final int HEIGHT_GRID = 310;
|
||||||
|
|
||||||
public static final int PADDING = 5;
|
public static final int PADDING = 5;
|
||||||
|
@ -76,16 +74,17 @@ public class MultiDragContact extends ContentPanel {
|
||||||
private Button buttonSelectedRight;
|
private Button buttonSelectedRight;
|
||||||
private Button buttonAllRight;
|
private Button buttonAllRight;
|
||||||
private Button buttonAllLeft;
|
private Button buttonAllLeft;
|
||||||
// private boolean hideOnPressOkButton;
|
// private boolean hideOnPressOkButton;
|
||||||
// private String headTitle;
|
// private String headTitle;
|
||||||
private String leftListContactsTitle;
|
private String leftListContactsTitle;
|
||||||
private String rightListContactsTitle;
|
private String rightListContactsTitle;
|
||||||
private Label allContacts;
|
private Label allContacts;
|
||||||
private Label shareWith;
|
private Label shareWith;
|
||||||
|
|
||||||
|
|
||||||
public MultiDragContact(String leftListContactsTitle, String rightListContactsTitle, boolean visibleAlreadyShared) {
|
public MultiDragContact(String leftListContactsTitle, String rightListContactsTitle, boolean visibleAlreadyShared) {
|
||||||
this(visibleAlreadyShared);
|
this(visibleAlreadyShared);
|
||||||
// setHeadTitle(headTitle);
|
// setHeadTitle(headTitle);
|
||||||
setLeftListContactsTitle(leftListContactsTitle);
|
setLeftListContactsTitle(leftListContactsTitle);
|
||||||
setRightListContactsTitle(rightListContactsTitle);
|
setRightListContactsTitle(rightListContactsTitle);
|
||||||
}
|
}
|
||||||
|
@ -95,22 +94,23 @@ public class MultiDragContact extends ContentPanel {
|
||||||
this.setBodyBorder(false);
|
this.setBodyBorder(false);
|
||||||
this.setBorders(false);
|
this.setBorders(false);
|
||||||
|
|
||||||
// setStyleAttribute("margin", "10px");
|
// setStyleAttribute("margin", "10px");
|
||||||
setBodyStyle("padding: "+PADDING+"px; background: none");
|
setBodyStyle("padding: " + PADDING + "px; background: none");
|
||||||
// SORTING STORE
|
// SORTING STORE
|
||||||
setGropUserStoreSorter(storeSource);
|
setGropUserStoreSorter(storeSource);
|
||||||
setGropUserStoreSorter(storeTarget);
|
setGropUserStoreSorter(storeTarget);
|
||||||
|
|
||||||
ContentPanel cpAlreadyShared = new ContentPanel();
|
ContentPanel cpAlreadyShared = new ContentPanel();
|
||||||
cpAlreadyShared.setWidth(WIDTH_CP);
|
cpAlreadyShared.setWidth(WIDTH_CP);
|
||||||
cpAlreadyShared.setId("Already-Shared-"+Random.nextInt());
|
cpAlreadyShared.setId("Already-Shared-" + Random.nextInt());
|
||||||
cpAlreadyShared.getElement().getStyle().setHeight(ALREADY_SHARED_HEIGHT, Unit.PX);
|
cpAlreadyShared.getElement().getStyle().setHeight(ALREADY_SHARED_HEIGHT, Unit.PX);
|
||||||
//cpAlreadyShared.setStyleAttribute("height", ALREADY_SHARED_HEIGHT+"px important!");
|
// cpAlreadyShared.setStyleAttribute("height", ALREADY_SHARED_HEIGHT+"px
|
||||||
|
// important!");
|
||||||
cpAlreadyShared.setHeaderVisible(false);
|
cpAlreadyShared.setHeaderVisible(false);
|
||||||
cpAlreadyShared.setVisible(visibleAlreadyShared);
|
cpAlreadyShared.setVisible(visibleAlreadyShared);
|
||||||
|
|
||||||
cpAlreadyShared.setLayout(new FitLayout());
|
cpAlreadyShared.setLayout(new FitLayout());
|
||||||
//cpAlreadyShared.setScrollMode(Scroll.AUTOY);
|
// cpAlreadyShared.setScrollMode(Scroll.AUTOY);
|
||||||
|
|
||||||
VerticalPanel vpShared = new VerticalPanel();
|
VerticalPanel vpShared = new VerticalPanel();
|
||||||
vpShared.setVerticalAlign(VerticalAlignment.MIDDLE);
|
vpShared.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
|
@ -140,7 +140,7 @@ public class MultiDragContact extends ContentPanel {
|
||||||
add(cpAlreadyShared);
|
add(cpAlreadyShared);
|
||||||
|
|
||||||
final ContentPanel cp = new ContentPanel();
|
final ContentPanel cp = new ContentPanel();
|
||||||
cp.setId("All-Contacts-Share-Contacts-"+Random.nextInt());
|
cp.setId("All-Contacts-Share-Contacts-" + Random.nextInt());
|
||||||
cp.setSize(WIDTH_CP, HEIGHT_CP);
|
cp.setSize(WIDTH_CP, HEIGHT_CP);
|
||||||
cp.setHeaderVisible(false);
|
cp.setHeaderVisible(false);
|
||||||
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
||||||
|
@ -151,8 +151,7 @@ public class MultiDragContact extends ContentPanel {
|
||||||
allContacts = new Label(ALL_CONTACTS);
|
allContacts = new Label(ALL_CONTACTS);
|
||||||
vpAllContacts.add(allContacts);
|
vpAllContacts.add(allContacts);
|
||||||
|
|
||||||
gridAllContacts = new Grid<InfoContactModel>(storeSource,
|
gridAllContacts = new Grid<InfoContactModel>(storeSource, createColumnModel());
|
||||||
createColumnModel());
|
|
||||||
|
|
||||||
storeSource.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeSource.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
storeSource.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeSource.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
@ -163,8 +162,7 @@ public class MultiDragContact extends ContentPanel {
|
||||||
final StoreFilterField<InfoContactModel> filter = new StoreFilterField<InfoContactModel>() {
|
final StoreFilterField<InfoContactModel> filter = new StoreFilterField<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doSelect(Store<InfoContactModel> store,
|
protected boolean doSelect(Store<InfoContactModel> store, InfoContactModel parent, InfoContactModel record,
|
||||||
InfoContactModel parent, InfoContactModel record,
|
|
||||||
String property, String filter) {
|
String property, String filter) {
|
||||||
|
|
||||||
String name = record.getName();
|
String name = record.getName();
|
||||||
|
@ -177,8 +175,8 @@ public class MultiDragContact extends ContentPanel {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// filter.setFieldLabel("Filter Contacts");
|
|
||||||
// filter.setWidth(247);
|
//
|
||||||
filter.setEmptyText("Filter All Contacts");
|
filter.setEmptyText("Filter All Contacts");
|
||||||
HorizontalPanel hp = new HorizontalPanel();
|
HorizontalPanel hp = new HorizontalPanel();
|
||||||
hp.setStyleAttribute("padding-top", "5px");
|
hp.setStyleAttribute("padding-top", "5px");
|
||||||
|
@ -213,13 +211,12 @@ public class MultiDragContact extends ContentPanel {
|
||||||
shareWith = new Label(SHARE_WITH);
|
shareWith = new Label(SHARE_WITH);
|
||||||
vpShareWith.add(shareWith);
|
vpShareWith.add(shareWith);
|
||||||
|
|
||||||
gridShareWith = new Grid<InfoContactModel>(storeTarget,createColumnModel());
|
gridShareWith = new Grid<InfoContactModel>(storeTarget, createColumnModel());
|
||||||
|
|
||||||
final StoreFilterField<InfoContactModel> filter2 = new StoreFilterField<InfoContactModel>() {
|
final StoreFilterField<InfoContactModel> filter2 = new StoreFilterField<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doSelect(Store<InfoContactModel> store,
|
protected boolean doSelect(Store<InfoContactModel> store, InfoContactModel parent, InfoContactModel record,
|
||||||
InfoContactModel parent, InfoContactModel record,
|
|
||||||
String property, String filter) {
|
String property, String filter) {
|
||||||
|
|
||||||
String name = record.getName();
|
String name = record.getName();
|
||||||
|
@ -233,7 +230,7 @@ public class MultiDragContact extends ContentPanel {
|
||||||
};
|
};
|
||||||
|
|
||||||
// filter.setFieldLabel("Filter Contacts");
|
// filter.setFieldLabel("Filter Contacts");
|
||||||
// filter2.setWidth(247);
|
// filter2.setWidth(247);
|
||||||
filter2.setEmptyText("Filter Share with");
|
filter2.setEmptyText("Filter Share with");
|
||||||
|
|
||||||
hp = new HorizontalPanel();
|
hp = new HorizontalPanel();
|
||||||
|
@ -263,17 +260,17 @@ public class MultiDragContact extends ContentPanel {
|
||||||
|
|
||||||
add(cp);
|
add(cp);
|
||||||
|
|
||||||
cp.addListener(Events.Render, new Listener<BaseEvent>() {
|
cp.addListener(Events.Render, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(BaseEvent be) {
|
public void handleEvent(BaseEvent be) {
|
||||||
int width = gridAllContacts.getWidth();
|
int width = gridAllContacts.getWidth();
|
||||||
filter.setWidth(width-2);
|
filter.setWidth(width - 2);
|
||||||
filter2.setWidth(width-2);
|
filter2.setWidth(width - 2);
|
||||||
gridAllContacts.setWidth(width);
|
gridAllContacts.setWidth(width);
|
||||||
vpAllContacts.setWidth(width+7);
|
vpAllContacts.setWidth(width + 7);
|
||||||
gridShareWith.setWidth(width);
|
gridShareWith.setWidth(width);
|
||||||
vpShareWith.setWidth(width+10);
|
vpShareWith.setWidth(width + 10);
|
||||||
vpShareWith.layout();
|
vpShareWith.layout();
|
||||||
vpAllContacts.layout();
|
vpAllContacts.layout();
|
||||||
cp.layout();
|
cp.layout();
|
||||||
|
@ -296,90 +293,81 @@ public class MultiDragContact extends ContentPanel {
|
||||||
buttonSelectedLeft = new Button();
|
buttonSelectedLeft = new Button();
|
||||||
buttonSelectedLeft.setIcon(Resources.getSelectedLeft());
|
buttonSelectedLeft.setIcon(Resources.getSelectedLeft());
|
||||||
buttonSelectedLeft.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'");
|
buttonSelectedLeft.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'");
|
||||||
buttonSelectedLeft
|
buttonSelectedLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
List<InfoContactModel> selectedItems = gridAllContacts
|
List<InfoContactModel> selectedItems = gridAllContacts.getSelectionModel().getSelectedItems();
|
||||||
.getSelectionModel().getSelectedItems();
|
|
||||||
|
|
||||||
if (selectedItems != null && selectedItems.size() > 0) {
|
if (selectedItems != null && selectedItems.size() > 0) {
|
||||||
|
|
||||||
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
||||||
storeTarget.add(extendedInfoContactModel);
|
storeTarget.add(extendedInfoContactModel);
|
||||||
storeSource.remove(extendedInfoContactModel);
|
storeSource.remove(extendedInfoContactModel);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
buttonSelectedRight = new Button();
|
buttonSelectedRight = new Button();
|
||||||
buttonSelectedRight.setIcon(Resources.getSelectedRight());
|
buttonSelectedRight.setIcon(Resources.getSelectedRight());
|
||||||
buttonSelectedRight.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
|
buttonSelectedRight.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
|
||||||
|
|
||||||
buttonSelectedRight
|
buttonSelectedRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
List<InfoContactModel> selectedItems = gridShareWith
|
List<InfoContactModel> selectedItems = gridShareWith.getSelectionModel().getSelectedItems();
|
||||||
.getSelectionModel().getSelectedItems();
|
|
||||||
|
|
||||||
if (selectedItems != null && selectedItems.size() > 0) {
|
if (selectedItems != null && selectedItems.size() > 0) {
|
||||||
|
|
||||||
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
||||||
storeSource.add(extendedInfoContactModel);
|
storeSource.add(extendedInfoContactModel);
|
||||||
storeTarget.remove(extendedInfoContactModel);
|
storeTarget.remove(extendedInfoContactModel);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
buttonAllLeft = new Button();
|
buttonAllLeft = new Button();
|
||||||
buttonAllLeft.setIcon(Resources.getAllLeft());
|
buttonAllLeft.setIcon(Resources.getAllLeft());
|
||||||
buttonAllLeft.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
|
buttonAllLeft.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
|
||||||
|
|
||||||
buttonAllLeft
|
buttonAllLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
if (storeSource != null && storeSource.getCount() > 0) {
|
|
||||||
for (InfoContactModel extendedInfoContactModel : storeSource
|
|
||||||
.getModels()) {
|
|
||||||
storeTarget.add(extendedInfoContactModel);
|
|
||||||
storeSource.remove(extendedInfoContactModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (storeSource != null && storeSource.getCount() > 0) {
|
||||||
|
for (InfoContactModel extendedInfoContactModel : storeSource.getModels()) {
|
||||||
|
storeTarget.add(extendedInfoContactModel);
|
||||||
|
storeSource.remove(extendedInfoContactModel);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
buttonAllRight = new Button();
|
buttonAllRight = new Button();
|
||||||
buttonAllRight.setIcon(Resources.getAllRight());
|
buttonAllRight.setIcon(Resources.getAllRight());
|
||||||
buttonAllRight
|
buttonAllRight.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
|
||||||
.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
|
|
||||||
|
|
||||||
buttonAllRight
|
buttonAllRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
if (storeTarget != null && storeTarget.getCount() > 0) {
|
|
||||||
for (InfoContactModel extendedInfoContactModel : storeTarget
|
|
||||||
.getModels()) {
|
|
||||||
storeSource.add(extendedInfoContactModel);
|
|
||||||
storeTarget.remove(extendedInfoContactModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (storeTarget != null && storeTarget.getCount() > 0) {
|
||||||
|
for (InfoContactModel extendedInfoContactModel : storeTarget.getModels()) {
|
||||||
|
storeSource.add(extendedInfoContactModel);
|
||||||
|
storeTarget.remove(extendedInfoContactModel);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
vp1.add(buttonSelectedLeft);
|
vp1.add(buttonSelectedLeft);
|
||||||
vp1.add(buttonAllLeft);
|
vp1.add(buttonAllLeft);
|
||||||
|
@ -394,8 +382,7 @@ public class MultiDragContact extends ContentPanel {
|
||||||
public void handleEvent(BaseEvent be) {
|
public void handleEvent(BaseEvent be) {
|
||||||
buttonSelectedLeft.el().setStyleAttribute("margin-top", "40px");
|
buttonSelectedLeft.el().setStyleAttribute("margin-top", "40px");
|
||||||
buttonAllLeft.el().setStyleAttribute("margin-top", "5px");
|
buttonAllLeft.el().setStyleAttribute("margin-top", "5px");
|
||||||
buttonSelectedRight.el()
|
buttonSelectedRight.el().setStyleAttribute("margin-top", "20px");
|
||||||
.setStyleAttribute("margin-top", "20px");
|
|
||||||
buttonAllRight.el().setStyleAttribute("margin", "5px");
|
buttonAllRight.el().setStyleAttribute("margin", "5px");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -410,20 +397,16 @@ public class MultiDragContact extends ContentPanel {
|
||||||
ColumnConfig icon = new ColumnConfig("Icon", "", 25);
|
ColumnConfig icon = new ColumnConfig("Icon", "", 25);
|
||||||
configs.add(icon);
|
configs.add(icon);
|
||||||
|
|
||||||
ColumnConfig columnConfigDisplayName = new ColumnConfig(
|
ColumnConfig columnConfigDisplayName = new ColumnConfig(InfoContactModel.FULLNAME, "Name", 150);
|
||||||
InfoContactModel.FULLNAME, "Name", 150);
|
|
||||||
configs.add(columnConfigDisplayName);
|
configs.add(columnConfigDisplayName);
|
||||||
|
|
||||||
ColumnConfig type = new ColumnConfig(InfoContactModel.ISGROUP, "Type",
|
ColumnConfig type = new ColumnConfig(InfoContactModel.ISGROUP, "Type", 50);
|
||||||
50);
|
|
||||||
configs.add(type);
|
configs.add(type);
|
||||||
|
|
||||||
GridCellRenderer<InfoContactModel> iconRender = new GridCellRenderer<InfoContactModel>() {
|
GridCellRenderer<InfoContactModel> iconRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
@Override
|
@Override
|
||||||
public String render(InfoContactModel model, String property,
|
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
ColumnData config, int rowIndex, int colIndex,
|
ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
||||||
ListStore<InfoContactModel> store,
|
|
||||||
Grid<InfoContactModel> grid) {
|
|
||||||
if (model.isGroup()) {
|
if (model.isGroup()) {
|
||||||
return Resources.getIconGroup().getHTML();
|
return Resources.getIconGroup().getHTML();
|
||||||
} else {
|
} else {
|
||||||
|
@ -435,17 +418,14 @@ public class MultiDragContact extends ContentPanel {
|
||||||
icon.setRenderer(iconRender);
|
icon.setRenderer(iconRender);
|
||||||
|
|
||||||
GridCellRenderer<InfoContactModel> displayNameCellRender = new GridCellRenderer<InfoContactModel>() {
|
GridCellRenderer<InfoContactModel> displayNameCellRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
public String render(InfoContactModel model, String property,
|
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
ColumnData config, int rowIndex, int colIndex,
|
ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
||||||
ListStore<InfoContactModel> store,
|
|
||||||
Grid<InfoContactModel> grid) {
|
|
||||||
|
|
||||||
if (model != null) {
|
if (model != null) {
|
||||||
|
|
||||||
String value = model.get(property);
|
String value = model.get(property);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
return "<span qtitle='' qtip='" + model.getLogin()
|
return "<span qtitle='' qtip='" + model.getLogin() + "'>" + value + "</span>";
|
||||||
+ "'>" + value + "</span>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,22 +437,18 @@ public class MultiDragContact extends ContentPanel {
|
||||||
|
|
||||||
GridCellRenderer<InfoContactModel> typeRender = new GridCellRenderer<InfoContactModel>() {
|
GridCellRenderer<InfoContactModel> typeRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
@Override
|
@Override
|
||||||
public String render(InfoContactModel model, String property,
|
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
ColumnData config, int rowIndex, int colIndex,
|
ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
||||||
ListStore<InfoContactModel> store,
|
|
||||||
Grid<InfoContactModel> grid) {
|
|
||||||
Boolean isGroup = (Boolean) model.get(property);
|
Boolean isGroup = (Boolean) model.get(property);
|
||||||
String color = "#0F4FA8";
|
String color = "#0F4FA8";
|
||||||
String val = "";
|
String val = "";
|
||||||
if (isGroup) {
|
if (isGroup) {
|
||||||
val = "Group";
|
val = "Group";
|
||||||
color = "#05316D";
|
color = "#05316D";
|
||||||
return "<span style='font-weight: bold; color:" + color
|
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
||||||
+ "'>" + val + "</span>";
|
|
||||||
} else {
|
} else {
|
||||||
val = "User";
|
val = "User";
|
||||||
return "<span style='font-weight: bold; color:" + color
|
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
||||||
+ "'>" + val + "</span>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -520,7 +496,6 @@ public class MultiDragContact extends ContentPanel {
|
||||||
storeTarget.add(listContact);
|
storeTarget.add(listContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addSourceContact(InfoContactModel contact) {
|
public void addSourceContact(InfoContactModel contact) {
|
||||||
if (contact != null)
|
if (contact != null)
|
||||||
storeSource.add(contact);
|
storeSource.add(contact);
|
||||||
|
@ -541,8 +516,8 @@ public class MultiDragContact extends ContentPanel {
|
||||||
store.setStoreSorter(new StoreSorter<InfoContactModel>() {
|
store.setStoreSorter(new StoreSorter<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Store<InfoContactModel> store,
|
public int compare(Store<InfoContactModel> store, InfoContactModel m1, InfoContactModel m2,
|
||||||
InfoContactModel m1, InfoContactModel m2, String property) {
|
String property) {
|
||||||
boolean m1Group = m1.isGroup();
|
boolean m1Group = m1.isGroup();
|
||||||
boolean m2Group = m2.isGroup();
|
boolean m2Group = m2.isGroup();
|
||||||
|
|
||||||
|
@ -557,19 +532,12 @@ public class MultiDragContact extends ContentPanel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setHeadTitle(String headTitle){
|
|
||||||
// this.headTitle = headTitle;
|
|
||||||
//
|
|
||||||
// if(headTitle==null)
|
|
||||||
// this.setHeading(GROUP_DRAGGING_CONTACTS);
|
|
||||||
// else
|
|
||||||
// this.setHeading(headTitle);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void setLeftListContactsTitle(String leftListContactsTitle) {
|
public void setLeftListContactsTitle(String leftListContactsTitle) {
|
||||||
this.leftListContactsTitle = leftListContactsTitle;
|
this.leftListContactsTitle = leftListContactsTitle;
|
||||||
|
|
||||||
if(leftListContactsTitle==null)
|
if (leftListContactsTitle == null)
|
||||||
allContacts.setText(ALL_CONTACTS);
|
allContacts.setText(ALL_CONTACTS);
|
||||||
else
|
else
|
||||||
allContacts.setText(leftListContactsTitle);
|
allContacts.setText(leftListContactsTitle);
|
||||||
|
@ -578,7 +546,7 @@ public class MultiDragContact extends ContentPanel {
|
||||||
public void setRightListContactsTitle(String rightListContactsTitle) {
|
public void setRightListContactsTitle(String rightListContactsTitle) {
|
||||||
this.rightListContactsTitle = rightListContactsTitle;
|
this.rightListContactsTitle = rightListContactsTitle;
|
||||||
|
|
||||||
if(rightListContactsTitle==null)
|
if (rightListContactsTitle == null)
|
||||||
shareWith.setText(SHARE_WITH);
|
shareWith.setText(SHARE_WITH);
|
||||||
else
|
else
|
||||||
shareWith.setText(rightListContactsTitle);
|
shareWith.setText(rightListContactsTitle);
|
||||||
|
@ -588,9 +556,7 @@ public class MultiDragContact extends ContentPanel {
|
||||||
return leftListContactsTitle;
|
return leftListContactsTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public String getHeadTitle() {
|
|
||||||
// return headTitle;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String getRightListContactsTitle() {
|
public String getRightListContactsTitle() {
|
||||||
return rightListContactsTitle;
|
return rightListContactsTitle;
|
|
@ -4,6 +4,8 @@
|
||||||
package org.gcube.portlets.widgets.workspacesharingwidget.server;
|
package org.gcube.portlets.widgets.workspacesharingwidget.server;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -30,7 +32,7 @@ import org.gcube.portlets.widgets.workspacesharingwidget.server.util.WsUtil;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ACL_TYPE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FolderModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FolderModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.UserVRE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.GXTFolderItemTypeEnum;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.GXTFolderItemTypeEnum;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
||||||
|
@ -38,7 +40,6 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL.USE
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VO;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VO;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VRE;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VRE;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||||
|
@ -57,6 +58,28 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
|
|
||||||
private static HashMap<String, InfoContactModel> hashTestUser = null;
|
private static HashMap<String, InfoContactModel> hashTestUser = null;
|
||||||
|
|
||||||
|
private static LiferayUserManager liferayUserManager;
|
||||||
|
private static GroupManager groupManager;
|
||||||
|
|
||||||
|
public static LiferayUserManager getLiferayUserManager() {
|
||||||
|
if (liferayUserManager == null) {
|
||||||
|
liferayUserManager = new LiferayUserManager();
|
||||||
|
return liferayUserManager;
|
||||||
|
} else {
|
||||||
|
return liferayUserManager;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GroupManager getGroupManager() {
|
||||||
|
if (groupManager == null) {
|
||||||
|
groupManager = new LiferayGroupManager();
|
||||||
|
return groupManager;
|
||||||
|
} else {
|
||||||
|
return groupManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used in test mode.
|
* Used in test mode.
|
||||||
*
|
*
|
||||||
|
@ -91,6 +114,9 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
hashTestUser.put("valentina.marioli", new InfoContactModel("valentina.marioli", "valentina.marioli",
|
hashTestUser.put("valentina.marioli", new InfoContactModel("valentina.marioli", "valentina.marioli",
|
||||||
"Valentina Marioli", "@isti.cnr.it", false));
|
"Valentina Marioli", "@isti.cnr.it", false));
|
||||||
|
|
||||||
|
hashTestUser.put("giancarlo.panichi", new InfoContactModel("giancarlo.panichi", "giancarlo.panichi",
|
||||||
|
"Giancarlo Panichi", "@isti.cnr.it", false));
|
||||||
|
|
||||||
hashTestUser.put("devVRE", new InfoContactModel("devVRE", "devVRE", "devVRE", "", true));
|
hashTestUser.put("devVRE", new InfoContactModel("devVRE", "devVRE", "devVRE", "", true));
|
||||||
|
|
||||||
// hashTestUser.put(WsUtil.TEST_USER.toString(),
|
// hashTestUser.put(WsUtil.TEST_USER.toString(),
|
||||||
|
@ -271,7 +297,7 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
*/
|
*/
|
||||||
public List<InfoContactModel> buildGXTListContactsModelFromUserModel(PortalContextInfo info) throws Exception {
|
public List<InfoContactModel> buildGXTListContactsModelFromUserModel(PortalContextInfo info) throws Exception {
|
||||||
|
|
||||||
List<GCubeUser> listUsers = new LiferayUserManager().listUsersByGroup(info.getCurrGroupId());
|
List<GCubeUser> listUsers = getLiferayUserManager().listUsersByGroup(info.getCurrGroupId());
|
||||||
|
|
||||||
if (listUsers == null) {
|
if (listUsers == null) {
|
||||||
logger.error("No users found in: " + info.getCurrentScope());
|
logger.error("No users found in: " + info.getCurrentScope());
|
||||||
|
@ -306,10 +332,10 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* Error
|
* Error
|
||||||
*/
|
*/
|
||||||
public List<InfoContactModel> buildGXTListContactsModelFromUserModel(PortalContextInfo info, GGroup gGroup)
|
public List<InfoContactModel> buildGXTListContactsModelByVRE(PortalContextInfo info, UserVRE gGroup)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
List<GCubeUser> listUsers = new LiferayUserManager().listUsersByGroup(gGroup.getGroupId());
|
List<GCubeUser> listUsers = getLiferayUserManager().listUsersByGroup(gGroup.getGroupId());
|
||||||
|
|
||||||
if (listUsers == null) {
|
if (listUsers == null) {
|
||||||
logger.error("No users found in: " + info.getCurrentScope());
|
logger.error("No users found in: " + info.getCurrentScope());
|
||||||
|
@ -331,37 +357,65 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
logger.trace("buildGXTListContactsModel is not returning user: " + userModel.getUsername()
|
logger.trace("buildGXTListContactsModel is not returning user: " + userModel.getUsername()
|
||||||
+ "because name is null or empty");
|
+ "because name is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("List contact model completed, return " + listContactsModel.size() + " contacts");
|
logger.trace("List contact model completed, return " + listContactsModel.size() + " contacts");
|
||||||
|
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<GGroup> getVREList(PortalContextInfo info) throws Exception {
|
public ArrayList<UserVRE> getUserVREList(PortalContextInfo info) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Current context is " + info.getCurrGroupId());
|
logger.info("Current context is " + info.getCurrGroupId());
|
||||||
ArrayList<GGroup> contexts = new ArrayList<>();
|
ArrayList<UserVRE> contexts = new ArrayList<>();
|
||||||
|
|
||||||
GroupManager gm = new LiferayGroupManager();
|
// GCubeGroup currentGroup = gm.getGroup(info.getCurrGroupId());
|
||||||
GCubeGroup currentGroup = gm.getGroup(info.getCurrGroupId());
|
logger.info("Current user: " + info.getUsername());
|
||||||
|
|
||||||
// is root
|
long userId = getLiferayUserManager().getUserId(info.getUsername());
|
||||||
List<GCubeGroup> children = currentGroup.getChildren();
|
|
||||||
for (GCubeGroup gCubeGroup : children) {
|
|
||||||
|
|
||||||
// get the vo children
|
logger.info("UserId is: " + userId);
|
||||||
List<GCubeGroup> childrenVO = gCubeGroup.getChildren();
|
// Get Gateways
|
||||||
for (GCubeGroup voChildren : childrenVO) {
|
List<GCubeGroup> listOfGroups = getGroupManager().listGroupsByUser(userId);
|
||||||
GGroup gGroup = new GGroup(voChildren.getGroupId(), voChildren.getParentGroupId(),
|
if (listOfGroups != null && !listOfGroups.isEmpty()) {
|
||||||
voChildren.getGroupName(), voChildren.getDescription());
|
for (GCubeGroup gCubeGroup : listOfGroups) {
|
||||||
contexts.add(gGroup);
|
// Get VOs
|
||||||
|
List<GCubeGroup> voGroups = gCubeGroup.getChildren();
|
||||||
|
if (voGroups != null && !voGroups.isEmpty()) {
|
||||||
|
for (GCubeGroup voGroup : voGroups) {
|
||||||
|
// Get VREs
|
||||||
|
List<GCubeGroup> vreGroups = voGroup.getChildren();
|
||||||
|
if (vreGroups != null && !vreGroups.isEmpty()) {
|
||||||
|
for (GCubeGroup vreGroup : vreGroups) {
|
||||||
|
UserVRE gGroup = new UserVRE(vreGroup.getGroupId(), vreGroup.getParentGroupId(),
|
||||||
|
vreGroup.getGroupName(), vreGroup.getDescription());
|
||||||
|
contexts.add(gGroup);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collections.sort(contexts, new Comparator<UserVRE>() {
|
||||||
|
|
||||||
|
public int compare(UserVRE vre1, UserVRE vre2) {
|
||||||
|
if (vre1.getGroupName() == null) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
if (vre2.getGroupName() == null) {
|
||||||
|
return +1;
|
||||||
|
} else {
|
||||||
|
return vre1.getGroupName().compareTo(vre2.getGroupName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
return contexts;
|
return contexts;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error retrieving the list of VRE!", e);
|
logger.error("Error retrieving the list of user VRE!", e);
|
||||||
throw new Exception("Error retrieving the list of VRE!", e);
|
throw new Exception("Error retrieving the list of VRE!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,8 +425,8 @@ public class GWTWorkspaceSharingBuilder {
|
||||||
try {
|
try {
|
||||||
logger.debug("Search use keyword: " + keyword);
|
logger.debug("Search use keyword: " + keyword);
|
||||||
List<InfoContactModel> listInfoContactModel = new ArrayList<>();
|
List<InfoContactModel> listInfoContactModel = new ArrayList<>();
|
||||||
UserManager userManager = new LiferayUserManager();
|
|
||||||
List<GCubeUser> users = userManager.searchUsersByGroup(keyword, info.getCurrGroupId());
|
List<GCubeUser> users = getLiferayUserManager().searchUsersByGroup(keyword, info.getCurrGroupId());
|
||||||
|
|
||||||
for (int i = 0; i < users.size() && i < 30; i++) {
|
for (int i = 0; i < users.size() && i < 30; i++) {
|
||||||
GCubeUser user = users.get(i);
|
GCubeUser user = users.get(i);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.portlets.widgets.workspacesharingwidget.server;
|
package org.gcube.portlets.widgets.workspacesharingwidget.server;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -45,14 +48,13 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.AllowAccess;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.GGroup;
|
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.SessionExpiredException;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.SessionExpiredException;
|
||||||
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.UserVRE;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
@ -69,7 +71,9 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements WorkspaceSharingService {
|
public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements WorkspaceSharingService {
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory.getLogger(WorkspaceSharingServiceImpl.class);
|
private static Logger logger = LoggerFactory.getLogger(WorkspaceSharingServiceImpl.class);
|
||||||
|
|
||||||
|
private static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the notification producer.
|
* Gets the notification producer.
|
||||||
|
@ -107,22 +111,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
org.gcube.common.homelibrary.home.exceptions.InternalErrorException, HomeNotFoundException {
|
org.gcube.common.homelibrary.home.exceptions.InternalErrorException, HomeNotFoundException {
|
||||||
|
|
||||||
logger.trace("Get Workspace");
|
logger.trace("Get Workspace");
|
||||||
PortalContext pContext = PortalContext.getConfiguration();
|
PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest());
|
||||||
// USER
|
|
||||||
GCubeUser user = pContext.getCurrentUser(httpServletRequest);
|
|
||||||
String username = user.getUsername();
|
|
||||||
String fullName = user.getFullname();
|
|
||||||
String email = user.getEmail();
|
|
||||||
String avatarID = user.getUserAvatarId();
|
|
||||||
String avatarURL = user.getUserAvatarURL();
|
|
||||||
// SESSION
|
|
||||||
String currentScope = pContext.getCurrentScope(httpServletRequest);
|
|
||||||
String userToken = pContext.getCurrentUserToken(httpServletRequest);
|
|
||||||
long currGroupId = pContext.getCurrentGroupId(httpServletRequest);
|
|
||||||
|
|
||||||
PortalContextInfo info = new PortalContextInfo(username, fullName, email, avatarID, avatarURL, currentScope,
|
|
||||||
userToken, currGroupId);
|
|
||||||
|
|
||||||
logger.trace("PortalContextInfo: " + info);
|
logger.trace("PortalContextInfo: " + info);
|
||||||
|
|
||||||
ScopeProvider.instance.set(info.getCurrentScope());
|
ScopeProvider.instance.set(info.getCurrentScope());
|
||||||
|
@ -194,23 +183,23 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GGroup> getVREList() throws Exception {
|
public List<UserVRE> getUserVREList() throws Exception {
|
||||||
try {
|
try {
|
||||||
PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest());
|
PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest());
|
||||||
|
|
||||||
GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder();
|
GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder();
|
||||||
|
|
||||||
List<GGroup> listContactsModel = builder.getVREList(info);
|
List<UserVRE> listContactsModel = builder.getUserVREList(info);
|
||||||
|
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error in getVREList(): " + e.getLocalizedMessage(), e);
|
logger.error("Error in getUserVREList(): " + e.getLocalizedMessage(), e);
|
||||||
throw new Exception("Error retrieving VRE List!", e);
|
throw new Exception("Error retrieving User VRE List!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InfoContactModel> getAllContactsByVRE(GGroup gGroup) throws Exception {
|
public List<InfoContactModel> getAllContactsByVRE(UserVRE gGroup) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Call getAllContactsByVRE(): " + gGroup);
|
logger.info("Call getAllContactsByVRE(): " + gGroup);
|
||||||
|
@ -230,7 +219,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder();
|
GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder();
|
||||||
|
|
||||||
List<InfoContactModel> listContactsModel = builder.buildGXTListContactsModelFromUserModel(info, gGroup);
|
List<InfoContactModel> listContactsModel = builder.buildGXTListContactsModelByVRE(info, gGroup);
|
||||||
|
|
||||||
// listContactsModel.addAll(builder.getGXTListContactsModelFromVOs(info));
|
// listContactsModel.addAll(builder.getGXTListContactsModelFromVOs(info));
|
||||||
|
|
||||||
|
@ -252,21 +241,25 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<InfoContactModel> getListUserSharedByFolderSharedId(String itemId) throws Exception {
|
public List<InfoContactModel> getListUserSharedByFolderSharedId(String itemId) throws Exception {
|
||||||
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
logger.info("Call getListUserSharedByFolderSharedId() Start Time: "+startTime.format(formatter));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Call getListUserSharedByFolderSharedId(): [folderId=" + itemId + "]");
|
logger.info("Call getListUserSharedByFolderSharedId(): [folderId=" + itemId + "]");
|
||||||
if (itemId == null || itemId.isEmpty()) {
|
if (itemId == null || itemId.isEmpty()) {
|
||||||
logger.error("Error in getListUserSharedByFolderSharedId(), invalid folder id: [id=" + itemId + "]");
|
logger.error("Error in getListUserSharedByFolderSharedId(), invalid folder id: [id=" + itemId + "]");
|
||||||
throw new Exception("Invalid item id requested: " + itemId);
|
throw new Exception("Invalid item id requested: " + itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageHubClient shc = new StorageHubClient();
|
StorageHubClient shc = new StorageHubClient();
|
||||||
OpenResolver openResolver = shc.open(itemId);
|
OpenResolver openResolver = shc.open(itemId);
|
||||||
FolderContainer folderContainer = openResolver.asFolder();
|
FolderContainer folderContainer = openResolver.asFolder();
|
||||||
FolderItem folder = folderContainer.get();
|
FolderItem folder = folderContainer.get();
|
||||||
|
|
||||||
if (folder.isShared()) {
|
if (folder.isShared()) {
|
||||||
if (folder instanceof SharedFolder) {
|
if (folder instanceof SharedFolder) {
|
||||||
SharedFolder sharedFolder = (SharedFolder) folder;
|
SharedFolder sharedFolder = (SharedFolder) folder;
|
||||||
|
|
||||||
return retrieveUsersListFromSharedFolder(sharedFolder);
|
return retrieveUsersListFromSharedFolder(sharedFolder);
|
||||||
} else {
|
} else {
|
||||||
FolderContainer rootSharedFolderContainer = folderContainer.getRootSharedFolder();
|
FolderContainer rootSharedFolderContainer = folderContainer.getRootSharedFolder();
|
||||||
|
@ -289,6 +282,13 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error in getListUserSharedByFolderSharedId(): " + e.getLocalizedMessage(), e);
|
logger.error("Error in getListUserSharedByFolderSharedId(): " + e.getLocalizedMessage(), e);
|
||||||
throw new Exception(e.getLocalizedMessage(), e);
|
throw new Exception(e.getLocalizedMessage(), e);
|
||||||
|
} finally {
|
||||||
|
LocalDateTime endTime = LocalDateTime.now();
|
||||||
|
logger.info("Call getListUserSharedByFolderSharedId() End Time: "+endTime.format(formatter));
|
||||||
|
|
||||||
|
long diff = ChronoUnit.MILLIS.between(startTime, endTime);
|
||||||
|
logger.info("Call getListUserSharedByFolderSharedId() Delay: MILLIS="+diff);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,11 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
if (map != null && !map.isEmpty()) {
|
if (map != null && !map.isEmpty()) {
|
||||||
List<InfoContactModel> listShared = new ArrayList<>();
|
List<InfoContactModel> listShared = new ArrayList<>();
|
||||||
List<String> keys = new ArrayList<String>(map.keySet());
|
List<String> keys = new ArrayList<String>(map.keySet());
|
||||||
UserManager um = new LiferayUserManager();
|
|
||||||
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
logger.info("Liferay retrieve users Start Time: "+startTime.format(formatter));
|
||||||
|
|
||||||
|
UserManager um = GWTWorkspaceSharingBuilder.getLiferayUserManager();
|
||||||
GCubeUser curr;
|
GCubeUser curr;
|
||||||
for (String username : keys) {
|
for (String username : keys) {
|
||||||
curr = null;
|
curr = null;
|
||||||
|
@ -326,6 +330,11 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
listShared.add(userInfo);
|
listShared.add(userInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LocalDateTime endTime = LocalDateTime.now();
|
||||||
|
logger.info("Liferay retrieve users End Time: "+endTime.format(formatter));
|
||||||
|
|
||||||
|
long diff = ChronoUnit.MILLIS.between(startTime, endTime);
|
||||||
|
logger.info("Liferay Delay: MILLIS="+diff);
|
||||||
return listShared;
|
return listShared;
|
||||||
} else {
|
} else {
|
||||||
logger.info("The folder with id: " + sharedFolder.getId() + " has a invalid map!");
|
logger.info("The folder with id: " + sharedFolder.getId() + " has a invalid map!");
|
||||||
|
@ -345,14 +354,17 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public InfoContactModel getOwnerByItemId(String itemId) throws Exception {
|
public InfoContactModel getOwnerByItemId(String itemId) throws Exception {
|
||||||
|
//TODO
|
||||||
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
logger.info("Call getOwnerByItemId() Start Time: "+startTime.format(formatter));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Call getOwnerByItemId(): [itemId=" + itemId + "]");
|
logger.info("Call getOwnerByItemId(): [itemId=" + itemId + "]");
|
||||||
if (itemId == null || itemId.isEmpty()) {
|
if (itemId == null || itemId.isEmpty()) {
|
||||||
logger.error("Error in getOwnerByItemId(), invalid item id: " + itemId);
|
logger.error("Error in getOwnerByItemId(), invalid item id: " + itemId);
|
||||||
throw new Exception("Invalid request, item id: " + itemId);
|
throw new Exception("Invalid request, item id: " + itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageHubClient shc = new StorageHubClient();
|
StorageHubClient shc = new StorageHubClient();
|
||||||
OpenResolver openResolverForFile = shc.open(itemId);
|
OpenResolver openResolverForFile = shc.open(itemId);
|
||||||
ItemContainer<Item> itemContainer = openResolverForFile.asItem();
|
ItemContainer<Item> itemContainer = openResolverForFile.asItem();
|
||||||
|
@ -361,16 +373,18 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
logger.debug("Owner: " + item.getOwner());
|
logger.debug("Owner: " + item.getOwner());
|
||||||
if (item.getOwner() != null && !item.getOwner().isEmpty()) {
|
if (item.getOwner() != null && !item.getOwner().isEmpty()) {
|
||||||
PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest());
|
try {
|
||||||
|
UserManager um = GWTWorkspaceSharingBuilder.getLiferayUserManager();
|
||||||
GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder();
|
GCubeUser curr=um.getUserByUsername(item.getOwner());
|
||||||
|
|
||||||
List<InfoContactModel> listContactsModel = builder.buildGXTListContactsModelFromUserModel(info);
|
if (curr != null && curr.getFullname() != null && !curr.getFullname().isEmpty()) {
|
||||||
for (InfoContactModel infoContactModel : listContactsModel) {
|
InfoContactModel infoContactModel = new InfoContactModel(String.valueOf(curr.getUserId()), curr.getUsername(), curr.getFullname(),
|
||||||
if (infoContactModel.getLogin().compareTo(item.getOwner()) == 0) {
|
extractDomainFromEmail(curr.getEmail()), false);
|
||||||
logger.debug("Retrieved: " + infoContactModel);
|
logger.debug("Owner found: "+infoContactModel);
|
||||||
return infoContactModel;
|
return infoContactModel;
|
||||||
}
|
}
|
||||||
|
} catch(Throwable e){
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.debug("Owner not found from user model!");
|
logger.debug("Owner not found from user model!");
|
||||||
return new InfoContactModel(item.getOwner(), item.getOwner(), item.getOwner(), "", false);
|
return new InfoContactModel(item.getOwner(), item.getOwner(), item.getOwner(), "", false);
|
||||||
|
@ -386,6 +400,13 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error in getOwnerByItemId(): " + e.getLocalizedMessage(), e);
|
logger.error("Error in getOwnerByItemId(): " + e.getLocalizedMessage(), e);
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
LocalDateTime endTime = LocalDateTime.now();
|
||||||
|
logger.info("Call getOwnerByItemId() End Time: "+endTime.format(formatter));
|
||||||
|
|
||||||
|
long diff = ChronoUnit.MILLIS.between(startTime, endTime);
|
||||||
|
logger.info("Call getOwnerByItemId() Delay: MILLIS="+diff);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,7 +1146,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.info("Unshared folded for users: " + users);
|
logger.info("Unshared folded for users: " + users);
|
||||||
ArrayList<InfoContactModel> listContacts = new ArrayList<>();
|
ArrayList<InfoContactModel> listContacts = new ArrayList<>();
|
||||||
for (String key : users) {
|
for (String key : users) {
|
||||||
InfoContactModel contact = new InfoContactModel(key, key, key, "",false);
|
InfoContactModel contact = new InfoContactModel(key, key, key, "", false);
|
||||||
listContacts.add(contact);
|
listContacts.add(contact);
|
||||||
}
|
}
|
||||||
NotificationsProducer np = getNotificationProducer(
|
NotificationsProducer np = getNotificationProducer(
|
||||||
|
@ -1321,15 +1342,14 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
private List<GCubeGroup> retrieveCurrentUserACLFromGroup(String userName) throws Exception {
|
private List<GCubeGroup> retrieveCurrentUserACLFromGroup(String userName) throws Exception {
|
||||||
try {
|
try {
|
||||||
// Instanciate the manager
|
|
||||||
GroupManager groupManager = new LiferayGroupManager();
|
|
||||||
// retrieve the groups to whom a given user belongs (given the user
|
// retrieve the groups to whom a given user belongs (given the user
|
||||||
// identifier)
|
// identifier)
|
||||||
long userId;
|
LiferayUserManager liferayUserManager = GWTWorkspaceSharingBuilder.getLiferayUserManager();
|
||||||
|
long userId = liferayUserManager.getUserId(userName);
|
||||||
userId = new LiferayUserManager().getUserId(userName);
|
|
||||||
|
|
||||||
|
GroupManager groupManager = GWTWorkspaceSharingBuilder.getGroupManager();
|
||||||
List<GCubeGroup> listOfGroups = groupManager.listGroupsByUser(userId);
|
List<GCubeGroup> listOfGroups = groupManager.listGroupsByUser(userId);
|
||||||
|
|
||||||
List<GCubeGroup> vres = new ArrayList<GCubeGroup>();
|
List<GCubeGroup> vres = new ArrayList<GCubeGroup>();
|
||||||
for (GCubeGroup g : listOfGroups) {
|
for (GCubeGroup g : listOfGroups) {
|
||||||
if (groupManager.isVRE(g.getGroupId())) {
|
if (groupManager.isVRE(g.getGroupId())) {
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
package org.gcube.portlets.widgets.workspacesharingwidget.shared;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
public class GGroup implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private long groupId;
|
|
||||||
private long parentGroupId;
|
|
||||||
private String groupName;
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
public GGroup() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public GGroup(long groupId, long parentGroupId, String groupName, String description) {
|
|
||||||
super();
|
|
||||||
this.groupId = groupId;
|
|
||||||
this.parentGroupId = parentGroupId;
|
|
||||||
this.groupName = groupName;
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getGroupId() {
|
|
||||||
return groupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroupId(long groupId) {
|
|
||||||
this.groupId = groupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getParentGroupId() {
|
|
||||||
return parentGroupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentGroupId(long parentGroupId) {
|
|
||||||
this.parentGroupId = parentGroupId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGroupName() {
|
|
||||||
return groupName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroupName(String groupName) {
|
|
||||||
this.groupName = groupName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "GGroup [groupId=" + groupId + ", parentGroupId=" + parentGroupId + ", groupName=" + groupName
|
|
||||||
+ ", description=" + description + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package org.gcube.portlets.widgets.workspacesharingwidget.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import com.extjs.gxt.ui.client.data.BaseModelData;
|
||||||
|
|
||||||
|
public class UserVRE extends BaseModelData implements Serializable, Comparable<UserVRE> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected static final String GROUP_ID = "groupId";
|
||||||
|
public static final String PARENT_GROUP_ID = "parentGroupId";
|
||||||
|
public static final String GROUP_NAME = "groupName";
|
||||||
|
public static final String GROUP_DESCRIPTION = "groupDescription";
|
||||||
|
|
||||||
|
public UserVRE() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserVRE(long groupId, long parentGroupId, String groupName, String description) {
|
||||||
|
super();
|
||||||
|
setGroupId(groupId);
|
||||||
|
setParentGroupId(parentGroupId);
|
||||||
|
setGroupName(groupName);
|
||||||
|
setDescription(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getGroupId() {
|
||||||
|
return get(GROUP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupId(long groupId) {
|
||||||
|
set(GROUP_ID, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getParentGroupId() {
|
||||||
|
return get(PARENT_GROUP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentGroupId(long parentGroupId) {
|
||||||
|
set(PARENT_GROUP_ID, parentGroupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupName() {
|
||||||
|
return get(GROUP_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupName(String groupName) {
|
||||||
|
set(GROUP_NAME, groupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return get(GROUP_DESCRIPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
set(GROUP_DESCRIPTION, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Comparator<UserVRE> COMPARATOR_USER_VRE = new Comparator<UserVRE>() {
|
||||||
|
|
||||||
|
public int compare(UserVRE o1, UserVRE o2) {
|
||||||
|
return (o1.getGroupId() < o2.getGroupId()) ? -1 : ((o1.getGroupId() == o2.getGroupId()) ? 0 : 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(UserVRE o) {
|
||||||
|
return UserVRE.COMPARATOR_USER_VRE.compare(this, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
int compare = compareTo((UserVRE) obj);
|
||||||
|
return compare == 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UserGroup [getGroupId()=" + getGroupId() + ", getParentGroupId()=" + getParentGroupId()
|
||||||
|
+ ", getGroupName()=" + getGroupName() + ", getDescription()=" + getDescription() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,7 +7,6 @@ public class VRE extends ResearchEnvironment implements Serializable {
|
||||||
|
|
||||||
public VRE() {
|
public VRE() {
|
||||||
super();
|
super();
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public VRE(String vreName, String description, String imageURL,
|
public VRE(String vreName, String description, String imageURL,
|
||||||
|
|
|
@ -31,5 +31,13 @@
|
||||||
<!-- Specify the paths for translatable code -->
|
<!-- Specify the paths for translatable code -->
|
||||||
<source path='client' />
|
<source path='client' />
|
||||||
<source path='shared' />
|
<source path='shared' />
|
||||||
|
|
||||||
|
<!-- <inherits name="com.google.gwt.logging.Logging" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.logLevel" value="SEVERE" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.enabled" value="TRUE" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.consoleHandler" value="ENABLED"/> -->
|
||||||
|
<!-- <set-property name="gwt.logging.firebugHandler" value="ENABLED" /> -->
|
||||||
|
<!-- <set-property name="gwt.logging.popupHandler" value="ENABLED" /> -->
|
||||||
|
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
|
|
Loading…
Reference in New Issue