Added Edit Permissions

Changed Multi Drag as simple panel
Added Dialog Multi-Drag

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@111504 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-01-28 10:21:10 +00:00
parent 87bb5e589d
commit 2a9bfd9017
10 changed files with 375 additions and 134 deletions

View File

@ -7,11 +7,16 @@ import java.util.List;
import org.gcube.portlets.widgets.workspacesharingwidget.client.permissions.MessageBoxAlert;
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.shared.InfoContactModel;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -27,7 +32,7 @@ public class MultiDragContactsEditPermissions extends SimpleMultiDragWorkspaceCo
private PanelTogglePermission permission;
private HorizontalPanel hpPermission = new HorizontalPanel();
private Dialog dialog;
private DialogMultiDragContact dialog;
/**
* @param load
* @param workspaceItemId
@ -35,12 +40,20 @@ public class MultiDragContactsEditPermissions extends SimpleMultiDragWorkspaceCo
* @param readGroupsFromPortal
* @param hiddenMySelf
*/
public MultiDragContactsEditPermissions(LOAD_CONTACTS_AS load, String workspaceItemId, boolean readGroupsFromHL, boolean readGroupsFromPortal, boolean hiddenMySelf) {
public MultiDragContactsEditPermissions(LOAD_CONTACTS_AS load, final String workspaceItemId, boolean readGroupsFromHL, boolean readGroupsFromPortal, boolean hiddenMySelf) {
super(load, workspaceItemId, readGroupsFromHL, readGroupsFromPortal,hiddenMySelf);
dialog = super.getMultiDragContact();
dialog.setHeight(dialog.getHeight()+100);
dialog.mask("Loading");
dialog = super.getDialogMultiDragContact();
// dialog.setHeight(dialog.getHeight()+100);
enableSubmit(false);
// hpPermission.setStyleAttribute("margin-top", "20px");
hpPermission.setStyleAttribute("margin-left", "165px");
// Html html = new Html("With Permission : ");
// html.setStyleAttribute("margin-left", "10px");
// hpPermission.add(html);
//TODO GET ACL FOR USER
WorkspaceSharingController.rpcWorkspaceSharingService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
@ -49,7 +62,10 @@ public class MultiDragContactsEditPermissions extends SimpleMultiDragWorkspaceCo
permission = new PanelTogglePermission(result);
hpPermission.add(permission);
hpPermission.layout();
dialog.unmask();
selectAclForFolder(workspaceItemId);
enableSubmit(true);
// dialog.unmask();
}
@Override
@ -59,10 +75,22 @@ public class MultiDragContactsEditPermissions extends SimpleMultiDragWorkspaceCo
}
});
dialog.add(permission);
dialog.add(hpPermission);
dialog.addListener(Events.Render, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
dialog.setHeight(dialog.getHeight()+50);
}
});
}
public Dialog getDialog() {
public void enableSubmit(boolean bool){
dialog.getButtonById(Dialog.OK).setEnabled(bool);
}
public DialogMultiDragContact getDialog() {
return dialog;
}
@ -98,6 +126,28 @@ public class MultiDragContactsEditPermissions extends SimpleMultiDragWorkspaceCo
}
private void selectAclForFolder(String itemID){
GWT.log("Loading ACL to: "+itemID);
WorkspaceSharingController.rpcWorkspaceSharingService.getACLForSharedItemId(itemID, new AsyncCallback<WorkspaceACL>() {
@Override
public void onFailure(Throwable arg0) {
GWT.log("An error occurred on selecting current ACL "+arg0);
}
@Override
public void onSuccess(WorkspaceACL arg0) {
GWT.log("Loaded ACL "+arg0);
if(arg0!=null){
permission.selectACL(arg0);
hpPermission.layout();
}
}
});
}
/**
*
* @return

View File

@ -8,10 +8,9 @@ import java.util.List;
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.multisuggest.MultiDragContact;
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest.DialogMultiDragContact;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -27,7 +26,7 @@ public class SimpleMultiDragWorkspaceContact {
private UserStore userStore = new UserStore();
private LOAD_CONTACTS_AS loadContactAs;
public static enum LOAD_CONTACTS_AS{SHARED_USER, ADMINISTRATOR}
private MultiDragContact multiDragContact = new MultiDragContact(SimpleMultiDragConstants.HEADING_DIALOG, SimpleMultiDragConstants.ALL_CONTACTS_LEFT_LIST, SimpleMultiDragConstants.SHARE_WITH_RIGHT_LIST,false, false);
private DialogMultiDragContact dialogMultiDragContact = new DialogMultiDragContact(SimpleMultiDragConstants.HEADING_DIALOG, SimpleMultiDragConstants.ALL_CONTACTS_LEFT_LIST, SimpleMultiDragConstants.SHARE_WITH_RIGHT_LIST,false, false);
private List<InfoContactModel> targets = new ArrayList<InfoContactModel>();
private boolean readGroupsFromPortal;
private boolean readGroupsFromHL;
@ -143,7 +142,7 @@ public class SimpleMultiDragWorkspaceContact {
public void addTargetContact(List<InfoContactModel> listContacts){
if(listContacts!=null){
for (InfoContactModel infoContactModel : listContacts) {
multiDragContact.addTargetContact(infoContactModel);
dialogMultiDragContact.getMultiDrag().addTargetContact(infoContactModel);
}
}
@ -155,13 +154,16 @@ public class SimpleMultiDragWorkspaceContact {
*/
private void fillMultiDrag(List<InfoContactModel> result){
GWT.log("Filling multi-drag..");
GWT.log("Hidden my self: "+hiddenMySelf);
for (InfoContactModel infoContactModel : result) {
if(infoContactModel.getLogin()!=null){
if(hiddenMySelf && (infoContactModel.getLogin().compareTo(myLogin)==0)){
GWT.log("Skipping myself: "+myLogin);
myContact = infoContactModel;
GWT.log("Skipping myLogin as: "+myContact);
}else{
multiDragContact.addTargetContact(infoContactModel);
dialogMultiDragContact.getMultiDrag().addTargetContact(infoContactModel);
targets.add(infoContactModel);
}
}
@ -195,29 +197,29 @@ public class SimpleMultiDragWorkspaceContact {
contactTargets.add(myContact);
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(contactTargets);
multiDragContact.addSourceContacts(exclusiveContacts);
dialogMultiDragContact.getMultiDrag().addSourceContacts(exclusiveContacts);
}
}
};
/**
*
* @return the multi drag Dialog
* @return the multi drag DialogMultiDragContact
*/
public Dialog getMultiDragContact() {
return multiDragContact;
public DialogMultiDragContact getDialogMultiDragContact() {
return dialogMultiDragContact;
}
public void show(){
multiDragContact.show();
dialogMultiDragContact.show();
}
/**
*
* @return
*/
public List<InfoContactModel> getTargetContacts() {
return multiDragContact.getTargetListContact();
return dialogMultiDragContact.getMultiDrag().getTargetListContact();
}
/**
@ -226,7 +228,12 @@ public class SimpleMultiDragWorkspaceContact {
*/
public List<InfoContactModel> getTargetContactsWithMyLogin() {
List<InfoContactModel> contacts = getTargetContacts();
contacts.add(myContact);
if(myContact == null){
GWT.log("TargetContactsWithMyLogin my Contact is null, skipping!");
}else
contacts.add(myContact);
return contacts;
}
}

View File

@ -98,7 +98,7 @@ public class WorkspaceSharingWidgetEntryPoint implements EntryPoint {
new ClickHandler() {
public void onClick(ClickEvent event) {
multiDragContact.getMultiDragContact().show();
multiDragContact.getDialogMultiDragContact().show();
}
});

View File

@ -78,4 +78,6 @@ public interface WorkspaceSharingService extends RemoteService {
List<InfoContactModel> getAdministratorsByFolderId(String sharedFolderId) throws Exception;
WorkspaceACL getACLForSharedItemId(String itemID) throws Exception;
}

View File

@ -76,4 +76,12 @@ public interface WorkspaceSharingServiceAsync
void getAdministratorsByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback);
/**
* @param itemID
* @param asyncCallback
*/
void getACLForSharedItemId(String itemID,
AsyncCallback<WorkspaceACL> asyncCallback);
}

View File

@ -5,6 +5,7 @@ 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.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.shared.ACL_TYPE;
@ -340,8 +341,9 @@ public class DialogShareWItem extends Dialog {
@Override
public void onClick(ClickEvent event) {
final MultiDragContact multiDrag = new MultiDragContact(true,true);
multiDrag.show();
final DialogMultiDragContact dialog = new DialogMultiDragContact(true,true);
final MultiDragContact multiDrag = dialog.getMultiDrag();
dialog.show();
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
multiDrag.addSourceContacts(exclusiveContacts);
@ -356,7 +358,7 @@ public class DialogShareWItem extends Dialog {
// multiDrag.addTargetContacts(suggestPanel.getSelectedUser());
multiDrag.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
dialog.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {

View File

@ -9,6 +9,7 @@ import java.util.List;
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
import org.gcube.portlets.widgets.workspacesharingwidget.client.SmartConstants;
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.shared.CredentialModel;
@ -295,8 +296,9 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
@Override
public void onClick(ClickEvent event) {
final MultiDragContact multiDrag = new MultiDragContact(true,true);
multiDrag.show();
final DialogMultiDragContact dialog = new DialogMultiDragContact(true,true);
final MultiDragContact multiDrag = dialog.getMultiDrag();
dialog.show();
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
multiDrag.addSourceContacts(exclusiveContacts);
@ -311,7 +313,7 @@ public class SmartShare extends Dialog implements SmartDialogInterface{
// multiDrag.addTargetContacts(suggestPanel.getSelectedUser());
multiDrag.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
dialog.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {

View File

@ -0,0 +1,203 @@
/**
*
*/
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.multisuggest;
import java.util.List;
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
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;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jan 27, 2015
*
*/
public class DialogMultiDragContact 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;
private MultiDragContact multiDragContact;
private ToolBar toolBar;
private String headTitle;
private boolean visibleTextArea;
/**
*
* @param headTitle
* @param leftListContactsTitle
* @param rightListContactsTitle
* @param visibleAlreadyShared
* @param hideOnPressOk
*/
public DialogMultiDragContact(String headTitle, String leftListContactsTitle, String rightListContactsTitle, boolean visibleAlreadyShared, boolean hideOnPressOk) {
this.multiDragContact = new MultiDragContact(leftListContactsTitle, rightListContactsTitle, visibleAlreadyShared);
this.hideOnPressOkButton = hideOnPressOk;
this.visibleTextArea = visibleAlreadyShared;
init();
setHeadTitle(headTitle);
add(multiDragContact);
}
/**
*
* @param visibleAlreadyShared
* @param hideOnPressOk
*/
public DialogMultiDragContact(boolean visibleAlreadyShared, boolean hideOnPressOk){
this.multiDragContact = new MultiDragContact(visibleAlreadyShared);
this.hideOnPressOkButton = hideOnPressOk;
this.visibleTextArea = visibleAlreadyShared;
init();
add(multiDragContact);
}
public void setHeadTitle(String headTitle){
this.headTitle = headTitle;
if(headTitle==null)
this.setHeading(GROUP_DRAGGING_CONTACTS);
else
this.setHeading(headTitle);
}
/**
*
* @param bool
*/
public void showToolBar(boolean bool){
this.toolBar.setVisible(bool);
}
/**
*
*/
private void init() {
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);
if(!visibleTextArea)
setHeight(HEIGHT_DIALOG-60);
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) {
if(hideOnPressOkButton){
List<InfoContactModel> shareContacts = multiDragContact.getTargetListContact();
if (shareContacts == null || shareContacts.isEmpty()) {
MessageBox mbc = MessageBox.confirm(
"Confirm exit?",
"You have not selected any contact to share, confirm exit?",
null);
mbc.addCallback(new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
String clickedButton = be.getButtonClicked().getItemId();
if (clickedButton.equals(Dialog.YES)) {
hide();
}
}
});
} else
hide();
}
}
});
}
/**
*
*/
public MultiDragContact getMultiDrag() {
return multiDragContact;
}
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;
}
}

View File

@ -9,7 +9,6 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.dnd.GridDragSource;
@ -18,18 +17,15 @@ 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.MessageBoxEvent;
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.Dialog;
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.StoreFilterField;
@ -44,17 +40,20 @@ import com.extjs.gxt.ui.client.widget.layout.FitLayout;
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.extjs.gxt.ui.client.widget.toolbar.ToolBar;
public class MultiDragContact extends Dialog {
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jan 27, 2015
*
*/
public class MultiDragContact extends ContentPanel {
private static final String GROUP_DRAGGING_CONTACTS = "Group dragging contacts";
private static final String ALL_CONTACTS = "All Contacts";
private static final String SHARE_WITH = "Share with...";
private static final int WIDTH_CP = 597;
private static final int HEIGHT_DIALOG = 542;
private static final int WIDTH_DIALOG = 625;
// private static final int HEIGHT_DIALOG = 542;
private static final int HEIGHT_GRID = 310;
private GridDropTarget dropSource;
@ -69,17 +68,16 @@ public class MultiDragContact extends Dialog {
private Button buttonSelectedRight;
private Button buttonAllRight;
private Button buttonAllLeft;
private boolean hideOnPressOkButton;
private String headTitle;
// private boolean hideOnPressOkButton;
// private String headTitle;
private String leftListContactsTitle;
private String rightListContactsTitle;
private Label allContacts;
private Label shareWith;
public MultiDragContact(String headTitle, String leftListContactsTitle, String rightListContactsTitle, boolean visibleAlreadyShared, boolean hideOnPressOk) {
this(visibleAlreadyShared, hideOnPressOk);
setHeadTitle(headTitle);
public MultiDragContact(String leftListContactsTitle, String rightListContactsTitle, boolean visibleAlreadyShared) {
this(visibleAlreadyShared);
// setHeadTitle(headTitle);
setLeftListContactsTitle(leftListContactsTitle);
setRightListContactsTitle(rightListContactsTitle);
}
@ -92,20 +90,13 @@ public class MultiDragContact extends Dialog {
* @param visibleAlreadyShared
* @param hideOnPressOk
*/
public MultiDragContact(boolean visibleAlreadyShared, boolean hideOnPressOk) {
this.hideOnPressOkButton = hideOnPressOk;
setStyleAttribute("margin", "10px");
setSize(WIDTH_DIALOG, HEIGHT_DIALOG);
setResizable(false);
setMaximizable(false);
setIcon(Resources.getIconUsers());
setModal(true);
setScrollMode(Scroll.AUTOY);
setBodyStyle("padding: 9px; background: none");
setResizable(true);
setButtonAlign(HorizontalAlignment.CENTER);
setButtons(Dialog.OKCANCEL);
public MultiDragContact(boolean visibleAlreadyShared) {
this.setHeaderVisible(false);
this.setBodyBorder(false);
this.setBorders(false);
// setStyleAttribute("margin", "10px");
setBodyStyle("padding: 5px; background: none");
// SORTING STORE
setGropUserStoreSorter(storeSource);
setGropUserStoreSorter(storeTarget);
@ -115,9 +106,6 @@ public class MultiDragContact extends Dialog {
cpAlreadyShared.setHeaderVisible(false);
cpAlreadyShared.setVisible(visibleAlreadyShared);
if(!visibleAlreadyShared)
setHeight(HEIGHT_DIALOG-60);
cpAlreadyShared.setLayout(new FitLayout());
VerticalPanel vpShared = new VerticalPanel();
@ -151,25 +139,6 @@ public class MultiDragContact extends Dialog {
cp.setHeaderVisible(false);
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
ToolBar toolBar = new ToolBar();
Button buttonHelp = new Button();
buttonHelp.setIcon(Resources.getIconInfo());
buttonHelp.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
MessageBox
.info("Group dragging action",
"Drag one or more contacts from the left (All Contacts) to the right (Share with) to add users in your sharing list.",
null);
}
});
toolBar.add(buttonHelp);
setTopComponent(toolBar);
final VerticalPanel vpAllContacts = new VerticalPanel();
vpAllContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
@ -288,47 +257,6 @@ public class MultiDragContact extends Dialog {
add(cp);
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) {
if(hideOnPressOkButton){
List<InfoContactModel> shareContacts = storeTarget.getModels();
if (shareContacts == null || shareContacts.isEmpty()) {
MessageBox mbc = MessageBox.confirm(
"Confirm exit?",
"You have not selected any contact to share, confirm exit?",
null);
mbc.addCallback(new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
String clickedButton = be.getButtonClicked().getItemId();
if (clickedButton.equals(Dialog.YES)) {
hide();
}
}
});
} else
hide();
}
}
});
cp.addListener(Events.Render, new Listener<BaseEvent>() {
@Override
@ -617,14 +545,14 @@ public class MultiDragContact extends Dialog {
});
}
public void setHeadTitle(String headTitle){
this.headTitle = headTitle;
if(headTitle==null)
this.setHeading(GROUP_DRAGGING_CONTACTS);
else
this.setHeading(headTitle);
}
// 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;
@ -648,9 +576,9 @@ public class MultiDragContact extends Dialog {
return leftListContactsTitle;
}
public String getHeadTitle() {
return headTitle;
}
// public String getHeadTitle() {
// return headTitle;
// }
public String getRightListContactsTitle() {
return rightListContactsTitle;

View File

@ -578,8 +578,47 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
e.printStackTrace();
}
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService#getACLForSharedItemId(java.lang.String)
*
* return the WorkspaceACL of shared folder, null otherwise
*/
@Override
public WorkspaceACL getACLForSharedItemId(String itemID) throws Exception{
logger.info("Getting ACLBySharedFolderId: "+itemID);
if(itemID==null || itemID.isEmpty()){
logger.warn("Getting ACLBySharedFolderId identifier is null or empty, returning null");
return null;
}
try {
Workspace workspace = getWorkspace();
WorkspaceItem item = workspace.getItem(itemID);
item.getIdSharedFolder();
if(item!=null && item.isFolder() && item.isShared()){ //IS A SHARED FOLDER
WorkspaceSharedFolder parentSharedFolder = (WorkspaceSharedFolder) workspace.getItem(item.getIdSharedFolder());
GWTWorkspaceSharingBuilder builder = getGWTWorkspaceBuilder();
logger.info("Read getPrivilege from HL: "+parentSharedFolder.getACLUser());
List<WorkspaceACL> wsAcls = builder.getWorkspaceACLFromACLs(Arrays.asList(parentSharedFolder.getPrivilege()));
if(wsAcls==null || wsAcls.isEmpty()){
logger.info("Converted ACLBySharedFolderId is null or empty, returning null");
return null;
}
logger.info("Returning first acl with id: "+wsAcls.get(0).getId());
return wsAcls.get(0);
}else
throw new Exception("The item is null or not a shared folder");
} catch (Exception e) {
logger.error("Error in server getACLForSharedItemId", e);
String error = "Sorry an error occurred when getting ACL for item: "+itemID;
throw new Exception(error);
}
}
}