Expand/Collapse All Version Sets

PSE 10, Is there a simple way to open all the Version Sets with one set of keystrokes, and having them stay open. I have a lot of version sets built up over time, and I would prefer not having to open each one individually. When I tried doing that on a small batch, as soon as I  changed to a different batch of pics, all of the Sets I had opened, promptly closed. The View > Expand/Collapse All Stacks does not work on the Version Sets.

Hi Surya
Create a new HTML region at the top of your page, using No Template and use this as the Source:
<script type="text/javascript">
function showHideAll(displaystyle)
var hideIMG = "/i/htmldb/builder/rollup_plus_dgray.gif";
var showIMG = "/i/htmldb/builder/rollup_minus_dgray.gif";
var k;
var r = document.getElementsByTagName("DIV");
if (r)
   for (k = 0; k < r.length; k++)
     if (r[k].className == 't12Hide')
       r[k].style.display = displaystyle;
var i = document.getElementsByTagName("IMG");
if ( i )
  for (k = 0; k < i.length; k++)
    if (i[k].id.substr(0, 5) == 'shIMG')
      i[k].src = (displaystyle == 'block') ? showIMG : hideIMG;
</script>
<a href="javascript:showHideAll('block');">Show All</a>
<a href="javascript:showHideAll('none');">Hide All</a>The image names and className (t12Hide) are based on my test page - change these as appropriate for your own page (you may need to do a View Source on the page to check these values).
Andy

Similar Messages

  • Decision Report: Toggling Expand / Collapse All (v10.2)

    Hi everyone,
    We're wondering if anyone can share an approach for enabling users to "expand/collapse all" (all nodes) in a decision report dynamically - i.e. using a button or toggle, rather than a global configuration or preference setting. For example, we would like to initially display a collapsed report (to show the high-level conclusions), and then enable the client to fully expand the report for printing.
    Importantly, we would like to be able to do this in version *10.2*.
    Thanks,
    - Patrick

    Granting my JavaScript is a bit rusty, I'm wondering if anyone else has encountered the following challenge when changing the global configuration settings for decision report (expanded/collapsed):
    Issue: The plus signs ( + ) at the nodes appear as minus signs ( - ), and vice versa. In other words, after our modifications, the user needs to click on a minus sign to expand a node.
    Our approach was simply to do a CTRL-F and replace "expanded" with "collapsed", so it's not surprising that there were unintended side effects.

  • Expand/Collapse all the Bookmarks in a PDF file

    Hi,
    This is my first message on the board :-)
    I work with very large PDF files (i.e 2000 pages, 700 bookmarks on 5 or 6 levels!) and I'm looking for a script (Acrobat 9 Pro) allowing to expand/collapse all the bookmarks in a PDF file.
    Thanks in advance for your valuable help,
    Cheers
    Antonella

    The Acrobat Javascript Scripting reference (http://partners.adobe.com/public/developer/en/acrobat/sdk/AcroJS.pdf) describes how to use scripting to access bookmarks and how to open and close them, which is what you're looking for.
    I suggest you read the reference and make a function that will do the job for you.
    That's the way I would do it.
    I don't think you can access the keyboard shortcuts "/" and "Shift + *" via scripting.
    Torben.

  • Expand/collapse all regions

    I have 5 show/hide regions on a page. is it possible to Expand/collapse all regions by clicking a "Show/Hide All" link or a button. any ideas are appreciated.
    thanks,
    Surya

    Hi Surya
    Create a new HTML region at the top of your page, using No Template and use this as the Source:
    <script type="text/javascript">
    function showHideAll(displaystyle)
    var hideIMG = "/i/htmldb/builder/rollup_plus_dgray.gif";
    var showIMG = "/i/htmldb/builder/rollup_minus_dgray.gif";
    var k;
    var r = document.getElementsByTagName("DIV");
    if (r)
       for (k = 0; k < r.length; k++)
         if (r[k].className == 't12Hide')
           r[k].style.display = displaystyle;
    var i = document.getElementsByTagName("IMG");
    if ( i )
      for (k = 0; k < i.length; k++)
        if (i[k].id.substr(0, 5) == 'shIMG')
          i[k].src = (displaystyle == 'block') ? showIMG : hideIMG;
    </script>
    <a href="javascript:showHideAll('block');">Show All</a>
    <a href="javascript:showHideAll('none');">Hide All</a>The image names and className (t12Hide) are based on my test page - change these as appropriate for your own page (you may need to do a View Source on the page to check these values).
    Andy

  • DHTML Tree Expand-Collapse ALL buttons

    Hi
    I am using at DHTML Tree (in APEX 3.0.1) as a menu. I am wondering if it is possible to add buttons (or link) to the region which a user can click to expand all or collapse all nodes in the tree.
    I don not want the tree to be expanded or collapsed all the time (as when using the Tree List template)
    Thanks

    Anyone?

  • Expand/Collapse all in OneNote 2013?

    Once I've created a hierarchy in OneNote, is there any way I can collapse all or expand all in a single click, or am I destined to have to click more than 100 [+]  when I want to see everything? Thanks.

    Hi,
    Do you mean you want to expand all collapsed outlines by single click? If so, we can use Alt + Shift + 0 to expand all levels in OneNote. Some related keyboard shortcut key are listed below:
    Show through Level 1.
        ALT+SHIFT+1
    Expand to Level 2.
        ALT+SHIFT+2
    Expand to Level 3.
        ALT+SHIFT+3
    Expand to Level 4.
        ALT+SHIFT+4
    Expand to Level 5.
        ALT+SHIFT+5
    Expand to Level 6.
        ALT+SHIFT+6
    Expand to Level 7.
        ALT+SHIFT+7
    Expand to Level 8.
        ALT+SHIFT+8
    Expand to Level 9.
        ALT+SHIFT+9
    Expand all levels.
        ALT+SHIFT+0
    Increase indent by one level.
        TAB
    Decrease indent by one level.
        SHIFT+TAB
    Expand a collapsed outline.
        ALT+SHIFT+PLUS SIGN
    Collapse an expanded outline.
        ALT+SHIFT+MINUS SIGN
    Hope this helps.
    Regards,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Expand/Collapse All functionality in TREE UI Element

    Hi All,
    I'm using Tree UI Element in which Collapse All button is coming defaultly in that Tree Application . But i need to know how the function is taking place behind . Because i need to refer to do it for Expand All scenario for the same tree . Is that collapse is refering to any method in class ? . Can anyone brief out the coding of that . Or if anyone knows the coding of Expand all pls refer to me,

    Hello Ramesh Vinay,
    *Create a node which has attributes (EXPANDED, IS_LEAF,ROW_KEY and PARENT_ROW_KEY) to build a tree.
    Following code will be executed when COLLAPSE ALL button is clicked.
    DATA: lo_nd_tree            TYPE REF TO if_wd_context_node,
               lt_elements           TYPE             wdr_context_element_set.
    FIELD-SYMBOLS:
            <lo_element>          TYPE REF TO if_wd_context_element.
    lo_nd_tree = wd_context->get_child_node( name = wd_this->wdctx_tree).
      lt_elements = lo_nd_tree ->get_elements( ).
      LOOP AT lt_elements ASSIGNING <lo_element>.
        <lo_element>->set_attribute(
          EXPORTING value = abap_false
                    name  = u2018EXAPNDEDu2019 ).
      ENDLOOP.
    Following code will be executed when EXPAND ALL button is clicked.
    DATA: lo_nd_tree            TYPE REF TO if_wd_context_node,
               lt_elements           TYPE             wdr_context_element_set.
    FIELD-SYMBOLS:
            <lo_element>          TYPE REF TO if_wd_context_element.
    lo_nd_tree = wd_context->get_child_node( name = wd_this->wdctx_tree).
      lt_elements = lo_nd_tree ->get_elements( ).
      LOOP AT lt_elements ASSIGNING <lo_element>.
        <lo_element>->set_attribute(
          EXPORTING value = abap_true
                    name  = u2018EXAPNDEDu2019 ).
      ENDLOOP.
    Reply me if you have any questions.
    Thanks,
    Bharath.K

  • Javascript to Expand/Collapse all grouped list items(2010 method no longer working)

    I have the below little piece of javascript that used to work in 2010(with plus.gif/minus.gif)
    <html>
    <head>
    <script language="Javascript" type="text/Javascript">
    function collapseGroups() { 
    $("img[src*='spcommon.png']:visible").parent().click(); 
    function expandGroups() { 
    $("img[src*='spcommon.png']:visible").parent().click(); 
    </script>
    </head>
    <body>
    <input type="button" id="btnExpand" onclick="expandGroups()" value="Expand All">
    <input type="button" id="btnExpand" onclick="collapseGroups()" value="Collapse All">
    </body>
    </html>
    This however does not work and results in a lot of "clicks" occuring on the site, wherever the spcommon.png is present(which is a lot)
    Has anyone hit this issue before?
    Regards
    Pieter
    PS. Works on 2010 with plus/minus.gif.
    Regards, Pieter
    MCPD | MCITP
    My Blog
    Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.

    Hi,
    In SharePoint 2013, we can add the following code into a Content Editor Web Part to achieve it.
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script language="Javascript" type="text/Javascript">
    function collapseGroups() {
    $("img[id^='img_']").click();
    function expandGroups() {
    $("img[id^='img_']").click();
    </script>
    <input id="btnExpand1" onclick="expandGroups()" type="button" value="Expand All" />
    <input id="btnExpand2" onclick="collapseGroups()" type="button" value="Collapse All" />
    Best Regards
    Dennis Guo
    TechNet Community Support

  • DTreeTable Expand/Collapse All

    I was wondering if anyone had any experience with the DTreeTable plugin found here: http://apex-plugin.com/oracle-apex-plugins/region-plugin/dtreetable_68.html
    If so, has anyone implemented an expand all or collapse all button with it?
    An example of the onclick for each node is dttToggleNode('2597807651112537', 1) - I could loop through these and click them all but is there a nicer way?
    Thanks.
    EDIT: Here is the javascript it is calling.  I'm thinking possibly loop through the whole page and do a variation of the two expand and collapse functions?
    var el = $('#dtt_' + regionId + '_table tbody tr span.dtt_icon')[rownum - 1];
                    if ($(el).hasClass('dtt_collapsed_span')) {
                                   // call expand function
                                   dttExpand(regionId, rownum);
                    } else {
                                   // call collapse function
                                   dttCollapse(regionId, rownum);
    function dttExpand(regionId, rownum) {
      // get related table row
      var el = $('#dtt_' + regionId + '_table tbody tr')[rownum - 1];
      // store current level
      var level = Number($(el).attr('dtt_level'));
      // change icon
      $(el).find('span.dtt_icon').removeClass('dtt_collapsed_span');
      $(el).find('span.dtt_icon').addClass('dtt_expanded_span');
      while ($($(el).next()).attr('dtt_level') != null) {
         var el = $(el).next();
         if ($(el).attr('dtt_level') == (level + 1)) {
          // change display
      el.removeClass('dtt_collapsed_tr');
      el.addClass('dtt_expanded_tr');
      } else if ($(el).attr('dtt_level')  == level) {
      break;
    function dttCollapse(regionId, rownum) {
      // get related table row
      var el = $('#dtt_' + regionId + '_table tbody tr')[rownum - 1];
      // store current level
      var level = Number($(el).attr('dtt_level'));
      // change icon
      $(el).find('span.dtt_icon').addClass('dtt_collapsed_span');
      $(el).find('span.dtt_icon').removeClass('dtt_expanded_span');
      while ($($(el).next()).attr('dtt_level') != null) {
         var el = $(el).next();
         if ($(el).attr('dtt_level') > level) {
          // change display
      el.addClass('dtt_collapsed_tr');
      el.removeClass('dtt_expanded_tr');
      // change icon
      $(el).find('span.dtt_icon').addClass('dtt_collapsed_span');
      $(el).find('span.dtt_icon').removeClass('dtt_expanded_span');
      } else if ($(el).attr('dtt_level')  == level) {
      break;

    Hi Surya
    Create a new HTML region at the top of your page, using No Template and use this as the Source:
    &lt;script type="text/javascript"&gt;
    function showHideAll(displaystyle)
    var hideIMG = "/i/htmldb/builder/rollup_plus_dgray.gif";
    var showIMG = "/i/htmldb/builder/rollup_minus_dgray.gif";
    var k;
    var r = document.getElementsByTagName("DIV");
    if (r)
       for (k = 0; k &lt; r.length; k++)
         if (r[k].className == 't12Hide')
           r[k].style.display = displaystyle;
    var i = document.getElementsByTagName("IMG");
    if ( i )
      for (k = 0; k &lt; i.length; k++)
        if (i[k].id.substr(0, 5) == 'shIMG')
          i[k].src = (displaystyle == 'block') ? showIMG : hideIMG;
    &lt;/script&gt;
    &lt;a href="javascript:showHideAll('block');"&gt;Show All&lt;/a&gt;
    &lt;a href="javascript:showHideAll('none');"&gt;Hide All&lt;/a&gt;The image names and className (t12Hide) are based on my test page - change these as appropriate for your own page (you may need to do a View Source on the page to check these values).
    Andy

  • Can I expand/collapse all of my email accounts in the folder pane?

    Greetings,
    Thank you in advance for your help.
    I'm using T-bird v31.0
    The inbox is configured to view/layout/folder pane and view/folders/unified.
    I have multiple email accounts that appear in the folder pane.
    I can expand/collapse inbox, drafts, sent, junk, trash, but not the email accounts.
    Is it possible to expand/collapse the email accounts?
    Thank you for you hard work and expertise.
    norm

    Do you have the removed account forwarded to your other account at the server?
    If the account is not still in Thunderbird there is no way for it to check mail on that account. Even if it did it would not place the messages in a different Inbox.
    Just to be sure when you go to Tools-Account Settings is the old account still in the list?
    Use Tools on the menu bar and not the AppMenu button.
    No menu bar? Press the alt key.

  • PSE13 Organizer: stacks and version sets do not expand

    Converted three catalogs from PSE12 show the stacks/versions sets overlay symbols in organizer but there seems to be no way to expand the stack/version set. All the menu choices for doing this are disabled.
    Anybody else seeing this? Any workaround? Any ETA besides PSE 14 or higher for a fix?

    I had the same issue. It took me a lot of time playing with the interface before I finally figured out the problem. Even though, when you double click a photo (single view) from within the default grid view, you "do" get the option to expand a stack or version set (not greyed out). However, it does not work. My frustration with that is that since it was not greyed out you would naturally expect it to be functional and it is not. In grid view the option is greyed out however that caused confusion as well since this option works in Elements 12 default view. So, one assumes it is a defect. Right? So the solution is to switch the grid view to detail view (view -> detail). Once you do that then the expand function works as expected. This should have been explained as I believe it is a change in functionality (user work flow) from earlier versions. I did try to find wording about this in the help file but no luck.  

  • Expand Multiple Version Sets

    I just upgraded to PSE9 from PSE6.  I am doing a little housecleaning and need to move many many many files.  Is there a way to select a whole bunch of pictures and expand all the version sets in there?  For instance, if a find by a date range, then find all version sets, now I would like to 'select all' and be able to expand the version sets.  Not Possible???  Doesn't seem to be.  Any ideas how I can use a workaround?

    99jon a écrit:
    It’s not a bug
    How do you know?
    Your expectations are simply unrealistic.
    That's not the answer. I know there are a number unrealistic expectations with the organizer. Let's see if it's the case here.
    What's the problem ?
    It's very different from the original subject, not about expanding multiple version sets.
    It's simply about trusting, or the limits in trusting in the 'file/move' function of the organizer, which is a subject you'll have seen discussed many times, and for which I have never seen a clear answer. On the other hand you have seen hundreds of times the advice to use the organizer move feature instead of doing this outside of the organizer. Where is the truth? It's not because I have personally never met a problem with the move feature that it can work in all circumstances, in all versions and OS.
    The reported behaviour is that the algorithm plays nicely and ends without warning nor freezing after skipping many files. This is very unusual, but it seems to be repetitive in a given environment (we don't know the details of...) This hints rather at a 'bug' in the algorithm rather than a compatibility problem with the OS or an available RAM or disk space, but we can't know without searching further.
    You'll note that the move feature is a basic and fundamental argument in favor of a database management system : it's not anecdotic, so it is just natural to expect it does work properly.
    If there are limits in the conditions the move feature can work properly it's realistic to expect to know them. And if those limits are known to the developers, something should be done to warn the user and avoid program crashes or false results.

  • Expanding and Collapsing All Nodes in a TreeByNestingTableColumn

    Hi Experts,
    I'm using NWDS 7.0.18.
    I have a table with TreeByNestingTableColumn (master column).
    The child nodes are recursive nodes and are loaded at runtime with an action onLoadChildren when clicking the master column. My question is, when the hierarchy is in its initial state, only the root node is loaded into the table. But I want to add functionality for expanding all nodes in the tree. Is there a way to achieve this, I'm a little confused because the Hierarchy children havent been loaded yet.
    Any suggestion will greatly help.
    Regards,
    Kunal.

    Hi Kunal,
    I got your problem.
    To expand & collpase all the child nodes please modify the code as below.
    Create two methods exapndAll &  collapseAll and call these two methods in existing button actions.
    as below.
    public void expandAll( com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogEntriesNode node )
        //@@begin expandAll()
           for (int i = 0; i < node.size(); i++) {
         node.getCatalogEntriesElementAt(i).setExpanded(true);
         if(node.getCatalogEntriesElementAt(i).getIsLeaf()==false)
              expandAll(node.getCatalogEntriesElementAt(i).nodeChildCatalogEntries());
        //@@end
    public void collapseAll( com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogEntriesNode node )
        //@@begin collapseAll()
         for (int i = 0; i < node.size(); i++) {
         node.getCatalogEntriesElementAt(i).setExpanded(false);
         if(node.getCatalogEntriesElementAt(i).getIsLeaf()==false)
              expandAll(node.getCatalogEntriesElementAt(i).nodeChildCatalogEntries());
        //@@end
    public void onActionCollapseAll(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionCollapseAll(ServerEvent)
        collapseAll(wdContext.nodeCatalogEntries());
        //@@end
    public void onActionExpandAll(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionExpandAll(ServerEvent)
        expandAll(wdContext.nodeCatalogEntries());
        //@@end
    We are invoking the methods recursively to expand/collapse all the child nodes.
    This works.
    Regards,
    Charan

  • Understanding Version Sets, Stacks, Picks, & Album Picks

    Aperture's documentation is very good in most respects (adjustments being the major exception), but I found it very difficult to put my head around the whole version set / stacks / picks / album picks thingy.
    While working on some images this morning, it all became clear.
    1. Version Sets vs. Stacks
    A Version Set is a single Master image with two or more Versions.
    Version Sets have a light gray border around the contained images, and a single dark gray border around all those images in the Version Set.
    A Stack is a collection of versions that do not use the same Master.
    A Stack can contain single Versions or Version Sets (and Version Sets remain grouped within a Stack: you'll see a light gray border around the Version Sets and a dark gray border around everything in the Stack).
    If you Stack two or more Version Sets, and then choose the Unstack command, all the Versions become separated--even if they share the same Master (i.e., UnStacking a Stack does not result in Version Sets, as you might expect--instead, it results in all individual Versions).
    You can re-Stack these separated Versions that share the same Master, and you'll get a Version Set (light gray border surrounded by dark gray border) automatically (which is good, since there is no Create Version Set command).
    From all these results, it appears that a Version Set is simply a Stack where each Version shares the same Master. It is different from other Stacks in that these Versions have a common light gray border.
    2. Picks vs. Album Picks
    Create an Album and add two separate images (i.e., two Versions with different Masters). Call it Album1.
    Duplicate the Album. Call it Album2.
    In Album1, create 3 different cropped versions of image1 (so you can tell the Versions apart). Likewise, create 2 different cropped versions of image2. You should now have 2 Version Sets in each album.
    To help keep track of which Version is the pick, press 'T' to turn on image overlays so you can see the Version Title when you pause your mouse over an image.
    Click on the number in the top left corner of each Version set to condense them. Notice that the left-most image (the Pick) is the image you se in the condensed Version Set. The same image will appear in Album1 and Album2.
    Open the Version Set again, and click on the right-most image, then click the Pick button on the top toolbar (not the Album Pick button; the Pick button). Notice the rightmost image physically moves to the leftmost position. Close the Version Set and notice that this Version is now the one that displays when the Version Set is condensed.
    Go into Album2 and condense the Version Set there, too. Notice that the same Version as in Album1 is the Pick. That's because we have not selected an Album Pick yet. The default Pick is the Pick for all albums until you pick an Album Pick for one or more albums.
    While in Album2, open the first Version Set and select the right-most image in the Version Set. Now click the Set Album Pick button on the top toolbar. Notice no images move this time (compare that to clicking the Pick button on the toolbar). Instead, a black checkmark in a gray circle appears over the image. This means this Version is the Album Pick. Collapse this Version Set in Album2, and notice that the Album Pick image is what shows in the condensed Version Set. Now go back to Album1, and you'll notice there is no checkmark on any images. Collapse the first Version Set, and you'll see the left-most image (the default Pick) is the image that shows up on the collapsed Version Set. If you wanted to, you could open up the Version Set, select the middle image and click the Set Album Pick button, and the middle image would represent the Version Set in Album1, while the 3rd image would represent the Version Set in Album2. Version Sets can have no Album Picks, in which case the default Pick (the leftmost image) is what is selected for a collapsed Version Set.
    OK, let's have some real fun now! Select the first Version Set, then command-click on the second Version Set to select both Version Sets. Now right-click (or control-click) on one of the images and select Stack. Both Version Sets should be combined into a single Stack, but you should still be able to see the light gray border around the two Version Sets within the Stack.
    Click outside the Stack to deselect all the Versions. Now click on the left-most Version in the right-most Version Set. Click the Pick button on the top toolbar. Notice the entire right-most Version Set moves to the left to become the (default) Pick! Press command-Z to undo your change.
    Now click on the right-most Version in the right-most Version set. Click the Pick button on the top toolbar. Notice that, not only does the entire right-most Version Set move to the left, but also the rightmost Version moves to the left-most position within the Version Set! You're not only telling Aperture to make the second Version Set the Pick for this Stack, you're also telling it that the right-most Version within that Version Set is the Pick for the Stack.
    Play around with setting the Album Pick within each Stack and comparing Album1 with Album2 when you collapse the Stack.
    This is a fun exercise that can really help you understand the difference (and similarities) between Version Sets, Stacks, (default) Picks, and Album Picks.
    Please correct anything that I'm misunderstanding, or feel free to add anything you've found out about these topics.

    Aperture's documentation is very good in most
    respects (adjustments being the major exception), but
    I found it very difficult to put my head around the
    whole version set / stacks / picks / album picks
    thingy.
    While working on some images this morning, it all
    became clear.
    <...>
    I thank you for the clarification on those matters, while I have used stacks quite a bit I have not yet explored in full detail the Version Set concept (though I had a rough idea of what it did). That was a great job of investigation.
    To help bring a similar level of understanding to others regarding the Aperture adjustment tools (which as you note are not well documented), I have published an Adjustment Tool Guide (2 MB PDF) that covers all of the Aperture adjustments - you can find it at:
    http://www.InsideAperture.com
    Just follow the Adjustment Tool Guide links.

  • JTree with XML content expand/collapse problem

    Hello all,
    I'm having this very weird problem with a JTree I use to display the contents of an XML file. I use the DOM parser (and not JDOM since I want the application to run as an applet as well, and don't want to have any external libraries for the user to download) and have a custom TreeModel and TreeNode implementations to wrap the DOM nodes so that they are displayed by the JTree.
    I have also added a popup menu in the tree, for the user to be able to expand/collapse all nodes under the selected one (i.e. a recursive method).
    When expandAll is run, everything works fine and the children of the selected node are expanded (and their children and so on).
    However, after the expansion when I run the collapseAll function, even though the selected node collapses, when I re-expand it (manually not by expandAll) all of it's children are still fully open! Even if I collapse sub-elements of the node manually and then collapse this node and re-expand it, it "forgets" the state of it's children and shows them fully expanded.
    In other words once I use expandAll no matter what I do, the children of this node will be expanded (once I close it and re-open it).
    Also after running expandAll the behaviour(!) of the expanded nodes change: i have tree.setToggleClickCount(1); but on the expanded nodes I need to double-click to collapse them.
    I believe the problem is related to my implementations of TreeModel and TreeNode but after many-many hours of trying to figure out what's happening I'm desperate... Please help!
    Here's my code:
    public class XMLTreeNode implements TreeNode 
         //This class wraps a DOM node
        org.w3c.dom.Node domNode;
        protected boolean allowChildren;
        protected Vector children;
        //compressed view (#text).
         private static boolean compress = true;   
        // An array of names for DOM node-types
        // (Array indexes = nodeType() values.)
        static final String[] typeName = {
            "none",
            "Element",
            "Attr",
            "Text",
            "CDATA",
            "EntityRef",
            "Entity",
            "ProcInstr",
            "Comment",
            "Document",
            "DocType",
            "DocFragment",
            "Notation",
        static final int ELEMENT_TYPE =   1;
        static final int ATTR_TYPE =      2;
        static final int TEXT_TYPE =      3;
        static final int CDATA_TYPE =     4;
        static final int ENTITYREF_TYPE = 5;
        static final int ENTITY_TYPE =    6;
        static final int PROCINSTR_TYPE = 7;
        static final int COMMENT_TYPE =   8;
        static final int DOCUMENT_TYPE =  9;
        static final int DOCTYPE_TYPE =  10;
        static final int DOCFRAG_TYPE =  11;
        static final int NOTATION_TYPE = 12;
        // The list of elements to display in the tree
       static String[] treeElementNames = {
            "node",
      // Construct an Adapter node from a DOM node
      public XMLTreeNode(org.w3c.dom.Node node) {
        domNode = node;
      public String toString(){
           if (domNode.hasAttributes()){
                return domNode.getAttributes().getNamedItem("label").getNodeValue();
           }else return domNode.getNodeName();      
      public boolean isLeaf(){ 
           return (this.getChildCount()==0);
      boolean treeElement(String elementName) {
          for (int i=0; i<treeElementNames.length; i++) {
            if ( elementName.equals(treeElementNames)) return true;
    return false;
    public int getChildCount() {
         if (!compress) {   
    return domNode.getChildNodes().getLength();
    int count = 0;
    for (int i=0; i<domNode.getChildNodes().getLength(); i++) {
    org.w3c.dom.Node node = domNode.getChildNodes().item(i);
    if (node.getNodeType() == ELEMENT_TYPE
    && treeElement( node.getNodeName() ))
    // Note:
    // Have to check for proper type.
    // The DOCTYPE element also has the right name
    ++count;
    return count;
    public boolean getAllowsChildren() {
         // TODO Auto-generated method stub
         return true;
    public Enumeration children() {
         // TODO Auto-generated method stub
         return null;
    public TreeNode getParent() {
         // TODO Auto-generated method stub
         return null;
    public TreeNode getChildAt(int searchIndex) {
    org.w3c.dom.Node node =
    domNode.getChildNodes().item(searchIndex);
    if (compress) {
    // Return Nth displayable node
    int elementNodeIndex = 0;
    for (int i=0; i<domNode.getChildNodes().getLength(); i++) {
    node = domNode.getChildNodes().item(i);
    if (node.getNodeType() == ELEMENT_TYPE
    && treeElement( node.getNodeName() )
    && elementNodeIndex++ == searchIndex) {
    break;
    return new XMLTreeNode(node);
    public int getIndex(TreeNode tnode) {
         if (tnode== null) {
              throw new IllegalArgumentException("argument is null");
         XMLTreeNode child=(XMLTreeNode)tnode;
         int count = getChildCount();
         for (int i=0; i<count; i++) {
              XMLTreeNode n = (XMLTreeNode)this.getChildAt(i);
              if (child.domNode == n.domNode) return i;
         return -1; // Should never get here.
    public class XMLTreeModel2 extends DefaultTreeModel
         private Vector listenerList = new Vector();
         * This adapter converts the current Document (a DOM) into
         * a JTree model.
         private Document document;
         public XMLTreeModel2 (Document doc){
              super(new XMLTreeNode(doc));
              this.document=doc;
         public Object getRoot() {
              //System.err.println("Returning root: " +document);
              return new XMLTreeNode(document);
         public boolean isLeaf(Object aNode) {
              return ((XMLTreeNode)aNode).isLeaf();
         public int getChildCount(Object parent) {
              XMLTreeNode node = (XMLTreeNode) parent;
    return node.getChildCount();
         public Object getChild(Object parent, int index) {
    XMLTreeNode node = (XMLTreeNode) parent;
    return node.getChildAt(index);
         public int getIndexOfChild(Object parent, Object child) {
    if (parent==null || child==null )
         return -1;
              XMLTreeNode node = (XMLTreeNode) parent;
    return node.getIndex((XMLTreeNode) child);
         public void valueForPathChanged(TreePath path, Object newValue) {
    // Null. no changes
         public void addTreeModelListener(TreeModelListener listener) {
              if ( listener != null
    && ! listenerList.contains( listener ) ) {
    listenerList.addElement( listener );
         public void removeTreeModelListener(TreeModelListener listener) {
              if ( listener != null ) {
    listenerList.removeElement( listener );
         public void fireTreeNodesChanged( TreeModelEvent e ) {
    Enumeration listeners = listenerList.elements();
    while ( listeners.hasMoreElements() ) {
    TreeModelListener listener =
    (TreeModelListener) listeners.nextElement();
    listener.treeNodesChanged( e );
         public void fireTreeNodesInserted( TreeModelEvent e ) {
    Enumeration listeners = listenerList.elements();
    while ( listeners.hasMoreElements() ) {
    TreeModelListener listener =
    (TreeModelListener) listeners.nextElement();
    listener.treeNodesInserted( e );
         public void fireTreeNodesRemoved( TreeModelEvent e ) {
    Enumeration listeners = listenerList.elements();
    while ( listeners.hasMoreElements() ) {
    TreeModelListener listener =
    (TreeModelListener) listeners.nextElement();
    listener.treeNodesRemoved( e );
         public void fireTreeStructureChanged( TreeModelEvent e ) {
    Enumeration listeners = listenerList.elements();
    while ( listeners.hasMoreElements() ) {
    TreeModelListener listener =
    (TreeModelListener) listeners.nextElement();
    listener.treeStructureChanged( e );
    The collapseAll, expandAll code (even though I m pretty sure that's not the problem since they work fine on a normal JTree):
        private void collapseAll(TreePath tp){
             if (tp==null) return;
             Object node=tp.getLastPathComponent();
             TreeModel model=tree.getModel();
             if (!model.isLeaf(node)){
                  tree.collapsePath(tp);
                  for (int i=0;i<model.getChildCount(node);i++){
                  //for (int i = node.childCount()-4;i>=0;i--){
                       collapseAll(tp.pathByAddingChild(model.getChild(node,i)));
                  tree.collapsePath(tp);
        private void expandAll(TreePath tp){
             if (tp==null) return;
             Object node=tp.getLastPathComponent();
             TreeModel model=tree.getModel();
             if (!model.isLeaf(node)){
                  tree.expandPath(tp);
                  for (int i=0;i<model.getChildCount(node);i++){
                  //for (int i = node.childCount()-4;i>=0;i--){
                       expandAll(tp.pathByAddingChild(model.getChild(node,i)));

    Hi,
    Iam not facing this problem. To CollapseAll, I do a tree.getModel().reload() which causes all nodes to get collapsed and remain so even if I reopen them manually.
    Hope this helps.
    cheers,
    vidyut

Maybe you are looking for

  • Ipod Touch 4 with iOS 6.1.6 crashes

    I have an iPod Touch 4 running iOS 6.1.6 that crashes frequently when I try to start or use some apps.  Words with Friends may take five or more attempts to get it to start, then it often crashes after I've entered a word to send to my opponent.  The

  • Multi company network

    Hi! I'm asked to setup a multi company network. There will be approximately 4-8 small companies around 8-15 people in each company. These companies will share some resources as printers and probably a nas. Furthermore they will have their own wlan ss

  • OPEN ITEM UPLOAD

    hi i would like to know while uploading the transcation data through lamw is there any special setting required for openitem transcaton data pls let me know G.Krishna

  • Is there a way do find out to which package a file belongs?

    If pacman tries to install a package it is normally aware of files beeing already installed and puts out an error message. Is it possible to encounter to which package a file belongs, t.m. which package did install it?

  • Fluid Grid Layout issue

    i created a Fluid Grid Layout the other day.  Published it via FTP and it worked fine.   Today I made some changes to the page and they look fine on dreamweaver.   When I save and publish,  none of the changes show up on the site.   Are there other f