Package org.directwebremoting

Examples of org.directwebremoting.ScriptBuffer


     * @param pollComet True/False to use Comet where supported
     * @see <a href="http://getahead.org/dwr/browser/engine/options">Options documentation</a>
     */
    public static void setPollUsingComet(boolean pollComet)
    {
        ScriptBuffer script = new ScriptBuffer();
        script.appendScript("dwr.engine.setPollUsingComet(")
              .appendData(pollComet)
              .appendScript(");");
        ScriptSessions.addScript(script);
    }
View Full Code Here


     * @param newPollType One of {@link #XMLHttpRequest}, {@link #IFrame} or {@link #ScriptTag}
     * @see <a href="http://getahead.org/dwr/browser/engine/options">Options documentation</a>
     */
    public static void setPollType(int newPollType)
    {
        ScriptBuffer script = new ScriptBuffer();
        script.appendScript("dwr.engine.setPollUsingComet(")
              .appendData(newPollType)
              .appendScript(");");
        ScriptSessions.addScript(script);
    }
View Full Code Here

     * @param message The text to go into the alert box
     * @param callback The function to be called when a browser replies
     */
    public static void confirm(String message, Callback<Boolean> callback)
    {
        ScriptBuffer script = new ScriptBuffer();
        String callbackPrefix = "";

        if (callback != null)
        {
            callbackPrefix = "var reply = ";
        }

        script.appendCall(callbackPrefix + "confirm", message);

        if (callback != null)
        {
            String key = CallbackHelperFactory.get().saveCallback(callback, Boolean.class);
            script.appendCall("__System.activateCallback", key, "reply");
        }

        ScriptSessions.addScript(script);
    }
View Full Code Here

     * @param message The text to go into the alert box
     * @param callback The function to be called when a browser replies
     */
    public static void prompt(String message, Callback<String> callback)
    {
        ScriptBuffer script = new ScriptBuffer();
        String callbackPrefix = "";

        if (callback != null)
        {
            callbackPrefix = "var reply = ";
        }

        script.appendCall(callbackPrefix + "prompt", message);

        if (callback != null)
        {
            String key = CallbackHelperFactory.get().saveCallback(callback, String.class);
            script.appendCall("__System.activateCallback", key, "reply");
        }

        ScriptSessions.addScript(script);
    }
View Full Code Here

     * Navigate to a new page
     * @param newPage The page to navigate to
     */
    public static void setLocation(String newPage)
    {
        ScriptBuffer script = new ScriptBuffer();
        script.appendData("window.location = '" + newPage + "';");

        ScriptSessions.addScript(script);
    }
View Full Code Here

     * temporary function will do just that.
     * This is a bit of a nasty hack that I hope we can get rid of
     */
    public void ignoreReturn()
    {
        ScriptBuffer script = new ScriptBuffer();
        script.appendScript(getContextPath().replaceFirst(".$", ";"));
        ScriptSessions.addScript(script);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.directwebremoting.io.JavascriptFunction#execute(java.lang.Object[])
     */
    public void execute(Object... params)
    {
        ScriptBuffer script = EnginePrivate.getRemoteExecuteFunctionScript(id, params);
        session.addScript(script);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.directwebremoting.io.JavascriptFunction#close()
     */
    public void close()
    {
        ScriptBuffer script = EnginePrivate.getRemoteCloseFunctionScript(id);
        session.addScript(script);
    }
View Full Code Here

                log.debug("Reply="+reply+" BatchId="+batchId);

                if (reply.getThrowable() != null)
                {
                    Throwable ex = reply.getThrowable();
                    ScriptBuffer script = EnginePrivate.getRemoteHandleExceptionScript(batchId, reply.getCallId(), ex);
                    conduit.addScript(script);

                    log.warn("--Erroring: batchId[" + batchId + "] message[" + ex.toString() + ']');
                }
                else
                {
                    Object data = reply.getReply();
                    log.debug("data="+data);
                    ScriptBuffer script = EnginePrivate.getRemoteHandleCallbackScript(batchId, reply.getCallId(), data);
                    conduit.addScript(script);
                }
            }

            String output = conduit.toString();
View Full Code Here

    {
        synchronized (scriptLock)
        {
            for (Iterator<ScriptBuffer> it = scripts.iterator(); it.hasNext();)
            {
                ScriptBuffer script = it.next();

                try
                {
                    if (conduit.addScript(script))
                    {
View Full Code Here

TOP

Related Classes of org.directwebremoting.ScriptBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.