ref 17169: Selection of users in the Sharing panel

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

Added support to workspace users discovery by VREs

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@181370 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-07-30 17:01:21 +00:00
parent 61486dc721
commit d66d46fc39
1 changed files with 24 additions and 20 deletions

View File

@ -4,9 +4,11 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.ContactFetcher;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
@ -44,7 +46,6 @@ public class MultiValuePanel extends Composite {
private SuggestBox box;
// private ContactFetcher userFetch;
private ServerMultiWordSuggestOracle oracle = new ServerMultiWordSuggestOracle(); // ORACLE
/**
* Instantiates a new multi value panel.
@ -139,29 +140,32 @@ public class MultiValuePanel extends Composite {
*/
private void chosenContactItem(InfoContactModelSuggestion suggest, final TextBox itemBox, final BulletList list) {
if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) {
final ListItem displayItem = new ListItem();
displayItem.setStyleName("multivalue-panel-token-ws");
Paragraph p = new Paragraph(suggest.getInfoContactModel().getName());
if (users.containsKey(suggest.getInfoContactModel().getName())) {
GWT.log("User already selected: " + suggest.getInfoContactModel().getName());
MessageBox.alert("Attention", "The user selected is already present in the list.", null);
itemBox.setValue("");
} else {
GWT.log("Adding selected user: " + suggest.getInfoContactModel().getName());
users.put(suggest.getInfoContactModel().getName(), suggest.getInfoContactModel());
Span span = new Span("x");
span.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
removeListItem(displayItem, list);
}
});
final ListItem displayItem = new ListItem();
displayItem.setStyleName("multivalue-panel-token-ws");
Paragraph p = new Paragraph(suggest.getInfoContactModel().getName());
displayItem.add(p);
displayItem.add(span);
Span span = new Span("x");
span.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
removeListItem(displayItem, list);
}
});
// original value of the item selected
GWT.log("Adding selected user '" + suggest.getInfoContactModel().getName());
// itemsSelected.add(itemBox.getValue());
// GWT.log("Total: " + itemsSelected);
users.put(suggest.getInfoContactModel().getName(), suggest.getInfoContactModel());
displayItem.add(p);
displayItem.add(span);
list.insert(displayItem, list.getWidgetCount() - 1);
itemBox.setValue("");
itemBox.setFocus(true);
list.insert(displayItem, list.getWidgetCount() - 1);
itemBox.setValue("");
itemBox.setFocus(true);
}
}
}