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

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

Updated to StorageHub

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

View File

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

View File

@ -37,15 +37,19 @@ public class ExplorerPanel extends LayoutContainer {
private boolean isSmartFolderInstanced;
private boolean isOnlyTreeInstanced;
/**
* Default instance an async tree to navigate user workspace
*
* @param instancingSmartFolder
* instancing smart folder
* @param instancingMessages
* instancing messages
* @param selectRootItem
* select root
*/
public ExplorerPanel(boolean instancingSmartFolder, boolean instancingMessages, boolean selectRootItem) {
this.isMessagesInstanced= instancingMessages;
this.isMessagesInstanced = instancingMessages;
this.isSmartFolderInstanced = instancingSmartFolder;
setBorders(false);
@ -56,29 +60,29 @@ public class ExplorerPanel extends LayoutContainer {
this.expPanel = new ContentPanel();
this.expPanel.setHeaderVisible(false);
// smartFolderPanel.setVisible(false);
// messagesPanel.setVisible(false);
// smartFolderPanel.setVisible(false);
// messagesPanel.setVisible(false);
asycTreePanel.setVisible(true);
expPanel.add(asycTreePanel);
// expPanel.add(smartFolderPanel);
// expPanel.add(messagesPanel);
// expPanel.add(smartFolderPanel);
// expPanel.add(messagesPanel);
//BULK
//REMOVED 2016-09-15 CHECK SVN
// buttBulk.setIcon(Resources.getIconBulkUpdate());
// buttBulk.setVisible(false);
// addListnerOnBulk();
// BULK
// REMOVED 2016-09-15 CHECK SVN
// buttBulk.setIcon(Resources.getIconBulkUpdate());
// buttBulk.setVisible(false);
// addListnerOnBulk();
add(expPanel);
}
/**
* Instance only tree
*
* @param instancingOnlyTree
* only tree
* @param selectRootItem
* select root item
*/
public ExplorerPanel(boolean instancingOnlyTree, boolean selectRootItem) {
@ -87,10 +91,10 @@ public class ExplorerPanel extends LayoutContainer {
setBorders(false);
initRadioButtons();
this.asycTreePanel = new AsyncTreePanel();
this.asycTreePanel.loadRootItem(selectRootItem); //load root item
this.asycTreePanel.loadRootItem(selectRootItem); // load root item
this.expPanel = new ContentPanel();
this.expPanel.setHeaderVisible(false);
// asycTreePanel.setVisible(true);
// asycTreePanel.setVisible(true);
expPanel.add(asycTreePanel);
add(expPanel);
@ -101,22 +105,21 @@ public class ExplorerPanel extends LayoutContainer {
@Override
public void componentSelected(ButtonEvent ce) {
// BulkCreatorWindow.getInstance().show();
// BulkCreatorWindow.getInstance().show();
}
});
}
public void setLoadingBulk(boolean bool){
public void setLoadingBulk(boolean bool) {
buttBulk.setVisible(true);
if(!bool)
if (!bool)
buttBulk.setIcon(Resources.getIconLoadingOff());
else
buttBulk.setIcon(Resources.getIconLoading());
toolBar.layout();
}
@ -126,28 +129,28 @@ public class ExplorerPanel extends LayoutContainer {
this.radioSmartFolder = new Radio();
this.radioMessages = new Radio();
// radioTree.setId(ConstantsExplorer.TREE);
// radioTree.setId(ConstantsExplorer.TREE);
radioTree.setBoxLabel(ConstantsExplorer.TREE);
radioTree.setValue(true);
radioTree.setValueAttribute(ConstantsExplorer.TREE);
radioGroup.add(radioTree);
// radioSmartFolder.setId(ConstantsExplorer.SMARTFOLDER);
// radioSmartFolder.setId(ConstantsExplorer.SMARTFOLDER);
if(isSmartFolderInstanced){
if (isSmartFolderInstanced) {
radioSmartFolder.setBoxLabel(ConstantsExplorer.SMARTFOLDER);
radioSmartFolder.setValueAttribute(ConstantsExplorer.SMARTFOLDER);
radioGroup.add(radioSmartFolder);
}
if(isMessagesInstanced){
if (isMessagesInstanced) {
radioMessages.setBoxLabel(ConstantsExplorer.MESSAGES);
radioMessages.setValueAttribute(ConstantsExplorer.MESSAGES);
radioGroup.add(radioMessages);
}
// radioGroup.setFieldLabel("Afecto");
// radioGroup.setFieldLabel("Afecto");
radioGroup.setStyleAttribute("margin-left", "20px");
@ -155,51 +158,45 @@ public class ExplorerPanel extends LayoutContainer {
public void handleEvent(BaseEvent be) {
Radio selectedRadio = radioGroup.getValue();
// System.out.println("radio value:" +selectedRadio.getValueAttribute());
// System.out.println("id" + selectedRadio.getId());
// System.out.println("radio value:"
// +selectedRadio.getValueAttribute());
// System.out.println("id" + selectedRadio.getId());
if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.SMARTFOLDER.toString()) == 0)
switchView(ViewSwitchType.SmartFolder);
else if(selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.TREE.toString()) == 0)
switchView(ViewSwitchType.Tree);
else
switchView(ViewSwitchType.Messages);
else if (selectedRadio.getValueAttribute().compareTo(ConstantsExplorer.TREE.toString()) == 0)
switchView(ViewSwitchType.Tree);
else
switchView(ViewSwitchType.Messages);
}
});
}
private void initToolBar(){
private void initToolBar() {
toolBar.add(radioGroup);
// toolBar.add(buttBulk);
toolBar.add(radioGroup);
// toolBar.add(buttBulk);
}
private void switchView(ViewSwitchType type) {
if (type.compareTo(ViewSwitchType.Tree)==0) {
if (type.compareTo(ViewSwitchType.Tree) == 0) {
asycTreePanel.setVisible(true);
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);
AppControllerExplorer.getEventBus().fireEvent(new SwitchViewEvent(ViewSwitchType.SmartFolder));
// this.expPanel.setVisible(shortuctsPanel.getElement(), false);
// this.expPanel.setVisible(asycTreePanel.getElement(), true);
}
else{
} else {
asycTreePanel.setVisible(false);
}
}
@ -208,27 +205,22 @@ public class ExplorerPanel extends LayoutContainer {
return asycTreePanel;
}
public boolean isSmartFolderInstanced() {
return isSmartFolderInstanced;
}
public void setMessagesInstanced(boolean isMessagesInstanced) {
this.isMessagesInstanced = isMessagesInstanced;
}
public void setSmartFolderInstanced(boolean isSmartFolderInstanced) {
this.isSmartFolderInstanced = isSmartFolderInstanced;
}
public boolean isOnlyTreeInstanced() {
return isOnlyTreeInstanced;
}
public void setOnlyTreeInstanced(boolean isOnlyTreeInstanced) {
this.isOnlyTreeInstanced = isOnlyTreeInstanced;
}

View File

@ -34,14 +34,10 @@ import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
/**
* The Class DialogShareFolder.
*
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
* Jul 10, 2017
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jul 10, 2017
*/
public class DialogShareFolder extends Dialog {
@ -55,82 +51,88 @@ public class DialogShareFolder extends Dialog {
private Button buttonMultiDrag = new Button("Choose Contacts");
private TextField<String> txtOwner;
private PanelTogglePermission permission;
private HorizontalPanel hpPermission = null;
private InfoContactModel shareOwner = null;
private HorizontalPanel hpPermission = null;
private InfoContactModel shareOwner = null;
private ListContact<InfoContactModel> listAlreadyShared = new ListContact<InfoContactModel>();
/**
* Use to modify a shared folder or share an existing folder.
*
* @param folderParentName the folder parent name
* @param folder the folder
* @param eventBus the event bus
* @param userStore the user store
* @param folderParentName
* the folder parent name
* @param folder
* the folder
* @param eventBus
* the event bus
* @param userStore
* the user store
*/
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus, UserStore userStore) {
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus,
UserStore userStore) {
initUserStore(userStore);
initLayout(folderParentName);
this.parentFolder = folder;
this.setIcon(Resources.getIconShareFolder());
this.parentFolder = folder;
this.setIcon(Resources.getIconShareFolder());
setWidth(widthDialog);
setButtons(Dialog.OKCANCEL);
setHeading("Share folder: "+folder.getName());
setWidth(widthDialog);
setButtons(Dialog.OKCANCEL);
setHeading("Share folder: " + folder.getName());
txtName = new TextField<String>();
txtName.setAllowBlank(false);
txtName.setValue(folder.getName());
txtName.setReadOnly(true);
txtName.setAutoValidate(true);
txtName.setFieldLabel("Folder Name");
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
txtName = new TextField<String>();
txtName.setAllowBlank(false);
txtName.setValue(folder.getName());
txtName.setReadOnly(true);
txtName.setAutoValidate(true);
txtName.setFieldLabel("Folder Name");
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
txtOwner = new TextField<String>();
txtOwner.setAllowBlank(true);
txtOwner.setValue("");
txtOwner.setReadOnly(true);
txtOwner.setAutoValidate(false);
txtOwner.setFieldLabel("Owner");
txtOwner = new TextField<String>();
txtOwner.setAllowBlank(true);
txtOwner.setValue("");
txtOwner.setReadOnly(true);
txtOwner.setAutoValidate(false);
txtOwner.setFieldLabel("Owner");
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
textAreaDescription.setHeight(heightTextArea);
textAreaDescription.setWidth(380);
textAreaDescription.setValue(folder.getDescription());
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
textAreaDescription.setHeight(heightTextArea);
textAreaDescription.setWidth(380);
textAreaDescription.setValue(folder.getDescription());
final LayoutContainer lc = new LayoutContainer();
lc.setStyleAttribute("margin-top", "10px");
lc.setStyleAttribute("margin-bottom", "10px");
lc.setSize(480, 50);
final LayoutContainer lc = new LayoutContainer();
lc.setStyleAttribute("margin-top", "10px");
lc.setStyleAttribute("margin-bottom", "10px");
lc.setSize(480, 50);
final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("userssuggest");
Label labelShareWith = new Label("Share with users");
flexTable.setWidget(0, 0, labelShareWith);
flexTable.setWidget(0, 1, suggestPanel);
final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("userssuggest");
Label labelShareWith = new Label("Share with users");
flexTable.setWidget(0, 0, labelShareWith);
flexTable.setWidget(0, 1, suggestPanel);
buttonMultiDrag.setStyleName("wizardButton");
buttonMultiDrag.setStyleName("wizardButton");
flexTable.setWidget(1, 0, new Label("Add more"));
flexTable.setWidget(1, 1, buttonMultiDrag);
flexTable.setWidget(1, 0, new Label("Add more"));
flexTable.setWidget(1, 1, buttonMultiDrag);
Label labelDescription = new Label("Description");
flexTable.setWidget(2, 0, labelDescription);
flexTable.setWidget(2, 1, textAreaDescription);
Label labelDescription = new Label("Description");
flexTable.setWidget(2, 0, labelDescription);
flexTable.setWidget(2, 1, textAreaDescription);
hpPermission = new HorizontalPanel();
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
Label labelProperty = new Label("Permissions");
hpPermission.add(labelProperty);
hpPermission = new HorizontalPanel();
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
Label labelProperty = new Label("Permissions");
hpPermission.add(labelProperty);
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
@Override
public void onSuccess(List<WorkspaceACL> result) {
permission = new PanelTogglePermission(result);
//ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM HL
if(folder.isShared())
// ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM
// HL
if (folder.isShared())
selectAclForFolder(folder);
hpPermission.add(permission);
@ -146,30 +148,30 @@ public class DialogShareFolder extends Dialog {
}
});
lc.add(flexTable);
if(hpPermission!=null)
lc.add(hpPermission);
lc.add(flexTable);
if (hpPermission != null)
lc.add(hpPermission);
lc.mask();
lc.mask();
userStore.getOwner(folder.getIdentifier(), new AsyncCallback<InfoContactModel>() {
userStore.getOwner(folder.getIdentifier(), new AsyncCallback<InfoContactModel>() {
@Override
public void onFailure(Throwable caught) {
txtOwner.setValue("Error on retrieving Owner");
txtOwner.setValue("Error on retrieving Owner");
}
@Override
public void onSuccess(InfoContactModel result) {
GWT.log("getOwner returned: "+result);
shareOwner = result;
if(shareOwner!=null)
txtOwner.setValue(shareOwner.getName());
//IF THE FOLDER IS NOT SHARED, CHECKS PERMISSIONS
if(!folder.isShared())
permissionControl(result.getLogin(), true);
GWT.log("getOwner returned: " + result);
shareOwner = result;
if (shareOwner != null)
txtOwner.setValue(shareOwner.getName());
// IF THE FOLDER IS NOT SHARED, CHECKS PERMISSIONS
if (!folder.isShared())
permissionControl(result.getLogin(), true);
fillRecipientAlreadyShared(folder.getIdentifier(), lc);
fillRecipientAlreadyShared(folder.getIdentifier(), lc);
}
});
@ -178,7 +180,7 @@ public class DialogShareFolder extends Dialog {
@Override
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);
hpPermission.unmask();
}
@ -190,25 +192,26 @@ public class DialogShareFolder extends Dialog {
}
};
if(folder.isShared())
if (folder.isShared())
getUsersManagers(folder.getIdentifier(), callback);
setFocusWidget(suggestPanel.getBox());
add(txtName);
add(txtOwner);
setFocusWidget(suggestPanel.getBox());
add(txtName);
add(txtOwner);
add(lc);
addListners();
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
enableFormDialog(false); // FORM IS DISABLED BY DEFAULT
this.show();
this.show();
}
/**
* 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.suggestPanel = new MultiValuePanel(userStore);
}
@ -216,46 +219,50 @@ public class DialogShareFolder extends Dialog {
/**
* Update recipient of share.
*
* @param listContacts the list contacts
* @param listContacts
* the list contacts
*/
private void updateRecipientOfShare(List<InfoContactModel> listContacts){
private void updateRecipientOfShare(List<InfoContactModel> listContacts) {
suggestPanel.resetItemSelected();
for (InfoContactModel contact : listContacts){
if(contact!=null && contact.getName()!=null){
if(!isShareOwner(contact)) //skip owner
for (InfoContactModel contact : listContacts) {
if (contact != null && contact.getName() != null) {
if (!isShareOwner(contact)) // skip owner
suggestPanel.addRecipient(contact.getName(), true);
else
suggestPanel.addRecipient(contact.getName(), false); //owner is not deletable
}
suggestPanel.addRecipient(contact.getName(), false); // owner
// is
// not
// deletable
}
}
}
/**
* Fill recipient already shared.
*
* @param folderId the folder id
* @param lc the lc
* @param folderId
* the folder id
* @param lc
* the lc
*/
private void fillRecipientAlreadyShared(String folderId, final LayoutContainer lc) {
userStore.getListSharedUserByFolderId(folderId,
new AsyncCallback<List<InfoContactModel>>() {
userStore.getListSharedUserByFolderId(folderId, new AsyncCallback<List<InfoContactModel>>() {
@Override
public void onSuccess(List<InfoContactModel> listContacts) {
@Override
public void onSuccess(List<InfoContactModel> listContacts) {
if (listContacts != null) {
listAlreadyShared.addAll(listContacts);
updateRecipientOfShare(listContacts);
}
lc.unmask();
if (listContacts != null) {
listAlreadyShared.addAll(listContacts);
updateRecipientOfShare(listContacts);
}
lc.unmask();
}
@Override
public void onFailure(Throwable caught) {
lc.unmask();
}
@Override
public void onFailure(Throwable caught) {
lc.unmask();
}
});
}
@ -263,17 +270,23 @@ public class DialogShareFolder extends Dialog {
/**
* Permission control.
*
* @param owner the owner
* @param showAlert the show alert
* @param owner
* the owner
* @param showAlert
* the show alert
*/
private void permissionControl(String owner, boolean showAlert){
GWT.log("Permission control compare between owner: "+owner +" and my login: "+AppControllerExplorer.myLogin);
private void permissionControl(String owner, boolean showAlert) {
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);
if(showAlert)
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not owner of \""+txtName.getValue()+"\"", null);
}else{
if (showAlert)
new MessageBoxAlert("Permission denied",
"You have no permissions to change sharing. You are not owner of \"" + txtName.getValue()
+ "\"",
null);
} else {
enableFormDialog(true);
}
}
@ -281,14 +294,15 @@ public class DialogShareFolder extends Dialog {
/**
* Enable form dialog.
*
* @param bool the bool
* @param bool
* the bool
*/
private void enableFormDialog(boolean bool){
getButtonById(Dialog.OK).setEnabled(bool);
buttonMultiDrag.setEnabled(bool);
textAreaDescription.setEnabled(bool);
if(permission!=null)
permission.setEnabled(bool);
private void enableFormDialog(boolean bool) {
getButtonById(Dialog.OK).setEnabled(bool);
buttonMultiDrag.setEnabled(bool);
textAreaDescription.setEnabled(bool);
if (permission != null)
permission.setEnabled(bool);
}
@ -304,77 +318,81 @@ public class DialogShareFolder extends Dialog {
/**
* Inits the layout.
*
* @param folderParentName the folder parent name
* @param folderParentName
* the folder parent name
*/
public void initLayout(String folderParentName){
public void initLayout(String folderParentName) {
FormLayout layout = new FormLayout();
layout.setLabelWidth(90);
layout.setDefaultWidth(380);
setLayout(layout);
setModal(true);
setScrollMode(Scroll.AUTOY);
setBodyStyle("padding: 9px; background: none");
setWidth(widthDialog);
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER);
setResizable(true);
setButtonAlign(HorizontalAlignment.CENTER);
setButtons(Dialog.OKCANCEL);
layout.setLabelWidth(90);
layout.setDefaultWidth(380);
setLayout(layout);
setModal(true);
setScrollMode(Scroll.AUTOY);
setBodyStyle("padding: 9px; background: none");
setWidth(widthDialog);
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER);
setResizable(true);
setButtonAlign(HorizontalAlignment.CENTER);
setButtons(Dialog.OKCANCEL);
}
/**
* Use to create a new shared folder.
*
* @param folderParentName the folder parent name
* @param eventBus the event bus
* @param userStore the user store
* @param folderParentName
* the folder parent name
* @param eventBus
* the event bus
* @param userStore
* the user store
*/
public DialogShareFolder(String folderParentName, HandlerManager eventBus, UserStore userStore) {
initUserStore(userStore);
initLayout(folderParentName);
this.setIcon(Resources.getIconSharedFolder());
setHeading("Create a new shared folder in: "+folderParentName);
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER-25);
setWidth(widthDialog);
setButtons(Dialog.OKCANCEL);
this.setIcon(Resources.getIconSharedFolder());
setHeading("Create a new shared folder in: " + folderParentName);
setHeight(ConstantsExplorer.HEIGHT_DIALOG_SHARE_FOLDER - 25);
setWidth(widthDialog);
setButtons(Dialog.OKCANCEL);
txtName = new TextField<String>();
txtName.setAllowBlank(false);
txtName.setAutoValidate(true);
txtName.setFieldLabel("Folder Name");
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
// txtName.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
txtName = new TextField<String>();
txtName.setAllowBlank(false);
txtName.setAutoValidate(true);
txtName.setFieldLabel("Folder Name");
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
// txtName.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
textAreaDescription.setHeight(heightTextArea);
textAreaDescription.setWidth(380);
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
textAreaDescription.setHeight(heightTextArea);
textAreaDescription.setWidth(380);
final LayoutContainer lc = new LayoutContainer();
lc.setStyleAttribute("margin-top", "10px");
lc.setStyleAttribute("margin-bottom", "10px");
lc.setSize(480, 50);
final LayoutContainer lc = new LayoutContainer();
lc.setStyleAttribute("margin-top", "10px");
lc.setStyleAttribute("margin-bottom", "10px");
lc.setSize(480, 50);
final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("userssuggest");
Label lableShareWith = new Label("Share with users");
flexTable.setWidget(0, 0, lableShareWith);
flexTable.setWidget(0, 1, suggestPanel);
final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("userssuggest");
Label lableShareWith = new Label("Share with users");
flexTable.setWidget(0, 0, lableShareWith);
flexTable.setWidget(0, 1, suggestPanel);
buttonMultiDrag.setStyleName("wizardButton");
buttonMultiDrag.setStyleName("wizardButton");
flexTable.setWidget(1, 0, new Label("Add more"));
flexTable.setWidget(1, 1, buttonMultiDrag);
flexTable.setWidget(1, 0, new Label("Add more"));
flexTable.setWidget(1, 1, buttonMultiDrag);
Label labelDescription = new Label("Description");
flexTable.setWidget(2, 0, labelDescription);
flexTable.setWidget(2, 1, textAreaDescription);
Label labelDescription = new Label("Description");
flexTable.setWidget(2, 0, labelDescription);
flexTable.setWidget(2, 1, textAreaDescription);
hpPermission = new HorizontalPanel();
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
Label labelProperty = new Label("Permissions");
hpPermission.add(labelProperty);
hpPermission = new HorizontalPanel();
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
Label labelProperty = new Label("Permissions");
hpPermission.add(labelProperty);
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
@Override
public void onSuccess(List<WorkspaceACL> result) {
@ -392,36 +410,34 @@ public class DialogShareFolder extends Dialog {
}
});
lc.add(flexTable);
lc.add(hpPermission);
lc.add(flexTable);
lc.add(hpPermission);
setFocusWidget(txtName);
add(txtName);
setFocusWidget(txtName);
add(txtName);
add(lc);
addListners();
this.show();
this.show();
}
/**
* Gets the shared list users.
*
* @return the shared list users
*/
public List<InfoContactModel> getSharedListUsers() {
// printSelectedUser();
// printSelectedUser();
return suggestPanel.getSelectedUser();
}
/**
* 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
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
public void componentSelected(ButtonEvent ce) {
if(isValidForm(false))
if (isValidForm(false))
hide();
}
});
buttonMultiDrag.addClickHandler(new ClickHandler() {
buttonMultiDrag.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final MultiDragContact multiDrag = new MultiDragContact();
multiDrag.show();
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
List<InfoContactModel> exclusiveContacts = userStore
.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
multiDrag.addSourceContacts(exclusiveContacts);
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
// if(!listAlreadyShared.contains(infoContactModel))
if(!isShareOwner(infoContactModel))
// if(!listAlreadyShared.contains(infoContactModel))
if (!isShareOwner(infoContactModel))
multiDrag.addTargetContact(infoContactModel);
}
@ -461,64 +477,65 @@ public class DialogShareFolder extends Dialog {
@Override
public void componentSelected(ButtonEvent ce) {
// initSuggestContacts();
// initSuggestContacts();
suggestPanel.resetItemSelected();
//SHARE OWNER IS NULL IN CASE OF NEW SHARE
if(shareOwner!=null)
suggestPanel.addRecipient(shareOwner.getName(),false);
// SHARE OWNER IS NULL IN CASE OF NEW SHARE
if (shareOwner != null)
suggestPanel.addRecipient(shareOwner.getName(), false);
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
suggestPanel.addRecipient(infoContactModel.getName(),true);
}
suggestPanel.addRecipient(infoContactModel.getName(), true);
}
suggestPanel.boxSetFocus();
// printSelectedUser();
// printSelectedUser();
}
});
}
});
}
/**
* Checks if is share owner.
*
* @param infoContactModel the info contact model
* @param infoContactModel
* the info contact model
* @return true, if is share owner
*/
public boolean isShareOwner(InfoContactModel infoContactModel){
public boolean isShareOwner(InfoContactModel infoContactModel) {
if(infoContactModel!=null && shareOwner!=null && InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner)==0)
if (infoContactModel != null && shareOwner != null
&& InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner) == 0)
return true;
return false;
}
/**
* List already shared contains.
*
* @param contact the contact
* @param contact
* the contact
* @return true, if successful
*/
private boolean listAlreadySharedContains(InfoContactModel contact){
private boolean listAlreadySharedContains(InfoContactModel contact) {
if(contact==null)
if (contact == null)
return false;
for (InfoContactModel ct : listAlreadyShared) {
if(InfoContactModel.COMPARATORLOGINS.compare(ct, contact)==0)
// if(ct.getLogin().compareTo(contact.getLogin())==0)
if (InfoContactModel.COMPARATORLOGINS.compare(ct, contact) == 0)
// if(ct.getLogin().compareTo(contact.getLogin())==0)
return true;
}
return false;
}
//DEBUG
// DEBUG
/**
* Prints the selected user.
*/
@SuppressWarnings("unused")
private void printSelectedUser(){
private void printSelectedUser() {
System.out.println("SELETECTED USERS: ");
for (InfoContactModel contact : suggestPanel.getSelectedUser())
@ -529,7 +546,7 @@ public class DialogShareFolder extends Dialog {
* Inits the suggest contacts.
*/
@SuppressWarnings("unused")
private void initSuggestContacts(){
private void initSuggestContacts() {
suggestPanel.resetItemSelected();
for (InfoContactModel contact : listAlreadyShared)
suggestPanel.addRecipient(contact.getName(), false);
@ -550,7 +567,7 @@ public class DialogShareFolder extends Dialog {
* @return the description
*/
public String getDescription() {
if(textAreaDescription.getValue()==null)
if (textAreaDescription.getValue() == null)
return "";
return textAreaDescription.getValue();
@ -559,20 +576,21 @@ public class DialogShareFolder extends Dialog {
/**
* Checks if is valid form.
*
* @param displayAlert the display alert
* @param displayAlert
* the display alert
* @return true, if is valid form
*/
public boolean isValidForm(boolean displayAlert){
public boolean isValidForm(boolean displayAlert) {
if(!txtName.isValid()){
if(displayAlert)
if (!txtName.isValid()) {
if (displayAlert)
new MessageBoxAlert("Attention", "Name must not be empty", null);
txtName.focus();
return false;
}
if(getSharedListUsers().size()==0){
if(displayAlert)
if (getSharedListUsers().size() == 0) {
if (displayAlert)
new MessageBoxAlert("Attention", "You must pick at least one user with which share the folder", null);
suggestPanel.boxSetFocus();
return false;
@ -587,8 +605,8 @@ public class DialogShareFolder extends Dialog {
*
* @return the selected acl
*/
public WorkspaceACL getSelectedACL(){
if(permission!=null)
public WorkspaceACL getSelectedACL() {
if (permission != null)
return permission.getSelectedACL();
return null;
}
@ -596,82 +614,95 @@ public class DialogShareFolder extends Dialog {
/**
* Select acl for folder.
*
* @param folder the folder
* @param folder
* the folder
*/
private void selectAclForFolder(FileModel folder){
GWT.log("Loading ACL to: "+folder);
WorkspaceSharingServiceAsync.INSTANCE.getACLsForSharedFolderId(folder.getIdentifier(), new AsyncCallback<WorkspaceACL>() {
private void selectAclForFolder(FileModel folder) {
GWT.log("Loading ACL to: " + folder);
WorkspaceSharingServiceAsync.INSTANCE.getACLsForSharedFolderId(folder.getIdentifier(),
new AsyncCallback<WorkspaceACL>() {
@Override
public void onFailure(Throwable arg0) {
GWT.log("An error occurred on selecting current ACL "+arg0);
@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);
permission.selectACL(arg0);
hpPermission.layout();
layout();
}
});
@Override
public void onSuccess(WorkspaceACL arg0) {
GWT.log("Loaded ACL " + arg0);
permission.selectACL(arg0);
hpPermission.layout();
layout();
}
});
}
/**
* Gets the users managers.
*
* @param sharedFolderId the shared folder id
* @param callback the callback
* @return the users managers
*
* @param sharedFolderId
* share folder id
* @param callback
* list of contacts
*/
public void getUsersManagers(final String sharedFolderId,final AsyncCallback<List<InfoContactModel>> callback) {
public void getUsersManagers(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback) {
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
WorkspaceSharingServiceAsync.INSTANCE.getAdministratorsByFolderId(sharedFolderId,
new AsyncCallback<List<InfoContactModel>>() {
@Override
public void onFailure(Throwable arg0) {
GWT.log("an error occured in getting user managers by Id "+sharedFolderId + " "+arg0.getMessage());
new MessageBoxAlert("Alert", "Sorry, an error occurred on getting users managers, try again later",null);
@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);
@Override
public void onSuccess(List<InfoContactModel> listManagers) {
callback.onSuccess(listManagers);
}
});
}
});
}
/**
* Permission control.
*
* @param listManagers the list managers
* @param showAlert the show alert
* @param folder the folder
* @param listManagers
* the list managers
* @param showAlert
* the show alert
* @param folder
* the folder
*/
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert, FileModel folder){
private void permissionControl(List<InfoContactModel> listManagers, boolean showAlert, FileModel folder) {
boolean permissionsOk = false;
for (InfoContactModel infoContactModel : listManagers) {
GWT.log("DialogPermission control compare between : "+infoContactModel.getLogin() +" and my login: "+AppControllerExplorer.myLogin);
if(AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin())==0){
GWT.log("DialogPermission control compare between : " + infoContactModel.getLogin() + " and my login: "
+ AppControllerExplorer.myLogin);
if (AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin()) == 0) {
permissionsOk = true;
break;
}
}
if(permissionsOk){
if (permissionsOk) {
enableFormDialog(true);
}else{
} else {
enableFormDialog(false);
if(showAlert)
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not manager of \""+folder.getName()+"\"", null);
if (showAlert)
new MessageBoxAlert("Permission denied",
"You have no permissions to change sharing. You are not manager of \"" + folder.getName()
+ "\"",
null);
}
}

View File

@ -39,7 +39,7 @@ public class DialogPermission extends Dialog {
private FileModel folder;
private DialogPermission INSTANCE = this;
public FileModel getParentFolder() {
return parentFolder;
}
@ -63,36 +63,38 @@ public class DialogPermission extends Dialog {
/**
* Use to set permission to VRE Folder
*
* @param folder
* folder
*/
public DialogPermission(FileModel folder) {
this.folder = folder;
Label labelProperty = new Label("Permissions");
hpPermission.add(labelProperty);
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
hpPermission.mask("Checking authorization");
AsyncCallback<List<InfoContactModel>> callback = new AsyncCallback<List<InfoContactModel>>() {
@Override
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();
}
@Override
public void onSuccess(List<InfoContactModel> listManagers) {
permissionControl(listManagers, true);
hpPermission.unmask();
permissionControl(listManagers, true);
hpPermission.unmask();
}
};
getUsersManagers(folder.getIdentifier(), callback);
//TODO GET ACL FOR USER
// TODO GET ACL FOR USER
WorkspaceSharingServiceAsync.INSTANCE.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
@Override
@ -105,7 +107,7 @@ public class DialogPermission extends Dialog {
@Override
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() {
this.getButtonById(Dialog.CANCEL).addSelectionListener(
new SelectionListener<ButtonEvent>() {
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
});
this.getButtonById(Dialog.OK).addSelectionListener(
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>() {
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void onFailure(Throwable caught) {
INSTANCE.hide();
new MessageBoxAlert("Error", caught.getMessage(),null);
}
@Override
public void componentSelected(ButtonEvent ce) {
@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()));
}
});
}
INSTANCE.mask("Changing permissions");
if (folder != null && getSelectedACL().getId() != null) {
WorkspaceSharingServiceAsync.INSTANCE.updateACLForVREbyGroupName(folder.getIdentifier(),
getSelectedACL().getId(), new AsyncCallback<Void>() {
@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;
for (InfoContactModel infoContactModel : listManagers) {
GWT.log("DialogPermission control compare between : "+infoContactModel.getLogin() +" and my login: "+AppControllerExplorer.myLogin);
if(AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin())==0){
GWT.log("DialogPermission control compare between : " + infoContactModel.getLogin() + " and my login: "
+ AppControllerExplorer.myLogin);
if (AppControllerExplorer.myLogin.compareToIgnoreCase(infoContactModel.getLogin()) == 0) {
permissionsOk = true;
break;
}
}
if(permissionsOk){
if (permissionsOk) {
enableFormDialog(true);
}else{
} else {
enableFormDialog(false);
if(showAlert)
new MessageBoxAlert("Permission denied", "You have no permissions to change sharing. You are not manager of \""+folder.getName()+"\"", null);
if (showAlert)
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(){
if(permission!=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() {
if (permission != null)
return permission.getSelectedACL();
return null;
}
}

View File

@ -26,11 +26,10 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The Class DialogEditProperties.
*
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
* Jun 11, 2015
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it Jun 11, 2015
*/
public class DialogEditProperties extends Dialog{
public class DialogEditProperties extends Dialog {
private FileModel item;
private int widthDialog = 450;
private int heigthDialog = 300;
@ -41,8 +40,10 @@ public class DialogEditProperties extends Dialog{
/**
* Instantiates a new dialog edit properties.
*
* @param itemId
* the item id
* @param item
* FileModel
* @param command
* Command
*/
public DialogEditProperties(FileModel item, Command command) {
this.item = item;
@ -53,7 +54,7 @@ public class DialogEditProperties extends Dialog{
layout.setDefaultWidth(300);
setLayout(layout);
setHeading("Edit Properties: "+item.getName());
setHeading("Edit Properties: " + item.getName());
setButtonAlign(HorizontalAlignment.RIGHT);
setModal(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()
*/
@Override
@ -83,68 +85,69 @@ public class DialogEditProperties extends Dialog{
loadGcubeItemProperties();
super.show();
}
/**
*
*/
private void resetForm() {
if(fields!=null)
if (fields != null)
fields.clear();
fields = null;
removeAll();
}
private void saveProperties(final boolean closeOnSuccess){
Map<String,String> prp = new HashMap<String, String>(fields.size());
private void saveProperties(final boolean closeOnSuccess) {
Map<String, String> prp = new HashMap<String, String>(fields.size());
for (TextField<String> field : fields) {
String value = field.getValue()!=null?field.getValue():"";
String value = field.getValue() != null ? field.getValue() : "";
prp.put(field.getFieldLabel(), value);
}
AppControllerExplorer.rpcWorkspaceService.setGcubeItemProperties(item.getIdentifier(), prp, new AsyncCallback<Void>() {
AppControllerExplorer.rpcWorkspaceService.setGcubeItemProperties(item.getIdentifier(), prp,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", caught.getMessage(), null);
}
@Override
public void onFailure(Throwable caught) {
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(){
// mask("Loading properties...");
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(), new AsyncCallback<Map<String,String>>() {
@Override
public void onSuccess(Map<String, String> result) {
// unmask();
setProperties(result);
}
@Override
public void onSuccess(Map<String, String> result) {
// unmask();
setProperties(result);
}
@Override
public void onFailure(Throwable caught) {
// unmask();
GWT.log("an error occured in loadGcubeItemProperties "+item + " "+caught.getMessage());
}
});
@Override
public void onFailure(Throwable caught) {
// unmask();
GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
}
});
}
private void setProperties(Map<String, String> result) {
fields = new ArrayList<TextField<String>>(result.size());
for (String key: result.keySet()) {
for (String key : result.keySet()) {
TextField<String> field = new TextField<String>();
field.setFieldLabel(key);
field.setValue(result.get(key));
add(field);
fields.add(field);
add(field);
fields.add(field);
}
layout(true);
}

View File

@ -7,28 +7,30 @@ import com.extjs.gxt.ui.client.widget.InfoConfig;
* @author Francesco Mangiacrapa francesco.mangiacrapaATisti.cnr.it
*
*/
public class InfoDisplay extends Info{
public class InfoDisplay extends Info {
/**
*
* @param title
* title
* @param text
* @param milliseconds - The time in milliseconds to display a message (defaults to 2500).
*/
public InfoDisplay(String title, String text, int milliseconds){
* text
* @param milliseconds
* milliseconds
*/
public InfoDisplay(String title, String text, int milliseconds) {
InfoConfig config = new InfoConfig(title, text);
config.display = milliseconds;
Info.display(config);
}
public InfoDisplay(String title, String text){
public InfoDisplay(String title, String text) {
Info.display(title, text);
}
}

View File

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