Package com.sun.jsftemplating.layout.descriptors

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


  return layoutDefinition;
    }

    public boolean process(LayoutElement parent, Node node, boolean nested) throws IOException {
  boolean abortProcessing = false;
  LayoutElement element = null;
  LayoutElement newParent = parent;
  boolean endElement = false;

  String value = node.getNodeValue();
//  TODO:  find out what "name" should be in the ctors
  switch (node.getNodeType()) {
View Full Code Here


    }
*/

   
    private LayoutElement createComponent(LayoutElement parent, Node node, boolean nested) {
  LayoutElement element = null;
  String nodeName = node.getNodeName();
  NamedNodeMap attrs = node.getAttributes();
  Node nameNode = attrs.getNamedItem("id");
  String id = (nameNode != null) ? nameNode.getNodeValue() :
      LayoutElementUtil.getGeneratedId(nodeName, getNextIdNumber());
View Full Code Here

  TemplateParser parser = reader.getTemplateParser();
  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;
  int ch = parser.nextChar();
  if (ch == '/') {
View Full Code Here

  // Get the FacesContext
  FacesContext context = FacesContext.getCurrentInstance();

  // Look on the UIComponent for the ValueChangeHandlers
  LayoutElement desc = null;
  List<Handler> handlers = (List<Handler>)
      evh.getAttributes().get(VALUE_CHANGE);
  if ((handlers != null) && (handlers.size() > 0)) {
      // This is needed for components that don't have corresponding
      // LayoutElements, it is also useful for dynamically defining
      // 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);
      desc = findLayoutElementByClientId(
        context, viewId, evh.getClientId(context));
      if (desc == null) {
    // Do a brute force search for the LE
    desc = findLayoutElementById(context, viewId, evh.getId());
      }
  }

  // If We still don't have a desc, we're stuck
  if (desc == null) {
      throw new IllegalArgumentException(
    "Unable to locate handlers for '"
    + evh.getClientId(context) + "'.");
  }

  // Dispatch the Handlers from the LayoutElement
  desc.dispatchHandlers(context, VALUE_CHANGE, event);
    }
View Full Code Here

    /**
     *  <p> This is called when static text is found (").</p>
     */
    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

     *      these circumstances, it is critical to store the necessary
     *      information with the UIComponent itself.</p>
     */
    public static LayoutElement findLayoutElementByClientId(FacesContext ctx, String layoutDefKey, String clientId) {
// FIXME: This should be a util method. (Same as CommandActionListener)
  LayoutElement result = null;
  try {
      result =
    findLayoutElementByClientId(
        LayoutDefinitionManager.
      getLayoutDefinition(ctx, layoutDefKey), clientId);
View Full Code Here

  // Sanity check
  if (id == null) {
      return null;
  }

  LayoutElement result = null;
  try {
      result = findLayoutElementById(
        LayoutDefinitionManager.
      getLayoutDefinition(ctx, layoutDefKey), id);
  } catch (LayoutDefinitionException ex) {
View Full Code Here

  if (elt.getUnevaluatedId().equals(id)) {
      return elt;
  }

  // Iterate over children and recurse (depth first)
  LayoutElement child = null;
  Iterator<LayoutElement> it = elt.getChildLayoutElements().iterator();
  while (it.hasNext()) {
      child = it.next();
// FIXME: Handle LayoutCompositions / LayoutInserts
      if (child instanceof LayoutComponent) {
View Full Code Here

  // Get the FacesContext
  FacesContext context = FacesContext.getCurrentInstance();

  // Look on the UIComponent for the CommandHandlers
  LayoutElement desc = null;
  List<Handler> handlers = (List<Handler>)
      command.getAttributes().get(LayoutComponent.COMMAND);
  if ((handlers != null) && (handlers.size() > 0)) {
      // This is needed for components that don't have corresponding
      // LayoutElements, it is also useful for dynamically defining
      // 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);
      desc = findLayoutElementByClientId(
        context, viewId, command.getClientId(context));
      if (desc == null) {
    // Do a brute force search for the LE
    desc = findLayoutElementById(context, viewId, command.getId());
      }
  }

  // If We still don't have a desc, we're stuck
  if (desc == null) {
      throw new IllegalArgumentException(
    "Unable to locate handlers for '"
    + command.getClientId(context) + "'.");
  }

  // Dispatch the Handlers from the LayoutElement
  desc.dispatchHandlers(context, COMMAND_EVENT_TYPE, event);
    }
View Full Code Here

     *      LayoutComponent tree.  For these reasons, this method may fail.  In
     *      these circumstances, it is critical to store the necessary
     *      information with the UIComponent itself.</p>
     */
    public static LayoutElement findLayoutElementByClientId(FacesContext ctx, String layoutDefKey, String clientId) {
  LayoutElement result = null;
  try {
      result =
    findLayoutElementByClientId(
        LayoutDefinitionManager.
      getLayoutDefinition(ctx, layoutDefKey), clientId);
View Full Code Here

TOP

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

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.