Package org.apache.myfaces.tobago.internal.component

Examples of org.apache.myfaces.tobago.internal.component.AbstractUITree


  public void decode(FacesContext facesContext, UIComponent component) {
    if (ComponentUtils.isOutputOnly(component)) {
      return;
    }

    AbstractUITree tree = (AbstractUITree) component;
    tree.setValid(true);
  }
View Full Code Here


  }

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

    AbstractUITree tree = (AbstractUITree) component;

    String clientId = tree.getClientId(facesContext);
    UIComponent root = tree.getRoot();
    if (root == null) {
      LOG.error("Can't find the tree root. This may occur while updating a tree from Tobago 1.0 to 1.5. "
          + "Please refer the documentation to see how to use tree tags.");
      return;
    }
View Full Code Here

    if (ComponentUtils.isOutputOnly(node)) {
      return;
    }

    AbstractUITree tree = ComponentUtils.findAncestor(node, AbstractUITree.class);
    ;
    String treeId = tree.getClientId(facesContext);
    String nodeStateId = node.nodeStateId(facesContext);
    Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
    String id = node.getClientId(facesContext);

    // expand state
    boolean expanded = Boolean.parseBoolean((String) requestParameterMap.get(id + "-expanded"));
    if (node.isExpanded() != expanded) {
      new TreeExpansionEvent(node, node.isExpanded(), expanded).queue();
    }

    // select
    String searchString;
    if (tree.getSelectableAsEnum() != TreeSelectable.OFF) { // selection
      String selected = (String) requestParameterMap.get(treeId + AbstractUITree.SELECT_STATE);
      searchString = ";" + nodeStateId + ";";
      if (StringUtils.contains(selected, searchString)) {
        // TODO: add selection to Component
        //state.addSelection((DefaultMutableTreeNode) node.getValue());
View Full Code Here

  }

  @Override
  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
    UITreeNode node = (UITreeNode) component;
    AbstractUITree tree = ComponentUtils.findAncestor(node, AbstractUITree.class);
    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    boolean folder = node.isFolder();
    int level = node.getLevel();
    String id = node.getClientId(facesContext);
    boolean expanded = node.isExpanded();

    if (level > 0) { // root will not rendered as an option
      writer.startElement(HtmlElements.OPTION, null);
      // todo: define where to store the selection of a tree, node.getValue() seems not to be a god place.
      //        writer.writeAttribute(HtmlAttributes.VALUE, node.getValue().toString(), true); // XXX converter?
      writer.writeIdAttribute(id);
      writer.writeAttribute(HtmlAttributes.SELECTED, expanded);
      writer.writeText("(" + level + ") " + getLabel(node));
      if (folder) {
        writer.writeText(" \u2192");
      }
      writer.endElement(HtmlElements.OPTION);
    }

    if (folder) {
      boolean siblingMode = "siblingLeafOnly".equals(tree.getAttributes().get(Attributes.SELECTABLE));
      ResponseWriterDivider divider = ResponseWriterDivider.getInstance(facesContext, TreeListboxRenderer.DIVIDER);
      boolean alreadyExists = divider.activateBranch(facesContext);
      writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
      if (!alreadyExists) {
        writer.startElement(HtmlElements.DIV, null);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.internal.component.AbstractUITree

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.