JTree node name

hi,
i have a jtree with a specific renderer, this renderer returns a jlabel to represent each node in the tree. The text can be either bold or normal, based on custom properties of the node being rendered. Sometimes, during the execution of the program, these properties change and the jtree is refreshed, it all works fine and the nodes changed become bold as i want, the only problem is that if the text changes size, the full name does not appear. For example when i have a node with this name :
Inbox
When the property changes, and the nome becomes bold, the name changes to :
Inb...
I have tried everything i can but i just can't solve the problem. anyone knows?
best regards
Zede

If you are using a DefaultTreeModel as your model, then when you change the text or the formatting of the node, call the model's nodeChanged(TreeNode) method.

Similar Messages

  • How to set Jtree Nodes' name into TextField??

    Dear Sir:
    I have following code to select any file's name then put into TextField,
    see:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.io.File;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextField;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.TreePath;
    public class JTreeSplitChooseDemo extends JPanel implements ActionListener{
        JFileChooser fc;
        JButton openButton, saveButton;
        JTextField jtf;
      public JTreeSplitChooseDemo() {
        final JTree tree;
        final JTextField jtf;
        JPanel jp= new JPanel();
        setPreferredSize(new Dimension(500,350));
        jp.setPreferredSize(new Dimension(500,300));
        DefaultMutableTreeNode top = new DefaultMutableTreeNode("Options");
        DefaultMutableTreeNode a = new DefaultMutableTreeNode("A");
        top.add(a);
        DefaultMutableTreeNode a1 = new DefaultMutableTreeNode("A1");
        a.add(a1);
        DefaultMutableTreeNode a2 = new DefaultMutableTreeNode("A2");
        a.add(a2);
        DefaultMutableTreeNode b = new DefaultMutableTreeNode("B");
        top.add(b);
        DefaultMutableTreeNode b1 = new DefaultMutableTreeNode("B1");
        b.add(b1);
        DefaultMutableTreeNode b2 = new DefaultMutableTreeNode("B2");
        b.add(b2);
        DefaultMutableTreeNode b3 = new DefaultMutableTreeNode("B3");
        b.add(b3);
        tree = new JTree(top);
        JScrollPane jsp = new JScrollPane(tree);
        jsp.setPreferredSize(new Dimension(500,300));
        tree.setPreferredSize(new Dimension(500,300));
        add(jsp, BorderLayout.CENTER);
        jtf = new JTextField("", 20);
        add(jtf, BorderLayout.SOUTH);
        tree.addMouseListener(new MouseAdapter() {
          public void mouseClicked(MouseEvent me) {
            TreePath tp = tree.getPathForLocation(me.getX(), me.getY());
            if (tp != null)
              jtf.setText(tp.toString());
            else
              jtf.setText("");
      public JPanel JTreeText() {
             JPanel jp= new JPanel();
             JPanel jpanel= new JPanel();
             setPreferredSize(new Dimension(400,350));
             jp.setPreferredSize(new Dimension(400,300));
             JScrollPane jsp = new JScrollPane(jp);
             jsp.setPreferredSize(new Dimension(400,300));
             jpanel.add(jsp, BorderLayout.CENTER);
             jtf = new JTextField("", 20);
             fc = new JFileChooser();
             openButton = new JButton("Open a File...",new ImageIcon("images/hui.gif"));
             openButton.addActionListener(this);
             JPanel buttonPanel = new JPanel(); //use FlowLayout
             buttonPanel.add(openButton);
             //jp.add(buttonPanel, BorderLayout.PAGE_START);
             jp.add(buttonPanel, BorderLayout.NORTH);
             jp.add(jtf, BorderLayout.CENTER);
             return jpanel;
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.getContentPane().add(new JTreeSplitChooseDemo(), new BorderLayout().WEST);
        frame.getContentPane().add(new JTreeSplitChooseDemo().JTreeText(), new BorderLayout().CENTER);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(800, 350);
        frame.setVisible(true);
    @Override
    public void actionPerformed(ActionEvent e) {
         //Handle open button action.
        if (e.getSource() == openButton) {
          int returnVal = fc.showOpenDialog(JTreeSplitChooseDemo.this);
          if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
             jtf.setText(file.getName());
          } else {
             jtf.add("Open command cancelled by user.", null);
    }For example, If i choose file : C:\temp\ftp\TestMyFile.txt
    after I press open button, then choose it, then, the file name TestMyFile.txt will be displayed in the textFiled.
    My problem is that I hope to choose any node in the JTree on the left Panel, then when I choose it, this JNode I selected will be displayed its name in the TextField.
    Not file, I need choose JNode,
    ie, B1 under B node, or A1 under A node, then B1 will be displayed in jtf.
    How to do this one??
    Can Guru throw some light??
    Thanks
    sunny

    Thanks, camickr.
    My fault not to explain detail.
    Actually I mean that I will use a dialog box(very much look like a file choose) that is something like a file chooser then I can browse over JTree first for any node then I can choose or select a node in this JTree, after select this node, its name is populated into text field. My one is I will use a JTree browser (something like that) to get a tree node.
    ie, this showOpenDialog will browse over JTree, not File system.
    I did not want to click on the node then this node name is populated into textField.
    the sample (http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html) shows that when I select a node, then its name was populated to a destination.

  • Xml in JTree: how to not collpase JTree node, when renaming XML Node.

    Hi.
    I'm writing some kind of XML editor. I want to view my XML document in JTree and make user able to edit contents of XML. I made my own TreeModel for JTree, which straight accesses XML DOM, produced by Xerces. Using DOM Events, I made good-looking JTree updates without collapsing JTree on inserting or removing XML nodes.
    But there is a problem. I need to produce to user some method of renaming nodes. As I know, there is no way to rename node in w3c DOM. So I create new one with new name and copy all children and attributes to it. But in this way I got a new object of XML Node instead of renamed one. And I need to initiate rebuilding (treeStructureChanged event) of JTree structure. Renamed node collapses. If I use treeNodesChanged event (no rebuilding, just changes string view of JTree node), then when I try to operate with renamed node again, exception will be throwed.
    Is there some way to rename nodes in my program without collpasing JTree?
    I'am new to Java. Maybe there is a method in Xerces DOM implementation to rename nodes without recreating?
    Thanks in advance.

    I assume that "rename" means to change the element name? Anyway your question seems to be "When I add a node to a JTree, how do I make sure it is expanded?" This is completely concerned with Swing, so it might have been better to post it in the Swing forum, but if it were me I would do this:
    1. Copy the XML document into a JTree.
    2. Allow the user to edit the document. Don't attempt to keep an XML document or DOM synchronized with the contents of the JTree.
    3. On request of the user, copy the JTree back to a new XML document.
    This way you can "rename" things to the user's heart's content without having the problem you described.

  • Jtree node info

    Hi there all,
    I am making a swing application using jtree and i have a problem faced.
    I need some help.
    I create a default node
    final Object bookId=me.getKey();
    inal Object bookName=me.getValue();
    DefaultMutableTreeNode book = new DefaultMutableTreeNode(here??);
    i have a treemap and in this there is an id and a name list.
    what i want to do,
    when i click to a node in a tree i want to get both name and id for this node. but i couldnt.
    How can i put bot name and id in the nodes? Names will be nodes name?
    thanks.

    public class Book {
      Object id;
      Object name;
    new DefaultMutableTreeNode(book);Then write a TreeCellRenderer to display the node-with-book how you want it (or override toString() for the easy way out).

  • Multiline text in a jtree node

    i'm not able to add the multiline text in a jtree node. i've checked the data in both the cases before adding into the tree and after adding into the tree. itz getting the data in the proper format. but while displaying inside the tree itz taking into the single line.
    kindly help me to get the data in a multi line format in the jtree.
    thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.text.*;
    public class DynamicTreeDemo extends JPanel {
    public static String transactionName=null;
    String p1Name=null;
       public static String duration=null;
        public static final String NEWLINE = System.getProperty("line.separator");
    static String[] arrCorrelatorId={"110","122","129","132","130","136","111","109","131","124","127",null};
    static String[] arrParcorrelatorId={"108","110","122","129","122","130","108","108","109","121","121"};
    static String[] arrtransactionName={"FINT3","FINT17","FINT20","FINT52","FINT21","FINT18","FINT4","FINT3"," FINT31","FINT19","FINT51"};
    public static MutableTreeNode node;
    public static DefaultTreeModel model;
    public static TreePath path;
    public static JTree tree;
    static String[] nodeName={"FINT3_108","FINT17_110","FINT20_122","FINT52_129","FINT21_122","FINT18_110","FINT4_108","FINT3_108"," FINT31_109","FINT19_121","FINT51_121",null};
    public DynamicTreeDemo(JFrame frame) {
    final DynamicTree treePanel = new DynamicTree(transactionName);
    populateTree(treePanel);
    JTextField name = new JTextField(20);
    setLayout(new BorderLayout());
    treePanel.setPreferredSize(new Dimension(300, 150));
    add(treePanel, BorderLayout.CENTER);
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(10,50));
    add(panel, BorderLayout.EAST);
    public DefaultMutableTreeNode newObj(String parent){
    DefaultMutableTreeNode pname= new DefaultMutableTreeNode(parent);
    return pname;
    public void populateTree(DynamicTree treePanel)
         String p3;
         DefaultMutableTreeNode p2,nNode, p1;
         int ind=0, i=0,k=0, len=0, m=0;
         boolean flag= false;
         String desc;
         while(nodeName[m]!=null)
         p3 = nodeName[m];
         ind = p3.indexOf("_");
         p3 = p3.substring(0, ind);
           desc=NEWLINE +"hi"+NEWLINE+"how r u";
         if(arrParcorrelatorId[m].equals(arrParcorrelatorId[0]))
                   treePanel.addObject(null, p3,desc);
         else{
              int loopcount=0;
              for(int j=0;nodeName[j]!=null;j++)
                        if(arrParcorrelatorId[m].equals(arrParcorrelatorId[j]))
                             for(int p=0;nodeName[p]!=null;p++)
                                       if(arrCorrelatorId[p].equals(arrParcorrelatorId[j]))
                                            p1=newObj(arrtransactionName[p]);
                                            System.out.println("parent:"+p1);
                                            System.out.println("child:"+p3);
                                            treePanel.addObject(p1, p3,desc);
                                            break;
                        break;
              m++;
    public static void showNodes(String corrId)
         transactionName="FINT3";
    public void DynamicDisplayNode(String corrId){
    JFrame frame = new JFrame("DynamicTreeDemo");
    showNodes(corrId);
    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new GridLayout(1,1));
    contentPane.add(new DynamicTreeDemo(frame));
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args)
    JFrame frame1=null;
    DynamicTreeDemo demo= new DynamicTreeDemo(frame1);
    demo.DynamicDisplayNode("108");
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.util.Enumeration;
    import java.util.StringTokenizer;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.border.Border;
    import javax.swing.border.LineBorder;
    import javax.swing.event.TreeModelEvent;
    import javax.swing.event.TreeModelListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.*;
    public class DynamicTree extends JPanel  {
        protected DefaultMutableTreeNode rootNode;
        protected DefaultTreeModel treeModel;
        protected JTree tree;
        protected DefaultTreeCellRenderer linksRenderer;
        public static final String NEWLINE = System.getProperty("line.separator");
        public DynamicTree(String appName) {
             rootNode = new DefaultMutableTreeNode(appName);
            treeModel = new DefaultTreeModel(rootNode);
            tree = new JTree(treeModel);
            tree.setEditable(false);
            tree.setShowsRootHandles(true);
            tree.setBackground(Color.white);
            tree.setCellRenderer(new DefaultTreeCellRenderer()
                 public Component getTreeCellRendererComponent(JTree pTree,
                     Object pValue, boolean pIsSelected, boolean pIsExpanded,
                     boolean pIsLeaf, int pRow, boolean pHasFocus)
                       DefaultMutableTreeNode node = (DefaultMutableTreeNode)pValue;
                       JLabel lbl = (JLabel)super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,pIsExpanded, pIsLeaf, pRow, pHasFocus);
                      lbl.setBorder(new LineBorder(Color.RED,1));
                 /* Component c =  super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,
                         pIsExpanded, pIsLeaf, pRow, pHasFocus);
                           if (node.isRoot())
                                          c.setForeground(Color.red);
                          else if (node.getChildCount() > 0)
                                    c.setForeground(Color.blue);
                           else if (pIsLeaf)
                                    c.setForeground(Color.black);//new Color(0x736AFF));*/
                           setBackgroundNonSelectionColor(Color.white);
                           JPanel p = new JPanel();
                           p.setBackground(tree.getBackground());
                           Dimension d = lbl.getPreferredSize();
                           p.setPreferredSize(new Dimension(d.width, d.height));
                           p.add(lbl);
                           tree.setRowHeight(30);
                  return (p);
            JScrollPane scrollPane = new JScrollPane(tree);
            setLayout(new GridLayout(1,0));
            add(scrollPane);
        public void addObject(DefaultMutableTreeNode parent,Object child,String desc)
            child=child+desc;
            //System.out.println("child"+child);
                DefaultMutableTreeNode     parent1;
            DefaultMutableTreeNode childNode =
                    new DefaultMutableTreeNode(child);
              if (parent == null)
                          parent = rootNode;
              else
                   String parentName = (String)parent.getUserObject();
                   String tok;
                   Enumeration e=null;
                   e=(Enumeration) rootNode.breadthFirstEnumeration();
                   int breakloop=0;
                   parent = rootNode.getLastLeaf();
                    while (e.hasMoreElements() ) {
                        if(parent!= null)
                             //System.out.println("parent.toString():"+parent.toString());
                             tok=parent.toString();
                             StringTokenizer st = new StringTokenizer(tok);
                             parent1=newObj(st.nextToken());
                             if(parent1.getUserObject().equals(parentName))
                                       breakloop=1;
                                       break;
                             parent= parent.getPreviousNode();
                   if(breakloop==0)
                        parent = rootNode.getLastLeaf();
              System.out.println("parent.toString():"+parent.toString());
              System.out.println("childNode"+childNode.toString());
              parent.add(childNode);
    public DefaultMutableTreeNode newObj(String parent){
          DefaultMutableTreeNode pname= new DefaultMutableTreeNode(parent);
              return pname;
    class MyTreeModelListener implements TreeModelListener {
            public void treeNodesChanged(TreeModelEvent e) {
                DefaultMutableTreeNode node;
                node = (DefaultMutableTreeNode)
                         (e.getTreePath().getLastPathComponent());
                try {
                    int index = e.getChildIndices()[0];
                    node = (DefaultMutableTreeNode)
                           (node.getChildAt(index));
                } catch (NullPointerException exc) {}
            public void treeNodesInserted(TreeModelEvent e) {
            public void treeNodesRemoved(TreeModelEvent e) {
            public void treeStructureChanged(TreeModelEvent e) {
    }

    Here is a simple example.
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javax.swing.tree.DefaultMutableTreeNode;
    public class MultiLineTreeDemo extends JFrame {
         private JTree tree;
         public static void main( String[] args ) throws Exception {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new MultiLineTreeDemo(); }
         public MultiLineTreeDemo() {
              super( "MultiLineTreeDemo" );
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( "<html>This is<p>the root node.</html>" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( "<html>This is<p>a child node.<html>" );
              root.add( node );
              tree = new JTree( root );
              setLayout( new BorderLayout() );
              JScrollPane scrollPane = new JScrollPane( tree );
              add( scrollPane, BorderLayout.CENTER );
              setSize( 200, 200 );
              setVisible( true );
    }

  • Xml: how to get node value when pasing node name as a parameter

    Hi,
    I've got some xml:
    var xmlData:XML =
    <1stNode>
        <buttonID>first child node value</buttonID>
        <imageID>second child node value</imageID>
        <labelID>third child node value</labelID>
    </1stNode>
    Then I want to read specific node value based on a value passed to a function. .
    var buttonID = new Button;
    var imageID = new Image;
    var labelID = new Label;
    getNodeValue(buttonID); //the value here is set dynamically
    private function getNodeValue (nodeName:String):void {
    trace (xmlData.nodeName)                      //doesn't work
    var str:String = "xmlData." + nodeName;
    var xml:XMLList = str as XMLList             //doesn't work
    I'm don't know how to get the value when node name is dynamically changed.

    use:
    getNodeValue(buttonID); //the value here is set dynamically
    private function getNodeValue (nodeName:String):void {
    trace (xmlData[nodeName])                    

  • How to map the node id to the node name in database view just like "V$GES_RESOURCE"

    i have a rac with 3 nodes,and the node id is from 1 to 3,i can check it with command olsnodes.
    $ olsnodes -p -n -i
    tdsdb1  1       tdsdb1-priv     tdsdb1-vip
    tdsdb2  2       tdsdb2-priv     tdsdb2-vip
    tdsdb3  3       tdsdb3-priv     tdsdb3-vip
    and i also can check it in gv$instance
    SQL> select inst_id,instance_number,instance_name from gv$instance;
       INST_ID INSTANCE_NUMBER INSTANCE_NAME
             1               1 jftds1
             3               3 jftds3
             2               2 jftds2
    but when i select the master node of some resource ,it shows some value of node id =0
    SQL> select resource_name,master_node from v$ges_resource;
    RESOURCE_NAME                  MASTER_NODE
    [0xdcc9fa12][0x246658a5],[QQ]            2
    [0x932][0x70c230e],[IV]                  0
    [0xd9fb][0x13181703],[IV]               0
    [0xddae][0x0],[TM]                       0
    [0xb970fb05][0x729b596a],[LB]            2
    [0xb580][0x70c2e1c],[IV]                 0
    [0x31ad56fb][0x7e4c3daa],[QQ]            2
    [0x3][0x797609],[HW]                     0
    [0x2bf04627][0xf28b1575],[QI]            0
    [0x19c89f33][0xd06ef447],[QQ]            0
    [0x529ae82][0x86e25d46],[QQ]             0
    it seems that the master node id is from 0 to 2
    i want to get the node name from the node id from   v$ges_resource,so i check the table cluster_nodes ,cluster_instances,but there are nothing.
    SQL> select * from CLUSTER_NODES;
    no rows selected
    SQL> select * from CLUSTER_INSTANCES ;
    no rows selected
    how can i get the node name from the node id in the tables just like " v$ges_resource"? thank you .

    my cluster ware version is 10.2.0.5
    database version is 10.2.0.5
    and the source of rac is all online
    $ crsctl query crs activeversion
    CRS active version on the cluster is [10.2.0.5.0]
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Productio
    NLSRTL Version 10.2.0.5.0 - Production
    $ crs_stat -t
    Name           Type           Target    State     Host       
    ora.jftds.db   application    ONLINE    ONLINE    tdsdb2     
    ora....tds1.cs application    ONLINE    ONLINE    tdsdb1     
    ora....s1.inst application    ONLINE    ONLINE    tdsdb1     
    ora....ds1.srv application    ONLINE    ONLINE    tdsdb1     
    ora....tds2.cs application    ONLINE    ONLINE    tdsdb2     
    ora....s2.inst application    ONLINE    ONLINE    tdsdb2     
    ora....ds2.srv application    ONLINE    ONLINE    tdsdb1     
    ora....tds3.cs application    ONLINE    ONLINE    tdsdb3     
    ora....s3.inst application    ONLINE    ONLINE    tdsdb3     
    ora....ds3.srv application    ONLINE    ONLINE    tdsdb3     
    ora....SM1.asm application    ONLINE    ONLINE    tdsdb1     
    ora....B1.lsnr application    ONLINE    ONLINE    tdsdb1     
    ora.tdsdb1.gsd application    ONLINE    ONLINE    tdsdb1     
    ora.tdsdb1.ons application    ONLINE    ONLINE    tdsdb1     
    ora.tdsdb1.vip application    ONLINE    ONLINE    tdsdb1     
    ora....SM2.asm application    ONLINE    ONLINE    tdsdb2     
    ora....B2.lsnr application    ONLINE    ONLINE    tdsdb2     
    ora.tdsdb2.gsd application    ONLINE    ONLINE    tdsdb2     
    ora.tdsdb2.ons application    ONLINE    ONLINE    tdsdb2     
    ora.tdsdb2.vip application    ONLINE    ONLINE    tdsdb2     
    ora....SM3.asm application    ONLINE    ONLINE    tdsdb3     
    ora....B3.lsnr application    ONLINE    ONLINE    tdsdb3     
    ora.tdsdb3.gsd application    ONLINE    ONLINE    tdsdb3     
    ora.tdsdb3.ons application    ONLINE    ONLINE    tdsdb3     
    ora.tdsdb3.vip application    ONLINE    ONLINE    tdsdb3    

  • HELP NEEDED!!!displaying xml node name in an input text box

    Hello everybody
    Have a simple proble. I have imported an XML file into flash
    using the Tree component and the XML_conn component. So i have the
    xml tree displying in flash when i have run it.
    I have created an input text box called 'subject'
    All i really need is when a user clicks on any node for that
    node name to be displayed in a the input text box. thats it. ITS
    DRIVING ME CRAZY

    Try something like this. (if your Tree is called myTree)
    var myTreeListener = {}
    myTreeListener.change = function(evtObj) {
    subject.text = evtObj.target.selectedNode.nodeName;
    myTree.addEventListener("change",myTreeListener)

  • Function Module to get the node name in particular level name in Hierarchy

    Hi All,
    We have 0Material hierarchy which consists of 14 levels and materials are in the 14th level.
    We have a requirement to update the 4th level node name to all materials.
    So we have created the attribute to this 0Material and thought of updating in the transformation.
    Could you please suggest us to which function module i can in this scenario.
    Thanks in advance,..
    Prasanna

    Can you explain in more detail what exactly you want to do?
    do you want to limit hierarchy to level4?
    Regards
    Sudeep

  • ABAP MAPPING Querry - How to create Different Target NODE NAME as of Source

    Hi,
    In abap Mapping
    <b>DATA READ FROM SOURCE XML NODE into <u>incode</u></b> ******
    data: incode type ref to if_ixml_node_collection.
    incode = idocument->get_elements_by_tag_name( 'BUSINESS_DAY' ).
    <b>CREATE OUTPUT XML NODE WITH SAME NAME AS <u>'BUSINESS_DAY'</u></b> **
    data: outcode type ref to if_ixml_node.
    outcode = incode->get_item( index = 0 ).
    data irc type i.
    irc = msgtype->append_child( outcode ).
    *<b>BUT TO CREATE OUTPUT XML NODE WITH <u>DIFFERENT NAME AS 'BUSS_DAY'</u></b>*
    data: ws_val type string VALUE 'xyz'.
    data: elementsender type ref to if_ixml_element.
    elementsender = odocument->create_simple_element(
    name = 'BUSS_DAY'
    value = ws_val
    parent = msgtype ).
    <b>Please guide me how I can assign <u>incode</u> value to ws_val.
    So that I can generate <u>OUTPUT XML NODE with different name as of SOURCE XML NODE</u></b>
    i.e. How to create Different Target NODE NAME as of
    Source with same Data
    <Note>: I am using "How to... Use ABAP Mapping in XI 3.0 ver.1.00" and to create different NODE name as of source
    is not given in it.
    Thanks & Regards.

    Hi ABAPers,
    Please Guide Me .....
    <u>This is ABAP Mapping problem in XI.</u>
    <b>How can I read data from incode into ws_val.</b>
    data: <b>ws_val</b> type string
    data: <b>incode</b> type ref to if_ixml_node_collection.
    <b>incode</b> = idocument->get_elements_by_tag_name( 'BUSINESS_DAY' ).
    Best Regards

  • XPATH to determine node name in condition of Interface determination

    Hi,
    does anybody out there know whether one can use a condition such as "name(/p1:Envelop/p1:Body/*)" to retrieve the name of the first element underneath the Body structure which is usually the payload. In the example below.  I'd like to retrieve "ns0:BAPI_USER_GET_DETAIL" or just "BAPI_USER_GET_DETAIL" which I would like to than compare in my "=" condition.
    <?xml version="1.0" encoding="iso-8859-1"?>
    <sap:Envelope xmlns:sap="urn:sap-com:document:sap" version="1.0">
      <sap:Header xmlns:rfcprop="urn:sap-com:document:sap:rfc:properties">
        <saptr:From xmlns:saptr="urn:sap-com:document:sap:transport">BC1</saptr:From>
        <saptr:To xmlns:saptr="urn:sap-com:document:sap:transport">BC2</saptr:To>
      </sap:Header>
      <sap:Body>
         <ns0:BAPI_USER_GET_DETAIL xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
          <CACHE_RESULTS/>
          <USERNAME>bauerd</USERNAME>
         </ns0:BAPI_USER_GET_DETAIL>
      </sap:Body>
    </sap:Envelope>
    I have a client that once to migrate his SAP BC interfaces to PI without having to change the sending application which is a CICS mainframe application. The mainframe application invokes various BAPI's by just passing in a different payload into the above envelope. The payload is always the request structure for the BAPI. The message is send synchronously to SAP BC which than calls the BAPI and returns the response to the caller, again in form of the above envelope and as payload the BAPI response structure.
    To convert this to PI I have to be able to initiate different interface mappings depending on what BAPI is requested. This is pretty straight forward as there are no special mapping transformation taking place in SAP BC for both the BAPI request and response. However I need to determine what interface mapping to call depending on BAPI requested by the CICS application.
    As said the customer does not want to change the sending application. The only part we are allowed to change is the URL which changes from SAP BC to the SAP PI Plain HTTP sender adapter. The post will always use the same outbound message interface. Therefore I can't use SAP PI's standard receiver determination. Using this adapter I will also be able to get access to the whole message envelope as outlined above.
    I already got all of this working nicely with the exception that I can't determine what BAPI is requested and therefore what interface mapping I have to trigger in my interface determination.
    Has anybody used a condition as above and if so how should it look like in the condition editor. The one outlined above does not seem to work. However it is also not failing in PI.
    Also I don't want to change my approach for doing this. However if it is not possible to retrieve the node name using the xpath statement (as outlined above) in the condtion editor than I will have to look for a different approach to resolve this problem. Any suggestions would than be more than welcome.
    Many thanks in advance.
    Dieter

    If the structure is not too big, you can use:
    //ns0:BAPI_USER_GET_DETAIL EX
    otherwise take the full path:
    /p1:Envelop/p1:Body/ns0:BAPI_USER_GET_DETAIL EX
    The namespaces have to be declared.
    Regards
    Stefan

  • PopupMenu on Jtree nodes Please [b]Help me][/b]

    how can I set my JpopupMenu to work on Jtree nodes and not on the tree?

    how can I set my JpopupMenu to work on Jtree nodes
    and not on the tree?Could you elaborate? Are you asking that popup events are ignored if the mouse click is not actually on the rendered area of a node or are you asking something else?

  • Node names of siblings in xslt

    I have following xslt code
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="*">
              <root>
                   <xsl:for-each select="*/*">
                        <xsl:variable name="mainNode" select="name()" />
                        <xsl:if
                             test="starts-with($mainNode,'Add_1') and contains($mainNode,'street1')">
                             <Add>
                                  <xsl:value-of select="." />
    <!-- I want something that goes in here that allows me to select next node name of "mainNode" and its next node-- i.e. Node names of next two siblings of mainNode -->
                             </Add>
                        </xsl:if>
                   </xsl:for-each>
              </root>
         </xsl:template>
    </xsl:stylesheet>As mentioned in the code, I want to find node names of next two siblings of mainNode
    Any suggestions?
    Thanks...

    I tried something like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="*">
              <root>
                   <xsl:for-each select="*/*">
                        <xsl:variable name="nodeName" select="name()" />
                        <xsl:if
                             test="starts-with($nodeName,'Add_1') and contains($nodeName,'street1')">
                             <Add>
                                  <xsl:value-of select="." />
                                  <xsl:value-of select="following-sibling::nodeName[1]" />  <!-- This is what I added-->
                             </Add>
                        </xsl:if>
                   </xsl:for-each>
              </root>
         </xsl:template>
    </xsl:stylesheet>My input XML file is as below:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <root>
         <person>
              <id>1 </id>
              <Add_1_street1>happy street</Add_1_street1>
              <Add_1_street2>A Road</Add_1_street2>
              <Add_1_city>City1</Add_1_city>
         </person>
         <person>
              <id>2</id>
              <Add_1_street1>sad street</Add_1_street1>
              <Add_1_street2>B Road</Add_1_street2>
              <Add_1_city>City2</Add_1_city>
              <Add_2_street1>Bore street</Add_2_street1>
              <Add_2_street2>C Road</Add_2_street2>
              <Add_2_city>City1</Add_2_city>
         </person>
    </root>It does not give me any compiler issue but it does not print the value of next sibling. Can't figure out why. Any pointers?
    Thanks!

  • How to Display Detailed navigation passing Top level navigation node name

    Hi All,
    I have prepared a DLN par file but unfortunatly my requirement is such that I need to pass one of the toplevel node name as input parameter and that should display the corresponding DLN which is from 3rd level.
    I have checked in sdn for passing a value to the navigation tag lib which will consider it as a selectednode but could find none.
    Can some body suggest me how to acheive this.
    Thanks in Advance.
    Sai Krishna. K

    Hi Kiran,
    Thanks for your Reply..
    Following is my Scenario:
    I use 2 same versions of portals connected via federated portal concept.
    I have my detailed navigation par file in portal2 and was calling it from portal1 from a iview.
    Since I am not physically navigating in portal2(which mean there is no selected node to iterate ), when I call that iview in portal1 it is picking up only 1st node in top level navigation.
    So i need to pass "My reports" (as 1st level) & "India" (as 2nd level) as parameters such that it gets only its DTN at all times from 3rd level.
    Hope you understand my scenario, below is my iteration code logic.
    <div id="myslidemenu" class="jqueryslidemenu">
    <ul>
         <nav:iterateSelectedNavNodesLevel level="<%=START_LEVEL%>">
         <%-- the 'currentDepth' attribute provides the byte value of the current level --%>
        <nav:recurseNavNodeChildren currentDepth="depth">
             <% current = start + depth.intValue() - 1; %>
             <%=writeClosingTags(last - current)%>
             <%
            last = current;
            %>
            <%-- we want to distinguish between folder and leaf nodes so we can use different graphics --%>
              <%-- complete the html syntax for the 'class' attribute pass it as an anchor attribute--%>
              <li><nav:navNodeAnchor navigationMethod="byURL" />
              <%-- checks for additional navigation level and the appropriate html tags to accomodate them --%>
            <nav:ifNextRecursionDepthWillIncrease>
                <ul>
            </nav:ifNextRecursionDepthWillIncrease>
            <nav:ifNextRecursionDepthWillNotChange>
                </li>
            </nav:ifNextRecursionDepthWillNotChange>
        </nav:recurseNavNodeChildren>
        <%=writeClosingTags(last - start)%>
        <% last = start; %>
    </nav:iterateSelectedNavNodesLevel>
    </ul>
    </div>
    As per the passing parameter concept please explain me a bit more clear with step by step procedure.
    <b>Here if not passing parameters, providing static values will also do for my requirement.</b>
    Many Thanks,
    Sai Krishna.
    Edited by: Konchada Sai Krishna on Feb 14, 2009 9:42 PM

  • How do I pull XML data by a node name?

    I am new to Flash and XML so I hope I am not asking a
    completely dumb question. I have figured out how to retrieve data
    from and XML file by the node possition but now I would like to
    know how to pull it by a specific node name. Here is what I
    currently have:
    on (rollOver)
    myLot = 1;
    _root.myInfo =
    _root.myXML.childNodes[0].childNodes[this.myLot].childNodes[0].childNodes[0].nodeValue;
    With XML file like this:
    <SectionOne>
    <Lot1>
    <Lot>1</Lot>
    <Price>$450,000</Price>
    <Status>Active</Status>
    </Lot1>
    <Lot4>
    <Lot>4</Lot>
    <Price>$389,000</Price>
    <Status>Sold</Status>
    </Lot2>
    </SectionOne>
    What I would like is to pull instead of
    childNodes[this.myLot] to pull the node named Lot1. The problem I
    have is I don't always have consecutive lot numbers and I don't
    want to have to build in blank xml lines for a placeholder. I hope
    that makes sense.

    Sorry for the delay. I originally posted this on the
    newsgroup, but I suppose it did not propagate to here.
    What you would do is use a loop statement and compare the
    nodeNames.
    To see a nodes name such as Lot1 you use:
    childNodes[x].nodeName
    // Load up the lotNodes object
    lotNodes = _root.myXML.childNodes[0];
    // Now lotNodes contains all the nodes Lot0, Lot1, Lot2.....
    // Iterate through all of lotNodes childNodes and compare the
    // nodeName until you find the one you want then drill down
    // it to get the info you want.
    for( var counter01 = 0;counter01 <
    lotNodes.childNodes.length;counter01++){
    if(lotNodes.childNodes[counter01].nodeName == "Lot1"){
    myInfo =
    lotNodes.childNodes[counter01].childNodes[0].childNodes[0].nodeValue;
    I have not had time to test this but it should work, I'll
    double check it after work.
    I hope this helps get you moving forward.
    If you have any other problems or can't get it to work, let
    me know here or email me. Preferably here, so others can learn and
    help.
    Scotty
    [email protected]

Maybe you are looking for

  • Pavilion 500-056

    I bought this computer a few weeks ago and it had Windows 8 on it. I am leagally blind so I have to have a special program to zoom in on the screen so I can read it. The program wasnt working with Windows 8 and it will be a while before an update wit

  • ITunes has stopped updating this podcast because you have not listened . .

    I found an archived article from two years ago: http://discussions.apple.com/message.jspa?messageID=8453115 and have found subsequent articles talking about outboard solutions that I have tried and do not work. The problem continues to this day. Why

  • Shipping condition in vendor evaluation

    how shipping conditions are taken in vendor evaluation.

  • Calling function at onFocus statement

    may i ask that the below code is correct or not? <jsp:useBean id = "pc" class="common.claim" scope="request" /> <td id=progPect><input type="text" size=5 id="progPect" value='<%=progPect.elementAt(c)%>' onFocus="<%=pc.chkBreakdown(wp.elementAt(c),ln.

  • Transaction Data Tab

    Dear All, When user creates ticket all the user status displayed in ticket under Transaction data tab-->Action Tab. But in my case for some user all the configured statuses are not getting displayed. What could be the reason? User has got enough auth