5 Replies Latest reply on Feb 16, 2009 1:21 PM by Nick Belaevski

    Facing problem with rich Tree and need help.

    Mohamed El Dawayaty Newbie

      I have a problem using <rich:tree />

      the problem is there is an empty line rendered before the last tree node and another is rendered after the last node, also the indentation of the tree is not correct. maybe the problem in my code. but i can't find out what is it.

      any body can help me ??


      the JSP page is as following:

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <f:view>
      <h:form id="mainForm">
      <rich:tree switchType="client" value="#{treeBean.node}" ajaxSubmitSelection="true" nodeSelectListener="#{treeBean.selectNode}" />
      </h:form>
      </f:view>


      i can provide a screen shot if you want but i don't know how to attache it to this forum.

      regards.


        • 1. Re: Facing problem with rich Tree and need help.
          Ilya Shaikovsky Master

          yes.. screenshot will be helpfull.(share at any image sharing server) I'm not sure that get the point completelly. Also provide java code of tree initialization.

          • 2. Re: Facing problem with rich Tree and need help.
            Mohamed El Dawayaty Newbie

            here is the source code for building the tree.

            i can't see any thing wrong with it.

            // this will get the tree data from the Database
            List rs = DatabaseAPI.executeQuery(queryStr, 5, queryDataTypes);

            // TestTreeNode is a class extends org.richfaces.model.TreeNodeImpl
            this.node = new TestTreeNode();

            String a_name, jspname;
            if (rs.size() > 0) {
            int iterator = 0;
            int i = 1;
            int parent = 0;
            int code = 0;
            boolean rootFlag = false;
            try {
            TestTreeNode root = null;
            TestTreeNode level1 = null;
            TestTreeNode level2 = null;
            while (iterator < rs.size()) {

            a_name = (String)(((List)(rs.get(iterator))).get(1));
            jspname = (String)(((List)(rs.get(iterator))).get(2));
            code = (Integer)(((List)(rs.get(iterator))).get(0));

            if ((((Integer)(((List)(rs.get(iterator))).get(3))) == 0 ) && (rootFlag == false)){

            root = new TestTreeNode();
            root.setData(a_name);
            parent = -1;
            rootFlag = true;

            } else {
            if ((String)(((List)(rs.get(iterator))).get(2)) == null) {
            level1 = new TestTreeNode();
            level1.setData(a_name);
            root.addChild(iterator,level1);
            } else {
            level2 = new TestTreeNode();
            level2.setData(a_name);
            if (!sessionInfo.isTreeLinkable())
            if((Integer)(((List)(rs.get(iterator))).get(4)) == 1 )// the link is enabled
            level2.setLink((String)(((List)(rs.get(iterator))).get(2)));
            else
            level2.setLink("/ETransactions/Sorry.html");
            level1.addChild(iterator,level2);
            }
            }
            iterator++;
            i++;
            }
            if (root == null){
            root = new TestTreeNode();
            root.setData("??????? ????????");
            }
            node.addChild(0,root);

            } catch (Exception ex) {
            // TODO
            System.out.println(ex.getMessage());
            }

            }
            return node;

            the problem that show up is (the result of this code):

            1- there is an empty space (about one node hight) between the last tree node and the previous node in any level (i.e. if you expand any node at any level all the child nodes will show up in adjacent places except the last one, there will be an empty space between it and the previous node).

            some thing like that:


            - 1
            - 1.1
            - 1.2
            - 1.2.1
            - 1.2.2

            - 1.2.3
            - 1.3

            - 1.4

            as you can see the space between 1.2.3 and 1.2.2
            also the same with 1.4 and 1.4.

            • 3. Re: Facing problem with rich Tree and need help.
              Nick Belaevski Master

              Hello,

              In what browser does that reproduce? And what is RF version?

              • 4. Re: Facing problem with rich Tree and need help.
                Mohamed El Dawayaty Newbie

                this problem on the folowing environment
                IE, RichFaces 3.1.6 GA, MyFaces 1.1.5, OC4j 10.1.3.3.0 with JDK 1.5_6

                i think that's all.

                • 5. Re: Facing problem with rich Tree and need help.
                  Nick Belaevski Master

                  I cannot reproduce the issue on 3.1.6.GA livedemo: http://livedemo.exadel.com/richfaces-demo-3.1.6.GA/richfaces/tree.jsf?c=tree. Do you have some custom styling enabled for P HTML element?