org/opengroupware/pubexport/OGoPubRenderer.java
/**
   * This method instantiates and runs the WOComponent for the
   * "master template". The master template is the template named 'Main.xtmpl'.
   * This template will be located using the OGoPubResourceManager (which itself
   * is invoked by WOApplication pageWithName()).
   * <p>
   * The document which is passed in is set as the mainPage 'document'. Its
   * WOComponent will only get triggered if the template uses
   * <code>&lt;SKYOBJ insertvalue="var" name="body" /&gt;</code>, which in turn
   * is mapped to the OGoPubContentReference dynamic element.
   * 
   * @param _p   - the (WOComponent based) page to be rendered
   * @param _ctx - the associated WOContext
   * @return an Exception on error or null if everything went fine
   */
This method instantiates and runs the WOComponent for the
"master template". The master template is the template named 'Main.xtmpl'.
This template will be located using the OGoPubResourceManager (which itself
is invoked by WOApplication pageWithName()).

The document which is passed in is set as the mainPage 'document'. Its
WOComponent will only get triggered if the template uses
<SKYOBJ insertvalue="var" name="body" />, which in turn
is mapped to the OGoPubContentReference dynamic element.

@param _p   - the (WOComponent based) page to be rendered
@param _ctx - the associated WOContext
@return an Exception on error or null if everything went fine
This method instantiates and runs the WOComponent for the " master template " . The master template is the template named ' Main . xtmpl ' . This template will be located using the OGoPubResourceManager ( which itself is invoked by WOApplication pageWithName () ) . The document which is passed in is set as the mainPage ' document ' . Its WOComponent will only get triggered if the template uses <SKYOBJ insertvalue = " var " name = " body " / > which in turn is mapped to the OGoPubContentReference dynamic element . @param _p - the ( WOComponent based ) page to be rendered @param _ctx - the associated WOContext @return an Exception on error or null if everything went fine
public Exception renderPubPage(OGoPubHTMLDocument _p, WOContext _ctx) {
    WOApplication app = _ctx.application();
    /* Reuses existing resource manager if the lookup context is the same. This
     * is used by the bulk exporter which sets the RM just once per directory.
     */
    WOResourceManager     oldRM = app.resourceManager();
    OGoPubResourceManager rm = null; 
    if (oldRM instanceof OGoPubResourceManager) {
      rm = (OGoPubResourceManager)oldRM;
      if (rm.container() != _p.container())
        rm = null; /* different context, we need a new resource manager */
    }
    if (rm == null)
      rm = new OGoPubResourceManager((IGoObject)_p.container(), oldRM, _ctx);
    if (rm != oldRM && rm != null) app.setResourceManager(rm);
    /* instantiate cdef */
    /* Note: this triggers lookupName() with a null-context */
    OGoPubComponent mainPage = (OGoPubComponent)
      app.pageWithName("Main", _ctx); 
    if (mainPage == null) {
      if (oldRM != rm) {
        app.setResourceManager(oldRM /* reset per-folder resource manager */);
        oldRM = null;
      }
      log.error("did not find master template at " + _p);
      return new GoNotFoundException("did not find master template");
    }
    mainPage.document = _p;
    /* generate response by calling main template */
    _ctx.setPage(mainPage);
    _ctx.enterComponent(mainPage, null /* component content */);
    try {
      mainPage.ensureAwakeInContext(_ctx);
      _ctx.response().setHeaderForKey(_p.mimeType(), "content-type");
      mainPage.appendToResponse(_ctx.response(), _ctx);
    }
    finally {
      _ctx.leaveComponent(mainPage);
      if (oldRM != rm)
        app.setResourceManager(oldRM /* reset per-folder resource manager */);
    }
    return null; /* rendering went fine */
  }
public Exception renderPubPage ( OGoPubHTMLDocument _p , WOContext _ctx ) { WOApplication app = _ctx . application ( ) ; /* Reuses existing resource manager if the lookup context is the same. This
     * is used by the bulk exporter which sets the RM just once per directory.
     */ WOResourceManager oldRM = app . resourceManager ( ) ; OGoPubResourceManager rm = null ; if ( oldRM instanceof OGoPubResourceManager ) { rm = ( OGoPubResourceManager ) oldRM ; if ( rm . container ( ) != _p . container ( ) ) rm = null ; /* different context, we need a new resource manager */ } if ( rm == null ) rm = new OGoPubResourceManager ( ( IGoObject ) _p . container ( ) , oldRM , _ctx ) ; if ( rm != oldRM && rm != null ) app . setResourceManager ( rm ) ; /* instantiate cdef */ /* Note: this triggers lookupName() with a null-context */ OGoPubComponent mainPage = ( OGoPubComponent ) app . pageWithName ( "Main" , _ctx ) ; if ( mainPage == null ) { if ( oldRM != rm ) { app . setResourceManager ( oldRM /* reset per-folder resource manager */ ) ; oldRM = null ; } log . error ( "did not find master template at " + _p ) ; return new GoNotFoundException ( "did not find master template" ) ; } mainPage . document = _p ; /* generate response by calling main template */ _ctx . setPage ( mainPage ) ; _ctx . enterComponent ( mainPage , null /* component content */ ) ; try { mainPage . ensureAwakeInContext ( _ctx ) ; _ctx . response ( ) . setHeaderForKey ( _p . mimeType ( ) , "content-type" ) ; mainPage . appendToResponse ( _ctx . response ( ) , _ctx ) ; } finally { _ctx . leaveComponent ( mainPage ) ; if ( oldRM != rm ) app . setResourceManager ( oldRM /* reset per-folder resource manager */ ) ; } return null ; /* rendering went fine */ }
This method instantiates and runs the WOComponent for the
 "master template".
This method instantiates and runs the WOComponent for the " master template " .
// TBD: what we *really* want is that the Template WOComponent is the //      renderer and produced by a proper IGoRenderFactory!!! // The resourcemanager should be attached to the OFS hierarchy. I think. // Hm, but maybe it should just "use" the OFS hierarchy. // The funny thing is that even templates locate their subtemplates using // the regular traversal path. // TODO: somehow fix this // TBD: does it? this method has a ctx argument? // extension doesn't matter?!