From 8d128da470e483a31379cba39154528f8f6d86ce Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Mon, 9 Jan 2017 14:29:46 +0000 Subject: [PATCH] Updated pom version at 6.15.2 Updated Share and UserStore behaviours git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@141488 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 8 +++++ pom.xml | 2 +- .../user/workspace/client/util/MaskPanel.java | 36 +++++++++++++++++++ .../sharing/multisuggest/MultiValuePanel.java | 30 +++++++++++++--- .../user/workspace/public/workspacetree.css | 5 +++ .../workspace/server/GWTWorkspaceBuilder.java | 7 ++++ 6 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/util/MaskPanel.java diff --git a/distro/changelog.xml b/distro/changelog.xml index 4cccabd..432e61d 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,12 @@ + + Added a loader on share window when contacts are loading from server + + + Removed message box shown in case of failure on getAllContatcs + [Feature #5873] Remove ASL Session from the Workspace and its components diff --git a/pom.xml b/pom.xml index eec1c9f..3dcf7ee 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.portlets.user workspace-tree-widget - 6.15.1-SNAPSHOT + 6.15.2-SNAPSHOT gCube Workspace Tree Widget gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/util/MaskPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/util/MaskPanel.java new file mode 100644 index 0000000..299cd71 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/util/MaskPanel.java @@ -0,0 +1,36 @@ +/** + * + */ +package org.gcube.portlets.user.workspace.client.util; + +import org.gcube.portlets.user.workspace.client.resources.Resources; + +import com.github.gwtbootstrap.client.ui.Label; +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.Image; + + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Jan 9, 2017 + */ +public class MaskPanel extends FlowPanel{ + + private HorizontalPanel hp = new HorizontalPanel(); + private Image loading = Resources.getIconLoading().createImage(); + private Label label = new Label(); + + /** + * + */ + public MaskPanel(String msg) { + msg = msg!=null &&!msg.isEmpty()?msg:"Loading..."; + label.setText(msg); + //label.getElement().getStyle().setMarginRight(2.0, Unit.PX); + hp.add(label); + hp.add(loading); + add(hp); + } +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/sharing/multisuggest/MultiValuePanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/sharing/multisuggest/MultiValuePanel.java index f16a851..a5cacc1 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/sharing/multisuggest/MultiValuePanel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/sharing/multisuggest/MultiValuePanel.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import org.gcube.portlets.user.workspace.client.model.InfoContactModel; +import org.gcube.portlets.user.workspace.client.util.MaskPanel; import org.gcube.portlets.user.workspace.client.view.sharing.ContactFetcher; import com.google.gwt.core.client.GWT; @@ -15,6 +16,7 @@ import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.user.client.Random; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; @@ -28,6 +30,7 @@ import com.google.gwt.user.client.ui.TextBox; * * @author Massimiliano Assante, ISTI-CNR * @version 0.2 Gen 2013 modified by Francesco Mangiacrapa + * @version 0.3 Gen 2017 modified by Francesco Mangiacrapa * Facebook style autocompleter */ public class MultiValuePanel extends Composite { @@ -41,6 +44,7 @@ public class MultiValuePanel extends Composite { private SuggestBox box; private ContactFetcher userFetch; private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); + private MaskPanel mask = new MaskPanel("Loading Contacts..."); /** * Instantiates a new multi value panel. @@ -50,6 +54,7 @@ public class MultiValuePanel extends Composite { public MultiValuePanel(ContactFetcher userFetch) { this.userFetch = userFetch; initWidget(panel); + this.getElement().setId("MultiValuePanel_"+Random.nextInt()); panel.setWidth("100%"); listBullet.setStyleName("multivalue-panel-suggest"); final ListItem item = new ListItem(); @@ -57,6 +62,7 @@ public class MultiValuePanel extends Composite { itemBox.getElement().setAttribute("autocomplete", "off"); itemBox.getElement().setAttribute("style", "outline-color: -moz-use-text-color; outline-style: none; outline-width: medium; border: none;"); + maskSuggestionPanel(true); box = new SuggestBox(getSuggestions(), itemBox); item.add(box); listBullet.add(item); @@ -97,6 +103,7 @@ public class MultiValuePanel extends Composite { panel.add(listBullet); box.getElement().setId("suggestion_box"); //needed for the focus on click panel.getElement().setAttribute("onclick", "document.getElementById('suggestion_box').focus()"); + } /** @@ -116,6 +123,23 @@ public class MultiValuePanel extends Composite { return panel; } + private void maskSuggestionPanel(boolean bool){ + + try{ + if(bool){ + GWT.log("Disabling panel suggestion"); + this.getElement().addClassName("disabledDIV"); + panel.add(mask); + }else{ + GWT.log("Enabling panel suggestion"); + this.getElement().removeClassName("disabledDIV"); + panel.remove(mask); + } + }catch(Exception e){ + GWT.log("error: "+e.getMessage()); + } + } + /** * actually insert the contact in the flow panel. * @@ -212,18 +236,16 @@ public class MultiValuePanel extends Composite { @Override public void onFailure(Throwable caught) { - + maskSuggestionPanel(false); } @Override public void onSuccess(List result) { - + maskSuggestionPanel(false); users.clear(); - for (InfoContactModel wsUser : result) { oracle.add(wsUser.getName()); users.put(wsUser.getName(), wsUser); - } } }; diff --git a/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css b/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css index 2931b8c..520c7ce 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css +++ b/src/main/java/org/gcube/portlets/user/workspace/public/workspacetree.css @@ -253,6 +253,11 @@ table.userssuggest th { cursor: pointer; } +.disabledDIV{ + pointer-events: none; + opacity: 0.5; +} + /** For the data catalogue modal **/ .insert-metadata-modal-style { width: 1200px !important; diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java index 21e503e..d0357fe 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java @@ -127,6 +127,13 @@ public class GWTWorkspaceBuilder { hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",false)); hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",false)); +// try{ +// logger.info("Sleeping for testing..."); +// Thread.sleep(30000); +// logger.info("Alive again"); +// }catch(Exception e){ +// +// } //GROUPS // hashTestUser.put("/gcube/devsec/devVRE", new InfoContactModel("/gcube/devsec/devVRE", "/gcube/devsec/devVRE", "",true)); // hashTestUser.put("/gcube/devsec/gcube-test-test", new InfoContactModel("/gcube/devsec/gcube-test-test", "/gcube/gcube-test-test", "",true));