JTree Expand All & Collapse All...

Hi All,
i hv two buttons "Expand All" & "Collapse All". If i press "Expand All" i should expand all the nodes in the all the root nodes(JTree).
If i press "Collapse All" i sh collapse all the entries in the JTree.
Is there any way to acheive this.
Thanks
ss

Hi!
You can try these methods where treeRoot is the root node of the tree:
* Collapses the function group tree.
public void collapseAll() {
for (int i = treeRoot.getChildCount(); i > 0; i--) {
tree.collapseRow(i);
* Collapses the function group tree.
public void expandAll() {
for (int i = treeRoot.getChildCount(); i > 0; i--) {
tree.expandRow(i);
/Malin

Similar Messages

  • Adding a link to expand and collapse all DHTML drop downs

    Hi, can anyone help me adapt the "Skinny on Skins" example "Add a Toolbar button to expand and collapse all DHTML drop downs" so that it will work with just a simple HTML link in RH8, instead of being attached to a custom skin button?
    The example looks like this:
    Step 1. Open the Skins Editor for the skin where you want to add the button.
    Step 2. After the preview loads into the window, ensure that the Toolbar tab has focus, then click the plus symbol. The Custom Toolbar Item dialog should display.
    Step 3. Type the Item Name (This is simply an internal reference for the button).
    Step 4. Type the Text (This is the text that will be seen by the end user. The field must contain something. So if you don't want any verbiage to display for your toolbar item, simply type a space.)
    Step 5. Choose your Image Options, then click the Action tab.
    Step 6. Click the JavaScript option button.
    Step 7. Enter the following code in the OnClick field:
    javascript:toggle()
    Step 8. In the JavaScript area, ensure the Inline JavaScript option button is selected, then click the edit (Pencil) icon located to the right.
    Step 9. Enter the following code in the Inline JavaScript dialog
    var show = "false";
    function toggle() {
    parent.frames[1].bsscright.focus();
    var arrayofDivs = parent.frames[1].bsscright.document.all.tags('DIV');
    if (show == "false") {
    for (x=0;x<arrayofDivs.length;x++) { arrayofDivs[x].style.display = "block";}
    show = "true";}
    else {
    for (x=0;x<arrayofDivs.length;x++) { arrayofDivs[x].style.display = "none"; }
    show = "false"; }
    Step 10. Click the OK button to close the Inline JavaScript dialog.
    Step 11. Click the OK button to close the Custom Toolbar Item dialog.
    Step 12. Click the OK button to close the Skin Editor.
    Step 13. Generate WebHelp via File > Generate > WebHelp and ensure that you have the new button selected with a check mark. This will probably require stepping through some screens to see the place where you can select it.
    Many thanks
    Jonathan

    Hi again
    I want to use it in the header of one of my Master Pages, so it will only be created/maintained once. Not all my pages have drop downs in so rather than have a toolbar button available for every page, I was trying to be a bit cuter by having two Master Pages - one for normal pages and one for pages with drop downs in.
    I'm no javascript expert so I'll see if one of my developers can help.
    Thanks anyway
    Jonathan

  • Expand all/ Collapse all topics button and Visited Topics color

    Hi
    First of all, I am not sure if it is a good idea to create one post for two queries. But I have these two requirements for my project.
    1. I need a Expand all/ Collapse all button(s) on the toolbar, which will open and close all books in the ToC. Is it possible to have one? How?
    2. Is it possible to have a different color for the visited topics on the ToC? How?
    Thanks
    Sreekanth

    Your requirements are
    1. I need a Expand all/ Collapse all button(s) on the toolbar, which will open and close all books in the ToC. Is it possible to have one? How?
    Not something I have ever seen.
    2. Is it possible to have a different color for the visited topics on the ToC? How?
    Same answer.
    Sorry.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How to Expand-all, Collapse- all in a table ????

    I am a beginner. I am using Jdevloper 11.1.2.3.0. I have a showdetailheader component as a parent and a Table as a child. There are 2 buttons "Expand-all" and "collapse-all" which references a managed bean.
    In the showDetailHeader disclosed property a variable is set. When i click Expand-all button the variable becomes true and it discloses all the child nodes. When i click collapse all the reverse happens fine. Now the
    problem is when i manually click any changes to the node on the page inside the showdetailheader, the collapse-all button doesnt collapse completely, It closes only till whichever node was not changed.The same problem comes with Expand-all also.
    I tried to set the DisclosedRowKeys to null in the managed bean when the two buttons are invoked it did not work as expected.
    Could some one pls give me some hint ????
    - Pani

    Hi Timo. Thanks a lot that was very helpful.
    During the collapse operation do i need to set the disclosed row keys to null ???
    will this solve my problem ?

  • Is it possible to add an Expand all/Collapse all button in WebHelp Output?

    Hi there,
    We now have > 15 child projects in our merged online help, each containing hundreds of topics. Each child project is a chapter in our WebHelp online help output.
    If a user opens a couple of topics in each project, the TOC can become difficult to navigate. Is it possible to add a button that enables users to collapse all of the open chapters / expand all of the closed chapters? We are using RoboHelp 10.
    Thanks a lot,
    Niamh

    Hi there
    Expanding all could be problematic. But collapsing all should be a snap. That is, as long as you don't mind one teensy side effect. That side effect would be that the default topic would load up in the Topic pane and replace whatever topic was open at the time your user clicked the Collapse All.
    The way to Collapse All is to simply create a hyperlink that re-opens the WebHelp start page. Things reload fresh (with the TOC all nice and collapsed).
    If you would like to suggest to the Adobe development team that we actually get proper collapse or expand all buttons, please feel free to suggest it using the link below:
    http://www.adobe.com/go/wish
    Cheers... Rick

  • 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

  • Expand or collapse all collapsible panels at once.

    Hi,
    I have a page with a number of collapsible panels on it generated from SpryData.
    I know the collapsible panel names because their IDs are generated from the Spry data with
    <div class="CollapsiblePanel" id="cp{ds_RowNumber}" spry:repeat="Events">
    I have a couple of links on the page that I want our members to be able to click to be be able to collapse or expand all collapsible panels at once. How can I return a reference to the collapsible panel objects so I can close / open them using the open / close functions of the widget etc?
    See http://www.thehmc.co.uk/Events4.html and the links with the text (Show or hide all event details)
    i.e. I have a function and I know Spry.$$ is not what I want , but what do I need to return the object reference?
    function dhide()
    var panelCount = Events.getRowCount();
    for (var p = 0;p < panelCount;p++)
      panelID = '#cp' + p;
      var mypanel = Spry.$$(panelID);
      var a = panelID.close();
    Thanks
    Phiol

    Hi,
    Yes I found CollapsiblePanelGroup in the Spry 1.6.1 samples and am now using the OpenAllPanels function.
    Finding the collapsible panel group API in the documentation isn't the most intuitive and you may wish to review.
    Regards
    Phil

  • Changing JTree Expand And collapsed Icons

    Hi,
    can anyone tell me how to change the expanded and collpased icons on a JTree, i am using windows look and feel, and i don't know how to change the '+' and '-' icons, the other icons are changed using the DefaulTreeCellRenderer, but i haven't found a way to achieve my goal....
    thanks

    In the beginning of your main method you write :
    try {
         UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
         UIManager.put("Tree.collapsedIcon",new ImageIcon("plus.gif");
         UIManager.put("Tree.expandedIcon",new ImageIcon("minus.gif");
    catch (Exception exc) {
         System.err.println("Error loading L&F: " + exc);
    }And you change the name of the images with the wanted ones.
    Denis

  • 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 all and collapse all in page

    Hi all,
    I need to implement* expand all and collapse all *in a custom page where I have some Link beans generated dynamically to show the allowable responsibilities.I have added the link beans and respective hide show regions in a stack layout.How to implement expand all/collapse all for this hide show in the page.
    If I'm not clear about my requirement please let me know.
    Thanks ,
    Krishna Priya Bandyopadhyay

    Hi Krishna,
    Are your hide/show items within a table or separate hide/show regions?
    Thanks,
    LC

  • How to disable "Expand All" and "Collapse All" when no node in a tree

    I have a <af:tree> inside <af:panelCollection>.
    All items under viewMenu like "Expand", "Expand All Below", "Collapse All Below", "Expand All" , "Collapse All", "Scroll to First" and "Scroll to Last" are implemented by default.
    When there is no node in a tree, "Expand", "Expand All Below", and "Collapse All Below" are grey out.
    However, "Expand All" , "Collapse All", "Scroll to First" and "Scroll to Last" are still enabled to be clicked.
    Is there any way we can diable them when no node?

    When I highlight last node in the tree and all nodes are collapsed, I see "Expand All Below" enabled but "Collapse All Below" disabled. Which is expected. Expand All Below will expand all the child nodes under a node.
    QA filed a bug said that "Expand All Below" should be disabled since no node below it. However, I don't find any place to control them. Can you confirm this? Or you know some way to do this?It it not a bug then. You don't have to control it and framework takes care of enabling and disabling it accordingly.
    If you need to expand all the nodes programatically, check this out.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/78-man-expanding-trees-treetables-354775.pdf
    -Arun

  • 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.

  • Collapse all below and expand all below

    hi,
    Expand all below & collapse all below action are not working for &lt;af:treeTable/&gt; UI component which are provide by &lt;af:panelCollection/&gt; component by default (we dont have control over them). But Action 'expand all below' on selected row is just expanding itself (selected one.)
    Here is the code of implement of treeTable
    &lt;af:panelAccordion inlineStyle="width:100%;" discloseMany="true"
    discloseNone="true" id="regional_panel1"&gt;
    &lt;af:panelCollection
    inlineStyle="width:100%;height:100%"
    id="regional_collection_table_tags"&gt;
    &lt;af:treeTable rowSelection="single" contextMenuId="treeTableMenu"
    rowBandingInterval="1" inlineStyle="width:100%;"
    columnStretching="last"
    value="#{bindings.result.treeModel}" var="node"
    id="TagTree"
    binding="#{pageFlowScope.TagHelper.tagTree}"
    selectionListener="#{pageFlowScope.TagHelper.tableSelectionListener}"&gt;
    &lt;f:facet name="nodeStamp"&gt;
    &lt;af:column headerText="#{bundle.TAG_NAME}"&gt;
    &lt;af:outputText value="#{node.name}"/&gt;
    &lt;/af:column&gt;
    &lt;/f:facet&gt;
    &lt;af:column headerText="#{bundle.DESCRIPTION}"&gt;
    &lt;af:outputText value="#{node.description}"/&gt;
    &lt;/af:column&gt;
    &lt;/af:treeTable&gt;
    &lt;/af:panelCollection
    &gt;
    &lt;/af:panelAccordion&gt;
    Note: Collapse All & Expand All actions are working fine which are also provide by &lt;af:panelCollection/&gt; component.
    Please provide me any info to fix this.
    kind revert me for more info.
    Thank
    KSB

    Hi,
    your panel accordion does not have a showDetail item as a child containing the panelCollection, The IDE should have flagged this as an error. Your problem doesn't reproduce for me
    Frank
    Ps.: component ID should be kept short (less than 7 characters) because they add to the download size and thus contribute to performance degradation

  • Expand All and Collapse All with Data table

    Hi Guys,
         I have a data table as shown in code pasted . where the first and second column have row category which gives a categorization with a twisty.
         When i click on the twisty or item name the level beneath it expands. Eerything works fine.. but i need to have to links     Expand All and Collapse All which when clicked open the entire hierarchy or collapse it. Can anyone suggest a way of doing. Can it be done using javascript, I am not comfortable with java script .If someone has done this before please share the piece of code.Also please suggest the different ways of doing it. I am using RAD 7 and IBM JSF components.
         <hx:dataTableEx border="0" cellpadding="2" cellspacing="0"
         columnClasses="columnClass1" headerClass="headerClass"
         footerClass="footerClass" rowClasses="rowClass1, rowClass2" binding="#{masterPublList.tablebindData}"
         id="tableEx1" styleClass="dataTableEx" value="#{masterPublList.lst_publication}" var="varlst_publication">
              <hx:columnEx id="columnEx3">
                   <hx:panelRowCategory id="rowCategory2"
                        styleClass="panelRowCategory"
                        value="#{varlst_publication.publCategory}" collapsed="true">
                   </hx:panelRowCategory>
              </hx:columnEx>
              <hx:columnEx id="columnEx2">
                   <hx:panelRowCategory id="rowCategory1"
                        styleClass="panelRowCategory" value="#{varlst_publication.publSubCategory1}">
                        <h:outputText id="text5" styleClass="outputText"></h:outputText>
                   </hx:panelRowCategory>
              </hx:columnEx>
              <hx:columnEx id="column1">
                   <hx:outputLinkEx id="linkEx1" styleClass="outputLinkEx" value="#{varlst_publication.publUrl}" target="_blank">
                        <h:outputText id="text3" styleClass="outputText" value="#{varlst_publication.publName}"></h:outputText>
                   </hx:outputLinkEx>
              </hx:columnEx>
              <hx:columnEx id="columnEx1">
                   <h:selectManyCheckbox disabledClass="selectManyCheckbox_Disabled"
                        id="checkbox1" styleClass="selectManyCheckbox" value= "#{varlst_publication.publLang}">
                        <f:selectItems value= "#{masterPublList.lst_lang}"/>
                   </h:selectManyCheckbox>
              </hx:columnEx>
         </hx:dataTableEx>
                   Thanks in anticipation

    Hi Naamkeek,
    Per my understanding that you have added the Expand All and Collapse All button in an drill down report by adding the "Go to report" action, now you got the report always refresh and return to the first page, right?
    I have tested on my local environment and can reproduce the issue, no matter whether to add two buttons or using the parameter to do the Expand All and Collapse All, it is always return to the first page.
    Gernerally, SQL Server Reporting Services does a postback while clicking a expand/collapse icon. SSRS re-renders reports because it need to regenerate the pages to fit the defined width & Height. That is why SQL Server Reporting Services reloads
    the whole report.
    This is by design. And, currently, we are not able to turned it off.
    I would suggest you submitting a wish at
    http://connect.microsoft.com
    If the service requests frequently, we may include it in the next release.
    Appreciate your understanding, and if you have any more questions, please feel free to ask.
    Regards
    Vicky Liu

  • 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.

Maybe you are looking for