Package org.xulfaces.component.tree

Examples of org.xulfaces.component.tree.TreeCellComponent


public class TreeCellRenderer extends XULRenderer {

  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {

    ResponseWriter responseWriter = facesContext.getResponseWriter();
    TreeCellComponent treeCellComponent = (TreeCellComponent) component;

    IconProvider iconProvider = treeCellComponent.getIconProvider();
    LabelProvider labelProvider = treeCellComponent.getLabelProvider();

    responseWriter.startElement("treecell", component);
   
    treeCellComponent.setNodeId(computeId(treeCellComponent));
    responseWriter.writeAttribute("id", treeCellComponent.getNodeId(), "id");

    String var = treeCellComponent.getVar();
    Object userObject = facesContext.getExternalContext().getSessionMap().get(var);

    if ( (treeCellComponent.getAttributes().get("label") != null|| (labelProvider != null)){
      // Deal with label
      String label = null;
      if (labelProvider != null) {
        label = labelProvider.getText(userObject, TreeRowComponent.CLOSED);
        treeCellComponent.setLabel(label);
      } else {
        Object value = convertAsString(facesContext, component, getProperty(facesContext, "label", component));
        if (value != null) {
          label = value.toString();
        }
      }

      if (label != null) {
        responseWriter.writeAttribute("label", label, "label");
      }
    }

    if ( (treeCellComponent.getAttributes().get("src") != null) || (iconProvider != null)){
      // Deal with src
      String src = null;
      if (iconProvider != null) {
        src = iconProvider.getIcon(userObject, TreeRowComponent.CLOSED);
      } else {
View Full Code Here


  }

  public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
    List children  = component.getChildren();
    for (int j = 0, size = component.getChildCount(); j < size; j++) {
      TreeCellComponent treeCellComponent = (TreeCellComponent) children.get(j);
      if (treeCellComponent.isRendered()) {
        renderChild(facesContext,treeCellComponent);             
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.xulfaces.component.tree.TreeCellComponent

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.