Examples of LayoutDefinition


Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

  }
  String key = content;
  if (!key.contains("://")) {
      key = "/" + point.getConsoleConfigId() + "/" + content;
  }
  LayoutDefinition def = LayoutDefinitionManager.getLayoutDefinition(ctx, key);
  LayoutViewHandler.buildUIComponentTree(ctx, parent, def);
    }
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

  }
  String key = content;
  if (!key.contains("://")) {
      key = "/" + point.getConsoleConfigId() + "/" + content;
  }
  LayoutDefinition def = LayoutDefinitionManager.getLayoutDefinition(ctx, key);
  LayoutViewHandler.buildUIComponentTree(ctx, parent, def);
    }
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

  }
  String key = content;
  if (!key.contains("://")) {
      key = "/" + point.getConsoleConfigId() + "/" + content;
  }
  LayoutDefinition def = LayoutDefinitionManager.getLayoutDefinition(ctx, key);
  LayoutViewHandler.buildUIComponentTree(ctx, parent, def);
    }
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

      Util.closeStream(is);
  }
    }

    public LayoutDefinition read() throws IOException {
  LayoutDefinition layoutDefinition = new LayoutDefinition(key);
  NodeList nodeList = document.getChildNodes();
  boolean abortProcessing = false;
    DocumentType docType = document.getDoctype();
    if (docType != null) {
        LayoutStaticText stDocType = new LayoutStaticText(layoutDefinition, "",
            "<!DOCTYPE " + docType.getName() + " PUBLIC \"" + docType.getPublicId() + "\" \"" + docType.getSystemId() + "\">");
        layoutDefinition.addChildLayoutElement(stDocType);
    }
    for (int i = 0; i < nodeList.getLength() && (abortProcessing != true); i++) {
      abortProcessing = process(layoutDefinition, nodeList.item(i), false);
  }
  return layoutDefinition;
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

      throw new LayoutDefinitionException(
        "Unable to locate '" + key + "'");
  }

  // Read the template file
  LayoutDefinition ld = null;
  try {
      ld  = new FaceletsLayoutDefinitionReader(key, url).read();
  } catch (IOException ex) {
      throw new LayoutDefinitionException(
    "Unable to process '" + url.toString() + "'.", ex);
  }

        // Dispatch "initPage" handlers
        ld.dispatchInitPageHandlers(FacesContext.getCurrentInstance(), ld);

        // Return the LayoutDefinition
        return ld;
    }
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

      throw new LayoutDefinitionException(
        "Unable to locate '" + key + "'");
  }

  // Read the template file
  LayoutDefinition ld = null;
  try {
      ld  = new TemplateReader(key, url).read();
  } catch (IOException ex) {
      throw new LayoutDefinitionException(
    "Unable to process '" + url.toString() + "'.", ex);
  }

  // Dispatch "initPage" handlers
  ld.dispatchInitPageHandlers(FacesContext.getCurrentInstance(), ld);

  // Return the LayoutDefinition
  return ld;
    }
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

      throw new LayoutDefinitionException(
        "Unable to locate '" + key + "'");
  }

  // Read the XML file
  LayoutDefinition ld = null;
  String baseURI = getBaseURI();
  try {
      ld  = new XMLLayoutDefinitionReader(url, getEntityResolver(),
    getErrorHandler(), baseURI).read();
  } catch (IOException ex) {
      throw new LayoutDefinitionException("Unable to process '"
        + url + "'.  EntityResolver: '" + getEntityResolver()
        + "'.  ErrorHandler: '" + getErrorHandler()
        + "'.  baseURI: '" + baseURI + "'.", ex);
  }

  // Dispatch "initPage" handlers
  ld.dispatchInitPageHandlers(FacesContext.getCurrentInstance(), ld);

  // Return the LayoutDefinition
  return ld;
    }
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

  // use the locale from the previous view if is was one which will be
  // the case if this is called from NavigationHandler. There wouldn't be
  // one for the initial case.
  if (context.getViewRoot() != null) {
      UIViewRoot oldViewRoot = context.getViewRoot();
      LayoutDefinition oldLD = ViewRootUtil.getLayoutDefinition(oldViewRoot);
      if ((oldLD != null) && oldViewRoot.getViewId().equals(viewId)) {
    // If you navigate to the page you are already on, JSF will
    // re-create the UIViewRoot of the current page.  The initPage
    // event needs to be reset so that it will re-execute itself.
    oldLD.setInitPageExecuted(context, Boolean.FALSE);
      }
      locale = context.getViewRoot().getLocale();
      renderKitId = context.getViewRoot().getRenderKitId();
  }

  // Create the ViewRoot
  UIViewRoot viewRoot = _oldViewHandler.createView(context, viewId);
  viewRoot.setViewId(viewId);
  ViewRootUtil.setLayoutDefinitionKey(viewRoot, viewId);

  // if there was no locale from the previous view, calculate the locale
  // for this view.
  if (locale == null) {
      locale = calculateLocale(context);
  }
  viewRoot.setLocale(locale);

  // set the renderkit
  if (renderKitId == null) {
      renderKitId = calculateRenderKitId(context);
  }
  viewRoot.setRenderKitId(renderKitId);

  // Save the current viewRoot, temporarily set the new UIViewRoot so
  // beforeCreate, afterCreate will function correctly
  UIViewRoot currentViewRoot = context.getViewRoot();

  // Set the View Root to the new viewRoot
  // NOTE: This must happen after return _oldViewHandler.createView(...)
  // NOTE2: However, we really want the UIViewRoot available during
  //    initPage events which are fired during
  //    getLayoutDefinition()... so we need to set this, then unset
  //    it if we go through _oldViewHandler.createView(...)
  context.setViewRoot(viewRoot);

  // Initialize Resources / Create Tree
  LayoutDefinition def = null;
  try {
      def = ViewRootUtil.getLayoutDefinition(viewRoot);
  } catch (LayoutDefinitionException ex) {
      if (LogUtil.configEnabled()) {
    LogUtil.config("JSFT0005", (Object) viewId);
    if (LogUtil.finestEnabled()) {
        LogUtil.finest(
      "File (" + viewId + ") not found!", ex);
    }
      }

      // Restore original ViewRoot, we set it prematurely
      if (currentViewRoot != null) {
// FIXME: Talk to Ryan about restoring the ViewRoot to null!!
    context.setViewRoot(currentViewRoot);
      }

// FIXME: Provide better feedback when no .jsf & no .jsp
// FIXME: Difficult to tell at this stage if no .jsp is present

      // Not found, delegate to old ViewHandler
      return _oldViewHandler.createView(context, viewId);
  } catch (RuntimeException ex) {
      // Restore original ViewRoot, we set it prematurely
      if (currentViewRoot != null) {
// FIXME: Talk to Ryan about restoring the ViewRoot to null!!
    context.setViewRoot(currentViewRoot);
      }

      // Allow error to be thrown (this isn't the normal code path)
      throw ex;
  }

  // We need to do this again b/c an initPage handler may have changed
  // the viewRoot
  viewRoot = context.getViewRoot();

  // Check to make sure we found a LD and that the response isn't
  // already finished (initPage could complete the response...
  // i.e. during a redirect).
  if ((def != null) && !context.getResponseComplete()) {
      // Ensure that our Resources are available
      Iterator<Resource> it = def.getResources().iterator();
      Resource resource = null;
      while (it.hasNext()) {
    resource = it.next();
    // Just calling getResource() puts it in the Request scope
    resource.getFactory().getResource(context, resource);
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

    // this after restoreView as we need the UIViewRoot available
    // during initPage events.  Formerly this was done during the
    // ApplyRequestValuesPhase, however, I no longer have a custom
    // UIViewRoot to use for this purpose, so I will do it here,
    // which should be just as good.
    LayoutDefinition def = ViewRootUtil.getLayoutDefinition(key);

    // While we're at it, we should call the LD decode() event so
    // we can provide a page-level decode() functionality.  This
    // won't effect components in the page, or JSFT-based
    // components.
    def.decode(context, root);
      }
  }

  // Return the UIViewRoot
  return root;
View Full Code Here

Examples of com.sun.jsftemplating.layout.descriptors.LayoutDefinition

    /**
     *
     */
    public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException {
  // Make sure we have a def
  LayoutDefinition def = ViewRootUtil.getLayoutDefinition(viewToRender);
  if (def == null) {
      // PartialRequest or No def, fall back to default behavior
      _oldViewHandler.renderView(context, viewToRender);
  } else {
      // Start document
      if (!context.getPartialViewContext().isPartialRequest() || context.getPartialViewContext().isRenderAll()) {
    ResponseWriter writer = setupResponseWriter(context);
    writer.startDocument();

    // Render content
    def.encode(context, viewToRender);

    // End document
    writer.endDocument();
      } else {
    // NOTE: This "if" branch has been added to avoid the
    // NOTE: start/endDocument calls being called 2x on PartialView
    // NOTE: requests.  JSF Issue #1307 has been filed to resolve
    // NOTE: this correctly (assuming checking here is not
    // NOTE: correct... which I do not feel that it is).
    //
    // Render content
    def.encode(context, viewToRender);
      }
  }
//System.out.println("PROCESSING TIME: " + (new java.util.Date().getTime() - _time.getTime()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.