Как получить доступ к именам вкладок веб-плеера Spotfire в Vaadin? - PullRequest
0 голосов
/ 20 июня 2019

Уведомление в веб-приложении Vaadin должно быть настраиваемым сообщением, связанным с текущей вкладкой в ​​веб-проигрывателе Spotfire.

Vaadin версия - 7.7.7

Версия для веб-плеера Sportfire - 7,7

В коде Vaadin есть setDoumentProperty (), который устанавливает свойство в Spotfire, которое запускает скрипт для обновления страницы в веб-плеере. SetDocumentProperty () определен в коде JavaScript веб-плеера вместе с getDocumentProperty (), мне нужно знать, связана ли функция get в Vaadin с кодом JavaScript в веб-плеере и как я могу реализовать getDoumentProperty () от веб-плеера Spotfire.

Dispo.java

spotfirePage.getVisualizationComponent().getSpotfireFrame().setDocumentProperty("RefreshActivities",new Long(System.currentTimeMillis()).toString());

SpotfireFrame.class

public void setDocumentProperty(String docPropName, String docPropVal)
{ 
getRpcProxy(SpotfireFrameClientRPC.class).setDocumentProperty(docPropName,docPropVal);
}

AbstractClientConnector.class

protected <T extends ClientRpc> T getRpcProxy(final Class<T> rpcInterface) {
        // create, initialize and return a dynamic proxy for RPC
        try {
            if (!rpcProxyMap.containsKey(rpcInterface)) {
                Class<?> proxyClass = Proxy.getProxyClass(
                        rpcInterface.getClassLoader(), rpcInterface);
                Constructor<?> constructor = proxyClass
                        .getConstructor(InvocationHandler.class);
                T rpcProxy = rpcInterface.cast(constructor
                        .newInstance(new RpcInvocationHandler(rpcInterface)));
                // cache the proxy
                rpcProxyMap.put(rpcInterface, rpcProxy);
            }
            return (T) rpcProxyMap.get(rpcInterface);
        } catch (Exception e) {
            // TODO exception handling?
            throw new RuntimeException(e);
        }
    }

SpotfireFrameClient.class

public interface SpotfireFrameClientRPC extends ClientRpc {

        public void setDocumentProperty(String documentPropertyName, String documentPropertyValue);

}

Веб-плеер-api.js

spotfire.webPlayer.Document.prototype.setDocumentProperty = function(propertyName, propertyValue)
{
    /// <summary>Set the value of a property.</summary>
    /// <param name="propertyName" type="string">The name of the property.</param>
    /// <param name="propertyValue" type="object">The value of the property.</param>

    this._document._executeApiMethod(['webPlayerProxy','analysisDocumentProxy','setDocumentProperty'], arguments);
};

spotfire.webPlayer.Document.prototype.getDocumentProperty = function(propertyName, callback)
{
    /// <summary>Get the information about the property with given name.</summary>
    /// <param name="propertyName" type="string">The name of the property.</param>
    /// <param name="callback" type="function">A callback function with the following signature: function(property) {}.</param>

    this._document._executeApiMethod(['webPlayerProxy','analysisDocumentProxy','getDocumentProperty'], arguments);
};
...