sending message via dom for explore_vres_landing_page

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@146690 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-04-07 14:16:32 +00:00
parent 3e130d6ae6
commit 5011dbc176
1 changed files with 15 additions and 5 deletions

View File

@ -21,6 +21,7 @@ import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.Window;
@ -216,7 +217,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
rootPanel.add(this);
updateSize();
// listen for DOM messages
listenForPostMessage();
// send message about gateway url
JSONObject obj = new JSONObject();
String landingPageVREs = Window.Location.getProtocol() + "//" + Window.Location.getHostName() + "/explore";
JSONString value = new JSONString(landingPageVREs);
obj.put("explore_vres_landing_page", value);
postMessage(obj.toString());
}
public static String getLatestSelectedProductIdentifier(){
@ -320,12 +329,13 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
/**
* Post message.
*
* @param msg the msg
* @param msg the msg (as json)
*/
protected native void postMessage(String msg) /*-{
console.log("Sending message " + msg);
$wnd.postMessage(msg, "*");
}-*/;
/**
* Print a message
* @param string
@ -344,7 +354,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
that.@org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel::onPostMessage(Ljava/lang/String;Ljava/lang/String;)(msg.data, msg.origin);
});
}-*/;
/**
* On post message.
*
@ -434,13 +444,13 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
return ckanAccessPoint.getBaseUrlWithContext();
}
/**
* Return the catalogue url (e.g. http://ckan-d-d4s.d4science.org:443/)
* @return
*/
public String getCatalogueUrl(){
printString("Base url for iframe is " + ckanAccessPoint.getCatalogueBaseUrl());
return ckanAccessPoint.getCatalogueBaseUrl();
}