How to highlight a tree node programmatically

Problem
=====
Just like a typical management software, I have a navigation tree presenting a list of objects (let's say toasters) on the left panel. The content panel on the right side presents the details of a toaster, when the user selects the toaster on the navigation tree. On the toaster details panel, I would like to have a hyper link referring to another toaster - associated to the selected toaster. On clicking on the hyperlink, I would like to display the details of the associated toaster and the navigation tree node for the associated toaster being highlighted.
For example, BUI presents the following now:
+ Toasters | Toaster 1 Details [Refresh]
+ <toaster1> |
+ toaster2 | ... toaster3
+ toaster3 |
toaster1 is selected on the navigation tree. The contents panel displays Toaster 1 details, which has a hyper link for toaster3.
When the user click on toster3 on the contents panel, I would like to see the following
+ Toasters | Toaster 3 Details [Refresh]
+ toaster1 |
+ toaster2 | ...
+ <toaster3> |
My Trial
=====
ADF Rich Client 11.1.2.3 is used for my development.
Jspx code for the navigation tree looks like this:
<af:tree id="navTree" ...>
<f:facet name="nodeStamp">
<af:panelGroupLayout id="nodePgl">
<af:switcher facetName="#{stamp.outcome!=null?'actnode':'noactnode'}" ...>
<f:facet name="actnode">
<af:commandLink id="leafLink" text="#{stamp.label}" action="#{stamp.actionOutcome}">
<af:setActionListener from="#{stamp.key}" to="#{treeHandler.selectedMenuItem}"/>
</af:commandLink>
</f:facet>
<f:facet name="noactnode">
<af:outputText id="notLeafText" value="#{stamp.label}"/>
</f:facet>
</af:switcher>
</af:panelGroupLayout>
</f:facet>
</af:tree>
The hyper link on the contents panel looks like this:
<af:iterator var="toaster" value="#{toastData.toasters}">
<af:commandLink text="#{toaster}" action="#{toasterHandler.goToToaster}">
<f:param name="toasterId" value="#{toaster}"/>
<af:setActionListener from="#{toaster}" to="#{treeHandler.selectedToaster}"/>
</af:commandLink>
</af:iterator>
I got some tips from this forum (cannot find thread at the moment) and implemented the treeHandler.selectedToaster method as follows:
// getSelectionState returns selStat, which is instantiated like the following:
// RowKeySet selStat = new RowKeySetTreeImpl();
// TreeModel model = (TreeModel) menuModel.getWrappedData();
// selStat.setCollectionModel(model);
// selStat.setContained(true);
RowKeySet rowKeySet = getSelectionState();
rowKeySet.removeAll();
// synthesize the rowKey for the selected toaster
// if the toaster found in the toaster node list,
// rowKey should look like [0, <rowIdx of toaster>]
ArrayList<Integer> rowKey = new ArrayList<Integer>();
rowKey.add(0);
rowKey.add(new Integer(rowIdx));
TreeModel model = (TreeModel) menuModel.getWrappedData();
model.setRowKey(rowKey);
model.setRowIndex(rowIdx);
rowKeySet.add();
This seems to work most of times except when I refresh the contents details panel using partial page rendering.
I get NullPointerException on the call to rowKeySet.removeAll().
Caused by: java.lang.NullPointerException
     at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl._selectAll(RowKeySetTreeImpl.java:459)
     at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl.removeAll(RowKeySetTreeImpl.java:146)
In my observation, this NPE happens when rowKeySet.size() returns 1 but rowKeySet.iterator() does not return any entries.
I suspect this is a bug on RowKeySetTreeImpl but not sure.
Help Need
=======
1. What is the reasonably right way to highlight the tree node for my problem?
2. If my trial is one way to do it, how can I get around the NPE? I cannot change ADF Rich Client library at this point.
Any help/suggestion/advise would be appreciated.
Thanks,
Jeongtae

I did this, to programmatically expand a tree node, you can try the same and set the row key to highlight.
private RowKeySet disclosedTreeRowKeySet = new RowKeySetImpl();
public void rowDisclosureListener(RowDisclosureEvent rowDisclosureEvent)
Iterator added = rowDisclosureEvent.getAddedSet().iterator();
if (added!=null)
while (added.hasNext())
Object rowKey = added.next();
//disclosedTreeRowKeySet.clear();
List path = (List)rowKey;
for( int i=0; i< path.size(); i++ )
List<Object> nodePath = new ArrayList<Object>();
for( int j=0; j<i; j++ )
nodePath.add( path.get( j ) );
disclosedTreeRowKeySet.add( nodePath );
disclosedTreeRowKeySet.add( rowKey );
System.out.println( "disclosed Keys...... " + disclosedTreeRowKeySet );
private void expandSelectedNode(RowKeySet addedObj) {
if (sourceTreeTable != null) {
Iterator added = (Iterator)addedObj.iterator();
if (added!=null)
while (added.hasNext())
Object rowKey = added.next();
List path = (List)rowKey;
for( int i=0; i< path.size(); i++ )
List<Object> nodePath = new ArrayList<Object>();
for( int j=0; j<i; j++ )
nodePath.add( path.get( j ) );
disclosedTreeRowKeySet.add( nodePath );
disclosedTreeRowKeySet.add( rowKey );
sourceTreeTable.setDisclosedRowKeys(disclosedTreeRowKeySet);
}

Similar Messages

  • How to get a Tree Node Value when a Tree is Expanded

    My reqiurement is when i Expand a Tree i need the Expanded tree Node Value. For Example Consider Parent as a Root Node of a Tree, and Consider its two Children Child1 and Child2.
    When + Parent Expanded
    I will Get the Output as --Parent
    - Child1
    - Child2
    so As when i expand the Tree i must Get the String Value Parent.

    duplicate
    How to get a Tree Node Value when a Tree is Expanded

  • How to make a Tree Node invisible?

    Hi
    I have got a JTree where I have created a DefaultTreeModel and a DefaultTreeCellRenderer. The JTree is filled to data from data base. These nodes after are used to do querys to a data base. But when in tree's level 2 has got only a child, this node I want to set like not visible. because this node i need it do querys.
    I have found a thread to explain something:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=126031
    a) A kind to do, it is so
    I make a new Class extends DefaultTreeCellRenderer, but it doesn't work, the code is here
    public class SegnalarNodoRender extends DefaultTreeCellRenderer {
      public SegnalarNodoRender() {
      public Component getTreeCellRendererComponent(JTree tree, Object value,
                                                    boolean sel, boolean expanded, boolean leaf,
                                                    int row, boolean hasFocus) {
               Component comp;
              DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) value;
              DefaultMutableTreeNode padreNodo = (DefaultMutableTreeNode) nodo.getParent();
               if (leaf && sel)  {
                 return super.getTreeCellRendererComponent(tree,value,sel,
                                                           expanded,leaf,row,hasFocus);}
               else
                 if (!leaf && nodo.getLevel()==2 && padreNodo.getChildCount()==1 ) {
                 //Set not visible
                   this.setVisible(false);
                   return  super.getTreeCellRendererComponent(tree, value, false,
                                                             expanded, leaf, row, hasFocus);
                 else {
                   return super.getTreeCellRendererComponent(tree, value, false,
                                                             expanded, leaf, row, hasFocus);
    }b) the anoher kinds it explains how to make it. It is extended a class from DefaultTreeModel, But it is in this function the this class(botton), where I don't know how the node sets to invisible. Why NodoPadre hasn't any function to set invisible.
    public Object getChild(Object parent, int index) {
      // DefaultMutableTreeNode NodoPadre = (DefaultMutableTreeNode) parent;
      // TreeNode p;
      // p = NodoPadre.getParent();
       return parent;
    }I hope somebody can help me.
    thanks in advanced.

    Hi,
    I have the same problem and would realy like to know how to do this´, using ADF Faces 11G with the up to date JDeveloper.
    I've found some blog entries in the web showing how to do this with a POJO-based approach. They insert Data programmatically based on a view object's result set, reading all data and inserting the data to the POJO.
    However, I like to
    1) Drag-And-Drop the data-control (based on one master and one details - view object and a view link) to a page and add it as tree table
    2) Get the folder icon only displayed when there are children
    3) get the last child (=leaf) displayed without folder icon.
    To make this possible, we should somehow extend the TreeModel Class and override the function isContainer
    @Override
    public boolean isContainer() {
      if (getRowData() != null) {
         MyRowImpl value = (MyRowImpl) getRowData();
        if (value.getChildValues() != null &&
           value.getChildValues().size() > 0) {
          return true;
        return false;
    }Can somehow please give me a hint how to extend the tree model base class (What class?) and how to get the framework to use this model class?
    Maybe there is a sample application for 11g somewhere?
    Thanks,
    Stefan
    Edited by: Stefan1979 on 04.11.2009 18:10

  • How to create Hierarchy Tree Node structure?

    Hi experts,
              I want to know how to create a tree with kind of below Structure:
    Root A
             NodeA1
                  ITEMA1_IT1
                  ITEMA1_IT2
                  ITEMA1_IT3
             NodeA2
                  ITEMA2_IT1
                  ITEMA2_IT2
             NodeA3
                  ITEMA3_IT1
                  ITEMA3_IT2
                  ITEMA3_IT3
                  ITEMA3_IT4
    So when i click on Root A it shows me, NODEA1, NODEA2 & NODEA3....
    when further i click on NODEA1, it shows me items like  ITEMA1_IT1,ITEMA1_IT2, ITEMA1_IT3.
    when further i click on NODEA2, it shows me items like  ITEMA2_IT1,ITEMA2_IT2.
    SO item will get loaded when i click on perticular node.
    how its possible.
    I have gone through SDN so many threads, bt i didn't get exactly for webdynpro ABAP.
    Please guide me for the same.
    Thanks ,
    Saurin Shah

    Hi,
    you can create the tree you wanted as follows:
    1) create a node under your context say "root_node" with cardinality 1..1
    2) now create an attribute under it called "text" with type string.
    3) now create three nodes under this "root_node" called nodeA1 nodeA2 and nodeA3 with cardinality 0..n
    4) now under nodeA1 , nodeA2 and nodeA3 create an attribute called "text" with type string...so each node will have one attribute called "text" of type string...
    5) now create a node under nodeA1 called "itemA1" with cardinlity 0..n
    6) now create an attribute called "text" of type string under this node "itemA"...
    7) repeat step 5 and 6 for the other two nodes...nodeA2 and nodeA3
    8) now create six supply functionsthese functions will supply the text values for your nodes-
    I created like this:
    FILL_ITEM1
    FILL_ITEM2
    FILL_ITEM3
    FILL_NODEA1
    FILL_NODEA2
    FILL_NODEA3
    Note:*******************my view is called MAIN******************
    hence the coding is
    data
        lt_elements type if_main=>elements_nodea1.
    if you view is called view1...than the data declaration would be
    data
        lt_elements type if_view1=>elements_nodea1.
    9) go to each node and assign the supply function respectively....you can assign this by going to context tab and selecting the node you want to assign the supply function to and just type in the name of the supply funciton or do the help for that field by clicking on the little square btn...
    10) now we go the layout tab and put the tree ui on the layout....bind the datasource property to the context node "root_node"
    and bind the rootText property to the attribute "text" of the root_node...
    11) now right click on this tree ui element under the ROOTUIELEMENTCONTAINER and select "insert node type" ...a box will appear where you can see it has two types of node for you....one is tree_node_type and other one is tree_item_type...
    create three nodes with tree_node_type with names "nodeA1" nodeA2 and nodeA3 and three with tree_item_type with names "itemA1" itemA2 and itemA3...
    12) now bind all these node types and item types data sources and texts with corresponding nodes and attributes under your context...
    so nodeA1datasource will get bind to context nodeA1 and itemA1 data source will get bind to itemA1 from context..and so on...
    13) now in the wddoinit method: I setup the text for the root node.....
    DATA lo_nd_root_node TYPE REF TO if_wd_context_node.
      DATA lo_el_root_node TYPE REF TO if_wd_context_element.
      DATA ls_root_node TYPE wd_this->element_root_node.
      DATA lv_root_txt TYPE wd_this->element_root_node-root_txt.
    navigate from <CONTEXT> to <ROOT_NODE> via lead selection
      lo_nd_root_node = wd_context->get_child_node( name = wd_this->wdctx_root_node ).
    get element via lead selection
      lo_el_root_node = lo_nd_root_node->get_element( ).
    @TODO fill attribute
    lv_root_txt = 'Root Node'.
    set single attribute
      lo_el_root_node->set_attribute(
        name =  `ROOT_TXT`
        value = lv_root_txt ).
    hope this will give you the solution you are looking for...
    Thanks...
    AS...........

  • How to hide a tree node from the GUI but still keep it in the tree model?

    Hi, All
    I used a JTree in my project in which I have a DefaultTreeModel to store all the tree structure and a JTree show it on the screen. But for some reason, I want to hide some of the nodes from the user, but I don't want to remove them from the tree model because later on I still need to use them.
    I searched on the web, some people suggested method to hide the root node, but that's not appliable to my project because I want to hide some non-root nodes; Some people also suggested to collapse the parent node when there are child to hide, it is not appliable to me either, because there still some other childnodes (sibling of the node to hide) I want to show.
    How can I hide some of the tree node from the user? Thanks for any information.
    Linda

    Here's an example using a derivation of DefaultTreeModel that shows (or does not show) two types of Sneech (appologies to the good Dr Zeus) by overiding two methods on the model.
    Now, there are many things wrong with this example (using instanceof, for example), but it's pretty tight and shows one way of doing what you want.
    Note: to make it useful, you''d have to change the implementation of setShowStarBelliedSneeches() to do something more sophisticated than simply firing a structure change event on the root node. You'd want to find all the star bellied sneech nodes and call fireTreeNodesRemoved(). That way the tree would stay expanded rather than collapse as it does now.
    import javax.swing.JTree;
    import javax.swing.JScrollPane;
    import javax.swing.JOptionPane;
    import javax.swing.JCheckBox;
    import javax.swing.JPanel;
    import javax.swing.tree.TreePath;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.DefaultMutableTreeNode;
    import java.awt.Dimension;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Enumeration;
    class FilteredTree
         private class PlainBelliedSneech {
              public String toString() { return "Plain Bellied Sneech"; }
         private class StarBelliedSneech {
              public String toString() { return "Star Bellied Sneech"; }
         private class FilteredTreeModel
              extends DefaultTreeModel
              private boolean mShowStarBelliedSneeches= true;
              private DefaultMutableTreeNode mRoot;
              FilteredTreeModel(DefaultMutableTreeNode root)
                   super(root);
                   mRoot= root;
              public Object getChild(Object parent, int index)
                   DefaultMutableTreeNode node=
                        (DefaultMutableTreeNode) parent;
                   if (mShowStarBelliedSneeches)
                        return node.getChildAt(index);
                   int pos= 0;
                   for (int i= 0, cnt= 0; i< node.getChildCount(); i++) {
                        if (((DefaultMutableTreeNode) node.getChildAt(i)).getUserObject()
                                            instanceof PlainBelliedSneech)
                             if (cnt++ == index) {
                                  pos= i;
                                  break;
                   return node.getChildAt(pos);
              public int getChildCount(Object parent)
                   DefaultMutableTreeNode node=
                        (DefaultMutableTreeNode) parent;
                   if (mShowStarBelliedSneeches)
                        return node.getChildCount();
                   int childCount= 0;
                   Enumeration children= node.children();
                   while (children.hasMoreElements()) {
                        if (((DefaultMutableTreeNode) children.nextElement()).getUserObject()
                                            instanceof PlainBelliedSneech)
                             childCount++;
                   return childCount;
              public boolean getShowStarBelliedSneeches() {
                   return mShowStarBelliedSneeches;
              public void setShowStarBelliedSneeches(boolean showStarBelliedSneeches)
                   if (showStarBelliedSneeches != mShowStarBelliedSneeches) {
                        mShowStarBelliedSneeches= showStarBelliedSneeches;
                        Object[] path= { mRoot };
                        int[] childIndices= new int[root.getChildCount()];
                        Object[] children= new Object[root.getChildCount()];
                        for (int i= 0; i< root.getChildCount(); i++) {
                             childIndices= i;
                             children[i]= root.getChildAt(i);
                        fireTreeStructureChanged(this, path, childIndices, children);
         private FilteredTree()
              final DefaultMutableTreeNode root= new DefaultMutableTreeNode("Root");
              DefaultMutableTreeNode parent;
              DefaultMutableTreeNode child;
              for (int i= 0; i< 2; i++) {
                   parent= new DefaultMutableTreeNode(new PlainBelliedSneech());
                   root.add(parent);
                   for (int j= 0; j< 2; j++) {
                        child= new DefaultMutableTreeNode(new StarBelliedSneech());
                        parent.add(child);
                        for (int k= 0; k< 2; k++)
                             child.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
                   for (int j= 0; j< 2; j++)
                        parent.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
                   parent= new DefaultMutableTreeNode(new StarBelliedSneech());
                   root.add(parent);
                   for (int j= 0; j< 2; j++) {
                        child= new DefaultMutableTreeNode(new PlainBelliedSneech());
                        parent.add(child);
                        for (int k= 0; k< 2; k++)
                             child.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
                   for (int j= 0; j< 2; j++)
                        parent.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
              final FilteredTreeModel model= new FilteredTreeModel(root);
              JTree tree= new JTree(model);
    tree.setShowsRootHandles(true);
    tree.putClientProperty("JTree.lineStyle", "Angled");
              tree.setRootVisible(false);
              JScrollPane sp= new JScrollPane(tree);
              sp.setPreferredSize(new Dimension(200,400));
              final JCheckBox check= new JCheckBox("Show Star Bellied Sneeches");
              check.setSelected(model.getShowStarBelliedSneeches());
              check.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        model.setShowStarBelliedSneeches(check.isSelected());
              JPanel panel= new JPanel(new BorderLayout());
              panel.add(check, BorderLayout.NORTH);
              panel.add(sp, BorderLayout.CENTER);
              JOptionPane.showOptionDialog(
                   null, panel, "Sneeches on Beeches",
                   JOptionPane.DEFAULT_OPTION,
                   JOptionPane.PLAIN_MESSAGE,
                   null, new String[0], null
              System.exit(0);
         public static void main(String[] argv) {
              new FilteredTree();

  • How to copy & paste tree nodes

    Hello,
    Can i have an example that copies & pastes tree nodes?
    thank u.

    It is most probably be cause you are trying to select/deselect an already selected/deselected node programmatically, you need to be careful when using SELECT_ON/OFF if the node is already selected.
    The WHEN-TREE-NODE-SELECTED trigger fires also when a node is deselected, this where the problem exists with this error.
    Use the :SYSTEM..TRIGGER_NODE_SELECTED system variable to determine whether the node is being selected or deselected, it returns 'TRUE' when selected and 'FALSE' when deselected and change your code logic accordingly.
    Metalink Note:292050.1 clearly states the cause of this error
    Tony
    Edited by: Tony Garabedian on Aug 26, 2008 2:08 PM

  • How do we get tree node infomation in an App Engine

    I want to write an app engine to get accounts that are under various tree nodes. How do I write this in an App Engine.. I just need help getting started

    you can use start with connect by clause in a SQL step to link data in a hierarchy
    something on the lines of :
    +SELECT     *+
    FROM pstreenode
    WHERE setid = '<YourSetID>'
    AND tree_name = '<YourTreeName>'
    AND EFFDT='<YourEFFDT>'
    START WITH tree_node = '<Tree Node for which you wish to find all the child nodes>'
    CONNECT BY PRIOR tree_node = parent_node_name

  • How to display the tree nodes distinctivly.

    Hay all,
    Frnds , i am facing a problem. I have created a tree whose each node consisted of a checkbox and a label. For that i have used DefaultMutableTreeNodes for tree nodes and a TreeCellRenderer. Is there any method or way to display some nodes distinctively(may be in different color or something else). Plz tell me soon its very urgent.

    Hi Jürgen,
    See http://help.sap.com/saphelp_nw04/helpdata/en/44/6aaf92f5a23672e10000000a114a6b/frameset.htm
    Only Worksets and Roles are not described, anyhow, doing a bit research via decompiling or just by searching on SDN will bring you the needed extra info; just as an example for roles access: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6112ecb7-0a01-0010-ef90-941c70c9e401
    Hope it helps
    Detlev

  • Want to select a tree node Programmatically

    Hi all,
    I have a tree which is acting as a menu and by deafult which nodes are collapsed. Now what I need is I want to select a tree node(which node value or node label is known) by clicking a button. Pls help me. Bye.
    BR
    Tarik.

    Is it about this one?
    FTREE.SET_TREE_SELECTION(tree, node, FTREE.SELECT_ON)
    If another node is already selected, first unselect it:
    FTREE.SET_TREE_SELECTION(tree, FTREE.GET_TREE_SELECTION(tree, 1), FTREE.SELECT_OFF);

  • How to select a tree node in JSF.

    Hi All,
    Sample code for JSF components having following lines to display a tree node:
    <d:graph_treenode name="File-New" label="New 5"
    icon="folder_16_pad.gif" action="demo-test.faces"/>
    The above lines are showing that when we select the node it is invoking "demo-test.jsp". Whether it is possible to select multiple nodes similar to JTree(Swing) functionality?
    Regards,
    Sharath Reddy.

    Hi again,
    I am sorry, I cannot help in another way than looking at the documentation, because I have currently no JDK available here. If expandPath(...) doesn't work, you can try to get all the nodes of that path and expand them from the root node downwards, perhaps that will work.
    greetings Marsian

  • Start Editing an Tree-Node programmatically

    Hello there!
    I have a JTree which the user can edit by clicking on the nodes three times. This I did setting "tree.setEditable(true);". Now i want a selected node to switch to editing-mode when the user clicks on a menu.
    So how can I programmatically start editing?
    Thanks a lot, DreamiX.

    JTree has method
    startEditingAtPath(TreePath path)
    best regards
    Stas

  • How to get all tree node parents upon select

    I have a tree, and when user clicks an item in the tree, I want to get all the parents of the selectedItem node.
    So if I have this XML:
    <products>
        <item>
            <sku>1001</sku>
            <quantity value="100" />
        </item>
        <item>
            <sku>2001</sku>
            <quantity value="250" />
        </item>
        <item>
            <sku>3001</sku>
            <quantity value="300" />
        </item>
    </products>  
    If user clicks on the 1001 sku, I want to get something like this:
    <products><item><sku>
    Also if I have a custom component, perhaps based on tree or but maybe not, and if this custom component shows the actual XML and used can click on XML elements or XML attributes, how can I use the selected item to get the parent nodes, so if they click on the value="100", I want to get this:
    <products><item><sku><quantity>
    I need this because I have a set of fields, and users will drag their XML node elements or attributes to my fields, to define a mapping between their XML and my fields.
    The selectedItem is just a snippet of XML cut off from its source XMLListCollection, and I might be able to search the XMLListCollection, but what if there were say <sku> elements at more than one level in the XML? I'm guessing a search might return multiple hits for a selected element, when I want the actual parent nodes for the actual selected node.
    Thanks very much!

    var path:Array=[]
    var parent:XML = xxxx.selectedItem.parent()
    while(parent){
    path.push(parent.localName())
    parent = parent.parent()
    Or, i didn't get your question and xxxx.selectedItem is "detached" XML snippet ?

  • How to re-open tree nodes after a refresh to AdvancedDataGrid's GroupingCollection?

    Hello,
    I have an AdvancedDataGrid, which has as it's dataProvider a
    GroupingCollection. The GroupingCollection's source is bound to an
    ArrayCollection. Items in the ArrayCollection can be edited.
    After a change to the ArrayCollection, I refresh() the
    GroupingCollection so it displays properly. Unfortunately, this
    collapses the tree of the AdvancedDataGrid, that is, the previously
    open nodes are no longer open. I would like to re-open the nodes
    after a refresh.
    In the code provided, I have attempted to save the nodes
    which were open before the refresh, perform the refresh, then
    re-expand the nodes with AdvancedDataGrid.expandItem(). But it
    didn't work, and I am stumped.
    Any ideas on how to expand nodes in the AdvancedDataGrid?
    or
    Any ideas on how to allow the user to modify a data item,
    including fields used as GroupingFields, in an AdvancedDataGrid?

    Yes, I try saving the nodes like this:
    //save the currently opened items
    openArray = new Array();
    for each(var obj:Object in advancedDataGrid.openItems)
    openArray = openArray.concat(obj);
    and then restoring them with the expand function:
    //expands the nodes which are passed in as the argument
    private var expand:Function = function(array:Array):void
    for each(var obj:Object in array)
    advancedDataGrid.expandItem(obj, true);
    Unfortunately, expandItem just seems to return without doing
    anything!

  • How to collapse the expanded nodes programmatically?

    Hi,
    I am using Jdeveloper11.1.1.4
    Use Case:
    Level of the tree is 2; Like Root has Department and child has Employees
    Use Case:
    I have exapanded Department 10 root node and on click of Department 20 root node,
    the department 10 root node must collapse.
    How to achieve this?
    Thanks
    RajGopal K

    In order for all the nodes in a treetable to be expanded, you would need to add all the rows to the disclosedRowKeySet.
    1) Create a binding for the treetable in managed mean code as 'treeTable'.
    2) In actionListener for the commandButton, invoke the following method 'expandTreeTable':
        public void onExpandButtonClick(ActionEvent actionEvent)
            this.expandTreeTable();
        private RowKeySet disclosedTreeRowKeySet = new RowKeySetImpl();
        private void expandTreeTable()
            if (this.treeTable != null)
                disclosedTreeRowKeySet = new RowKeySetImpl();
                CollectionModel model = (CollectionModel) treeTable.getValue();
                JUCtrlHierBinding treeBinding = (JUCtrlHierBinding) model.getWrappedData();
                JUCtrlHierNodeBinding rootNode = treeBinding.getRootNodeBinding();
                disclosedTreeRowKeySet = treeTable.getDisclosedRowKeys();
                if (disclosedTreeRowKeySet == null)
                    disclosedTreeRowKeySet = new RowKeySetImpl();
                List<JUCtrlHierNodeBinding> firstLevelChildren = rootNode.getChildren();
                for (JUCtrlHierNodeBinding node: firstLevelChildren)
                    ArrayList list = new ArrayList();
                    list.add(node.getRowKey());
                    disclosedTreeRowKeySet.add(list);
                    expandTreeChildrenNode(treeTable, node, list);
                treeTable.setDisclosedRowKeys(disclosedTreeRowKeySet);
        private void expandTreeChildrenNode(RichTreeTable rt, JUCtrlHierNodeBinding node,
                                            List<Key> parentRowKey)
            ArrayList children = node.getChildren();
            List<Key> rowKey;
            if (children != null)
                for (int i = 0; i < children.size(); i++)
                    rowKey = new ArrayList<Key>();
                    rowKey.addAll(parentRowKey);
                    rowKey.add(((JUCtrlHierNodeBinding) children.get(i)).getRowKey());
                    disclosedTreeRowKeySet.add(rowKey);
                    if (((JUCtrlHierNodeBinding) (children.get(i))).getChildren() == null)
                        continue;
                    expandTreeChildrenNode(rt, (JUCtrlHierNodeBinding) (node.getChildren().get(i)),
                                           rowKey);
        }Timo

  • How to create static tree nodes without query

    hi ,
    i want to create static tree .
    e.g.
    Employee
    Department
    Order
    these names are static. i dont have from query. but i have to link that nodes to pages how can i do?

    Hi Nilesh.
    I modified my example to show an extra level for the employees.
    But I can't say that I fully understand what you are trying to do. You say you don't want to use links, but you want to use the tree for the navigation of pages. And you say that all the names are static, yet there is a node saying 'show employee' ...
    But I hope you now understand how it all works and can continue your work!
    Kind regards,
    -Peter-

Maybe you are looking for

  • Accept License Agreement

    Adobe Software License Agremment (under Adobe Application Manager) does not show license agrreement, and will not let me accept to activate newly downloaded iCloud Adobe Acrobat XI Pro.

  • DATA exchange using XML using ABAP

    Client is having requirement of sharing data with Third party using XML files and this needs to be done using ABAP and changes in XML structure are highly likely in the future and structure is very complex around 100 fields corresponding to an accoun

  • Summer survival guide part 6: using your PC to keep kids out of trouble

    Like many Canadians, I spend much of my winter looking forward to summer. However, summer isn't all BBQs, beaches and convertibles. Canadian parents are also facing the yearly ritual of keeping the kids busy now that school's out. This aspect of summ

  • HT4759 I am accessing itunes match and it keeps coming up with "I tunes has stopped working

    Itunes has worked on and off giving me the message that "itunes has stopped working" after only a few minutes while it is trying to complete the "Match" in order to have the songs available on my iphone 5. I have been resigning in since yesterday aft

  • Can't use Desktop

    Hey all, I can't use my desktop. Get the information on the screen that I can drag files to the Desktop, but I can't see them. This problem occured when I was searching a file on my TimeCapsule. Someone? All best, FyFörSören