JTree - Highlighting a different node dynamically

Hello All,
I am using a JTree to display a tree hierarchy. I have a situation, in which, the Tree window should update in the sense, point to a different node ( A different node has to be selected) based on user input.
Say the tree has root and then 3 children
root
- A
- - B
- - C
- D
- E
Each hyphen indicates a level, now when the user types B in the text box I need to update the currently selected node as B, and when he types E it should update to E Automatically. I googled online in general, and also saw that the action listeners are based on some action performed on the tree... but is there any function that can be trigged externally to update the tree selected data?
Also It will be great if there is a way in which my TreeSelectionListener event is not triggered during this change.
Regards,
Sirish

you can add key listener to your text field. Then invoke the method valueForPathChanged() of tree model. For example see small piece of code
final JTree tree = new JTree();
textField.addKeyListener(new KeyAdapter(){
            public void keyReleased(KeyEvent e) {
                TreePath path = tree.getSelectionPath();
                if(path == null) return;
                tree.getModel().valueForPathChanged(path, textField.getText());
        });

Similar Messages

  • Drag and Drop different nodes within a JTree

    I have a JTree that represents a hierarchical object. Within the tree are different nodes representing different objects, each within a container,
    For Example:
    A
    -B container
    -- B NodeObject
    -- B NodeObject
    -C Container
    -- C NodeObject
    -- C NodeObject
    I have got the drag and drop working but as the gesture listener is on the actual JTree object it allows me to drag any object to any other place.
    What i want to be able to do is to force the drag and drop to allow only objects of type C to be put in the C container, etc and to reject any moves
    over other containers.
    As TreeNodes are not Components how do i force this behaviour?
    If i have to i can force the behaviour after the mouse has been released but I would prefer it if Swing would show the correct mouse over icons
    when I put an object over the wrong container.
    Thanks
    Dan Alford

    When you drag get the [x,y] mouse position and use the JTree method:
    getRowForLocation(x, y) for node you at the also for the parent node location of the child node.
    Once the childY is less than childParentY, you stop the drag.
    Hope that helps?

  • How to change icons of a JTree node dynamically

    Hi all!
    I want to change icon associated with a node dynamically ( i.e. after the tree has being displayed). How can i achieve this?
    Can any one provide me a sample code snippet.
    Thanks in advance
    Murali

    I have created CustomCellRenderer and i'm calling this class as follows
    tree.setCellRenderer((TreeCellRenderer) new CustomCellRenderer(true));
    The boolean value for the constructor (in this case it's true) will be set to
    a local variable in the CustomCellRenderer class. Then upon clicking a node in the tree the boolean value (true) is set and the icon for that node should be changed as specified in the CustomCellRenderer class.
    When i click on a node all the icons of that tree are disappearing.
    Can any one help me in this issue
    public class CustomCellRenderer
              extends          JLabel
              implements     TreeCellRenderer
    private ImageIcon          grayfolderImage;
    private ImageIcon          greenfolderImage;
    private ImageIcon          bluefolderImage;
    private ImageIcon          redfolderImage;
    private ImageIcon          whitefolderImage;
    private boolean               bSelected;
    boolean logfileDeleted;
         public CustomCellRenderer()
              grayfolderImage = new ImageIcon("C:\\images\\grayFolder.gif");     
              greenfolderImage = new ImageIcon("C:\\images\\greenFolder.gif");     
              bluefolderImage = new ImageIcon("C:\\images\\blueFolder.gif");     
              redfolderImage = new ImageIcon("C:\\images\\redFolder.gif");
              whitefolderImage = new ImageIcon("C:\\images\\whiteFolder.gif");     
         public CustomCellRenderer(boolean logfileDeleted){
              this.logfileDeleted = logfileDeleted;
         public Component getTreeCellRendererComponent( JTree tree,
                             Object value, boolean bSelected, boolean bExpanded,
                                       boolean bLeaf, int iRow, boolean bHasFocus )
              // Find out which node we are rendering and get its text
              DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
              String     labelText = (String)node.getUserObject();
              this.bSelected = bSelected;
              // Set the correct foreground color
              /*if( !bSelected )
                   setForeground( Color.black );
              else
                   setForeground( Color.red ); */
              // Determine the correct icon to display
              if( labelText.equals( "ioexception001" ) )
                   setIcon( redfolderImage );
              else if( labelText.equals( "ioexception002" ) )
                   setIcon( greenfolderImage );
              else if( logfileDeleted ==true )
                   setIcon( whitefolderImage );
              else if( labelText.equals( "ioexception004" ) )
                   setIcon( redfolderImage );
              else
                   setIcon(bluefolderImage);
              // Add the text to the cell
              setText( labelText );
              return this;
         // This is a hack to paint the background. Normally a JLabel can
         // paint its own background, but due to an apparent bug or
         // limitation in the TreeCellRenderer, the paint method is
         // required to handle this.
         public void paint( Graphics g )
              Color          bColor;
              Icon          currentI = getIcon();
              // Set the correct background color
              bColor = bSelected ? SystemColor.textHighlight : Color.white;
              g.setColor( bColor );
              // Draw a rectangle in the background of the cell
              g.fillRect( 0, 0, getWidth() - 1, getHeight() - 1 );
              super.paint( g );
    }

  • How to display different icon, for different node of jtree

    Hi All,
    How to display different icon, for different node of jtree

    you haven't responded to my last post here: [http://forums.sun.com/thread.jspa?threadID=5323190&messageID=10382676#10382676|http://forums.sun.com/thread.jspa?threadID=5323190&messageID=10382676#10382676]

  • Possibility to have your own icons in JTree depending on what node

    Can you specify your own icons in a JTree? With this I mean more than your own directory/leaf icons. For example, if you have a family tree, you might want different icons for sons and daugthers etc.

    I did like you said, and it works, almost.
    I use the following code to find out what type my nodes in the tree are. I can just look at my NodeInfo object to get that. But when I click at different nodes in the tree, other nodes than the clicked one changes icons.
    DefaultMutableTreeNode node =
                   (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
              NodeInfo selectedNode = (NodeInfo)node.getUserObject();Edit: Also tried this code but that gave me:
    Exception in thread "main" java.lang.ClassCastException: java.lang.String
         at gui.MyTreeCellRenderer.getTreeCellRendererComponent(MyTreeCellRenderer.java:26)
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
              NodeInfo selectedNode = (NodeInfo)node.getUserObject();Message was edited by:
    sandsater

  • Reassignment of hierarchy nodes dynamically

    Hi Experts,
    I have a requirement wherein I need to re-assign the hierarchy node for an account based on Functional area.
    Currently, we load 0ACCOUNT info object with hierarchy defined in KDH3 transaction in R/3. Here, the account 650000000 is defined under local accounts node of the hierarchy. Hence, when we use the 0account infobject in BEx with hierarchy activated, all the records in transaction data with account no. 650000000 are aggregated under local accounts node.
    However, the user wants us to check the functional area for each of the record with 65000000 account and re-assign it to a different node of the hierarchy. For example, if the transaction data has account number 65000000 and functional area 400, then the record needs to be aggregated under a different node in hierarchy, say overhead costs. Similarly, if there is another record with account 650000000 and functional area 300, then the record needs to be aggregated under Sales & marketing.
    How do we handle such conditional assignment of hierarchy nodes?
    Regards,
    SS

    Hi,
    I really doubt if dynamic reassignment of hierarchy nodes is possible in BW, but could be wrong.
    Alternatives which you can consider
    a. A flat hierarchy modeled in the dimension of the cube i.e. higher levels of 0ACCOUNT can be filled during transformations based on functional area. Major disadvantage here is that any change to the hierarchy or assignment could require reloads depending on your requirement i.e. touch history data or not
    b.Customized Hierarchy created by combining the original hierarchy and the assignment details
    for eg 
    Leaf Node: 650000000_400 under parent Overhead Costs
    Leaf Node: 650000000_300,under parent Sales & Marketing
    Regards,
    Advait

  • How to add data in a table UI from  two different NODE

    Hello Experts,
    We have a requirement to show data in a table which is coming from different node.
    Suppose the table has 10 column ( among them 5 are coming from node A and others are coming from node B)
    I tried to add node A as a source of the table, and then add individual context to corresponding column element from node A and node B .
    Like:
    Table Source-->Node A
    Table Column1 element value --> NodeA.context
    Table Column1 element value--> NodeB.context.
    But in this case the problem is, whenever i am trying to add a new row in the table it is copying previous value to the new cell.
    I have also tried to add context of B node to A node and then tried to copy data from B node to Anode, but it is saying that Node A is already binded; add or bind element is not possible.
    Can any one please help me on this scenario.
    Regards,
    Sambaran Chakraborty

    Hi,
    Yes you can do it. In that case you need to add moveTo() function for both nodeA as well as nodeB inside the for loop. Then only both the node's pointer will move with the value of i.
    You can use something lik this:
    Create a node C and then do the following: (Considering that name,age,desc,empid are the attributes which we are trying to copy to node C )
    for(int i = 0; i < wdContext.nodeNodeA().size(); i++){
    //Moving the pointer of node A and node B based upon value of i.
    wdContext.nodeNodeA().moveTo(i);
    wdContext.nodeNodeB().moveTo(i);
    //Creating an element for node C.
    IPrivateTestApp9View.INodeCElement element1 = wdContext.nodeNodeC().createNodeCElement();
    //Copying the attributes values of node C from node A .
    element1.setName(wdContext.currentNodeAElement().getName());
    element1.setAge(wdContext.currentNodeAElement().getAge());
    //Copyingthe attributes values of node C from B.
    element1.setDesc(wdContext.currentNodeBElement().getDesc());
    element1.setEmpid(wdContext.currentNodeBElement().getEmpid());
    //Finally adding that element on to the node C.
    wdContext.nodeNodeC().addElement(element1);
    Regards,
    Jithin
    Edited by: jithus on Nov 9, 2011 12:44 PM

  • Restore to a different node with RMAN and EMC Networker

    Please, really need help :)
    I took hotbackup using RMAN catalog which went to tape. Here is the script for that:
    connect target sys/****@PROD;*
    connect rcvcat rman/***@catalog;*
    *run {*
    allocate channel t1 type 'SBT_TAPE';
    send 'NSR_ENV=(NSR_SERVER="**",NSR_DATA_VOLUME_POOL=Oracle)';*
    *backup database plus archivelog;*
    *release channel t1;*
    My settings include control file autobackup as follows:
    *RMAN&gt; show all;*
    *RMAN configuration parameters are:*
    *CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;*
    *CONFIGURE BACKUP OPTIMIZATION OFF; # default*
    *CONFIGURE DEFAULT DEVICE TYPE TO DISK;*
    *CONFIGURE CONTROLFILE AUTOBACKUP ON;*
    *CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '/NMO_%F/';*
    *CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default*
    *CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default*
    *CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default*
    *CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default*
    *CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/data/backups/PROD/ora_df%t_s%s_s%p';*
    *CONFIGURE MAXSETSIZE TO UNLIMITED; # default*
    *CONFIGURE ENCRYPTION FOR DATABASE OFF; # default*
    *CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default*
    *CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default*
    *CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/data/backups/PROD/hotbkp/snapcf_PROD.f';*
    I am trying to restore this backup that is on tape (EMC Networker) to a different node. I can do this outside of Networker without any problems. However, when I try to get the backup from tape I have this issue:
    1. initPROD.ora is created and modified accordingly on a new server
    2. Export sid, startup nomount on new server
    export ORACLE_SID=PROD (on this new server)
    *rman target /*
    *startup nomount*
    3. I then run the following and get this error:
    *RMAN&gt; run {*
    *2&gt; allocate channel t1 type 'SBT_TAPE'*
    *3&gt; send 'NSR_ENV=(NSR_SERVER="***",NSR_CLIENT="********")';*
    *4&gt; restore controlfile from autobackup;*
    *5&gt; sql 'alter database mount';*
    *6&gt; sql 'alter database rename file "/data/dbf/PROD/redo01.log" to "/data/scratch/dbf/PROD/redo01.log"';*
    *7&gt; sql 'alter database rename file "/data/dbf/PROD/redo02.log to "/data/scratch/dbf/PROD/redo02.log"';*
    *8&gt; sql 'alter database rename file "/data/dbf/PROD/redo03.log to "/data/scratch/dbf/PROD/redo03.log"';*
    *9&gt; set until sequence 22; (I get this from archive logs)*
    *10&gt; set newname for datafile 1 to '/data/scratch/dbf/PROD/system01.dbf';*
    *11&gt; set newname for datafile 2 to '/data/scratch/dbf/PROD/undotbs01.dbf';*
    *12&gt; set newname for datafile 3 to '/data/scratch/dbf/PROD/sysaux01.dbf';*
    *13&gt; set newname for datafile 4 to '/data/scratch/dbf/PROD/users01.dbf';*
    *14&gt; restore database;*
    *15&gt; switch datafile all;*
    *16&gt; recover database;*
    *17&gt; alter database open resetlogs;*
    *18&gt; }*
    *allocated channel: t1*
    *channel t1: sid=149 devtype=SBT_TAPE*
    *channel t1: NMO v4.5.0.0*
    *Starting restore at 27-FEB-09*
    *released channel: t1*
    *RMAN-00571: ===========================================================*
    *RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============*
    *RMAN-00571: ===========================================================*
    *RMAN-03002: failure of restore command at 02/27/2009 22:10:43*
    *RMAN-06495: must explicitly specify DBID with SET DBID command*
    I cannot seem to pass this error. This error indicates that the db has to be either mounted or DBID set before the restore of teh controlfile. Mounting db before the restore of the controlfile does not work. Setting db id 1) does not make sense because if the primary db is down then I cannot get it, right? My primary is up now, so I was able to get db id, but setting it made the restore hang with the following:
    *RMAN&gt; run {*
    *connect target*
    *set dbid=466048808*
    *2&gt; allocate channel t1 type 'SBT_TAPE'*
    *3&gt; send 'NSR_ENV=(NSR_SERVER="***",NSR_CLIENT="********")';*
    *4&gt; restore controlfile from autobackup;*
    *5&gt; sql 'alter database mount';*
    *6&gt; sql 'alter database rename file "/data/dbf/PROD/redo01.log" to "/data/scratch/dbf/PROD/redo01.log"';*
    *7&gt; sql 'alter database rename file "/data/dbf/PROD/redo02.log to "/data/scratch/dbf/PROD/redo02.log"';*
    *8&gt; sql 'alter database rename file "/data/dbf/PROD/redo03.log to "/data/scratch/dbf/PROD/redo03.log"';*
    *9&gt; set until sequence 22; (I get this from archive logs)*
    *10&gt; set newname for datafile 1 to '/data/scratch/dbf/PROD/system01.dbf';*
    *11&gt; set newname for datafile 2 to '/data/scratch/dbf/PROD/undotbs01.dbf';*
    *12&gt; set newname for datafile 3 to '/data/scratch/dbf/PROD/sysaux01.dbf';*
    *13&gt; set newname for datafile 4 to '/data/scratch/dbf/PROD/users01.dbf';*
    *14&gt; restore database;*
    *15&gt; switch datafile all;*
    *16&gt; recover database;*
    *17&gt; alter database open resetlogs;*
    *18&gt; }*
    *connected to target database: PROD (not mounted)*
    *executing command: SET DBID*
    *using target database control file instead of recovery catalog*
    *allocated channel: t1*
    *channel t1: sid=152 devtype=SBT_TAPE*
    *channel t1: NMO v4.5.0.0*
    *Starting restore at 27-FEB-09*
    *channel t1: looking for autobackup on day: 20090227*
    *channel t1: looking for autobackup on day: 20090226*
    *channel t1: looking for autobackup on day: 20090225*
    It looks like it cannot find the autbackup of controlfile? But when I list backup while connected to the target db and rman catalog, I see that autobackup is included in every hot backup that we do:
    *BS Key Type LV Size Device Type Elapsed Time Completion Time*
    *4639 Full 7.00M SBT_TAPE 00:00:04 27-FEB-09*
    *BP Key: 4641 Status: AVAILABLE Compressed: NO Tag: TAG20090227T150141*
    *Handle: /NMO_c-466048808-20090227-01/ Media:*
    *Control File Included: Ckp SCN: 23352682865 Ckp time: 27-FEB-09*
    *SPFILE Included: Modification time: 26-FEB-09*
    I am stuck What I am doing wrong? Thank you!
    Edited by: rysalka on Feb 28, 2009 8:35 AM

    Do a list command to see if the controlfile backup is on tape.
    RMAN> list backup of controlfile;
    I suggest you to read the manual of EMC Networker or call EMC on how to restore the database to another node. I am using Veritas Netbackup, it may be similar to EMC Networke for your reference. There are a few things that need to be followed when you restore database to another node:
    1) set DB_ID, which you have done
    2) set NB_CLIENT (in your case NSR_CLIENT) to the primary node from where backup was taken
    3) configure the backup server to allow redirect restore between the two nodes.
    Hope this helps.

  • Generating target nodes dynamically in message mapping

    Hi XI GURUS
    I am trying to generate target node using using more then source node. Is it possible to do this.
    I need this as in source I have 2 different nodes (0 to unbounded) and in target I want to create corresponding number of target nodes. For e.g if I have 2 + 1 nodes in source then I want to create 3 nodes in target
    Source as below
    <FIRSTNAME>
         <Raj>
         <Kum>
    </FIRSTNAME>
    <FIRSTNAME>
         <Naveen>
         <Kumar>
    </FIRSTNAME>
    <CITY>
    <bANGALORE>
    </CITY>
    Desired output in target as below
    <ADDRESS>
    <qwerty1>
    <ADDRESS>
    <ADDRESS>
    <qwerty2>
    <ADDRESS>
    <ADDRESS>
    <qwerty2>
    <ADDRESS>
    Can i follow an alternative approach (using java function) of counting the total number of occurences of  source nodes and generating as many number of the target node
    Thanx

    If you have a condition check for each of the source node to be mapped to the target node,
    use "create if" standard function and pass the boolean result of your Condition check as an input to this standard function. For each "true" a value would be added to the output queue. If you have a simple condition check on some source field value for each correspoding node, use "if without else" or depending on the complexity of the condition you may use a udf to get the boolean outcome.
    And for mapping from more than on type of source node, you may duplicate subtree for target node.
    Regards,
    Suddha

  • Node - Dynamic Attributes

    Hi,
    I have a node 'CONF' with attribute ATNAM01. I used a ZSTRUC to create this node. Here my requirement is that based on user inputs I will execute a FM, I will get no of entries in my itab. I need to assign attributes based on itab entries to 'CONF' node dynamically ....
    Ex: ATNAM01, ATNAM02....ATNAMNN.
    Is it possible? How? Any code/link!
    Regards,
    Sateesh...

    Hi sateesh,
            Is your problem statement is some thing like this .Based on data in attribute ATNM01  you need to perform correpsonding treatment .
    DATA:
        node_check                          TYPE REF TO if_wd_context_node,
        elem_check                          TYPE REF TO if_wd_context_element,
        stru_check                          TYPE if_start_ior=>element_check ,
        item_check_attribute                LIKE stru_check-check_attribute.
    element = wd_context->get_lead_selection( ).
    index = wdevent->get_string( 'INDEX' ).
    navigate from <CONTEXT> to <CHECK> via lead selection
      node_check = wd_context->get_child_node( name =  if_start_ior=>wdctx_check ).
    get element via lead selection
      elem_check = node_check->get_element(  ).
    get single attribute
      elem_check->get_attribute(
        EXPORTING
          name =  `CHECK_ATTRIBUTE`
        IMPORTING
          value = item_check_attribute ).
    if index EQ 2.
    elem_check->set_attribute( name = 'CHECK_ATTRIBUTE' value = Abap_true ).
    endif.
    if index EQ 1.
    elem_check->set_attribute( name = 'CHECK_ATTRIBUTE' value = Abap_false ).
    endif.
    endmethod.
    Point I want make is based on data populated in attribute <b>check_attribute</b>
    .I have identified index of attribute and accordingly performed treatment.
    Hope this will help you .
    If yes give points.
    Cheers!
    Parag

  • Different nodes/ format in DMEE tree

    Hi,
    i have to create a new DMEE format tree.
    the example is:
    DOMESTIC PAYMENTS ***********
    HEADER
    :01:F110000006
    :02:7.00
    :03:3
    :04:INGBBGSF
    :05:OUR ABC Company
    :07:FileName.txt
    :20:B2290306
    :23B:CRED
    :32A:060329BGN5.00
    :50K:/BG93INGB91451050232010
    OUR ABC Company
    Address
    City
    :52D:
    INGB9145
    ING BANK SOFIA
    :57D:
    BFTB7624
    TB BULBANK-PLOWDIV
    :59:/BG13BFTB76241002787514
    TBC-INKOM-OOD
    :70:INVOICE NO 123
    :71A:SHA
    :72:/DTYPE/PORD/RINGS
    :20:/B2290307
    :23B:CRED
    :32A:060329BGN1,00
    :50K:/BG93INGB91451050232010
    OUR ABC Company
    :52D:
    INGB9145
    ING BANK SOFIA
    :57D:
    BFTB7625
    TB Bulbank Zlatni Piasaci
    :59:/BG95BFTB76251001348013
    Microsystem LTD
    Address
    City
    :70:Invoice NO 897
    Invoice NO 898
    :71A:SHA
    :72:/DTYPE/PORD
    :20:/B2290307
    :23B:CRED
    :32A:060329BGN1,00
    :50K:/BG93INGB91451050232010
    OUR ABC Company
    :52D:
    INGB9145
    ING BANK SOFIA
    :57D:
    BFTB7625
    TB Bulbank
    :59:/BG95BFTB76251001348013
    Micro Ltd
    Address
    City
    :70:Invoice NO 897
    Invoice NO 898
    :71A:SHA
    :72:/DTYPE/PORD
    the bank has given the documents also.
    as you can see there are 3 items for one header.
    and some data like :57D:, :59: are different in items.
    so how to create node for them ?
    and  i have to create for FOREIGN PAYMENTS also.
    which is :
    :01:F110000006
    :02:33230.74
    :03:2
    :04:INGBBGSF
    :05:OUR ABC Company
    :07:FileName.txt
    :20:F110000007
    :32A:060403EUR1480.74
    :50:OUR ABC Company
    :52A:/D/BG64INGB91450000000000
    INGBBGSF
    :57D:THEIR BANK
    THEIR BANK 2 LINE
    THEIR BANK ADDRESS
    THEIR BANK CITY
    :59:/BG64INGB91450000000000
    XYZ COMPANY
    Address
    City
    :70:INVOICE NO 123
    :71A:SHA
    you can see :50: and 52A: are not present in earlier DOMESTIC PAYMENTS.
    how the same DMEE file format contains different nodes ?
    please share your thoughts, and if anyone created new DMEE file format, please share how to start create it.
    your answers are highly needed, appreciated.
    Thanks,
    Vidya

    Hi Vidya
    the DMEE file which you are refering to is MT940 format (guess)
    basically dmee file is divided in header, transaction and footer format.
    what you see 20: , 57:, are called as tags.  which are created within nodes. these tags are created across header, transaction and footer information.
    hope this is of some help to you
    regards
    sanjeev

  • How to transfer data between different nodes of the same context.

    Hi experts,
       I am working on an application in ABAP webdynpro in which i want to copy data from one node to another node in the same context of a view and both the nodes are mapped with different nodes of context of component controller. How to code this. Please help.
    Thanks and Regards.
    Vaibhav Tiwari.

    Hi Vaibhav,
    you are in the wrong forum.
    BTW: Copying value of nodes is done automaticcally if you connect the nodes.
    Regards Mario

  • Creating new nodes dynamically in message mapping

    Gurus,
    Source Structure is
    <Phone></Phone>
    <Phone></Phone>
    And I want to create target structure as for this Node1
    <Phones>
    <Phone1>Has value from first Phone Node in source</Phone1>
    <Phone2>Has value from second Phone Node in source</Phone2>
    </Phones>
    The requirement is that I want to create <Phone1><Phone2> .........<PhoneN> nodes dynamically based on the number of <Phone> nodes in Source Structure. The cardinality of  <Phone> node in Source is 0 to Unbound.
    Any suggestion ...?
    Thanking you all in advance.

    Hi Ivan,
    Since you have enter the xslt mapping in Message Interface mapping and both Message Interfaces (target and source) are tied with the message type. And in message type you have fixed schema, do you think it still possible to use xslt mapping to generate some of the target nodes dynamically (the nodes which are not part of MessageType/DataType)....thx?

  • 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);
    }

  • Help:create tree node dynamically from java code...

    hi there...can anyone give me solution how to create or add tree node dynamically from java code???
    currently i am using tree node to handle my menu...i try to create tree and add treenode dynamically from .java page, but it failed...can anyone give solution how to create tree ui from java code, so i can create a dynamic menu...thanz before...

    Hi:
    Just put the statements you would normally put on a sqlplus command line in jdbc statements and execute them?
    http://www-db.stanford.edu/~ullman/fcdb/oracle/or-jdbc.html#0.1_executeUpdate
    MJG

Maybe you are looking for

  • Can anyone shed some light on HotSpot/JNI?

    I posted this to the Hotspot forum, but this place might be better ... Hello, I have just wrapped a C API in JNI. It pumps messages into a callback, which are then forward to the Java side via a env->CallIntMethod(object, method, jlong, jlong). On th

  • Sending Command and Capturing Screen

    Does anybody have/know of a JAVA example to do this: 1. Sending a command to a Netview session to query different machines. I will be reading a list of machines from a text file. The text command will always be the same but the machine will be differ

  • Starting to get Kernel Panics

    Hi everyone, Last month, while working my Mac Pro it kind of “turn off” on me;you could still hear the drive and the fans on as well as the isight camera lighton but the music was cut off and it started to sound like a scratched cd, sothe only thing

  • Preparing for 1Z0-007 exam .. Need Help !!

    I have ORACLE documentation (material) but there is a lot of them here; I have the following files and I don't know which one to use for the 1Z0-007 exam: Introduction to Oracle9i SQL - Volume I.pdf Introduction to Oracle9i SQL - Volume II.pdf Introd

  • Redirecting the servlet output to jsp

    Hi i need to redirect my servlet out put to jsp in result set's every row i have 9 columns this result set how can i redirct to jsp plz can any one let me know with an example thanks a lot in advance