Package com.sun.jsftemplating.layout.descriptors

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


    private LayoutComponent processComponent(LayoutElement parent, Node node, NamedNodeMap attrs, String id, boolean trimming) {
  if (trimming) {
      parent = parent.getLayoutDefinition(); // parent to the LayoutDefinition
      parent.getChildLayoutElements().clear(); // a ui:composition clears everything outside of it
 
  LayoutComponent lc = new LayoutComponent(parent, id,
    LayoutDefinitionManager.getGlobalComponentType(null, "event"));
  parent.addChildLayoutElement(lc);
  LayoutComposition comp = processComposition(lc, "template", attrs, id+"_lc", trimming)

  NodeList nodeList = node.getChildNodes();
  boolean abortChildProcessing = false;
  for (int i = 0; i < nodeList.getLength() && (abortChildProcessing != true); i++) {
      try {
    abortChildProcessing = process(comp, nodeList.item(i), true);
      } catch (IOException e) {
    e.printStackTrace();
      }
  }
  lc.addChildLayoutElement(comp);

  return lc;
    }
View Full Code Here


      boolean isRendered =
    !LayoutElementUtil.isNestedLayoutComponent(facetElt);
      facetElt.setRendered(isRendered);
      element = facetElt;
  } else {
      LayoutComponent lc = null;
      ComponentType componentType = null;
      String nsURI = node.getNamespaceURI();
      if (nsURI != null) {
    // Do lookup using namespace...
    componentType = LayoutDefinitionManager.getGlobalComponentType(
      null, nsURI + ':' + node.getLocalName());
      }
      if (componentType == null) {
    // Try w/o using namespace
    componentType = LayoutDefinitionManager.
      getGlobalComponentType(null, nodeName);
      }
      if (componentType == null) {
    String value = node.getNodeValue();
    if (value == null) {
        value = "";
    }
//    FIXME: This needs to account for beginning and ending tags....
    lc = new LayoutStaticText(parent, id,
      "<" + nodeName + buildAttributeList(node) + ">");
      } else {
    lc = new LayoutComponent(parent, id, componentType);
    addAttributesToComponent(lc, node);
      }
      lc.setNested(nested);
//      FIXME: Because of the way pages are composed in facelets, the parent
//      FIXME: LayoutComponent may not exist in this LD.  In that case it is not
//      FIXME: a "facet child", but it appears to be according to the following
//      FIXME: method.  We need a better way to mark children as facets or real
//      FIXME: children.  This may even require diverging the LD into 1 for
View Full Code Here

     */
    public static void dumpTree(LayoutElement elt, StringBuffer buf, String indent) {
  // First add the current LayoutElement
  String compInfo = "";
  if (elt instanceof LayoutComponent) {
      LayoutComponent comp = (LayoutComponent) elt;
      compInfo = " nested=" + comp.isNested();
  } else if (elt instanceof LayoutFacet) {
      compInfo = " isRendered=" + ((LayoutFacet) elt).isRendered();
  }
  buf.append(indent + elt.getUnevaluatedId() + " (" + elt.getClass().getName() + ")" + compInfo + "\n");

View Full Code Here

  parser.skipCommentsAndWhiteSpace(TemplateParser.SIMPLE_WHITE_SPACE);

// tagStack.push(content);
  // Create the LayoutComponent
  LayoutElement parent = env.getParent();
  LayoutComponent child = reader.createLayoutComponent(
    parent, env.isNested(), content);
  parent.addChildLayoutElement(child);

  // See if this is a single tag or if there is a closing tag
  boolean single = false;
View Full Code Here

     */
    public void staticText(ProcessingContextEnvironment env, String content) throws IOException {
  LayoutElement parent = env.getParent();

  // Create a LayoutStaticText
  LayoutComponent child = new LayoutStaticText(
      parent,
      LayoutElementUtil.getGeneratedId(
    "txt", env.getReader().getNextIdNumber()),
      content);
  child.addOption("value", content);
  child.setNested(env.isNested());

  parent.addChildLayoutElement(child);
    }
View Full Code Here

      // Handlers (advanced and not recommended unless you have a good
      // reason).  May also happen if "id" for any component in
      // hierarchy is not a simple String.

      // No parent (null) or ComponentType, just pass (null)
      desc = new LayoutComponent(
    (LayoutElement) null, evh.getId(), (ComponentType) null);
  } else {
      // Attempt to find LayoutElement based on evh's client id
      // "desc" may be null
      String viewId = getViewId(evh);
View Full Code Here

      // Handlers (advanced and not recommended unless you have a good
      // reason).  May also happen if "id" for any component in
      // hierarchy is not a simple String.

      // No parent (null) or ComponentType, just pass (null)
      desc = new LayoutComponent(
    (LayoutElement) null, command.getId(), (ComponentType) null);
  } else {
      // Attempt to find LayoutElement based on command's client id
      // "desc" may be null
      String viewId = getViewId(command);
View Full Code Here

  }
  LayoutElement attributeElt = null;

  // Check if we're setting this on a LayoutComponent vs. LayoutMarkup
  // Do this after checking for "name" to show correct error message
  LayoutComponent comp = null;
  if (parent instanceof LayoutComponent) {
      comp = (LayoutComponent) parent;
  } else {
      comp = LayoutElementUtil.getParentLayoutComponent(parent);
  }
View Full Code Here

  LayoutElement markupElt = null;
  if ((parent instanceof LayoutComponent)
    || LayoutElementUtil.isNestedLayoutComponent(parent)) {
      // Make a "markup" LayoutComponent..
      ComponentType type = ensureMarkupType(parent);
      markupElt = new LayoutComponent(
        parent, MARKUP_ELEMENT + _markupCount++, type);
      LayoutComponent markupComp = ((LayoutComponent) markupElt);
      markupComp.addOption("tag", tag);
      markupComp.setNested(true);

      // Add children...
      addChildLayoutComponentChildren(markupComp, node);
  } else {
      // Create new LayoutMarkup
View Full Code Here

        + "' attribute not found on '" + COMPONENT_ELEMENT
        + "' Element!");
  }

  // Create new LayoutComponent
  LayoutComponent component =  new LayoutComponent(parent, id,
      getComponentType(parent, type));

  // Check for overwrite flag
  String overwrite = attributes.get(OVERWRITE_ATTRIBUTE);
  if ((overwrite != null) && (overwrite.length() > 0)) {
      component.setOverwrite(Boolean.valueOf(overwrite).booleanValue());
  }

  // Set flag to indicate if this LayoutComponent is nested in another
  // LayoutComponent.  This is significant b/c during rendering, events
  // will need to be fired differently (the TemplateRenderer /
  // LayoutElements will not have any control).  The strategy used will
  // rely on "instance" handlers, this flag indicates that "instance"
  // handlers should be used.
  // NOTE: While this could be implemented on the LayoutComponent
  //   itself, I decided not to for performance reasons and to
  //   allow this value to be overruled if desired.
  component.setNested(
      LayoutElementUtil.isNestedLayoutComponent(component));

  // Figure out if this should be stored as a facet, if so under what id
  if (!LayoutElementUtil.isLayoutComponentChild(component)) {
      // Need to add this so that it has the correct facet name
      // Check to see if this LayoutComponent is inside a LayoutFacet
      while (parent != null) {
    if (parent instanceof LayoutFacet) {
        // Inside a LayoutFacet, use its id... only if this facet
        // is a child of a LayoutComponent (otherwise, it is a
        // layout facet used for layout, not for defining a facet
        // of a UIComponent)
        if (LayoutElementUtil.isLayoutComponentChild(parent)) {
      id = parent.getUnevaluatedId();
        }
        break;
    }
    parent = parent.getParent();
      }

      // Set the facet name
      component.addOption(LayoutComponent.FACET_NAME, id);
  }

  // Add children... (different for component LayoutElements)
  addChildLayoutComponentChildren(component, node);
View Full Code Here

TOP

Related Classes of com.sun.jsftemplating.layout.descriptors.LayoutComponent

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.