How can I update the children after updating a node in a tree?

Hi everyone.
I'm trying to update a subtree programatically while using a managed bean as data source.
All topics I can find are about using VOs and JUCtrlHierNodeBinding.updateValuesFromRows.
Now I need to find some way to directly update nodes without any Row. What should I do?
Here's the code:
tags:
                                <af:tree id="tframe" initiallyExpanded="true"
                                         selectionListener="#{backingBeanScope.systemDataFrameBB.onSelectNode}" var="n"
                                         binding="#{backingBeanScope.systemDataFrameBB.tframe}"
                                         value="#{systemDataFrameMB.treeData}" expandAllEnabled="true"
                                         rowSelection="single" fetchSize="-1" contentDelivery="immediate"
                                         immediate="true" summary="summary">
                                    <f:facet name="nodeStamp">
                                                  <af:group>
                                                  <af:outputText value="#{n.is_system?'[SYSTEM]':''}" />
                                                  <af:outputText value="#{n.is_use?'':'[X]'}" />
                                                                 <af:outputText value="#{n.data_frame_name}"/>
                                                  </af:group>
                                    </f:facet>
                                </af:tree>
managed bean(systemDataFrameMB):
     private ChildPropertyTreeModel treeData;
     public ChildPropertyTreeModel getTreeData() throws SQLException
          if (this.treeData == null)
               AuthAMImpl authAM = this.getAppModule();
               List<DataFrameNode> subTrees = authAM.getDataFrameTrees();    // load with JDBC and POJO
               DataFrameNode root = new DataFrameNode();      // insert all sub-trees into a new tree
               root.setData_frame_id(0);
               root.setData_frame_name("[ROOT]");
               root.setParent_data_frame_id(Integer.MIN_VALUE);
               root.setIs_system(true);
               root.setIs_use(true);
               if (subTrees != null && subTrees.size() > 0)
                    root.setChildren(subTrees);
                    for (DataFrameNode n : subTrees)
                         n.setParent(root);
               this.treeData = new ChildPropertyTreeModel(root, "children");      // I guess this is the simplest way to show hierachical data...
          return this.treeData;
model:
public class DataFrameNode
     private int data_frame_id;
     private String data_frame_name;
     private int parent_data_frame_id;
     private boolean is_use;
     private boolean is_system;
     private DataFrameNode parent;
     private List<DataFrameNode> children;
        // getters/setters are omitted....
backing bean(systemDataFrameBB):
        // edit event handler
     public void onEditResult(DialogEvent de)
          String name = (String)this.getItName().getValue();
          boolean isUse = this.getSbcIsUse().isSelected();
          SystemDataFrameMB dfMB = (SystemDataFrameMB)JSFUtils.resolveExpression("#{systemDataFrameMB}");
          try
               node.setData_frame_name(name);
               node.setIs_use(isUse);
               dfMB.updateNode(node);                   // persist changes, this method will change all the children's 'is_use' field to FALSE when isUse == FALSE
               AdfFacesContext.getCurrentInstance().addPartialTarget(this.getTframe());      // refresh the tree, only the edited node will be updated, but I want the tree to update the whole sub-tree to reflect the change on all its children
          catch (Exception e)
                        // omitted...
        }

I solved the problem using RichTree.visitChildren :)
Maybe not the proper way, but at least it works...
                                <af:tree id="tframe" initiallyExpanded="true"
                                         selectionListener="#{backingBeanScope.systemDataFrameBB.onSelectNode}" var="n"
                                         binding="#{backingBeanScope.systemDataFrameBB.tframe}"
                                         value="#{systemDataFrameMB.treeData}" expandAllEnabled="true" rendered="true"
                                         rowSelection="single" fetchSize="-1" contentDelivery="immediate"
                                         immediate="true" clientComponent="true" summary="summary">
                                    <f:facet name="nodeStamp">
                                        <af:panelGroupLayout id="tg">
                                            <af:clientAttribute name="node_path" value="#{n.node_path}"/>
                                            <af:outputText id="tIsSystem" value="#{n.is_system?'[SYSTEM]':''}"/>
                                            <af:outputText id="tIsUse" value="#{n.is_use?'':'[X]'}"/>
                                            <af:outputText value="(#{n.data_frame_id})#{n.data_frame_name}"/>
                                        </af:panelGroupLayout>
                                    </f:facet>
                                </af:tree>
private static final String PARENT_NODE_PATH = "PARENT_NODE_PATH";
// all nodes should have a 'node_path' property whose value looks like 'id1/id2/id3'
// keep path on view root
FacesContext.getCurrentInstance().getViewRoot().getAttributes().put(PARENT_NODE_PATH, node.getNode_path());
// visit the whole tree to find specified nodes
VisitContext vc = VisitContext.createVisitContext(FacesContext.getCurrentInstance());
RichTree.visitChildren(vc, this.getTframe(), new VisitCallback()
          @Override
          public VisitResult visit(VisitContext visitContext, UIComponent uIComponent)
               if (uIComponent instanceof RichPanelGroupLayout &&
                    visitContext.getFacesContext().getCurrentPhaseId().equals(PhaseId.INVOKE_APPLICATION))
                    String parentPath = (String)visitContext.getFacesContext().getViewRoot().getAttributes().get(PARENT_NODE_PATH);
                    if (parentPath != null & parentPath.length() > 0)
                         // if current node is in the sub-tree then update its state
                         String path = (String)uIComponent.getAttributes().get("node_path");
                         if (path != null && path.length() > parentPath.length() && path.charAt(parentPath.length()) == '/')
                              RichOutputText t = (RichOutputText)uIComponent.findComponent("tIsUse");
                              JSFUtils.refreshTarget(t);
               return VisitResult.ACCEPT;
     });there might be another solution which uses JavaScript:
I found out that the HTML tag ADF generated has a attribute like "id='0_1_2_3'", that means I can find the sub-tree with JavaScript.
But it was not tested 'cause I don't think it would be stable.
it looks like this:
StringBuffer clientId = new StringBuffer(node.getLevel_id() * 4);
while (node != null)
     clientId.insert(0, node.getData_frame_id());
     clientId.insert(0, '_');
     node = node.getParent();
JSFUtils.executeScript("disableSubTree('" + (clientId.length() > 0 ? clientId.substring(1) : clientId.toString()) +"')");
            <af:resource type="javascript">
              function disableSubTree(id)
                  // find the adfrichtree component and traverse it, trying to find the sub-tree and modify the nodes
            </af:resource>

Similar Messages

  • How can I change the country after a massage saying that check the security code

    How can I change the country after a massage saying that check the security code

    Massage?
    Why not ask the masseuse who gave you the massage?

  • How can I unlock the screen after a shock lighter?

    how can I unlock the screen after a shock lighter?

    What is a shock lighter? I don't understand what you are asking? If you are saying the the slide to unlock isn't working, try rebooting your iPad.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up

  • How can we delete the request after compression? is it possible ?if so how?

    how can we delete the request after compression? is it possible ?if so how?

    Hi,
    You basically have 3 options:
    1. Use selective deletion and delete the error records.
    2. Do reverse posting and negate the error records.
    3. This is my preference. Delete all the data from the cube. RSA1 -> cube -> right click -> delete data -> choose "fact and dim" from pop-up. Now reconstruct all the requests that you need i.e ignore the error request. But before all this make sure you have the PSAs for all the request.
    Bye
    Dinesh

  • HT4075 I don't have any problems merging the documents by dragging, but when I try to save and open afterwards, only the last shown doc was saved, not the combined files I wanted to merge. I tried save and export, how can I create the file after merging?

    Hi, I'm having trouble saving the documents when merging in Preview. I don't have any problems merging the pdf documents by dragging them in preview, but when I try to save and open afterwards, only the last shown doc was saved, not the combined files I wanted to merge. I've tried save and export, but none merge the documents after saving... how can I create the file (with all the pdf files) after merging?

    That's a comment in the file. It has no effect at all.

  • HT201302 How can I remove the photos after they've been imported to my phone?

    I thought I was importing my pictures from my old iphone to my new one and I ended up importing all the pictures that were saved on my computer.  How can I delete the pictures I don't want? 

    Sync your phone to your computer and then deselect sync all photos to your phone and that will delete them.

  • How can we monitor the audio after the cleanup process before we actually record the trans

    I have the Sound Blaster Audigy 2 ZS board and I am using it to transfer vinyl records to make CDs. Before my upgrading of Creative Media Source 2 to Creative Media Source 5, I was able to monitor the audio after the cleanup prior to the transfering process. Now I can only monitor the sound at the line input point and not after the cleanup process. Is there any way that we can do that?Vinylrecord

    Assuming you mean Actions when you say "Batches", use this menu...
    1.  Click on the name of the actions set you wish to save.
    2.  Click the fly-out menu icon at the upper-right corner.
    3.  Save Actions, put them someplace on your hard drive other than in the Photoshop installation area.
    -Noel

  • How can we change the structure after a Journal has been created??

    Hi Experts,
                    We have made an application and create a journal for it using the journal wizard.
    But later on on the development, we need to change or modify the structure of the application.
    so when we try to do it, the system prompt that we cant change the structure because it has journals.
    so we use the clear journal function and try it again. It still give the same prompt.
                    How can we deal with this problem?? we really need to change the structure.
    Thanks,
    Bennie Jay

    Hi Shova V.
                  I tried it and it worked!!! thanks!!  although it doesn't work for the first time when i try to modify. if have to process it first for  it to work.
                  I just hope in the next version it shouldn't be manually done.
    Thanks,
    Benniejay

  • Ios7 - how can i remove the "passcode" after swipe screen?

    I just upgraded to iOS7and don't want to enter a passcode everytime I turn on my iphone.  How can I remove this passcode?

    Settings>General>Passcode Lock. Enter your passcode lock, turn passcode off, it will prompt for the passcode again and it will then be off.

  • How can I change the color after applying a 3d effect (without altering the effect)?

    I created a 3D drop shape and need to totaly change the colors (from red to yellow)... I use illustrator CS5

    Yeah, it works well by changing the fill color, but the shadow effect isnt as good as it was with my previous color and I can't acces the 3D dialog box without applying a new 3D effect to the shape...

  • How can I select the row after a cfgrid refresh?

    I have a form that is bound to a cfgrid.  The grid is populated from a database.  When you navigate in the grid the data displayed in the form changes to match the selected row.  I can edit the data in the form and update the database.  After updating the data I refresh the cfgrid, which then displays the updated data.
    Unfortunately the cfgrid always highlights the first row, row 0, after a refresh.  I want to highlight the same row that was highlighted when the data was edited and saved.  Can anyone advise as to how I can do that?
    I have tried setting a listener when the grid is initiated that responds whenever the store is refreshed and triggers the function refreshSelection():
    g.getStore().on('load', refreshSelection) ;
    Before the form data is saved, the row number is stored in selectedRow[0].  When the grid is refreshed, refreshSelection is run:
    function refreshSelection() {
    if (0 >= selectedRecords.length)
         return;
    alert('Selected row is Row ' + selectedRecords[0] ) ;
    g.getSelectionModel().selectRow(selectedRecords[0]) ;
    selectedRecords[0] = 0 ;
    The alert shows the correct row number each time, but highlighting the last row viewed works intermittently, and only if the alert line is active.  If I comment out the alert, this fails every time, with row 0 being highlighted.  selectedRecords[0] is reset to 0 after the attempt to select the row so that navigation through the grid, such as choosing "Next Page," will properly highlight the first row of the page rather than the last row number that was edited.
    -Rick

    Massage?
    Why not ask the masseuse who gave you the massage?

  • I downloaded ADE 3.0 for Win 8 to read Books with my KOBO touch - how can I authorize the reader after changing my e-mail-adress?

    Hi, I've changed my E-Mail-Adress and made a download of ADE 3.0 on my new Notebook. The Problem is, I can't autorise my Kobo touch reader because the link doesn't work  Can you help me?

    First, go install all the CS6 updates -- you're still on 13.0.0!

  • How can we remove the space after changing look and feel to generic

    Hi
    I want to remove the space which left blank after changing look and feel to generic in formsweb.cfg file.
    Can anybody help me to remove this blank space.

    Hi,
    can you be more specific on teh space you mean?
    Frank

  • How can I change the hostname after Oracle Database XE is installed?

    I currently have XE installed and working on my ubuntu machine.
    When I change the hostname of my machine, oracle database no longer connects and says "ORA-12505, TNS:listener does not currently know of SID given in connect descriptor".
    Can anyone tell me how I can change the hostname of my machine and keep oracle database working correctly?
    Thanks

    Stopping, reconfig, starting the instance is one way, although that is somewhat like using petrol to kill ants.
    The database instance pretty much does not care about the hostname setting. But the listener does- the installer finds the hostname and uses that in the setup bits.
    As posted somewhere here, when using the 1521 default listener port, the listener.ora config file can just be moved out of the way. Another potential fix is setting the HOST=0.0.0.0 for the IPv4 "any IP" address setting, or setting it to the correct hostname. Or HOST= can be set to IPv4 address. For IPv6, have to use HOST=<hostname> and it must resolve, can't HOST=... an IPv6 address.
    To move the listener file, stop the listener first. To change a HOST=... setting, also stop the listener first.
      lsnrctl stop
      mv $ORACLE_HOME/network/admin/listener.ora $ORACLE_HOME/network/admin/listener.bk0
      # or
      vi $ORACLE_HOME/network/admin/listener.ora
      # change HOST=<whatever> to the correct value, or 0.0.0.0
      lsnrctl start
      sqlplus /nolog
      conn system
      ... password ... Connected.
      alter system register;
      exit
      # start the lsnr
      lsnrctl start
      # check the status, services
      lsnrctl stat
      lsnrctl serv
    If the host has a wireless (or another NIC) that one does not want to offer up remote connections on, the 0.0.0.0 is not a good way to go either
    Message was edited by: clcarter
    typos

  • How can i see the password after connected the WiFi

    i want to see the wifi password on my iphone 4

    Passwords are encrypted, they do not display or they would not be secure.

  • How can i make the navigation easier in my content area? (TREE VIEW)

    Now I use 1 navbar for my whole content area.
    This is what I want :
    I would like to navigatie in my content area lik I navigate in the explorer of microsoft.
    Is there a script,
    portlet, or something like that.
    when I delete a folder it must automaticle disapear from the tree view.
    When I add it must be displayed.
    When the folder isn't public it, the public can't see it
    thxc in advance
    Bert Leeman

    If you are using the same nav bar you could build a custom nav bar in the shared objects and publish it as a portlet. In the properties of a folder you can assign an image for the nav bar. This could make it look like a tree assuming you build the images that way. Also your folder links should disappear from the nav bar when they are deleted. I think.

Maybe you are looking for

  • Install 10g RAC on solaris10(x86) in VMware,but failed on crs's root.sh

    VMware server 1.0.4 build-56528 bash-3.00# uname -a SunOS rac02 5.10 Generic_118855-33 i86pc i386 i86pc disk information: format->partition->print,this is the result Current partition table (original): Total disk cylinders available: 3580 + 2 (reserv

  • How to create Aperture-like folder structure for referenced files?

    Hello, I've just been exploring the "Relocate Masters for Project" option to take a project's master out of the Library. I like the option to (say) create subfolders at the destination based on image year, month, day. My question is whether there is

  • Noob with some iweb questions...

    Let me clarify - im not a noob when it comes to mac & computers in general, but when it comes to web pages, how they're made, & hosted etc i have no idea! I have been using iweb08 to make my web page for my business. Its turning out really well but t

  • TFS 2012 SharePoint Related Error

    Hello, I have installed TFS 2012, a fresh install, on Server 2012 R2, SQL 2012, SharePoint 2013, and at the end of the TFS2012 install, i got a warning: TF400113: The SharePoint Services referenced by the admin Url http://servername:port and site Url

  • Safari do not open and ends up not responding

    Hi, Safari no longer works for me after a software update. Safari will not open and ends up not responding upon launch at which time I have to force quit. I have gone through the Mac help forums without finding a suitable answer and I tried the follo