Insert Parent Node From Tree To Another

Hello
My problem is: haw can I insert or shift Parent Node with its child from tree to another without use SQL query.
I should find the child and if this child has a child to shift with the parent to another tree, there are no tools or function can return the child of the node? Or what is the best procedure to do that?
I will be thankful if there some one can help me
Regards

You can grab the data with ftree.populate_group_from_tree and then use ftree.add_tree_data to put it in another tree.

Similar Messages

  • How to retrieve a child node's immediate parent node from a tree table?

    Hello
    Hi,
    I have a category_subcategories table, and I would like to know how to construct a sql and sub-sql for retrieving a child node's immediate parent node.
    Here is my first part of the sql, it only returns the node "Flash"'s parent and its grand-parents:
    SELECT parent.category_name, node.lft, node.rgt
    FROM category_subcategories AS node,
    category_subcategories AS parent
    WHERE node.lft > parent.lft AND node.lft < parent.rgt
    AND node.category_name = 'FLASH'
    ORDER BY parent.lft;
    | name |
    | ELECTRONICS |
    | PORTABLE ELECTRONICS |
    | MP3 PLAYERS | |
    how can I modify this query so that it returns Flash' parent - 'MP3 Players'?
    Thanks a lot
    Sam

    Hi,
    This is an Oracle forum. If you're not iusing Oracle, make that clear. Always say what version of your softwate you're using, whether it's Oracle or anything else.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. Explain how you get those results from that data.
    It looks like you're using the Nested Sets technique for modeling a tree. To get the parents of given nodes, do something like this:
    SELECT        parent.category_name
    ,       node.lft
    ,       node.rgt
    FROM        category_subcategories      node     -- Can't use AS with table alias in Oracle
    ,       category_subcategories      parent
    WHERE        parent.lft      IN (
                        SELECT     MAX (lft)
                        FROM     category_subcategories
                        WHERE     lft     < node.lft
                        AND     rgt     > node.rgt
    AND        node.category_name          = 'FLASH'
    ORDER BY  parent.lft; This should work in Oracle 8.1 and up. (I can't actually test it unless you post CREATE TABLE and INSERT statements for some sample data). You may need to modify the syntax a little for your database.
    785102 wrote:
    Hello,
    I tried to implement the solution as follow:
    mysql> select parent.*
    -> from category_subcategories as parent
    -> having parent.lft =
    -> (select max(parent.lft) from
    -> (SELECT parent.category_name, parent.lft, parent.rgt
    -> FROM category_subcategories AS node,
    -> category_subcategories AS parent
    -> WHERE node.lft > parent.lft AND node.lft < parent.rgt
    -> AND node.category_name = 'Sofa'
    -> ORDER BY parent.lft
    -> )
    -> );
    ERROR 1248 (42000): Every derived table must have its own alias
    mysql>
    But I got an error.
    What is wrong with it?What does the error message say?
    Apparantly, in your system (unlike Oracle), every sub-query must have a name. Try something like this:
    select      parent.*
    from      category_subcategories as parent
    having      parent.lft = (
                   select      max(parent.lft)
                   from     (
                             SELECT        parent.category_name
                             ,       parent.lft
                             ,       parent.rgt
                             FROM        category_subcategories      AS node,
                                    category_subcategories      AS parent
                             WHERE        node.lft      > parent.lft
                             AND        node.lft      < parent.rgt
                             AND        node.category_name = 'Sofa'
                             ORDER BY  parent.lft     -- Is this a waste of effort?
                        )  AS got_name_lft_and_rgt
                  )     AS got_lft
    ;What is the purpose of having the inner sub-query, the one I called got_name_lft_and_rgt?
    Also, in Oracle, an ORDER BY clause in a sub-query doesn;t guarantee that any super-queries will keep that order. Why do you have an ORDER BY clause in the sub-query, and not in the main query?

  • Getting Parent Node On tree Issue..

    Hi,
    I Have Constructed a Tree and i am Able to get the Details of the clicked Node on the Tree into the Backing Bean.
    But I'm unable to get the Parent Node of the Clicked Child Node.
    Ex:On Click of Employee(Child Node) in the Tree, I should get the Department (Parent Node) in Backing Bean.
    I'm able to get only the details in the same Level of Tree Node(ie All Employees in the Selected Employee Level).
    IDE: JDeveloper 10.1.3.2.
    Please Suggest me.
    Thanking You,
    Bandaru.

    Sounds like you are looking for something like this
    Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.6.0
    SQL> WITH table_1 AS
      2  (SELECT XMLTYPE('<sdi_header>
      3  <Person>
      4  <Customer_First_Name>ABC</Customer_First_Name>
      5  <Customer_Last_Name>DEF</Customer_Last_Name>
      6  </Person>
      7  <warehouse>
      8  <Person>
      9  <Customer_First_Name>XYZ</Customer_First_Name>
    10  <Customer_Last_Name>MNO</Customer_Last_Name>
    11  </Person>
    12  </warehouse>
    13  </sdi_header>') column_name
    14     FROM dual)  -- WITH simulates your table I do not have
    15  select t1.*
    16    from TABLE_1,
    17         XMLTABLE('for $i in /sdi_header//Person
    18                     return <root>
    19                           {$i/Customer_First_Name,
    20                           $i/Customer_Last_Name}
    21                           <parent>{$i/../name()}</parent>
    22                      </root>'
    23                  PASSING table_1.column_name
    24                  COLUMNS
    25                  fname   VARCHAR2(20) PATH 'Customer_First_Name',
    26                  lname   VARCHAR2(20) PATH 'Customer_Last_Name',
    27                  pnode   VARCHAR2(20) PATH 'parent') t1;
    FNAME                LNAME                PNODE
    ABC                  DEF                  sdi_header
    XYZ                  MNO                  warehouseYou can find out how formatted that message by looking in the FAQ in the upper right. It uses the { code } tag (without spaces).

  • Get Parent node from Base member

    Hi ,
    My user select base member from CV .
    I want parent node for that base member .
    I am using =EVPRO( App name , memmber id , "PARENTH1" ) .
    I am not getting parent member from this funcation .
    Pls let me know any other way for this ?
    regards,
    PSR

    Hi,
    EVPRO for getting the value for PARENTH1 of any member should work. Please check whether you have included all the parameters of this function inside double quotes.
    EVPRO("APPNAME","MEMBER_ID","PROPERTY")
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • Calling EJB on specific node from EJB on another node

    Hello,
    In cluster environment what is the best approach to call session bean on one node from session bean on another node? The scenario would allow synchronization of local cache (singleton) between two nodes. I understand that there are other options like SingletonService, distributed cache etc., but I wonder how hard would be to implement synchronization calls between nodes on remote session beans.
    Thanks
    Greg K.

    Hi,
    Based on your query on thread i can suggestthe following as a best option: Re: replica-aware stub.
    Use the JMX code to get the Cluster details....It means the name of the Cluster members and their Listen port and Listen Addresses then in your Client code do the following:
    InitialContext ic = getInitialContext(“t3://ClusterMemberOne:7002,ClusterMemberTwo:7003″);Like that whatever InitialContext object you will get will be able to provide you the correct EJB from any newly added member of the Cluster as well..
    You can enhance the JMX code mentioned in the following link : http://middlewaremagic.com/weblogic/?p=210 you will need to add only 2-3 lines to make it work for your requirement.
    Just tweak the following code to get the ListenPort and ListenAddress of cluster Nodes:
    public void printClusterInfo() throws Exception
         ObjectName[] serverRT = getServerRuntimes();
         Hashtable server_states = new Hashtable();
         for(ObjectName ser: serverRT)
              server_states.put((String) connection.getAttribute(ser,”Name”), (String) connection.getAttribute(ser,”State”));
         }Thanks
    Jay SenSharma

  • Remove root node from tree ...

    hi all,
    how can i delete the root node from a tree ???
    i've tried:
    tree.removeAll();
    this removes all nodes from the tree except the root.
    thanks.

    try this:
    tree.setRootVisible(false);
    Bye!

  • Problem in delting child node from tree

    Hello friends I have a problem in tree component
    I am using Xml File with creator .
    I am showing company name as a root node
    then department name as a child of company name
    then employee name as a child of department
    Initialy its working fine ,user can add edit and delete any node
    In add and edit option I have no problem but in delete I hava a problem
    when I am deleting any child node and after deleting the node I am clicking on the root node of the deleted node the it gives me null pointer Ecxeption .
    but user added any child node and then delete it then Application work properly .
    What is the problem I can't Understand please help me
    thanks
    Raviraj Gangrade

    thanks deepsix for helping me
    it gives me java.lang.NullPointerException and class name is
    net.sf.saxon.dom.NodeWrapper$ChildEnumeration
    here is my Stack Trace
    javax.faces.FacesException: #{Graphs.childNode_action}: javax.faces.el.EvaluationException: java.lang.NullPointerException
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
    at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
    at javax.faces.component.UICommand.broadcast(UICommand.java:312)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:307)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
    Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
    ... 44 more
    Caused by: java.lang.NullPointerException
    at pegasusweb.Graphs.childNode_action(Graphs.java:1075)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
    ... 45 more
    |#]
    [#|2006-11-30T14:51:30.000+0530|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=16;|StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
    com.sun.rave.web.ui.appbase.ApplicationException: #{Graphs.childNode_action}: javax.faces.el.EvaluationException: java.lang.NullPointerException
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java:601)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:302)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
    Caused by: javax.faces.FacesException: #{Graphs.childNode_action}: javax.faces.el.EvaluationException: java.lang.NullPointerException
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
    at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
    at javax.faces.component.UICommand.broadcast(UICommand.java:312)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:307)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    ... 36 more
    Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
    ... 44 more
    Caused by: java.lang.NullPointerException
    at pegasusweb.Graphs.childNode_action(Graphs.java:1075)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
    ... 45 more
    |#]

  • Can't remove a node from a tree

    I am using the custom tree dataDescriptor provided in Flex live
    doc. It works for creating the tree and add notes, however when I
    try to remove a node from the tree it cant work. Does anyone have
    any idea?
    This is the code for MyCustomeTreeDataDescriptor.as
    package
    import mx.collections.ArrayCollection;
    import mx.collections.CursorBookmark;
    import mx.collections.ICollectionView;
    import mx.collections.IViewCursor;
    import mx.events.CollectionEvent;
    import mx.events.CollectionEventKind;
    import mx.controls.treeClasses.*;
    public class MyCustomTreeDataDescriptor implements
    ITreeDataDescriptor
    // The getChildren method requires the node to be an Object
    // with a children field.
    // If the field contains an ArrayCollection, it returns the
    field
    // Otherwise, it wraps the field in an ArrayCollection.
    public function getChildren(node:Object,
    model:Object=null):ICollectionView
    try
    if (node is Object) {
    if(node.children is ArrayCollection){
    return node.children;
    }else{
    return new ArrayCollection(node.children);
    catch (e:Error) {
    trace("[Descriptor] exception checking for getChildren");
    return null;
    // The isBranch method simply returns true if the node is an
    // Object with a children field.
    // It does not support empty branches, but does support null
    children
    // fields.
    public function isBranch(node:Object,
    model:Object=null):Boolean {
    try {
    if (node is Object) {
    if (node.children != null) {
    return true;
    catch (e:Error) {
    trace("[Descriptor] exception checking for isBranch");
    return false;
    // The hasChildren method Returns true if the node actually
    has children.
    public function hasChildren(node:Object,
    model:Object=null):Boolean {
    if (node == null)
    return false;
    var children:ICollectionView = getChildren(node, model);
    try {
    if (children.length > 0)
    return true;
    catch (e:Error) {
    return false;
    // The getData method simply returns the node as an Object.
    public function getData(node:Object,
    model:Object=null):Object {
    try {
    return node;
    catch (e:Error) {
    return null;
    // The addChildAt method does the following:
    // If the parent parameter is null or undefined, inserts
    // the child parameter as the first child of the model
    parameter.
    // If the parent parameter is an Object and has a children
    field,
    // adds the child parameter to it at the index parameter
    location.
    // It does not add a child to a terminal node if it does not
    have
    // a children field.
    public function addChildAt(parent:Object, child:Object,
    index:int,
    model:Object=null):Boolean {
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.ADD;
    event.items = [child];
    event.location = index;
    if (!parent) {
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.insert(child);
    else if (parent is Object) {
    if (parent.children != null) {
    if(parent.children is ArrayCollection) {
    parent.children.addItemAt(child, index);
    if (model){
    model.dispatchEvent(event);
    model.itemUpdated(parent);
    return true;
    else {
    parent.children.splice(index, 0, child);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    // The removeChildAt method does the following:
    // If the parent parameter is null or undefined, removes
    // the child at the specified index in the model.
    // If the parent parameter is an Object and has a children
    field,
    // removes the child at the index parameter location in the
    parent.
    public function removeChildAt(parent:Object, child:Object,
    index:int, model:Object=null):Boolean
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.REMOVE;
    event.items = [child];
    event.location = index;
    //handle top level where there is no parent
    if (!parent)
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.remove();
    if (model)
    model.dispatchEvent(event);
    return true;
    else if (parent is Object)
    if (parent.children != undefined)
    parent.children.splice(index, 1);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    This is my tree definition:
    <mx:Tree width="143" top="0" bottom="0" left="0"
    height="100%"
    id="publicCaseTree"
    dataDescriptor="{new MyCustomTreeDataDescriptor()}"
    dataProvider="{ac}"
    defaultLeafIcon="@Embed('assets/caseIcon.png')"
    change="publicTreeChanged(event)"
    dragEnabled="true"
    dragMoveEnabled="false"/>
    This is how I remove the selected node from the tree. When
    Delete button is clicked, the doDeleteCase function is
    exectuted.
    public function publicTreeChanged(event:Event):void {
    selectedNode =
    publicCaseTree.dataDescriptor.getData(Tree(event.target).selectedItem,
    ac);
    public function doDeleteCase(event:Event):void{
    publicCaseTree.dataDescriptor.removeChildAt(publicCaseTree.firstVisibleItem,
    selectedNode, 0, ac);
    Any help would be appreciated.Thanks.

    Finally I removed nodes from tree, but not sure I did in the
    right way. Anybody encounter the same problem, please
    discuss.

  • How to create a new DOM tree with nodes from another DOM tree?

    Hello,
    I would like to create a DOM tree by using nodes from an existing DOM. How can I do that? I tried with appendChild and it gaves me as error: "WRONG_DOCUMENT_ERR".
    Thx!

    The xml that should be parsed is something like that:
    <?xml version="1.0" encoding="UTF-8"?>
    <root xmlns="http://www.nebi.biz/schemas/bd/nebienvelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" BusinessDocumentVersion="7.0" xsi:schemaLocation="http://www.nebi.biz/schemas/bd/nebienvelope NeBiEnvelope_L_0_3.xsd">
        <Header>
            <To>
                <OrganisationId>OrganisationId0</OrganisationId>
                <DestinationType>DestinationType0</DestinationType>
                <Destination>Destination0</Destination>
            </To>
            <From>
                <OrganisationId>OrganisationId1</OrganisationId>
                <DestinationType>DestinationType1</DestinationType>
                <Destination>Destination1</Destination>
            </From>
            <Dialog>Dialog0</Dialog>
            <DialogId>DialogId0</DialogId>
            <MessageType>MessageType0</MessageType>
            <MessageId>MessageId0</MessageId>
            <Reference Role="buyer" Type="BusinessAgreement">Reference0</Reference>
            <SequenceId>SequenceId0</SequenceId>
            <Checksum Type="MD5">Checksum0</Checksum>
        </Header>
        <Body>
            <Order xmlns="http://www.nebi.biz/schemas/bd/order" BusinessDocumentVersion="7.0" OrderType="request" xsi:schemaLocation="http://www.nebi.biz/schemas/bd/order Order_L_0_96.xsd">
                <OrderId Role="buyer"/>
                <ProductLine Number="1">
                    <ProductUseCaseDetails Id="WICreation">
                        <wiCreation xmlns="http://mydomain.com/GRIPP/workitem">
                            <wiCreationHeader>
                                <userId>wmadm</userId>
                                <taskModelName>DNS02_CreateMasterZone</taskModelName>
                            </wiCreationHeader>
                            <wiCreationBody>
                                <DNS02CreationBody>
                                    <GlobalSection xmlns="http://mydomain.com/GRIPP/dns02">
                                        <Outcome>1</Outcome>
                                    </GlobalSection>
                                    <SpecificSection xmlns="http://mydomain.com/GRIPP/dns02">
                                        <Zonename>0.0</Zonename>
                                        <RRLocation>Domain</RRLocation>
                                        <RemoteSlaves type="multiline">
                                            <RemoteSlaveFQDN>test.com</RemoteSlaveFQDN>
                                            <RemoteSlaveIP>123.234.234.123</RemoteSlaveIP>
                                            <RemoteSlaveFQDN>test.net</RemoteSlaveFQDN>
                                            <RemoteSlaveIP>123.123.123.123</RemoteSlaveIP>
                                        </RemoteSlaves>
                                    </SpecificSection>
                                </DNS02CreationBody>
                            </wiCreationBody>
                        </wiCreation>
                    </ProductUseCaseDetails>
                </ProductLine>
             </Order>
        </Body>
        <Trace>
            <CheckPoint>
                <SystemName>SystemName0</SystemName>
                <SystemDateTime>2006-05-04T18:13:51.0Z</SystemDateTime>
            </CheckPoint>
        </Trace>
    </root>This is the output of the Document after parsing and augmentation with the Xerces parser.

  • Problem with trees(Duplication of the parent node in creation of  children)

    Hi guys i am experiencing a slight problem with the creation of trees.Here is a clear explanation of my program.I created a program that generates edges from a set of datapoints then use each and every edge that is generated to create multiple trees with the edge as the rootnode for each and every tree.Everything up to so far everything went well but the problem comes when i want the program to pick every single tree and traverse through the set of generated edges to create the children of a tree.What it does at the moment for each tree is returning the a duplication of the parent node as the child nodes and that is a problem.Can anyone related with this problem help.Your help will be appreciated.
    The code
    TreeNode class
    package SPO;
    import java.util.*;
    public class TreeNode
            Edge edge;
            TreeNode node;
         Vector childrens = new Vector();
            public TreeNode(Edge edge)
                    this.edge = edge;
            public synchronized  void insert(Edge edge)
                    if(edge.fromNode == this.edge.toNode)
                            if(node == null )
                                    node = new TreeNode(edge);
                                    childrens.add(node);
                            else
                        node.insert(edge);
                                    childrens.add(node);
    Tree class
    package SPO;
    import java.util.*;
    public class Tree
            TreeNode rootNode;
         public Tree()
                    rootNode = null;
            public Tree[]  createTrees(Vector initTrees,Vector edges)
                   Tree [] trees =  new Tree[initTrees.size()];
                   for(int c = 0;c < trees.length;c++)
                      trees[c] = (Tree)initTrees.elementAt(c);     
                   for(int i = 0;i < trees.length;i++)
                            for(int x = 0;x < edges.size();x++)
                                    Vector temp = (Vector)edges.elementAt(x);
                                    for(int y = 0;y < temp.size();y++)
                                           trees.insertNode((Edge)temp.elementAt(y));
    return trees;
    public void printTree(Tree tree)
    System.out.print("("+tree.rootNode.edge.fromNode.getObjName()+","+tree.rootNode.edge.toNode.getObjName()+")");
    Vector siblings = tree.rootNode.childrens;
    for(int i = 0; i < siblings.size();i++)
    TreeNode node = (TreeNode)siblings.elementAt(i);
    System.out.print("("+node.edge.fromNode.getObjName()+","+node.edge.toNode.getObjName()+")");
    System.out.println();
    public Vector initializeTrees(Vector edges)
    Vector trees = new Vector();
    for(int i = 0;i < edges.size();i++)
    Vector temp = (Vector)edges.elementAt(i);
    for(int j = 0;j < temp.size();j++)
    Tree tree = new Tree();
    tree.insertNode((Edge)temp.elementAt(j));
    trees.add(tree);
    return trees;
    public synchronized void insertNode(Edge edge)
    if(rootNode == null)
    rootNode = new TreeNode(edge);
    else
    rootNode.insert(edge);
    EdgeGenerator class
    package SPO;
    import java.util.*;
    import k_means.*;
    public class EdgeGenerator
         public EdgeGenerator()
    public Vector createEdges(Vector dataPoints)
    //OrderPair orderPair = new OrderPair();
    Vector edges = new Vector();
    for(int i = 0;i < dataPoints.size()-1 ;i++)
    Vector temp = new Vector();
    for(int j = i+1;j < dataPoints.size();j++)
    //Create an order of edges
    Edge edge = new Edge((DataPoint)dataPoints.elementAt(i),(DataPoint)dataPoints.elementAt(j));
    temp.add(edge);
    edges.add(temp);
    return edges;
    Edge class
    package SPO;
    import k_means.*;
    public class Edge
    public DataPoint toNode;
    public DataPoint fromNode;
    public Edge(DataPoint x,DataPoint y)
    if (x.getX() > y.getX())
    this.fromNode = x;
    this.toNode = y;
    else
    this.fromNode=y;
    this.toNode = x;
    Entry Point
    package SPO;
    import java.util.*;
    import k_means.*;
    public class Tester {
         public static void main(String[] args)
              Vector dataPoints = new Vector();
              dataPoints.add(new DataPoint(140, "Orange"));
              dataPoints.add(new DataPoint(114.2, "Lemmon"));
              dataPoints.add(new DataPoint(111.5, "Coke"));
              dataPoints.add(new DataPoint(104.6, "Pine apple"));
              dataPoints.add(new DataPoint(94.1, "W grape"));
              dataPoints.add(new DataPoint(85.2, "Appletizer"));
              dataPoints.add(new DataPoint(84.8, "R Grape"));
              dataPoints.add(new DataPoint(74.2, "Sprite"));
              dataPoints.add(new DataPoint(69.2, "Granadilla"));
              dataPoints.add(new DataPoint(59, "Strawbery"));
              dataPoints.add(new DataPoint(45.5, "Stone"));
              dataPoints.add(new DataPoint(36.3, "Yam"));
              dataPoints.add(new DataPoint(27, "Cocoa"));
              dataPoints.add(new DataPoint(13.8, "Pawpaw"));
    EdgeGenerator eg = new EdgeGenerator();
    Vector edges = eg.createEdges(dataPoints);
    Tree treeMaker = new Tree();
    Vector partialTrees = treeMaker.initializeTrees(edges);
    Tree [] trees = treeMaker.createTrees(partialTrees,edges);
    for(int i = 0;i < trees.length;i++)
    treeMaker.printTree(trees[i]);
    The program output
    Each and every "@" symbol represents the start of a tree
    @(Orange,Lemmon)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)(Lemmon,Coke)
    @(Orange,Coke)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)
    @(Orange,Pine apple)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)
    @(Orange,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Orange,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Orange,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Orange,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Orange,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Orange,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Orange,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Orange,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Orange,Cocoa)(Cocoa,Pawpaw)
    @(Orange,Pawpaw)
    @(Lemmon,Coke)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)(Coke,Pine apple)
    @(Lemmon,Pine apple)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)
    @(Lemmon,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Lemmon,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Lemmon,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Lemmon,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Lemmon,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Lemmon,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Lemmon,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Lemmon,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Lemmon,Cocoa)(Cocoa,Pawpaw)
    @(Lemmon,Pawpaw)
    @(Coke,Pine apple)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)(Pine apple,W grape)
    @(Coke,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Coke,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Coke,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Coke,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Coke,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Coke,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Coke,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Coke,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Coke,Cocoa)(Cocoa,Pawpaw)
    @(Coke,Pawpaw)
    @(Pine apple,W grape)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)(W grape,Appletizer)
    @(Pine apple,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(Pine apple,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Pine apple,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Pine apple,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Pine apple,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Pine apple,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Pine apple,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Pine apple,Cocoa)(Cocoa,Pawpaw)
    @(Pine apple,Pawpaw)
    @(W grape,Appletizer)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)(Appletizer,R Grape)
    @(W grape,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(W grape,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(W grape,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(W grape,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(W grape,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(W grape,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(W grape,Cocoa)(Cocoa,Pawpaw)
    @(W grape,Pawpaw)
    @(Appletizer,R Grape)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)(R Grape,Sprite)
    @(Appletizer,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(Appletizer,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Appletizer,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Appletizer,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Appletizer,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Appletizer,Cocoa)(Cocoa,Pawpaw)
    @(Appletizer,Pawpaw)
    @(R Grape,Sprite)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)(Sprite,Granadilla)
    @(R Grape,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(R Grape,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(R Grape,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(R Grape,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(R Grape,Cocoa)(Cocoa,Pawpaw)
    @(R Grape,Pawpaw)
    @(Sprite,Granadilla)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)(Granadilla,Strawbery)
    @(Sprite,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Sprite,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Sprite,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Sprite,Cocoa)(Cocoa,Pawpaw)
    @(Sprite,Pawpaw)
    @(Granadilla,Strawbery)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)(Strawbery,Stone)
    @(Granadilla,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Granadilla,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Granadilla,Cocoa)(Cocoa,Pawpaw)
    @(Granadilla,Pawpaw)
    @(Strawbery,Stone)(Stone,Yam)(Stone,Yam)(Stone,Yam)
    @(Strawbery,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Strawbery,Cocoa)(Cocoa,Pawpaw)
    @(Strawbery,Pawpaw)
    @(Stone,Yam)(Yam,Cocoa)(Yam,Cocoa)
    @(Stone,Cocoa)(Cocoa,Pawpaw)
    @(Stone,Pawpaw)
    @(Yam,Cocoa)(Cocoa,Pawpaw)
    @(Yam,Pawpaw)
    @(Cocoa,Pawpaw)

    Your program description makes no sense. What exactly is it supposed to do?
    Your errors make no sense. What is it doing wrong?
    Your program output makes no sense. Look up pre-order, in-order, and post-order notation for representing trees. Pick one of those that you think would be best. I would go with pre-order. Because what you are doing isn't understandable.
    By the way, I think your concept of a tree is flawed. A node in a tree has 3 things. it has a reference to its parent, it has references to any of its children, and it has some key value that represents the node (if each node were represented by numbers, the value would be an integer or something). In the case of the root, its reference to its parent is null. I don't know what you are doing with your tree, but it is highly confusing.

  • How do i Drag and drop From one tree to another and vise versa?

    I have two tree structures and i'm trying to drag a leaf of a branch from one tree to another and vise versa. i'm using flex 3 to code it. I'm also trying to put a prevention on dropping a leaf of one tree from being dropped inside a branch of another tree. Anything that is dragged over to another tree should be placed as a dangling node in that tree. Please share this code and help me find a solution.
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="
    http://www.adobe.com/2006/mxml" xmlns:comp="
    com.adobe.flex.extras.controls.*" initialize="data2
    new
    ArrayCollection(countries);"layout="
    absolute"verticalAlign="
    middle" backgroundColor="white" height="
    551">
    <mx:Script>
    <![CDATA[
    importmx.events.FlexEvent; 
    importmx.collections.ArrayCollection; 
    importmx.controls.Alert; 
    importmx.events.DragEvent; 
    importmx.managers.DragManager;  
    importmx.core.DragSource;  
    importmx.core.UIComponent;  
    importmx.controls.Tree;  
    // data provider for role name[
    Bindable] private vardata2: ArrayCollection; 
    // variable to store the node that is dragged from a tree 
    private var draggedItemOfAccessTree:XML = null;  
    private var draggedItemOfExclusionTree:XML = null; 
    private var dragItemAccess:DisplayObject =null; 
    private var dragItemExclusion:DisplayObject =null; 
    // Array to store the Role list[
    Bindable]public varcountries: Array = [{id: 0, name:
    "Role 1"},{id: 1, name:
    "Role 2"},{id: 2, name:
    "Role 3"},{id: 3, name:
    "Role 4"},{id: 4, name:
    "Role 5"},{id: 5, name:
    "Role 6"},{id: 6, name:
    "Role 7"},{id: 7, name:
    "Role 8"},{id: 8, name:
    "Role 9"},{id: 9, name:
    "Role 10"},{id: 10,name:
    "Role 11"} 
    // this event is called when we begin dragging a node in a tree 
    private function onAccessListDragEnter( event:DragEvent ) : void{
    event.preventDefault();
    vards1:DragSource = event.dragSource;  
    var items1:Array = ds1.dataForFormat("treeItems") asArray; 
    if (items1 != null && items1.length > 0 && (items1[0] isXML)){
    draggedItemOfAccessTree = items1[0];
    dragItemAccess = items1[0]
    asDisplayObject;}
    DragManager.acceptDragDrop(UIComponent(event.currentTarget));
    private function onExclusionListDragEnter( event:DragEvent ) : void{
    event.preventDefault();
    vards2:DragSource = event.dragSource;  
    var items2:Array = ds2.dataForFormat("treeItems") asArray; 
    if (items2 != null && items2.length > 0 && (items2[0] isXML)){
    draggedItemOfExclusionTree = items2[0];
    dragItemExclusion =items2[0]
    asDisplayObject;}
    DragManager.acceptDragDrop(UIComponent(event.currentTarget));
    private function onAccessListDragOver( event:DragEvent ) : void{
    event.preventDefault();
    varvar1:Number = AccessTree.selectedIndex; 
    varvar2:Number = ExclusionTree.calculateDropIndex(event);  
    var node1:XML = AccessTree.selectedItem asXML;  
    var node2:XML = ExclusionTree.calculateDropIndex(event) asXML;  
    //restrict drag & drop to nodes within same parent  
    if(draggedItemOfAccessTree.parent() == node1.parent() || draggedItemOfAccessTree.parent() != node1.parent()){
    DragManager.showFeedback(DragManager.NONE);
    //return; }
    elseDragManager.showFeedback(DragManager.MOVE);
    private function onExclusionListDragOver( event:DragEvent ) : void{
    event.preventDefault();
    varvar1:Number = ExclusionTree.selectedIndex;  
    varvar2:Number = AccessTree.calculateDropIndex(event); 
    var node1:XML = AccessTree.calculateDropIndex(event) asXML;  
    var node2:XML = ExclusionTree.selectedItem asXML;  
    //restrict drag & drop to nodes within same parent  
    if( draggedItemOfExclusionTree.parent() == node2.parent() || draggedItemOfExclusionTree.parent() != node2.parent()){
    DragManager.showFeedback(DragManager.NONE);
    // return; }
    elseDragManager.showFeedback(DragManager.MOVE);
    private function onAccessListDragDrop( event:DragEvent ) : void{
    event.preventDefault();
    varSindex:Number = AccessTree.selectedIndex; 
    varEindex:Number= ExclusionTree.calculateDropIndex(event);  
    var Enode:XML = ExclusionTree.selectedItem asXML;  
    var Anode:XML = AccessTree.selectedItem asXML; 
    if((draggedItemOfAccessTree.parent() != Anode.parent()) ){
    AccessTree.removeChildAt(Sindex);
    ExclusionTree.addChildAt(dragItemAccess , Eindex);
    // AccessTree.rdataDescriptor.removeChildAt(Anode.parent(),draggedItemOfAccessTree,Sindex);  
    //ExclusionTree.dataDescriptor.addChildAt(Enode.parent(),draggedItemOfAccessTree,Eindex); }
    private function onExclusionListDragDrop( event:DragEvent ) : void{
    event.preventDefault();
    varEindex:Number = ExclusionTree.selectedIndex; 
    varSindex:Number = AccessTree.calculateDropIndex(event);  
    var Anode:XML = AccessTree.selectedItem asXML;  
    var Enode:XML = ExclusionTree.selectedItem asXML; 
    if((draggedItemOfExclusionTree.parent() != Enode.parent()) ){
    ExclusionTree.removeChildAt(Eindex);
    AccessTree.addChildAt(dragItemExclusion, Sindex);
    // ExclusionTree.dataDescriptor.removeChildAt(Enode.parent(),draggedItemOfExclusionTree,Eind ex);  
    // AccessTree.dataDescriptor.addChildAt(Anode.parent(),draggedItemOfExclusionTree,Eindex); }
    private function onDragComplete( event:DragEvent ) : void

    Yes, I have set dragEnabled and dropEnabled to true. I trying to put restriction on dropping the node(aka leaf) of 1st free tree inside the branch(aka folder) of the 2nd tree. If something is dragged from tree1, it should be dropped only on tree2  i.e., dragged node should be appended at the end of tree2 and not inside nay of the branches of tree2. This functionality should work on both the trees. I'll be glad if u can provide the solution.

  • Adding multiple same-name nodes from one xml into another

    Hi,
    Following on from my question the other day (Adding multiple different nodes from one xmltype into another), I now have a slightly more complex requirement that I cannot work out where to start, assuming that it's something that can reuse some/all of yesterday's work (thanks again, odie_63!). ETA: I'm on 11.2.0.3
    So, here's the (slightly amended) xml along with yesterday's solution:
    with sample_data as (select xmltype('<root>
                                           <xmlnode>
                                             <subnode1>val1</subnode1>
                                             <subnode2>val2</subnode2>
                                           </xmlnode>
                                           <xmlnode>
                                             <subnode1>val3</subnode1>
                                             <subnode2>val4</subnode2>
                                           </xmlnode>
                                         </root>') xml_to_update,
                                xmltype('<a>
                                           <b>valb</b>
                                           <c>valc</c>
                                           <d>
                                             <d1>vald1</d1>
                                             <d2>vald2</d2>
                                           </d>
                                           <e>vale</e>
                                           <f>valf</f>
                                           <g>
                                             <g1>valg1</g1>
                                             <g2>valg2</g2>
                                           </g>
                                           <h>
                                             <h1>valh1</h1>
                                             <h2>valh2</h2>
                                           </h>
                                           <multinode>
                                             <name>fred</name>
                                             <type>book</type>
                                             <head>1</head>
                                           </multinode>
                                           <multinode>
                                             <name>bob</name>
                                             <type>car</type>
                                             <head>0</head>
                                           </multinode>                                        
                                         </a>') xml_to_extract_from
                          from   dual)
    select xmlserialize(document
               xmlquery(
                 'copy $d := $old
                  modify (
                    insert node element extrainfo {
                      $new/a/b
                    , $new/a/d
                    , $new/a/f
                    , $new/a/h
                    } as first into $d/root
                  return $d'
                 passing sd.xml_to_update as "old"
                       , sd.xml_to_extract_from as "new"
                 returning content
             indent
    from sample_data sd;
    That gives me:
    <root>
      <extrainfo>
        <b>valb</b>
        <d>
          <d1>vald1</d1>
          <d2>vald2</d2>
        </d>
        <f>valf</f>
        <h>
          <h1>valh1</h1>
          <h2>valh2</h2>
        </h>
      </extrainfo>
      <xmlnode>
        <subnode1>val1</subnode1>
        <subnode2>val2</subnode2>
      </xmlnode>
      <xmlnode>
        <subnode1>val3</subnode1>
        <subnode2>val4</subnode2>
      </xmlnode>
    </root>
    However, I now need to add in a set of new nodes based on information from the <multinode> nodes, something like:
    <root>
      <extrainfo>
        <b>valb</b>
        <d>
          <d1>vald1</d1>
          <d2>vald2</d2>
        </d>
        <f>valf</f>
        <h>
          <h1>valh1</h1>
          <h2>valh2</h2>
        </h>
        <newnode>
          <name>fred</name>
          <type>book</type>
        </newnode>
        <newnode>
          <name>bob</name>
          <type>car</type>
        </newnode>
      </extrainfo>
      <xmlnode>
        <subnode1>val1</subnode1>
        <subnode2>val2</subnode2>
        <type>book</type>
      </xmlnode>
      <xmlnode>
        <subnode1>val3</subnode1>
        <subnode2>val4</subnode2>
        <type>car</type>
      </xmlnode>
    </root>
    If it's easier, I *think* we would be ok with something like:
    <newnode>
      <type name="fred">book</type>
      <type name="bob">car</type>
    </newnode>
    The closest I've come is:
    with sample_data as (select xmltype('<root>
                                           <xmlnode>
                                             <subnode1>val1</subnode1>
                                             <subnode2>val2</subnode2>
                                           </xmlnode>
                                           <xmlnode>
                                             <subnode1>val3</subnode1>
                                             <subnode2>val4</subnode2>
                                           </xmlnode>
                                         </root>') xml_to_update,
                                xmltype('<a>
                                           <b>valb</b>
                                           <c>valc</c>
                                           <d>
                                             <d1>vald1</d1>
                                             <d2>vald2</d2>
                                           </d>
                                           <e>vale</e>
                                           <f>valf</f>
                                           <g>
                                             <g1>valg1</g1>
                                             <g2>valg2</g2>
                                           </g>
                                           <h>
                                             <h1>valh1</h1>
                                             <h2>valh2</h2>
                                           </h>
                                           <multinode>
                                             <name>fred</name>
                                             <type>book</type>
                                             <head>1</head>
                                           </multinode>
                                           <multinode>
                                             <name>bob</name>
                                             <type>car</type>
                                             <head>0</head>
                                           </multinode>                                        
                                         </a>') xml_to_extract_from
                          from   dual)
    select xmlserialize(document
               xmlquery(
                 'copy $d := $old
                  modify (
                    insert node element extrainfo {
                      $new/a/b
                    , $new/a/d
                    , $new/a/f
                    , $new/a/h
                    , element newnode {
                                       $new/a/multinode/name
                                       ,$new/a/multinode/type
                    } as first into $d/root
                  return $d'
                 passing sd.xml_to_update as "old"
                       , sd.xml_to_extract_from as "new"
                 returning content
             indent
             ) fred
    from sample_data sd;
    Which produces:
    <newnode>
      <name>fred</name>
      <name>bob</name>
      <type>book</type>
      <type>car</type>
    </newnode>
    - obviously not right!
    Can anyone provide any hints? I've tried searching for similar examples, but I mustn't be putting in the right search terms or something!

    odie_63 wrote:
    or, similarly, to get the alternate output :
    copy $d := $old
    modify (
      insert node element extrainfo {
        $new/a/b
      , $new/a/d
      , $new/a/f
      , $new/a/h
      , element newnode {
          for $i in $new/a/multinode
          return element type {
            attribute name {data($i/name)}
          , data($i/type)
      } as first into $d/root
    return $d
    So we're going with the second method, but I've discovered that the "$i/name" node is not always present. When that happens, I would like to use a default value (for example, "george"). I promise I've searched and searched, but I'm completely failing to turn up anything that sounds remotely like what I'm after (seriously, I can't believe my google-fu sucks this badly!).
    Is there a simple way of doing it? The only thing that I've found that looks vaguely relevant is "declare default namespace...." but I'm not sure that that's the correct thing to use, or if it is, how I'm supposed to reference it when populating the attribute value.

  • How to insert a row in Tree table which is dragged from the table?

    Hi All,
    I am having a Tree table and a Table in the same page, like below
    Treetable                                         Table
    Item1                                              Subitem12
         Subitem1                                   Subitem13
         Subitem2                                   Subitem14
         Subitem3                                   Subitem15
         Subitem4                                   Subitem16
    Item2                                              Subitem17
         Subitem5                                   Subitem18
         Subitem6                                   Subitem19
         Subitem7                                   Subitem20
         Subitem8                                   Subitem21
    Item3
         Subitem9
         Subitem10
         Subitem11
    The requirement is i need to "drag" a row from the Table and place it under any parent node in the Tree table.
    What i have done is I make the Tree table as ".ui-sortable" and table as a "draggable".
    I am not able to find the position of the dragged item when i dropped it in the Treetable.
    Please provide me a solution.
    Regards,
    Aravindh

    Hello:
    Do you mean setting the selectedRowKeys in the setter method of the treeTable in the Request Scoped Managed Bean?
    If that is what you mean, I tried that and there was no change in behavior. (Still does not highlight the correct row in the tree table upon execution of the next method for the bindings) Does anyone have any sample code they can provide that works?
    Thanks for the help.

  • Af:tree Master child relation ,but showing child id's as parent node vice

    Hi ,
    Am using adf 11G 11.1.1.5
    I have a small requiement .
    Am using af:tree , where i display childId's . Onclick of child it i have to show popup with tree structure where i will show parentid as node and childId's as child nodes
    i have created view link between child and parent views.
    Now isssue is when i selected childId in table (i mean a checkbox is given where user check the child Id and fire button ).On dat action am calling popup with tree structure .BUT here childId's are displaying like Parent nodes and parentId's as child node.
    any suggestion . if want i will drop the code

    i knew somewhere i was messed up .
    There is only viewlink between, Parent and child .NO FK ,these are not related database table (Entity Object.).
    simple query's which are made from same table , but base on Parent/Root col i have show data in tree structure way.
    Just like
    ParentId Chilld id
    100 jhon
    100 max
    100 adam
    101 jack
    103 jill
    103 marven
    Now it will show in table like
    jhon
    max
    adam
    jack
    jill
    marven
    If i click max i mean check box and fire button , i have to show tree structure like below
    100
    jhon
    max
    adam
    As max parentid is 100 , i have to show all the childid which have 100 as parentid.
    any suggestion plz , me struck here to handel

  • Is it possible to put two different colors in tree parent node background and child nodes background?

    Is it possible to put two different colors in tree parent
    node background and child nodes background?
    Any help will be very helpful.
    Thanks

    Hi PanosE,
    Yes, you can set up another Standard Edition Server in child domain and then deploy pool pairing.
    You need to deploy a new Front End Pool for the new Standard Edition Server.
    A similar case for your reference.
    https://social.technet.microsoft.com/Forums/office/en-US/eca4299c-8edb-481e-b328-c7deba2a79ba/lync-2013-standard-edition-lync-fe-pools-in-multiple-domain-single-forest-senario?forum=lyncdeploy
    Best regards,
    Eric
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Maybe you are looking for

  • Problem Event :APPCRASH=Application:iTunes.exe=Fault Module QuickTime.qts

    Dear Friends, When i usb-connect my iphone to computer, i-tunes opens and says "ITUNES HAS STOPPED WORKING" and it shuts down. If any body faced this problem, Please advice me how to connect to itunes, i cannot upload or download anything from iphone

  • How can I make OSX index a network share for spotlight?

    How can I make OSX index a network share for spotlight? I am using a QNAP NAS with SMB network shares, which I mount with OS X Mavericks. They are not searchable, as far as I know because of the indexing of network share is by default not activated.

  • DTP to load Master Data

    Hi All, We have a DTP which will load data to Master Data Object from a DSO. I have executed the DTP and its loading the data properly. But, when the same DTP is being executed thru process chain, it is not all getting processed. The process is yello

  • Adobe Flash Player error during update from 10.0.45 to 10.1

    I am getting this error message during the upgrade from 10.0 to 10.1 and it errors with the following error: Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact yo

  • HELP - Airport remains solid amber

    I've just bought the Airport extreme and when I plugged it in for the first time, for brief moment I saw green and then solid amber and it remains like that for hours and hours without changing. anyone got a solution?