ref 13226:StorageHub - Update workspace-sharing-widget to SH
https://support.d4science.org/issues/13226 Updated to StorageHub git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@177233 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
25b3e96391
commit
f3c41d67ac
|
@ -115,13 +115,11 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
void createFolder(String nameFolder, String description, FileModel parent, AsyncCallback<FolderModel> callback);
|
void createFolder(String nameFolder, String description, FileModel parent, AsyncCallback<FolderModel> callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the details file.
|
*
|
||||||
*
|
|
||||||
* @param item
|
* @param item
|
||||||
* the item
|
* the item
|
||||||
* @param callback
|
* @param callback
|
||||||
* the callback
|
* file details model
|
||||||
* @return the details file
|
|
||||||
*/
|
*/
|
||||||
void getDetailsFile(FileModel item, AsyncCallback<FileDetailsModel> callback);
|
void getDetailsFile(FileModel item, AsyncCallback<FileDetailsModel> callback);
|
||||||
|
|
||||||
|
@ -308,8 +306,6 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
*/
|
*/
|
||||||
void getTimeSeriesById(String identifier, AsyncCallback<GWTWorkspaceItem> callback);
|
void getTimeSeriesById(String identifier, AsyncCallback<GWTWorkspaceItem> callback);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list parents by item identifier.
|
* Gets the list parents by item identifier.
|
||||||
*
|
*
|
||||||
|
@ -514,7 +510,6 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
*/
|
*/
|
||||||
void moveItems(List<String> ids, String destinationId, AsyncCallback<WorkspaceOperationResult> callback);
|
void moveItems(List<String> ids, String destinationId, AsyncCallback<WorkspaceOperationResult> callback);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the my login.
|
* Gets the my login.
|
||||||
*
|
*
|
||||||
|
@ -525,7 +520,6 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
*/
|
*/
|
||||||
void getMyLogin(String currentPortletUrl, AsyncCallback<UserBean> callback);
|
void getMyLogin(String currentPortletUrl, AsyncCallback<UserBean> callback);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the trash content.
|
* Gets the trash content.
|
||||||
*
|
*
|
||||||
|
@ -557,7 +551,6 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
void executeOperationOnTrash(List<String> listTrashItemIds, WorkspaceTrashOperation operation,
|
void executeOperationOnTrash(List<String> listTrashItemIds, WorkspaceTrashOperation operation,
|
||||||
AsyncCallback<TrashOperationContent> callback);
|
AsyncCallback<TrashOperationContent> callback);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user workspace total items.
|
* Gets the user workspace total items.
|
||||||
*
|
*
|
||||||
|
@ -584,7 +577,6 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
*/
|
*/
|
||||||
void getItemDescriptionById(String identifier, AsyncCallback<String> callback);
|
void getItemDescriptionById(String identifier, AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load gcube item properties.
|
* Load gcube item properties.
|
||||||
*
|
*
|
||||||
|
|
|
@ -37,15 +37,19 @@ public class ExplorerPanel extends LayoutContainer {
|
||||||
private boolean isSmartFolderInstanced;
|
private boolean isSmartFolderInstanced;
|
||||||
private boolean isOnlyTreeInstanced;
|
private boolean isOnlyTreeInstanced;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default instance an async tree to navigate user workspace
|
* Default instance an async tree to navigate user workspace
|
||||||
|
*
|
||||||
* @param instancingSmartFolder
|
* @param instancingSmartFolder
|
||||||
|
* instancing smart folder
|
||||||
* @param instancingMessages
|
* @param instancingMessages
|
||||||
|
* instancing messages
|
||||||
|
* @param selectRootItem
|
||||||
|
* select root
|
||||||
*/
|
*/
|
||||||
public ExplorerPanel(boolean instancingSmartFolder, boolean instancingMessages, boolean selectRootItem) {
|
public ExplorerPanel(boolean instancingSmartFolder, boolean instancingMessages, boolean selectRootItem) {
|
||||||
|
|
||||||
this.isMessagesInstanced= instancingMessages;
|
this.isMessagesInstanced = instancingMessages;
|
||||||
this.isSmartFolderInstanced = instancingSmartFolder;
|
this.isSmartFolderInstanced = instancingSmartFolder;
|
||||||
|
|
||||||
setBorders(false);
|
setBorders(false);
|
||||||
|
@ -56,29 +60,29 @@ public class ExplorerPanel extends LayoutContainer {
|
||||||
this.expPanel = new ContentPanel();
|
this.expPanel = new ContentPanel();
|
||||||
this.expPanel.setHeaderVisible(false);
|
this.expPanel.setHeaderVisible(false);
|
||||||
|
|
||||||
|
// smartFolderPanel.setVisible(false);
|
||||||
// smartFolderPanel.setVisible(false);
|
// messagesPanel.setVisible(false);
|
||||||
// messagesPanel.setVisible(false);
|
|
||||||
asycTreePanel.setVisible(true);
|
asycTreePanel.setVisible(true);
|
||||||
expPanel.add(asycTreePanel);
|
expPanel.add(asycTreePanel);
|
||||||
// expPanel.add(smartFolderPanel);
|
// expPanel.add(smartFolderPanel);
|
||||||
// expPanel.add(messagesPanel);
|
// expPanel.add(messagesPanel);
|
||||||
|
|
||||||
|
// BULK
|
||||||
|
// REMOVED 2016-09-15 CHECK SVN
|
||||||
//BULK
|
// buttBulk.setIcon(Resources.getIconBulkUpdate());
|
||||||
//REMOVED 2016-09-15 CHECK SVN
|
// buttBulk.setVisible(false);
|
||||||
// buttBulk.setIcon(Resources.getIconBulkUpdate());
|
// addListnerOnBulk();
|
||||||
// buttBulk.setVisible(false);
|
|
||||||
// addListnerOnBulk();
|
|
||||||
|
|
||||||
add(expPanel);
|
add(expPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance only tree
|
* Instance only tree
|
||||||
|
*
|
||||||
* @param instancingOnlyTree
|
* @param instancingOnlyTree
|
||||||
|
* only tree
|
||||||
|
* @param selectRootItem
|
||||||
|
* select root item
|
||||||
*/
|
*/
|
||||||
public ExplorerPanel(boolean instancingOnlyTree, boolean selectRootItem) {
|
public ExplorerPanel(boolean instancingOnlyTree, boolean selectRootItem) {
|
||||||
|
|
||||||
|
@ -87,10 +91,10 @@ public class ExplorerPanel extends LayoutContainer {
|
||||||
setBorders(false);
|
setBorders(false);
|
||||||
initRadioButtons();
|
initRadioButtons();
|
||||||
this.asycTreePanel = new AsyncTreePanel();
|
this.asycTreePanel = new AsyncTreePanel();
|
||||||
this.asycTreePanel.loadRootItem(selectRootItem); //load root item
|
this.asycTreePanel.loadRootItem(selectRootItem); // load root item
|
||||||
this.expPanel = new ContentPanel();
|
this.expPanel = new ContentPanel();
|
||||||
this.expPanel.setHeaderVisible(false);
|
this.expPanel.setHeaderVisible(false);
|
||||||
// asycTreePanel.setVisible(true);
|
// asycTreePanel.setVisible(true);
|
||||||
expPanel.add(asycTreePanel);
|
expPanel.add(asycTreePanel);
|
||||||
add(expPanel);
|
add(expPanel);
|
||||||
|
|
||||||
|
@ -101,22 +105,21 @@ public class ExplorerPanel extends LayoutContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
// BulkCreatorWindow.getInstance().show();
|
// BulkCreatorWindow.getInstance().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoadingBulk(boolean bool){
|
public void setLoadingBulk(boolean bool) {
|
||||||
|
|
||||||
buttBulk.setVisible(true);
|
buttBulk.setVisible(true);
|
||||||
|
|
||||||
if(!bool)
|
if (!bool)
|
||||||
buttBulk.setIcon(Resources.getIconLoadingOff());
|
buttBulk.setIcon(Resources.getIconLoadingOff());
|
||||||
else
|
else
|
||||||
buttBulk.setIcon(Resources.getIconLoading());
|
buttBulk.setIcon(Resources.getIconLoading());
|
||||||
|
|
||||||
|
|
||||||
toolBar.layout();
|
toolBar.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,28 +129,28 @@ public class ExplorerPanel extends LayoutContainer {
|
||||||
this.radioSmartFolder = new Radio();
|
this.radioSmartFolder = new Radio();
|
||||||
this.radioMessages = new Radio();
|
this.radioMessages = new Radio();
|
||||||
|
|
||||||
// radioTree.setId(ConstantsExplorer.TREE);
|
// radioTree.setId(ConstantsExplorer.TREE);
|
||||||
radioTree.setBoxLabel(ConstantsExplorer.TREE);
|
radioTree.setBoxLabel(ConstantsExplorer.TREE);
|
||||||
radioTree.setValue(true);
|
radioTree.setValue(true);
|
||||||
radioTree.setValueAttribute(ConstantsExplorer.TREE);
|
radioTree.setValueAttribute(ConstantsExplorer.TREE);
|
||||||
radioGroup.add(radioTree);
|
radioGroup.add(radioTree);
|
||||||
|
|
||||||
// radioSmartFolder.setId(ConstantsExplorer.SMARTFOLDER);
|
// radioSmartFolder.setId(ConstantsExplorer.SMARTFOLDER);
|
||||||
|
|
||||||
if(isSmartFolderInstanced){
|
if (isSmartFolderInstanced) {
|
||||||
radioSmartFolder.setBoxLabel(ConstantsExplorer.SMARTFOLDER);
|
radioSmartFolder.setBoxLabel(ConstantsExplorer.SMARTFOLDER);
|
||||||
radioSmartFolder.setValueAttribute(ConstantsExplorer.SMARTFOLDER);
|
radioSmartFolder.setValueAttribute(ConstantsExplorer.SMARTFOLDER);
|
||||||
|
|
||||||
radioGroup.add(radioSmartFolder);
|
radioGroup.add(radioSmartFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isMessagesInstanced){
|
if (isMessagesInstanced) {
|
||||||
radioMessages.setBoxLabel(ConstantsExplorer.MESSAGES);
|
radioMessages.setBoxLabel(ConstantsExplorer.MESSAGES);
|
||||||
radioMessages.setValueAttribute(ConstantsExplorer.MESSAGES);
|
radioMessages.setValueAttribute(ConstantsExplorer.MESSAGES);
|
||||||
radioGroup.add(radioMessages);
|
radioGroup.add(radioMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
// radioGroup.setFieldLabel("Afecto");
|
// radioGroup.setFieldLabel("Afecto");
|
||||||
|
|
||||||
radioGroup.setStyleAttribute("margin-left", "20px");
|
radioGroup.setStyleAttribute("margin-left", "20px");
|
||||||
|
|
||||||
|
@ -155,51 +158,45 @@ public class ExplorerPanel extends LayoutContainer {
|
||||||
public void handleEvent(BaseEvent be) {
|
public void handleEvent(BaseEvent be) {
|
||||||
|
|
||||||
Radio selectedRadio = radioGroup.getValue();
|
Radio selectedRadio = radioGroup.getValue();
|
||||||
// System.out.println("radio value:" +selectedRadio.getValueAttribute());
|
// System.out.println("radio value:"
|
||||||
// System.out.println("id" + selectedRadio.getId());
|
// +selectedRadio.getValueAttribute());
|
||||||
|
// System.out.println("id" + selectedRadio.getId());
|
||||||
if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.SMARTFOLDER.toString()) == 0)
|
if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.SMARTFOLDER.toString()) == 0)
|
||||||
switchView(ViewSwitchType.SmartFolder);
|
switchView(ViewSwitchType.SmartFolder);
|
||||||
else if(selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.TREE.toString()) == 0)
|
else if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.TREE.toString()) == 0)
|
||||||
switchView(ViewSwitchType.Tree);
|
switchView(ViewSwitchType.Tree);
|
||||||
else
|
else
|
||||||
switchView(ViewSwitchType.Messages);
|
switchView(ViewSwitchType.Messages);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initToolBar(){
|
private void initToolBar() {
|
||||||
|
|
||||||
toolBar.add(radioGroup);
|
toolBar.add(radioGroup);
|
||||||
// toolBar.add(buttBulk);
|
// toolBar.add(buttBulk);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchView(ViewSwitchType type) {
|
private void switchView(ViewSwitchType type) {
|
||||||
|
|
||||||
if (type.compareTo(ViewSwitchType.Tree)==0) {
|
if (type.compareTo(ViewSwitchType.Tree) == 0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
asycTreePanel.setVisible(true);
|
asycTreePanel.setVisible(true);
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.Tree));
|
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.Tree));
|
||||||
// asycTreePanel.setSearch(false);
|
// asycTreePanel.setSearch(false);
|
||||||
|
|
||||||
} else if (type.compareTo(ViewSwitchType.SmartFolder)==0){
|
} else if (type.compareTo(ViewSwitchType.SmartFolder) == 0) {
|
||||||
asycTreePanel.setVisible(false);
|
asycTreePanel.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.SmartFolder));
|
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.SmartFolder));
|
||||||
|
|
||||||
// this.expPanel.setVisible(shortuctsPanel.getElement(), false);
|
// this.expPanel.setVisible(shortuctsPanel.getElement(), false);
|
||||||
// this.expPanel.setVisible(asycTreePanel.getElement(), true);
|
// this.expPanel.setVisible(asycTreePanel.getElement(), true);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
|
|
||||||
asycTreePanel.setVisible(false);
|
asycTreePanel.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -208,27 +205,22 @@ public class ExplorerPanel extends LayoutContainer {
|
||||||
return asycTreePanel;
|
return asycTreePanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isSmartFolderInstanced() {
|
public boolean isSmartFolderInstanced() {
|
||||||
return isSmartFolderInstanced;
|
return isSmartFolderInstanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setMessagesInstanced(boolean isMessagesInstanced) {
|
public void setMessagesInstanced(boolean isMessagesInstanced) {
|
||||||
this.isMessagesInstanced = isMessagesInstanced;
|
this.isMessagesInstanced = isMessagesInstanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setSmartFolderInstanced(boolean isSmartFolderInstanced) {
|
public void setSmartFolderInstanced(boolean isSmartFolderInstanced) {
|
||||||
this.isSmartFolderInstanced = isSmartFolderInstanced;
|
this.isSmartFolderInstanced = isSmartFolderInstanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isOnlyTreeInstanced() {
|
public boolean isOnlyTreeInstanced() {
|
||||||
return isOnlyTreeInstanced;
|
return isOnlyTreeInstanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setOnlyTreeInstanced(boolean isOnlyTreeInstanced) {
|
public void setOnlyTreeInstanced(boolean isOnlyTreeInstanced) {
|
||||||
this.isOnlyTreeInstanced = isOnlyTreeInstanced;
|
this.isOnlyTreeInstanced = isOnlyTreeInstanced;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,10 @@ import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
import com.google.gwt.user.client.ui.Label;
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class DialogShareFolder.
|
* The Class DialogShareFolder.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jul 10, 2017
|
||||||
* Jul 10, 2017
|
|
||||||
*/
|
*/
|
||||||
public class DialogShareFolder extends Dialog {
|
public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
|
@ -55,82 +51,88 @@ public class DialogShareFolder extends Dialog {
|
||||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||||
private TextField<String> txtOwner;
|
private TextField<String> txtOwner;
|
||||||
private PanelTogglePermission permission;
|
private PanelTogglePermission permission;
|
||||||
private HorizontalPanel hpPermission = null;
|
private HorizontalPanel hpPermission = null;
|
||||||
private InfoContactModel shareOwner = null;
|
private InfoContactModel shareOwner = null;
|
||||||
private ListContact<InfoContactModel> listAlreadyShared = new ListContact<InfoContactModel>();
|
private ListContact<InfoContactModel> listAlreadyShared = new ListContact<InfoContactModel>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to modify a shared folder or share an existing folder.
|
* Use to modify a shared folder or share an existing folder.
|
||||||
*
|
*
|
||||||
* @param folderParentName the folder parent name
|
* @param folderParentName
|
||||||
* @param folder the folder
|
* the folder parent name
|
||||||
* @param eventBus the event bus
|
* @param folder
|
||||||
* @param userStore the user store
|
* the folder
|
||||||
|
* @param eventBus
|
||||||
|
* the event bus
|
||||||
|
* @param userStore
|
||||||
|
* the user store
|
||||||
*/
|
*/
|
||||||
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus, UserStore userStore) {
|
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus,
|
||||||
|
UserStore userStore) {
|
||||||
initUserStore(userStore);
|
initUserStore(userStore);
|
||||||
initLayout(folderParentName);
|
initLayout(folderParentName);
|
||||||
this.parentFolder = folder;
|
this.parentFolder = folder;
|
||||||
this.setIcon(Resources.getIconShareFolder());
|
this.setIcon(Resources.getIconShareFolder());
|
||||||
|
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
setHeading("Share folder: "+folder.getName());
|
setHeading("Share folder: " + folder.getName());
|
||||||
|
|
||||||
txtName = new TextField<String>();
|
txtName = new TextField<String>();
|
||||||
txtName.setAllowBlank(false);
|
txtName.setAllowBlank(false);
|
||||||
txtName.setValue(folder.getName());
|
txtName.setValue(folder.getName());
|
||||||
txtName.setReadOnly(true);
|
txtName.setReadOnly(true);
|
||||||
txtName.setAutoValidate(true);
|
txtName.setAutoValidate(true);
|
||||||
txtName.setFieldLabel("Folder Name");
|
txtName.setFieldLabel("Folder Name");
|
||||||
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
||||||
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
||||||
|
|
||||||
txtOwner = new TextField<String>();
|
txtOwner = new TextField<String>();
|
||||||
txtOwner.setAllowBlank(true);
|
txtOwner.setAllowBlank(true);
|
||||||
txtOwner.setValue("");
|
txtOwner.setValue("");
|
||||||
txtOwner.setReadOnly(true);
|
txtOwner.setReadOnly(true);
|
||||||
txtOwner.setAutoValidate(false);
|
txtOwner.setAutoValidate(false);
|
||||||
txtOwner.setFieldLabel("Owner");
|
txtOwner.setFieldLabel("Owner");
|
||||||
|
|
||||||
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
textAreaDescription.setWidth(380);
|
textAreaDescription.setWidth(380);
|
||||||
textAreaDescription.setValue(folder.getDescription());
|
textAreaDescription.setValue(folder.getDescription());
|
||||||
|
|
||||||
final LayoutContainer lc = new LayoutContainer();
|
final LayoutContainer lc = new LayoutContainer();
|
||||||
lc.setStyleAttribute("margin-top", "10px");
|
lc.setStyleAttribute("margin-top", "10px");
|
||||||
lc.setStyleAttribute("margin-bottom", "10px");
|
lc.setStyleAttribute("margin-bottom", "10px");
|
||||||
lc.setSize(480, 50);
|
lc.setSize(480, 50);
|
||||||
|
|
||||||
final FlexTable flexTable = new FlexTable();
|
final FlexTable flexTable = new FlexTable();
|
||||||
flexTable.setStyleName("userssuggest");
|
flexTable.setStyleName("userssuggest");
|
||||||
Label labelShareWith = new Label("Share with users");
|
Label labelShareWith = new Label("Share with users");
|
||||||
flexTable.setWidget(0, 0, labelShareWith);
|
flexTable.setWidget(0, 0, labelShareWith);
|
||||||
flexTable.setWidget(0, 1, suggestPanel);
|
flexTable.setWidget(0, 1, suggestPanel);
|
||||||
|
|
||||||
buttonMultiDrag.setStyleName("wizardButton");
|
buttonMultiDrag.setStyleName("wizardButton");
|
||||||
|
|
||||||
flexTable.setWidget(1, 0, new Label("Add more"));
|
flexTable.setWidget(1, 0, new Label("Add more"));
|
||||||
flexTable.setWidget(1, 1, buttonMultiDrag);
|
flexTable.setWidget(1, 1, buttonMultiDrag);
|
||||||
|
|
||||||
Label labelDescription = new Label("Description");
|
Label labelDescription = new Label("Description");
|
||||||
flexTable.setWidget(2, 0, labelDescription);
|
flexTable.setWidget(2, 0, labelDescription);
|
||||||
flexTable.setWidget(2, 1, textAreaDescription);
|
flexTable.setWidget(2, 1, textAreaDescription);
|
||||||
|
|
||||||
hpPermission = new HorizontalPanel();
|
hpPermission = new HorizontalPanel();
|
||||||
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
Label labelProperty = new Label("Permissions");
|
Label labelProperty = new Label("Permissions");
|
||||||
hpPermission.add(labelProperty);
|
hpPermission.add(labelProperty);
|
||||||
|
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<WorkspaceACL> result) {
|
public void onSuccess(List<WorkspaceACL> result) {
|
||||||
permission = new PanelTogglePermission(result);
|
permission = new PanelTogglePermission(result);
|
||||||
|
|
||||||
//ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM HL
|
// ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM
|
||||||
if(folder.isShared())
|
// HL
|
||||||
|
if (folder.isShared())
|
||||||
selectAclForFolder(folder);
|
selectAclForFolder(folder);
|
||||||
|
|
||||||
hpPermission.add(permission);
|
hpPermission.add(permission);
|
||||||
|
@ -146,30 +148,30 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
lc.add(flexTable);
|
lc.add(flexTable);
|
||||||
if(hpPermission!=null)
|
if (hpPermission != null)
|
||||||
lc.add(hpPermission);
|
lc.add(hpPermission);
|
||||||
|
|
||||||
lc.mask();
|
lc.mask();
|
||||||
|
|
||||||
userStore.getOwner(folder.getIdentifier(), new AsyncCallback<InfoContactModel>() {
|
userStore.getOwner(folder.getIdentifier(), new AsyncCallback<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
txtOwner.setValue("Error on retrieving Owner");
|
txtOwner.setValue("Error on retrieving Owner");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(InfoContactModel result) {
|
public void onSuccess(InfoContactModel result) {
|
||||||
GWT.log("getOwner returned: "+result);
|
GWT.log("getOwner returned: " + result);
|
||||||
shareOwner = result;
|
shareOwner = result;
|
||||||
if(shareOwner!=null)
|
if (shareOwner != null)
|
||||||
txtOwner.setValue(shareOwner.getName());
|
txtOwner.setValue(shareOwner.getName());
|
||||||
//IF THE FOLDER IS NOT SHARED, CHECKS PERMISSIONS
|
// IF THE FOLDER IS NOT SHARED, CHECKS PERMISSIONS
|
||||||
if(!folder.isShared())
|
if (!folder.isShared())
|
||||||
permissionControl(result.getLogin(), true);
|
permissionControl(result.getLogin(), true);
|
||||||
|
|
||||||
fillRecipientAlreadyShared(folder.getIdentifier(), lc);
|
fillRecipientAlreadyShared(folder.getIdentifier(), lc);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -178,7 +180,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
new MessageBoxAlert("Alert", "Sorry, an error occurred during on getting Managers from server",null);
|
new MessageBoxAlert("Alert", "Sorry, an error occurred during on getting Managers from server", null);
|
||||||
enableFormDialog(false);
|
enableFormDialog(false);
|
||||||
hpPermission.unmask();
|
hpPermission.unmask();
|
||||||
}
|
}
|
||||||
|
@ -190,25 +192,26 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(folder.isShared())
|
if (folder.isShared())
|
||||||
getUsersManagers(folder.getIdentifier(), callback);
|
getUsersManagers(folder.getIdentifier(), callback);
|
||||||
|
|
||||||
setFocusWidget(suggestPanel.getBox());
|
setFocusWidget(suggestPanel.getBox());
|
||||||
add(txtName);
|
add(txtName);
|
||||||
add(txtOwner);
|
add(txtOwner);
|
||||||
add(lc);
|
add(lc);
|
||||||
addListners();
|
addListners();
|
||||||
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
|
enableFormDialog(false); // FORM IS DISABLED BY DEFAULT
|
||||||
|
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the user store.
|
* Inits the user store.
|
||||||
*
|
*
|
||||||
* @param userStore the user store
|
* @param userStore
|
||||||
|
* the user store
|
||||||
*/
|
*/
|
||||||
private void initUserStore(UserStore userStore){
|
private void initUserStore(UserStore userStore) {
|
||||||
this.userStore = userStore;
|
this.userStore = userStore;
|
||||||
this.suggestPanel = new MultiValuePanel(userStore);
|
this.suggestPanel = new MultiValuePanel(userStore);
|
||||||
}
|
}
|
||||||
|
@ -216,46 +219,50 @@ public class DialogShareFolder extends Dialog {
|
||||||
/**
|
/**
|
||||||
* Update recipient of share.
|
* Update recipient of share.
|
||||||
*
|
*
|
||||||
* @param listContacts the list contacts
|
* @param listContacts
|
||||||
|
* the list contacts
|
||||||
*/
|
*/
|
||||||
private void updateRecipientOfShare(List<InfoContactModel> listContacts){
|
private void updateRecipientOfShare(List<InfoContactModel> listContacts) {
|
||||||
suggestPanel.resetItemSelected();
|
suggestPanel.resetItemSelected();
|
||||||
for (InfoContactModel contact : listContacts){
|
for (InfoContactModel contact : listContacts) {
|
||||||
if(contact!=null && contact.getName()!=null){
|
if (contact != null && contact.getName() != null) {
|
||||||
if(!isShareOwner(contact)) //skip owner
|
if (!isShareOwner(contact)) // skip owner
|
||||||
suggestPanel.addRecipient(contact.getName(), true);
|
suggestPanel.addRecipient(contact.getName(), true);
|
||||||
else
|
else
|
||||||
suggestPanel.addRecipient(contact.getName(), false); //owner is not deletable
|
suggestPanel.addRecipient(contact.getName(), false); // owner
|
||||||
}
|
// is
|
||||||
|
// not
|
||||||
|
// deletable
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill recipient already shared.
|
* Fill recipient already shared.
|
||||||
*
|
*
|
||||||
* @param folderId the folder id
|
* @param folderId
|
||||||
* @param lc the lc
|
* the folder id
|
||||||
|
* @param lc
|
||||||
|
* the lc
|
||||||
*/
|
*/
|
||||||
private void fillRecipientAlreadyShared(String folderId, final LayoutContainer lc) {
|
private void fillRecipientAlreadyShared(String folderId, final LayoutContainer lc) {
|
||||||
|
|
||||||
userStore.getListSharedUserByFolderId(folderId,
|
userStore.getListSharedUserByFolderId(folderId, new AsyncCallback<List<InfoContactModel>>() {
|
||||||
new AsyncCallback<List<InfoContactModel>>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> listContacts) {
|
public void onSuccess(List<InfoContactModel> listContacts) {
|
||||||
|
|
||||||
if (listContacts != null) {
|
if (listContacts != null) {
|
||||||
listAlreadyShared.addAll(listContacts);
|
listAlreadyShared.addAll(listContacts);
|
||||||
updateRecipientOfShare(listContacts);
|
updateRecipientOfShare(listContacts);
|
||||||
}
|
|
||||||
lc.unmask();
|
|
||||||
}
|
}
|
||||||
|
lc.unmask();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
lc.unmask();
|
lc.unmask();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -263,17 +270,23 @@ public class DialogShareFolder extends Dialog {
|
||||||
/**
|
/**
|
||||||
* Permission control.
|
* Permission control.
|
||||||
*
|
*
|
||||||
* @param owner the owner
|
* @param owner
|
||||||
* @param showAlert the show alert
|
* the owner
|
||||||
|
* @param showAlert
|
||||||
|
* the show alert
|
||||||
*/
|
*/
|
||||||
private void permissionControl(String owner, boolean showAlert){
|
private void permissionControl(String owner, boolean showAlert) {
|
||||||
GWT.log("Permission control compare between owner: "+owner +" and my login: "+AppControllerExplorer.myLogin);
|
GWT.log("Permission control compare between owner: " + owner + " and my login: "
|
||||||
|
+ AppControllerExplorer.myLogin);
|
||||||
|
|
||||||
if(AppControllerExplorer.myLogin.compareToIgnoreCase(owner)!=0){
|
if (AppControllerExplorer.myLogin.compareToIgnoreCase(owner) != 0) {
|
||||||
enableFormDialog(false);
|
enableFormDialog(false);
|
||||||
if(showAlert)
|
if (showAlert)
|
||||||
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not owner of \""+txtName.getValue()+"\"", null);
|
new MessageBoxAlert("Permission denied",
|
||||||
}else{
|
"You have no permissions to change sharing. You are not owner of \"" + txtName.getValue()
|
||||||
|
+ "\"",
|
||||||
|
null);
|
||||||
|
} else {
|
||||||
enableFormDialog(true);
|
enableFormDialog(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,14 +294,15 @@ public class DialogShareFolder extends Dialog {
|
||||||
/**
|
/**
|
||||||
* 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);
|
||||||
textAreaDescription.setEnabled(bool);
|
textAreaDescription.setEnabled(bool);
|
||||||
if(permission!=null)
|
if (permission != null)
|
||||||
permission.setEnabled(bool);
|
permission.setEnabled(bool);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,77 +318,81 @@ public class DialogShareFolder extends Dialog {
|
||||||
/**
|
/**
|
||||||
* Inits the layout.
|
* Inits the layout.
|
||||||
*
|
*
|
||||||
* @param folderParentName the folder parent name
|
* @param folderParentName
|
||||||
|
* the folder parent name
|
||||||
*/
|
*/
|
||||||
public void initLayout(String folderParentName){
|
public void initLayout(String folderParentName) {
|
||||||
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(widthDialog);
|
setWidth(widthDialog);
|
||||||
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER);
|
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER);
|
||||||
setResizable(true);
|
setResizable(true);
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to create a new shared folder.
|
* Use to create a new shared folder.
|
||||||
*
|
*
|
||||||
* @param folderParentName the folder parent name
|
* @param folderParentName
|
||||||
* @param eventBus the event bus
|
* the folder parent name
|
||||||
* @param userStore the user store
|
* @param eventBus
|
||||||
|
* the event bus
|
||||||
|
* @param userStore
|
||||||
|
* the user store
|
||||||
*/
|
*/
|
||||||
public DialogShareFolder(String folderParentName, HandlerManager eventBus, UserStore userStore) {
|
public DialogShareFolder(String folderParentName, HandlerManager eventBus, UserStore userStore) {
|
||||||
initUserStore(userStore);
|
initUserStore(userStore);
|
||||||
initLayout(folderParentName);
|
initLayout(folderParentName);
|
||||||
this.setIcon(Resources.getIconSharedFolder());
|
this.setIcon(Resources.getIconSharedFolder());
|
||||||
setHeading("Create a new shared folder in: "+folderParentName);
|
setHeading("Create a new shared folder in: " + folderParentName);
|
||||||
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER-25);
|
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER - 25);
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
|
|
||||||
txtName = new TextField<String>();
|
txtName = new TextField<String>();
|
||||||
txtName.setAllowBlank(false);
|
txtName.setAllowBlank(false);
|
||||||
txtName.setAutoValidate(true);
|
txtName.setAutoValidate(true);
|
||||||
txtName.setFieldLabel("Folder Name");
|
txtName.setFieldLabel("Folder Name");
|
||||||
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
||||||
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
||||||
// txtName.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
|
// txtName.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
|
||||||
|
|
||||||
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
textAreaDescription.setWidth(380);
|
textAreaDescription.setWidth(380);
|
||||||
|
|
||||||
final LayoutContainer lc = new LayoutContainer();
|
final LayoutContainer lc = new LayoutContainer();
|
||||||
lc.setStyleAttribute("margin-top", "10px");
|
lc.setStyleAttribute("margin-top", "10px");
|
||||||
lc.setStyleAttribute("margin-bottom", "10px");
|
lc.setStyleAttribute("margin-bottom", "10px");
|
||||||
lc.setSize(480, 50);
|
lc.setSize(480, 50);
|
||||||
|
|
||||||
final FlexTable flexTable = new FlexTable();
|
final FlexTable flexTable = new FlexTable();
|
||||||
flexTable.setStyleName("userssuggest");
|
flexTable.setStyleName("userssuggest");
|
||||||
Label lableShareWith = new Label("Share with users");
|
Label lableShareWith = new Label("Share with users");
|
||||||
flexTable.setWidget(0, 0, lableShareWith);
|
flexTable.setWidget(0, 0, lableShareWith);
|
||||||
flexTable.setWidget(0, 1, suggestPanel);
|
flexTable.setWidget(0, 1, suggestPanel);
|
||||||
|
|
||||||
buttonMultiDrag.setStyleName("wizardButton");
|
buttonMultiDrag.setStyleName("wizardButton");
|
||||||
|
|
||||||
flexTable.setWidget(1, 0, new Label("Add more"));
|
flexTable.setWidget(1, 0, new Label("Add more"));
|
||||||
flexTable.setWidget(1, 1, buttonMultiDrag);
|
flexTable.setWidget(1, 1, buttonMultiDrag);
|
||||||
|
|
||||||
Label labelDescription = new Label("Description");
|
Label labelDescription = new Label("Description");
|
||||||
flexTable.setWidget(2, 0, labelDescription);
|
flexTable.setWidget(2, 0, labelDescription);
|
||||||
flexTable.setWidget(2, 1, textAreaDescription);
|
flexTable.setWidget(2, 1, textAreaDescription);
|
||||||
|
|
||||||
hpPermission = new HorizontalPanel();
|
hpPermission = new HorizontalPanel();
|
||||||
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
Label labelProperty = new Label("Permissions");
|
Label labelProperty = new Label("Permissions");
|
||||||
hpPermission.add(labelProperty);
|
hpPermission.add(labelProperty);
|
||||||
|
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<WorkspaceACL> result) {
|
public void onSuccess(List<WorkspaceACL> result) {
|
||||||
|
@ -392,36 +410,34 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
lc.add(flexTable);
|
lc.add(flexTable);
|
||||||
lc.add(hpPermission);
|
lc.add(hpPermission);
|
||||||
|
|
||||||
setFocusWidget(txtName);
|
setFocusWidget(txtName);
|
||||||
add(txtName);
|
add(txtName);
|
||||||
add(lc);
|
add(lc);
|
||||||
|
|
||||||
addListners();
|
addListners();
|
||||||
|
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the shared list users.
|
* Gets the shared list users.
|
||||||
*
|
*
|
||||||
* @return the shared list users
|
* @return the shared list users
|
||||||
*/
|
*/
|
||||||
public List<InfoContactModel> getSharedListUsers() {
|
public List<InfoContactModel> getSharedListUsers() {
|
||||||
// printSelectedUser();
|
// printSelectedUser();
|
||||||
return suggestPanel.getSelectedUser();
|
return suggestPanel.getSelectedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the listners.
|
* Adds the listners.
|
||||||
*/
|
*/
|
||||||
public void addListners(){
|
public void addListners() {
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -429,29 +445,29 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 MultiDragContact multiDrag = new MultiDragContact();
|
final MultiDragContact multiDrag = new MultiDragContact();
|
||||||
multiDrag.show();
|
multiDrag.show();
|
||||||
|
|
||||||
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
List<InfoContactModel> exclusiveContacts = userStore
|
||||||
|
.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
||||||
multiDrag.addSourceContacts(exclusiveContacts);
|
multiDrag.addSourceContacts(exclusiveContacts);
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
||||||
// if(!listAlreadyShared.contains(infoContactModel))
|
// if(!listAlreadyShared.contains(infoContactModel))
|
||||||
if(!isShareOwner(infoContactModel))
|
if (!isShareOwner(infoContactModel))
|
||||||
multiDrag.addTargetContact(infoContactModel);
|
multiDrag.addTargetContact(infoContactModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,64 +477,65 @@ public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
// initSuggestContacts();
|
// initSuggestContacts();
|
||||||
suggestPanel.resetItemSelected();
|
suggestPanel.resetItemSelected();
|
||||||
//SHARE OWNER IS NULL IN CASE OF NEW SHARE
|
// SHARE OWNER IS NULL IN CASE OF NEW SHARE
|
||||||
if(shareOwner!=null)
|
if (shareOwner != null)
|
||||||
suggestPanel.addRecipient(shareOwner.getName(),false);
|
suggestPanel.addRecipient(shareOwner.getName(), false);
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
||||||
suggestPanel.addRecipient(infoContactModel.getName(),true);
|
suggestPanel.addRecipient(infoContactModel.getName(), true);
|
||||||
}
|
}
|
||||||
suggestPanel.boxSetFocus();
|
suggestPanel.boxSetFocus();
|
||||||
// printSelectedUser();
|
// printSelectedUser();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is share owner.
|
* Checks if is share owner.
|
||||||
*
|
*
|
||||||
* @param infoContactModel the info contact model
|
* @param infoContactModel
|
||||||
|
* the info contact model
|
||||||
* @return true, if is share owner
|
* @return true, if is share owner
|
||||||
*/
|
*/
|
||||||
public boolean isShareOwner(InfoContactModel infoContactModel){
|
public boolean isShareOwner(InfoContactModel infoContactModel) {
|
||||||
|
|
||||||
if(infoContactModel!=null && shareOwner!=null && InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner)==0)
|
if (infoContactModel != null && shareOwner != null
|
||||||
|
&& InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner) == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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(InfoContactModel.COMPARATORLOGINS.compare(ct, contact)==0)
|
if (InfoContactModel.COMPARATORLOGINS.compare(ct, contact) == 0)
|
||||||
// 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.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void printSelectedUser(){
|
private void printSelectedUser() {
|
||||||
|
|
||||||
System.out.println("SELETECTED USERS: ");
|
System.out.println("SELETECTED USERS: ");
|
||||||
for (InfoContactModel contact : suggestPanel.getSelectedUser())
|
for (InfoContactModel contact : suggestPanel.getSelectedUser())
|
||||||
|
@ -529,7 +546,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
* Inits the suggest contacts.
|
* Inits the suggest contacts.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void initSuggestContacts(){
|
private void initSuggestContacts() {
|
||||||
suggestPanel.resetItemSelected();
|
suggestPanel.resetItemSelected();
|
||||||
for (InfoContactModel contact : listAlreadyShared)
|
for (InfoContactModel contact : listAlreadyShared)
|
||||||
suggestPanel.addRecipient(contact.getName(), false);
|
suggestPanel.addRecipient(contact.getName(), false);
|
||||||
|
@ -550,7 +567,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
* @return the description
|
* @return the description
|
||||||
*/
|
*/
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if(textAreaDescription.getValue()==null)
|
if (textAreaDescription.getValue() == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return textAreaDescription.getValue();
|
return textAreaDescription.getValue();
|
||||||
|
@ -559,20 +576,21 @@ public class DialogShareFolder extends Dialog {
|
||||||
/**
|
/**
|
||||||
* Checks if is valid form.
|
* Checks if is valid form.
|
||||||
*
|
*
|
||||||
* @param displayAlert the display alert
|
* @param displayAlert
|
||||||
|
* the display alert
|
||||||
* @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)
|
||||||
new MessageBoxAlert("Attention", "Name must not be empty", null);
|
new MessageBoxAlert("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)
|
||||||
new MessageBoxAlert("Attention", "You must pick at least one user with which share the folder", null);
|
new MessageBoxAlert("Attention", "You must pick at least one user with which share the folder", null);
|
||||||
suggestPanel.boxSetFocus();
|
suggestPanel.boxSetFocus();
|
||||||
return false;
|
return false;
|
||||||
|
@ -587,8 +605,8 @@ public class DialogShareFolder extends Dialog {
|
||||||
*
|
*
|
||||||
* @return the selected acl
|
* @return the selected acl
|
||||||
*/
|
*/
|
||||||
public WorkspaceACL getSelectedACL(){
|
public WorkspaceACL getSelectedACL() {
|
||||||
if(permission!=null)
|
if (permission != null)
|
||||||
return permission.getSelectedACL();
|
return permission.getSelectedACL();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -596,82 +614,95 @@ public class DialogShareFolder extends Dialog {
|
||||||
/**
|
/**
|
||||||
* Select acl for folder.
|
* Select acl for folder.
|
||||||
*
|
*
|
||||||
* @param folder the folder
|
* @param folder
|
||||||
|
* the folder
|
||||||
*/
|
*/
|
||||||
private void selectAclForFolder(FileModel folder){
|
private void selectAclForFolder(FileModel folder) {
|
||||||
GWT.log("Loading ACL to: "+folder);
|
GWT.log("Loading ACL to: " + folder);
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getACLsForSharedFolderId(folder.getIdentifier(), new AsyncCallback<WorkspaceACL>() {
|
WorkspaceSharingServiceAsync.INSTANCE.getACLsForSharedFolderId(folder.getIdentifier(),
|
||||||
|
new AsyncCallback<WorkspaceACL>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable arg0) {
|
public void onFailure(Throwable arg0) {
|
||||||
GWT.log("An error occurred on selecting current ACL "+arg0);
|
GWT.log("An error occurred on selecting current ACL " + arg0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(WorkspaceACL arg0) {
|
public void onSuccess(WorkspaceACL arg0) {
|
||||||
GWT.log("Loaded ACL "+arg0);
|
GWT.log("Loaded ACL " + arg0);
|
||||||
permission.selectACL(arg0);
|
permission.selectACL(arg0);
|
||||||
hpPermission.layout();
|
hpPermission.layout();
|
||||||
layout();
|
layout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the users managers.
|
* Gets the users managers.
|
||||||
*
|
*
|
||||||
* @param sharedFolderId the shared folder id
|
*
|
||||||
* @param callback the callback
|
* @param sharedFolderId
|
||||||
* @return the users managers
|
* share folder id
|
||||||
|
* @param callback
|
||||||
|
* list of contacts
|
||||||
*/
|
*/
|
||||||
public void getUsersManagers(final String sharedFolderId,final AsyncCallback<List<InfoContactModel>> callback) {
|
public void getUsersManagers(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback) {
|
||||||
|
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
|
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId,
|
||||||
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable arg0) {
|
public void onFailure(Throwable arg0) {
|
||||||
GWT.log("an error occured in getting user managers by Id "+sharedFolderId + " "+arg0.getMessage());
|
GWT.log("an error occured in getting user managers by Id " + sharedFolderId + " "
|
||||||
new MessageBoxAlert("Alert", "Sorry, an error occurred on getting users managers, try again later",null);
|
+ arg0.getMessage());
|
||||||
|
new MessageBoxAlert("Alert",
|
||||||
|
"Sorry, an error occurred on getting users managers, try again later", null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> listManagers) {
|
public void onSuccess(List<InfoContactModel> listManagers) {
|
||||||
callback.onSuccess(listManagers);
|
callback.onSuccess(listManagers);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission control.
|
* Permission control.
|
||||||
*
|
*
|
||||||
* @param listManagers the list managers
|
* @param listManagers
|
||||||
* @param showAlert the show alert
|
* the list managers
|
||||||
* @param folder the folder
|
* @param showAlert
|
||||||
|
* the show alert
|
||||||
|
* @param folder
|
||||||
|
* the folder
|
||||||
*/
|
*/
|
||||||
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert, FileModel folder){
|
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert, FileModel folder) {
|
||||||
|
|
||||||
boolean permissionsOk = false;
|
boolean permissionsOk = false;
|
||||||
for (InfoContactModel infoContactModel : listManagers) {
|
for (InfoContactModel infoContactModel : listManagers) {
|
||||||
|
|
||||||
GWT.log("DialogPermission control compare between : "+infoContactModel.getLogin() +" and my login: "+AppControllerExplorer.myLogin);
|
GWT.log("DialogPermission control compare between : " + infoContactModel.getLogin() + " and my login: "
|
||||||
if(AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin())==0){
|
+ AppControllerExplorer.myLogin);
|
||||||
|
if (AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin()) == 0) {
|
||||||
permissionsOk = true;
|
permissionsOk = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(permissionsOk){
|
if (permissionsOk) {
|
||||||
enableFormDialog(true);
|
enableFormDialog(true);
|
||||||
}else{
|
} else {
|
||||||
enableFormDialog(false);
|
enableFormDialog(false);
|
||||||
if(showAlert)
|
if (showAlert)
|
||||||
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not manager of \""+folder.getName()+"\"", null);
|
new MessageBoxAlert("Permission denied",
|
||||||
|
"You have no permissions to change sharing. You are not manager of \"" + folder.getName()
|
||||||
|
+ "\"",
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DialogPermission extends Dialog {
|
||||||
private FileModel folder;
|
private FileModel folder;
|
||||||
|
|
||||||
private DialogPermission INSTANCE = this;
|
private DialogPermission INSTANCE = this;
|
||||||
|
|
||||||
public FileModel getParentFolder() {
|
public FileModel getParentFolder() {
|
||||||
return parentFolder;
|
return parentFolder;
|
||||||
}
|
}
|
||||||
|
@ -63,36 +63,38 @@ public class DialogPermission extends Dialog {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to set permission to VRE Folder
|
* Use to set permission to VRE Folder
|
||||||
|
*
|
||||||
|
* @param folder
|
||||||
|
* folder
|
||||||
*/
|
*/
|
||||||
public DialogPermission(FileModel folder) {
|
public DialogPermission(FileModel folder) {
|
||||||
|
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
|
|
||||||
Label labelProperty = new Label("Permissions");
|
Label labelProperty = new Label("Permissions");
|
||||||
|
|
||||||
hpPermission.add(labelProperty);
|
hpPermission.add(labelProperty);
|
||||||
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
hpPermission.mask("Checking authorization");
|
hpPermission.mask("Checking authorization");
|
||||||
|
|
||||||
|
|
||||||
AsyncCallback<List<InfoContactModel>> callback = new AsyncCallback<List<InfoContactModel>>() {
|
AsyncCallback<List<InfoContactModel>> callback = new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
new MessageBoxAlert("Alert", "Sorry, an error occurred on recovering ACLs",null);
|
new MessageBoxAlert("Alert", "Sorry, an error occurred on recovering ACLs", null);
|
||||||
hpPermission.unmask();
|
hpPermission.unmask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> listManagers) {
|
public void onSuccess(List<InfoContactModel> listManagers) {
|
||||||
permissionControl(listManagers, true);
|
permissionControl(listManagers, true);
|
||||||
hpPermission.unmask();
|
hpPermission.unmask();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getUsersManagers(folder.getIdentifier(), callback);
|
getUsersManagers(folder.getIdentifier(), callback);
|
||||||
|
|
||||||
//TODO GET ACL FOR USER
|
// TODO GET ACL FOR USER
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,7 +107,7 @@ public class DialogPermission extends Dialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
new MessageBoxAlert("Alert", "Sorry, an error occurred on recovering ACLs",null);
|
new MessageBoxAlert("Alert", "Sorry, an error occurred on recovering ACLs", null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -124,101 +126,108 @@ public class DialogPermission extends Dialog {
|
||||||
|
|
||||||
public void addListners() {
|
public void addListners() {
|
||||||
|
|
||||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getButtonById(Dialog.OK).addSelectionListener(
|
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentSelected(ButtonEvent ce) {
|
|
||||||
|
|
||||||
INSTANCE.mask("Changing permissions");
|
|
||||||
if(folder!=null && getSelectedACL().getId()!=null){
|
|
||||||
|
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.updateACLForVREbyGroupName(folder.getIdentifier(), getSelectedACL().getId(), new AsyncCallback<Void>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
INSTANCE.hide();
|
|
||||||
new MessageBoxAlert("Error", caught.getMessage(),null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
INSTANCE.mask("Changing permissions");
|
||||||
public void onSuccess(Void result) {
|
if (folder != null && getSelectedACL().getId() != null) {
|
||||||
INSTANCE.unmask();
|
|
||||||
INSTANCE.hide();
|
WorkspaceSharingServiceAsync.INSTANCE.updateACLForVREbyGroupName(folder.getIdentifier(),
|
||||||
new InfoDisplay("Permission updated", "The permissions have been changed correctly");
|
getSelectedACL().getId(), new AsyncCallback<Void>() {
|
||||||
|
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new UpdatedVREPermissionEvent(folder.getIdentifier()));
|
@Override
|
||||||
}
|
public void onFailure(Throwable caught) {
|
||||||
});
|
INSTANCE.hide();
|
||||||
}
|
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
INSTANCE.unmask();
|
||||||
|
INSTANCE.hide();
|
||||||
|
new InfoDisplay("Permission updated",
|
||||||
|
"The permissions have been changed correctly");
|
||||||
|
|
||||||
|
AppControllerExplorer.getEventBus()
|
||||||
|
.fireEvent(new UpdatedVREPermissionEvent(folder.getIdentifier()));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert) {
|
||||||
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert){
|
|
||||||
|
|
||||||
boolean permissionsOk = false;
|
boolean permissionsOk = false;
|
||||||
for (InfoContactModel infoContactModel : listManagers) {
|
for (InfoContactModel infoContactModel : listManagers) {
|
||||||
|
|
||||||
GWT.log("DialogPermission control compare between : "+infoContactModel.getLogin() +" and my login: "+AppControllerExplorer.myLogin);
|
GWT.log("DialogPermission control compare between : " + infoContactModel.getLogin() + " and my login: "
|
||||||
if(AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin())==0){
|
+ AppControllerExplorer.myLogin);
|
||||||
|
if (AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin()) == 0) {
|
||||||
permissionsOk = true;
|
permissionsOk = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(permissionsOk){
|
if (permissionsOk) {
|
||||||
enableFormDialog(true);
|
enableFormDialog(true);
|
||||||
}else{
|
} else {
|
||||||
enableFormDialog(false);
|
enableFormDialog(false);
|
||||||
if(showAlert)
|
if (showAlert)
|
||||||
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not manager of \""+folder.getName()+"\"", null);
|
new MessageBoxAlert("Permission denied",
|
||||||
|
"You have no permissions to change sharing. You are not manager of \"" + folder.getName()
|
||||||
|
+ "\"",
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableFormDialog(boolean bool){
|
|
||||||
getButtonById(Dialog.OK).setEnabled(bool);
|
|
||||||
|
|
||||||
if(permission!=null)
|
|
||||||
permission.setEnabled(bool);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getUsersManagers(final String sharedFolderId,final AsyncCallback<List<InfoContactModel>> callback) {
|
|
||||||
|
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable arg0) {
|
|
||||||
GWT.log("an error occured in getting user managers by Id "+sharedFolderId + " "+arg0.getMessage());
|
|
||||||
new MessageBoxAlert("Alert", "Sorry, an error occurred on getting users managers, try again later",null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<InfoContactModel> listManagers) {
|
|
||||||
callback.onSuccess(listManagers);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkspaceACL getSelectedACL(){
|
private void enableFormDialog(boolean bool) {
|
||||||
if(permission!=null)
|
getButtonById(Dialog.OK).setEnabled(bool);
|
||||||
|
|
||||||
|
if (permission != null)
|
||||||
|
permission.setEnabled(bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getUsersManagers(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback) {
|
||||||
|
|
||||||
|
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId,
|
||||||
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable arg0) {
|
||||||
|
GWT.log("an error occured in getting user managers by Id " + sharedFolderId + " "
|
||||||
|
+ arg0.getMessage());
|
||||||
|
new MessageBoxAlert("Alert",
|
||||||
|
"Sorry, an error occurred on getting users managers, try again later", null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<InfoContactModel> listManagers) {
|
||||||
|
callback.onSuccess(listManagers);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkspaceACL getSelectedACL() {
|
||||||
|
if (permission != null)
|
||||||
return permission.getSelectedACL();
|
return permission.getSelectedACL();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,10 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
/**
|
/**
|
||||||
* The Class DialogEditProperties.
|
* The Class DialogEditProperties.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jun 11, 2015
|
||||||
* Jun 11, 2015
|
|
||||||
*/
|
*/
|
||||||
public class DialogEditProperties extends Dialog{
|
public class DialogEditProperties extends Dialog {
|
||||||
|
|
||||||
private FileModel item;
|
private FileModel item;
|
||||||
private int widthDialog = 450;
|
private int widthDialog = 450;
|
||||||
private int heigthDialog = 300;
|
private int heigthDialog = 300;
|
||||||
|
@ -41,8 +40,10 @@ public class DialogEditProperties extends Dialog{
|
||||||
/**
|
/**
|
||||||
* Instantiates a new dialog edit properties.
|
* Instantiates a new dialog edit properties.
|
||||||
*
|
*
|
||||||
* @param itemId
|
* @param item
|
||||||
* the item id
|
* FileModel
|
||||||
|
* @param command
|
||||||
|
* Command
|
||||||
*/
|
*/
|
||||||
public DialogEditProperties(FileModel item, Command command) {
|
public DialogEditProperties(FileModel item, Command command) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
@ -53,7 +54,7 @@ public class DialogEditProperties extends Dialog{
|
||||||
layout.setDefaultWidth(300);
|
layout.setDefaultWidth(300);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
setHeading("Edit Properties: "+item.getName());
|
setHeading("Edit Properties: " + item.getName());
|
||||||
setButtonAlign(HorizontalAlignment.RIGHT);
|
setButtonAlign(HorizontalAlignment.RIGHT);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
// setBodyBorder(true);
|
// setBodyBorder(true);
|
||||||
|
@ -72,9 +73,10 @@ public class DialogEditProperties extends Dialog{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.extjs.gxt.ui.client.widget.Window#show()
|
* @see com.extjs.gxt.ui.client.widget.Window#show()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,68 +85,69 @@ public class DialogEditProperties extends Dialog{
|
||||||
loadGcubeItemProperties();
|
loadGcubeItemProperties();
|
||||||
super.show();
|
super.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void resetForm() {
|
private void resetForm() {
|
||||||
if(fields!=null)
|
if (fields != null)
|
||||||
fields.clear();
|
fields.clear();
|
||||||
fields = null;
|
fields = null;
|
||||||
removeAll();
|
removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveProperties(final boolean closeOnSuccess){
|
private void saveProperties(final boolean closeOnSuccess) {
|
||||||
Map<String,String> prp = new HashMap<String, String>(fields.size());
|
Map<String, String> prp = new HashMap<String, String>(fields.size());
|
||||||
for (TextField<String> field : fields) {
|
for (TextField<String> field : fields) {
|
||||||
String value = field.getValue()!=null?field.getValue():"";
|
String value = field.getValue() != null ? field.getValue() : "";
|
||||||
prp.put(field.getFieldLabel(), value);
|
prp.put(field.getFieldLabel(), value);
|
||||||
}
|
}
|
||||||
AppControllerExplorer.rpcWorkspaceService.setGcubeItemProperties(item.getIdentifier(), prp, new AsyncCallback<Void>() {
|
AppControllerExplorer.rpcWorkspaceService.setGcubeItemProperties(item.getIdentifier(), prp,
|
||||||
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
commad.execute();
|
||||||
|
if (closeOnSuccess)
|
||||||
|
DialogEditProperties.this.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Void result) {
|
|
||||||
commad.execute();
|
|
||||||
if(closeOnSuccess)
|
|
||||||
DialogEditProperties.this.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadGcubeItemProperties() {
|
||||||
|
// mask("Loading properties...");
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(),
|
||||||
|
new AsyncCallback<Map<String, String>>() {
|
||||||
|
|
||||||
private void loadGcubeItemProperties(){
|
@Override
|
||||||
// mask("Loading properties...");
|
public void onSuccess(Map<String, String> result) {
|
||||||
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(), new AsyncCallback<Map<String,String>>() {
|
// unmask();
|
||||||
|
setProperties(result);
|
||||||
@Override
|
}
|
||||||
public void onSuccess(Map<String, String> result) {
|
|
||||||
// unmask();
|
|
||||||
setProperties(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// unmask();
|
// unmask();
|
||||||
GWT.log("an error occured in loadGcubeItemProperties "+item + " "+caught.getMessage());
|
GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setProperties(Map<String, String> result) {
|
private void setProperties(Map<String, String> result) {
|
||||||
fields = new ArrayList<TextField<String>>(result.size());
|
fields = new ArrayList<TextField<String>>(result.size());
|
||||||
for (String key: result.keySet()) {
|
for (String key : result.keySet()) {
|
||||||
TextField<String> field = new TextField<String>();
|
TextField<String> field = new TextField<String>();
|
||||||
field.setFieldLabel(key);
|
field.setFieldLabel(key);
|
||||||
field.setValue(result.get(key));
|
field.setValue(result.get(key));
|
||||||
add(field);
|
add(field);
|
||||||
fields.add(field);
|
fields.add(field);
|
||||||
}
|
}
|
||||||
layout(true);
|
layout(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,28 +7,30 @@ import com.extjs.gxt.ui.client.widget.InfoConfig;
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class InfoDisplay extends Info{
|
public class InfoDisplay extends Info {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param title
|
* @param title
|
||||||
|
* title
|
||||||
* @param text
|
* @param text
|
||||||
* @param milliseconds - The time in milliseconds to display a message (defaults to 2500).
|
* text
|
||||||
*/
|
* @param milliseconds
|
||||||
public InfoDisplay(String title, String text, int milliseconds){
|
* milliseconds
|
||||||
|
*/
|
||||||
|
public InfoDisplay(String title, String text, int milliseconds) {
|
||||||
|
|
||||||
InfoConfig config = new InfoConfig(title, text);
|
InfoConfig config = new InfoConfig(title, text);
|
||||||
|
|
||||||
config.display = milliseconds;
|
config.display = milliseconds;
|
||||||
|
|
||||||
Info.display(config);
|
Info.display(config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfoDisplay(String title, String text){
|
public InfoDisplay(String title, String text) {
|
||||||
|
|
||||||
Info.display(title, text);
|
Info.display(title, text);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
package org.gcube.portlets.user.workspace.client.view.windows;
|
package org.gcube.portlets.user.workspace.client.view.windows;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jun 25, 2013
|
||||||
* Jun 25, 2013
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class InfoDisplayMessage extends InfoDisplay{
|
public class InfoDisplayMessage extends InfoDisplay {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param title
|
* @param title
|
||||||
|
* message title
|
||||||
* @param text
|
* @param text
|
||||||
|
* message text
|
||||||
*/
|
*/
|
||||||
public InfoDisplayMessage(String title, String text) {
|
public InfoDisplayMessage(String title, String text) {
|
||||||
super(title, text);
|
super(title, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param title
|
* @param title
|
||||||
|
* message title
|
||||||
* @param text
|
* @param text
|
||||||
|
* message text
|
||||||
*/
|
*/
|
||||||
public InfoDisplayMessage(String title, String text, int milliseconds) {
|
public InfoDisplayMessage(String title, String text, int milliseconds) {
|
||||||
super(title, text, milliseconds);
|
super(title, text, milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue