cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ovi...@apache.org
Subject cvs commit: xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/javascript JSWebContinuation.java
Date Thu, 21 Mar 2002 23:24:36 GMT
ovidiu      02/03/21 15:24:36

  Added:       src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/javascript
                        JSWebContinuation.java
  Log:
  JavaScript representation of the WebContinuation Java class.
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/javascript/JSWebContinuation.java
  
  Index: JSWebContinuation.java
  ===================================================================
  package org.apache.cocoon.components.flow.javascript;
  
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.cocoon.components.flow.ContinuationsManager;
  import org.apache.cocoon.components.flow.WebContinuation;
  import org.mozilla.javascript.Context;
  import org.mozilla.javascript.Function;
  import org.mozilla.javascript.Scriptable;
  import org.mozilla.javascript.ScriptableObject;
  import org.mozilla.javascript.JavaScriptException;
  
  public class JSWebContinuation extends ScriptableObject
  {
    WebContinuation wk;
    ContinuationsManager continuationsMgr;
  
    public JSWebContinuation() {}
  
    public String getClassName()
    {
      return "WebContinuation";
    }
  
    public static Scriptable jsConstructor(Context cx, Object[] args,
                                           Function ctorObj, 
                                           boolean inNewExpr)
      throws Exception
    {
      JSCocoon cocoon = (JSCocoon)args[0];
      // FIXME: why doesn't this work???
  //     ComponentManager contMgr
  //       = ((ComponentManager)manager).lookup(ContinuationsManager.ROLE);
      ComponentManager manager = cocoon.getComponentManager();
  
      ContinuationsManager contMgr = cocoon.getContinuationsManager();
      Object kont = args[1];
      Object pwk = args[2];
  
      JSWebContinuation jswk = new JSWebContinuation();
      WebContinuation wk
        = contMgr.createWebContinuation(kont, (WebContinuation)pwk);
      wk.setUserObject(jswk);
      jswk.wk = wk;
      jswk.continuationsMgr = contMgr;
  
      return jswk;
    }
  
    public String jsGet_id()
    {
      return wk.getId();
    }
  
    public Object jsGet_continuation()
    {
      return wk.getContinuation();
    }
  
    public void jsFunction_invalidate()
    {
      continuationsMgr.invalidateWebContinuation(wk);
    }
  
    public void jsFunction_display()
    {
      wk.display();
    }
  }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message