Examples of LayoutDefinition


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

      throw new RuntimeException("Document Element must be '"
        + LAYOUT_DEFINITION_ELEMENT + "'");
  }

  // Create a new LayoutDefinition (the id is not propagated here)
  LayoutDefinition ld = new LayoutDefinition("");

  // Do "resources" first, they are defined at the top of the document
  List<Node> childElements = getChildElements(node, RESOURCES_ELEMENT);
  Iterator<Node> it = childElements.iterator();
  if (it.hasNext()) {
      // Found the RESOURCES_ELEMENT, there is at most 1
      addResources(ld, it.next());
  }

  // Do "types", they need to be defined before parsing the layout
  childElements = getChildElements(node, TYPES_ELEMENT);
  it = childElements.iterator();
  if (it.hasNext()) {
      // Found the TYPES_ELEMENT, there is at most 1
      addTypes(ld, it.next());
  }

  // Do "handlers" next, they need to be defined before parsing the layout
  childElements = getChildElements(node, HANDLERS_ELEMENT);
  it = childElements.iterator();
  if (it.hasNext()) {
      // Found the HANDLERS_ELEMENT, there is at most 1
      cacheHandlerDefs(it.next());
  }

  // Look to see if there is an EVENT_ELEMENT defined
  childElements = getChildElements(node, EVENT_ELEMENT);
  it = childElements.iterator();
  if (it.hasNext()) {
      // Found the EVENT_ELEMENT, there is at most 1
      // Get the event type
      Node eventNode = it.next();
      String type = getAttributes(eventNode).get(TYPE_ATTRIBUTE);

      // Set the Handlers for the given event type (name)
      List<Handler> handlers = ld.getHandlers(type);
      ld.setHandlers(type, getHandlers(eventNode, handlers));
  }

  // Next look for "layout", there is exactly 1
  childElements = getChildElements(node, LAYOUT_ELEMENT);
  it = childElements.iterator();
View Full Code Here

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

     *  <p> This method ensures that a "popupMenu" {@link ComponentType} has
     *      been defined so that it can be used implicitly.</p>
     */
    private ComponentType ensurePopupMenuType(LayoutElement elt) {
  // See if it is defined
  LayoutDefinition ld = elt.getLayoutDefinition();
  ComponentType type = null;
  try {
      type = getComponentType(elt, POPUP_MENU_TYPE);
  } catch (IllegalArgumentException ex) {
      // Nope, define it...
      type = new ComponentType(POPUP_MENU_TYPE, POPUP_MENU_TYPE_CLASS);
      ld.addComponentType(type);
  }

  // Return the type
  return type;
    }
View Full Code Here

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

     *  <p> This method ensures that a "editArea" {@link ComponentType} has
     *      been defined so that it can be used implicitly.</p>
     */
    private ComponentType ensureEditAreaType(LayoutElement elt) {
  // See if it is defined
  LayoutDefinition ld = elt.getLayoutDefinition();
  ComponentType type = null;
  try {
      type = getComponentType(elt, EDIT_AREA_TYPE);
  } catch (IllegalArgumentException ex) {
      // Nope, define it...
      type = new ComponentType(EDIT_AREA_TYPE, EDIT_AREA_TYPE_CLASS);
      ld.addComponentType(type);
  }

  // Return the type
  return type;
    }
View Full Code Here

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

     *  <p> This method ensures that a "markup" {@link ComponentType} has been
     *      defined so that it can be used implicitly.</p>
     */
    private ComponentType ensureMarkupType(LayoutElement elt) {
  // See if it is defined
  LayoutDefinition ld = elt.getLayoutDefinition();
  ComponentType type = null;
  try {
      type = getComponentType(elt, MARKUP_ELEMENT);
  } catch (IllegalArgumentException ex) {
      // Nope, define it...
      type = new ComponentType(MARKUP_ELEMENT, MARKUP_FACTORY_CLASS);
      ld.addComponentType(type);
  }

  // Return the type
  return type;
    }
View Full Code Here

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

     *
     *  @return  The new {@link LayoutDefinition} Object.
     */
    private LayoutDefinition readLayoutDefinition() throws IOException {
  // Create a new LayoutDefinition (the id is not propagated here)
  LayoutDefinition ld = new LayoutDefinition(_id);

  // For now we will only support global resources.  In the future, we
  // may want to allow resources to be overriden at the page level and /
  // or additional page-specific resources to be added.
  //
  // NOTE: Resources may be locale specific, so we can't easily share
  //   this at the application scope.  Here, "global" means across
  //   pages, not across sessions.
// FIXME: This isn't implemented yet...
  ld.setResources(LayoutDefinitionManager.getGlobalResources(null));

/*
  // Look to see if there is an EVENT_ELEMENT defined
  childElements = getChildElements(node, EVENT_ELEMENT);
  it = childElements.iterator();
View Full Code Here

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

      throw new IllegalArgumentException(
    "TemplateRenderer requires that its UIComponent be an "
    + "instance of TemplateComponent!");
  }
  TemplateComponent tempComp = (TemplateComponent) component;
  LayoutDefinition def = tempComp.getLayoutDefinition(context);

  // First 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

      return;
  }

  // Get the LayoutDefinition and begin rendering
  TemplateComponent tempComp = (TemplateComponent) component;
  LayoutDefinition def = tempComp.getLayoutDefinition(context);

  // The following "encode" method does all the rendering
  def.encode(context, (UIComponent) tempComp);
    }
View Full Code Here

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

  // Call the super first
  super.decode(context, component);

  // Call any decode handlers
  TemplateComponent tempComp = (TemplateComponent) component;
  LayoutDefinition def = tempComp.getLayoutDefinition(context);
  def.decode(context, component);
    }
View Full Code Here

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

  FacesContext context = FacesContext.getCurrentInstance();

  // Make sure we don't already have it...
  Map<String, Object> requestMap =
      context.getExternalContext().getRequestMap();
  LayoutDefinition ld = (LayoutDefinition)
      requestMap.get(LAYOUT_DEFINITION_KEY + key);
  if (ld != null) {
      return ld;
  }
View Full Code Here

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

      return childComponent;
  }

  // If we're still here, then we need to create it... hopefully we have
  // a LayoutComponent to tell us how to do this!
  LayoutDefinition ld = getLayoutDefinition(context);
  if (ld == null) {
      // No LayoutDefinition to tell us how to create it... return null
      return null;
  }
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.