Examples of LayoutComponent


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

        }
  if (nodeObject.toString().equals(_objectName)) {
      return null;
  }
  Properties props = new Properties();
  LayoutComponent desc = this.getLayoutComponent();

  // Check to see if a childActionListener was added
  // NOTE: This is not needed when a "command" event is used.  In the
  //   case of a CommandEvent an ActionListener will be
  //   automatically registered by the ComponentFactoryBase class
  //   during "setOptions()".  Also, setting a childActionListener
  //   here should not stop "command" handlers from being invoked.
  setProperty(props, "actionListener", desc.getOption("childActionListener"));

  // Also se the target and text...
  setProperty(props, "target", desc.getOption("childTarget"));
  setProperty(props, "text", comp.getAttributes().get("text"));
// FIXME: Add support for other hyperlink properties??

  // Create Hyperlink
  // NOTE: Last attribute "content" will be the facet named used.
  UIComponent link = ComponentUtil.getChild(
      comp, "link",
      "com.sun.jsftemplating.component.factory.sun.HyperlinkFactory",
      props, "content");

  // Check to see if we have a childURL, evalute it here (after component
  // is created, before rendered) so we can use the link itself to define
  // the URL.  This has proven to be useful...
  Object val = desc.getOption("childURL");
  if (val != null) {
      link.getAttributes(). put("url", desc.resolveValue(
      FacesContext.getCurrentInstance(), link, val));
  }

  // Set href's handlers...
  // We do it this way rather than earlier b/c the factory will not
  // recognize this as a property, it requires it to be defined in the
  // LayoutComponent as a handler.  So we must do this manually like
  // this.
  List handlers = desc.getHandlers("childCommand");
  if (handlers != null) {
      link.getAttributes().put("command", handlers);
      // This adds the required action listener to proces the commands
      // This is needed here b/c the factory has already executed -- the
      // factory is normally the place where this is added (iff there is
View Full Code Here

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

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

  // This is the descriptor for this dynamic TreeNode, it contains all
  // information (options) necessary for this Adaptor
  LayoutComponent desc = getLayoutComponent();

  // The parent UIComponent
  UIComponent parent = getParentUIComponent();

  // Get the Index
        Index index = (Index) desc.getEvaluatedOption(ctx, "index", parent);

  // The following method should set the "key" to the node containing all
  // the children... the children will also have keys which must be
  // retrievable by the next method (getChildTreeNodeObjects)... these
  // "keys" will be used by the rest of the methods in this file for
View Full Code Here

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

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

  // This is the descriptor for this dynamic TreeNode, it contains all
  // information (options) necessary for this Adaptor
  LayoutComponent desc = getLayoutComponent();

  // The parent UIComponent
  UIComponent parent = getParentUIComponent();

  // Get the TOC
        TOC toc = (TOC) desc.getEvaluatedOption(ctx, "toc", parent);

  // The following method should set the "key" to the node containing all
  // the children... the children will also have keys which must be
  // retrievable by the next method (getChildTreeNodeObjects)... these
  // "keys" will be used by the rest of the methods in this file for
View Full Code Here

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

        // Read the content...
        String content = new String(FileUtil.readFromURL(contentURL));

        // Create a StaticText component and add it under the
        // "root" component.
        LayoutComponent stDesc = new LayoutComponent(null,
      "externalContent", new ComponentType("tmpTextCT",
      "com.sun.jsftemplating.component.factory.basic.StaticTextFactory"));
        stDesc.addOption("value", content);
        ComponentUtil.getInstance(ctx).createChildComponent(ctx, stDesc, root);
    } else {
        // Include the first one...
        includeIntegrationPoint(ctx, root, point);
    }
View Full Code Here

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

      // Find the children...
      FacesContext ctx = FacesContext.getCurrentInstance();

      // This is the descriptor for this dynamic TreeNode, it contains all
      // information (options) necessary for this Adaptor
      LayoutComponent desc = getLayoutComponent();
      Object val = desc.getOption("children");
      if (val == null) {
    throw new IllegalArgumentException("'children' must be specified!");
      }
      val = desc.resolveValue(ctx, getParentUIComponent(), val.toString());
      if ((val != null) && (val instanceof Map)) {
    _childMap = (Map<String, Object>) val;
    val = new ArrayList<Object>(_childMap.keySet());
                Collections.sort((List)val);
      }
View Full Code Here

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

    public Map<String, Object> getFactoryOptions(Object nodeObject) {
  if (nodeObject == null) {
      return null;
  }

  LayoutComponent desc = getLayoutComponent();
  Map<String, Object> props = new HashMap<String, Object>();
  if ((nodeObject instanceof Integer) && nodeObject.equals(TOP_ID)) {
      // This case deals with the top node.

      // NOTE: All supported options must be handled here,
      //    otherwise they'll be ignored.
      // NOTE: Options will be evaluated later, do not eval here.
      setProperty(props, "text", desc.getOption("text"));
      setProperty(props, "url", desc.getOption("url"));
      setProperty(props, "imageURL", desc.getOption("imageURL"));
      setProperty(props, "target", desc.getOption("target"));
      setProperty(props, "action", desc.getOption("action"));
    

      // NOTE: Although actionListener is supported, LH currently
      //       implements this to be the ActionListener of the "turner"
      //       which is inconsistent with "action".  We should make use
      //       of the "Handler" feature which provides a "toggle"
      //       CommandEvent.
      setProperty(props, "actionListener", desc.getOption("actionListener"));
      setProperty(props, "expanded", desc.getOption("expanded"));
      setProperty(props, "rendered", desc.getOption("rendered"));
  } else {
      // This case deals with the children
      if (nodeObject instanceof Map) {
    String key = (String) desc.getOption("childNameKey");
    if (key == null) {
        key = "name";
    }
    setProperty(props, "text", ((Map) nodeObject).get(key));
      } else {
    // Use the object itself...
    setProperty(props, "text", nodeObject);
      }

      // Finish setting the child properties
      setProperty(props, "url", desc.getOption("childURL"));
      setProperty(props, "imageURL", desc.getOption("childImageURL"));
      setProperty(props, "action", desc.getOption("childAction"));
      String tt = (String) desc.getOption("targetConfigName");
      if (!GuiUtil.isEmpty(tt)){
    setProperty(props, "targetConfigName", tt);
      }
  /*
      String check = (String) desc.getOption("checkAdminServer");
      if (!GuiUtil.isEmpty(check)) {
    String serverName = (String) props.get("text");
    if (serverName.equals("server")) {
        setProperty(props, "text", "server (Admin Server)");
        setProperty(props, "serverName", "server");
    } else {
        setProperty(props, "serverName", serverName);
    }
      }
  */
      setProperty(props, "encodedText",
        GuiUtil.encode((String) props.get("text"), null, null));
// We are using "childActionListener" for the hyperlink, not the TreeNode
//      setProperty(props, "actionListener", desc.getOption("childActionListener"));
      setProperty(props, "expanded", desc.getOption("childExpanded"));
  }

  // Return the options
  return props;
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.layout.LayoutComponent

          neitherRendered = false;
        }
        // recursion
        if (cell instanceof OriginCell) {
          OriginCell origin = (OriginCell) cell;
          LayoutComponent component = cell.getComponent();
          if (component instanceof LayoutContainer && component.isRendered()) {
            LayoutManager layoutManager = ((LayoutContainer) component).getLayoutManager();
            // TODO: may be improved
            boolean childAuto = origin.getSpan(orientation) == 1 && heads[i].getToken() instanceof AutoLayoutToken;
            layoutManager.fixRelativeInsideAuto(orientation, childAuto);
          }
View Full Code Here

Examples of org.apache.myfaces.tobago.layout.LayoutComponent

      IntervalList intervalList = new IntervalList();
      for (int j = 0; j < heads2.length; j++) {
        Cell cell = grid.getCell(i, j, orientation);
        if (cell instanceof OriginCell) {
          OriginCell origin = (OriginCell) cell;
          LayoutComponent component = cell.getComponent();

          if (component instanceof LayoutContainer && (component.isRendered() || isRigid())) {
            ((LayoutContainer) component).getLayoutManager().preProcessing(orientation);
          }

          if (token instanceof AutoLayoutToken || token instanceof RelativeLayoutToken) {
            if (origin.getSpan(orientation) == 1 && (component.isRendered() || isRigid())) {
              intervalList.add(new Interval(component, orientation));
            } else {
              if (LOG.isDebugEnabled()) {
                LOG.debug("Components with span > 1 will be ignored in 'auto' layout rows/columns.");
                // todo: give this information to the developer
View Full Code Here

Examples of org.apache.myfaces.tobago.layout.LayoutComponent

    // call manage sizes for all sub-layout-managers
    for (int i = 0; i < heads.length; i++) {
      for (int j = 0; j < heads2.length; j++) {
        Cell cell = grid.getCell(i, j, orientation);
        if (cell instanceof OriginCell) {
          LayoutComponent component = cell.getComponent();

          component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and tobago.css

          Integer span = ((OriginCell) cell).getSpan(orientation);

          // compute the size of the cell
          Measure size = Measure.ZERO;
          for (int k = 0; k < span; k++) {
            size = size.add(heads[i + k].getCurrent());
          }
          size = size.add(computeSpacing(orientation, i, span));
          Measure current = LayoutUtils.getCurrentSize(orientation, component);
          if (current == null) {
            LayoutUtils.setCurrentSize(orientation, component, size);
          }

          // call sub layout manager
          if (component instanceof LayoutContainer && (component.isRendered() || isRigid())) {
            ((LayoutContainer) component).getLayoutManager().mainProcessing(orientation);
          }
        }
      }
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.layout.LayoutComponent

    // call manage sizes for all sub-layout-managers
    for (int i = 0; i < heads.length; i++) {
      for (int j = 0; j < heads2.length; j++) {
        Cell cell = grid.getCell(i, j, orientation);
        if (cell instanceof OriginCell) {
          LayoutComponent component = cell.getComponent();

          component.setDisplay(Display.BLOCK);

          // compute the position of the cell
          Measure position = Measure.ZERO;
          position = position.add(LayoutUtils.getPaddingBegin(orientation, getLayoutContainer()));
          position = position.add(getMarginBegin(orientation));
          for (int k = 0; k < i; k++) {
            if (heads[k] != null
                && heads[k].getCurrent() != null
                && heads[k].isRendered()
                && heads[k].getCurrent().greaterThan(Measure.ZERO)) {
              position = position.add(heads[k].getCurrent());
              position = position.add(getSpacing(orientation));
            }
          }
          if (orientation == Orientation.HORIZONTAL) {
            component.setLeft(position);
          } else {
            component.setTop(position);
          }

          // call sub layout manager
          if (component instanceof LayoutContainer && (component.isRendered() || isRigid())) {
            ((LayoutContainer) component).getLayoutManager().postProcessing(orientation);
          }

          // set scrolling type
          final boolean scroll = grid.isOverflow(orientation);
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.