|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.PublicLink;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
|
|
|
|
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Alert;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Button;
|
|
|
|
@ -16,6 +16,7 @@ import com.github.gwtbootstrap.client.ui.Tooltip;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.constants.VisibilityChange;
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
|
import com.google.gwt.dom.client.Element;
|
|
|
|
|
import com.google.gwt.dom.client.Style.Unit;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
|
|
import com.google.gwt.event.dom.client.MouseOverEvent;
|
|
|
|
@ -26,6 +27,7 @@ import com.google.gwt.user.client.Random;
|
|
|
|
|
import com.google.gwt.user.client.Timer;
|
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
|
import com.google.gwt.user.client.ui.Composite;
|
|
|
|
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
|
|
|
import com.google.gwt.user.client.ui.Label;
|
|
|
|
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
|
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
|
|
@ -109,6 +111,9 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
@UiField
|
|
|
|
|
Button showPublicLongLinkButton;
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
HTMLPanel info_panel;
|
|
|
|
|
|
|
|
|
|
// @UiField
|
|
|
|
|
// HTMLPanel panelFieldsContainer;
|
|
|
|
|
|
|
|
|
@ -126,6 +131,7 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
+ "with your coworkers, you will enact the users of the group the folder is shared with, "
|
|
|
|
|
+ "to access the file and the shared folder content. Login required";
|
|
|
|
|
|
|
|
|
|
private LoaderIcon loadingIcon = new LoaderIcon("loading...");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Interface DialogShareableLinkUiBinder.
|
|
|
|
@ -175,8 +181,9 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showMessage("", false);
|
|
|
|
|
loadingIcon.getElement().getStyle().setMarginBottom(20,Unit.PX);
|
|
|
|
|
showLoadingIcon(true);
|
|
|
|
|
|
|
|
|
|
// alertFilePublicLink.setVisible(true);
|
|
|
|
|
loadAndShowPublicLinksForItem(item);
|
|
|
|
@ -271,7 +278,6 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
privateLongLinkCopyButton.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -382,7 +388,6 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copy to clipboard.
|
|
|
|
|
*
|
|
|
|
@ -399,7 +404,6 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
//alert("Copied the text: " + copyText.value);
|
|
|
|
|
}-*/;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Load and show public links for item.
|
|
|
|
|
*
|
|
|
|
@ -407,11 +411,11 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
*/
|
|
|
|
|
private void loadAndShowPublicLinksForItem(GeoNaItemRef item) {
|
|
|
|
|
|
|
|
|
|
GeoportalDataViewerServiceAsync.Util.getInstance().getPublicLinksFor(item,
|
|
|
|
|
new AsyncCallback<GeoNaItemRef>() {
|
|
|
|
|
GeoportalDataViewerServiceAsync.Util.getInstance().getPublicLinksFor(item, new AsyncCallback<GeoNaItemRef>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(GeoNaItemRef itemReferences) {
|
|
|
|
|
showLoadingIcon(false);
|
|
|
|
|
openPublicLink = itemReferences.getOpenLink();
|
|
|
|
|
restrictedPublicLink = itemReferences.getRestrictedLink();
|
|
|
|
|
String toPublicURL = openPublicLink.getShortURL() != null && !openPublicLink.getShortURL().isEmpty()
|
|
|
|
@ -421,8 +425,8 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
textPublicLink.setValue(toPublicURL);
|
|
|
|
|
textPublicLongLink.setValue(openPublicLink.getCompleteURL());
|
|
|
|
|
|
|
|
|
|
String toPrivateURL = restrictedPublicLink.getShortURL() != null && !restrictedPublicLink.getShortURL().isEmpty()
|
|
|
|
|
? restrictedPublicLink.getShortURL()
|
|
|
|
|
String toPrivateURL = restrictedPublicLink.getShortURL() != null
|
|
|
|
|
&& !restrictedPublicLink.getShortURL().isEmpty() ? restrictedPublicLink.getShortURL()
|
|
|
|
|
: restrictedPublicLink.getCompleteURL();
|
|
|
|
|
|
|
|
|
|
textPrivateLink.setValue(toPrivateURL);
|
|
|
|
@ -431,6 +435,7 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
showLoadingIcon(false);
|
|
|
|
|
openPublicLink = null;
|
|
|
|
|
disableTextBox(textPublicLink);
|
|
|
|
|
disableTextBox(textPrivateLink);
|
|
|
|
@ -439,6 +444,17 @@ public class DialogShareableLink extends Composite {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void showLoadingIcon(boolean show) {
|
|
|
|
|
try {
|
|
|
|
|
if(show)
|
|
|
|
|
info_panel.add(loadingIcon);
|
|
|
|
|
else
|
|
|
|
|
info_panel.remove(loadingIcon);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Disable text box.
|
|
|
|
|
*
|
|
|
|
|