コード例 #1
0
  private void loadRootComponent(String className) {
    ComponentPageElement rootComponent =
        pageElementFactory.newRootComponentElement(page, className, locale);

    page.setRootElement(rootComponent);

    componentQueue.push(rootComponent);
  }
コード例 #2
0
  private void dtd(DTDToken token) {
    // first DTD encountered wins.
    if (dtdAdded) return;

    PageElement element =
        new DTDPageElement(token.getName(), token.getPublicId(), token.getSystemId());
    // since rendering via the markup writer is to the document tree,
    // we don't really care where this gets placed in the tree; the
    // DTDPageElement will set the dtd of the document directly, rather than
    // writing anything to the markup writer
    page.getRootElement().addToTemplate(element);

    dtdAdded = true;
  }
コード例 #3
0
  /**
   * As currently implemented, this should be invoked just once and then the PageLoaderProcessor
   * instance should be discarded.
   */
  public Page loadPage(String logicalPageName, String pageClassName, Locale locale) {
    // Ensure that loadPage() may only be invoked once.

    lock.lock();

    this.locale = locale;

    // Todo: Need a resources object for Pages, not just ComponentPageElement ... too many
    // parameters here.

    page =
        new PageImpl(
            logicalPageName,
            this.locale,
            linkFactory,
            persistentFieldManager,
            componentClassResolver);

    loadRootComponent(pageClassName);

    workComponentQueue();

    // Take care of any finalization logic that's been deferred out.

    for (Runnable r : finalization) {
      r.run();
    }

    // The page is *loaded* before it is attached to the request.
    // This is to help ensure that no client-specific information leaks
    // into the page.

    page.loaded();

    return page;
  }