6 Replies Latest reply on Feb 5, 2008 12:15 PM by Arty13

    Tree Disclosure Triangle?

    Arty13
      I have a tree and I want to be able to toggle the Disclosure Triangle (triangle left to a branch node which expands/collapses that node)
      For example, I want to specify a value so that triangle does not show on certain branch items that do not have children.
      [ I do not want to specify the default icon for a nonbranch node to be the same as a branch node ]

      Is there a way to do this easily? or do I need to extend the tree class?

      Any help is appreciated.

      Art
        • 1. Re: Tree Disclosure Triangle?
          ntsiii Level 3
          Look into creating a custom TreeItemDataDescriptor. I have not done one yet so I can't be more helpful.

          Tracy
          • 2. Re: Tree Disclosure Triangle?
            Arty13 Level 1
            Tracy, thanks for your help.
            I already did create a custom TreeDataDesriptor and using that. My custom TreeDataDesriptor has 2 types of children, one consists of Folders and the other consists of Files. I need to keep the two groups seperate and I didnt want to filter out a single group for an attribute to determine if it was a folder or file.
            So when I click on an item in the tree it will display its folders and files in a seperate list object. So with the folders that dont have any subfolders it still needs to be considered a branch item and I need to be able to toggle the triangle.
            Currently I am looking through the tree class and seeing if it can easily be done without having a hackish work around.

            Thanks,

            Art
            • 3. Re: Tree Disclosure Triangle?
              Arty13 Level 1
              In the tree class, the triangle icon is specified during the initListData function. it is called the disclosureIcon property. It is declared in the ListBase class. But in the initListData function there is a comment that states that the disclosureIcon will be hidden for non-branch items. But anyone know where that is done?

              Thanks,

              Art
              • 4. Re: Tree Disclosure Triangle?
                Sreenivas R Adobe Employee
                The setting of treeListData.hasChildren = branch; in initListData does the trick.

                If you want to control the disclosure icon display you can put the logic in the customDataDescriptor.isBranch function which gets called to set this flag through the Tree.isBranch() function.

                HTH
                • 5. Re: Tree Disclosure Triangle?
                  Arty13 Level 1
                  Thanks HTH, but I still want that attribute of branch to be True, I need to toggle the triangle seperately from the branch value.
                  It looks like I will need to make my own TreeItemRenderer and edit the updateDisplayList function so I can toggle the disclosureIcon visible value.

                  Thanks, and let me know if anyone knows a different way.

                  Art
                  • 6. Re: Tree Disclosure Triangle?
                    Arty13 Level 1
                    I ended up doing a custom TreeItemRenderer and overrided the updateDisplayList function, and have some custom code to check to see if I want the disclosureIcon to be visible or not.

                    Short term, this will work for me. The real way I want to do this, I will need to create custom TreeClasses to incorporate all my needs.

                    Thanks everyone for your help.

                    Art