Search in sources :

Example 1 with ScriptSession

use of org.directwebremoting.ScriptSession in project ma-core-public by infiniteautomation.

the class ScriptProxy method addScript.

/**
 * Utility to add the given script to all known browsers.
 * @param script The Javascript to send to the browsers
 */
public void addScript(ScriptBuffer script) {
    for (Iterator it = scriptSessions.iterator(); it.hasNext(); ) {
        ScriptSession scriptSession = (ScriptSession) it.next();
        scriptSession.addScript(script);
    }
}
Also used : Iterator(java.util.Iterator) ScriptSession(org.directwebremoting.ScriptSession)

Example 2 with ScriptSession

use of org.directwebremoting.ScriptSession in project aries by apache.

the class ServerSideClass method addFunctionCall.

private void addFunctionCall(String name, Object... params) {
    final ScriptBuffer script = new ScriptBuffer();
    script.appendScript(name).appendScript("(");
    for (int i = 0; i < params.length; i++) {
        if (i != 0)
            script.appendScript(",");
        script.appendData(params[i]);
    }
    script.appendScript(");");
    Browser.withAllSessions(new Runnable() {

        public void run() {
            for (ScriptSession s : Browser.getTargetSessions()) {
                s.addScript(script);
            }
        }
    });
}
Also used : ScriptSession(org.directwebremoting.ScriptSession) ScriptBuffer(org.directwebremoting.ScriptBuffer)

Aggregations

ScriptSession (org.directwebremoting.ScriptSession)2 Iterator (java.util.Iterator)1 ScriptBuffer (org.directwebremoting.ScriptBuffer)1