Package com.liferay.faces.alloy.component.dataitem

Examples of com.liferay.faces.alloy.component.dataitem.DataItem


    }

    if (iterateOverDataModel) {

      // Get the first child and use it as a prototype.
      DataItem prototypeChildDataItem = getFirstChildDataItem(dataList);

      if (prototypeChildDataItem == null) {
        logger.warn("Unable to iterate because alloy:dataList does not have an alloy:dataItem child element.");
      }
      else {

        int rowCount = dataList.getRowCount();

        for (int i = 0; i < rowCount; i++) {
          dataList.setRowIndex(i);

          // Encode the starting element that represents the specified child's content.
          responseWriter.startElement(itemTag, prototypeChildDataItem);
          responseWriter.writeAttribute(StringPool.CLASS, styleClass + StringPool.DASH + ITEM,
            StringPool.CLASS);

          // Encode the children of the specified child as the actual content.
          prototypeChildDataItem.encodeAll(facesContext);

          // Encode the closing element for the specified child.
          responseWriter.endElement(itemTag);

          if (facet != null) {
            responseWriter.startElement("dd", uiComponent);
            responseWriter.writeAttribute(StringPool.CLASS, styleClass + StringPool.DASH + DESCRIPTION,
              StringPool.CLASS);
            facet.encodeAll(facesContext);
            responseWriter.endElement("dd");
          }
        }

        dataList.setRowIndex(-1);
      }
    }

    // Otherwise, encode content for each child of the specified dataList.
    else {
      List<UIComponent> children = uiComponent.getChildren();
      int childCount = children.size();

      for (int i = 0; i < childCount; i++) {

        UIComponent child = children.get(i);

        if (child.isRendered() && (child instanceof DataItem)) {
          DataItem childDataItem = (DataItem) child;

          // Encode the starting element that represents the specified child's content.
          responseWriter.startElement(itemTag, childDataItem);
          RendererUtil.encodeStyleable(responseWriter, childDataItem);

          // Encode the children of the specified child as the actual content.
          childDataItem.encodeAll(facesContext);

          // Encode the closing element for the specified child.
          responseWriter.endElement(itemTag);
        }
        else {
View Full Code Here


    return childDataItems;
  }

  protected DataItem getFirstChildDataItem(UIData uiData) {

    DataItem prototypeChildType = null;

    List<DataItem> childDataItems = getChildDataItems(uiData);

    if (childDataItems.size() > 0) {
      prototypeChildType = childDataItems.get(0);
View Full Code Here

TOP

Related Classes of com.liferay.faces.alloy.component.dataitem.DataItem

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.