Getting jtree node

hi
pls help in getting the node from jtree
not by using getLastSelectedPathComponent() method.
when i use this method iam getting the node but i want an alternate way of getting the node with out selecting or keeping focus on the node.
thanks in advance

yes the second one is right
i have the problem but unable to explain
so let me put the thing clear
i have a window like this
the main window is divided into two JTabbedPanes
left side one TabbedPane and Rightside OneTabbed pane
both of them are added to one frame.
on the left side JTree will be created 8 nodes are displayed.
and their root is invisible.
each node will have a right click menu when we select a node and right click then a context menu appear.
most of the context menu's will have search and create when we click on search then a popup window appear and selected data will be put into the TabedPanes on the right side for view to the end user.
when we select create in the context menu a blank window will be added to JTabbedPane in the right side so that user can enter some data init.
so the issue is when i enter some data in the right hand side window and say i have clicked on save button then it is throwing an exception as node not found (when used getLastSelecetedPathComponent)
because when i fill data the foucs on the node which was there while right click and select create option from context menu is last .
the same thing works when i manully select the node before i click on save
this is the problem
hope u understood

Similar Messages

  • How to get a Node with Empty Text in a JTree

    Hi,
    I want to get the node which does not have any text and I want to get it when the tree expands NOT when the user selects a node( thats pretty easy)
    Thankx in advance...

    What do you mean by "get"?Since I would like to remove such a node therefoe I would like ot kow if such a node is in my JTree
    Thankx

  • How to get the icon type of a JTree node, very urgent

    hi,
    i need to get the type of a JTree node but don't know how. this is quite an emergency. please help. thank you all.
    -joey

    there are several icons defined in the DefaultTreeCellRenderer class, such as closedIcon, leafIcon, openIcon. i was wondering if there is any way to get the icon type of a node. thanks for your reply.
    -joey

  • How to get the TreePath of a JTree Node

    hello all:
    Given a DefaultMutableTreeNode JTree node, how i can
    get the TreePath for it.
    because I want to use this method to fire the function expandPath(TreePath path)
    thank you very much!
    -Daniel Mark

    thank you I had got idea from forum
    http://forum.java.sun.com/thread.jsp?forum=31&thread=381249
    thx again.
    -Daniel

  • Jtree node refuses to collapse upon clicking handle; makeVisible() was used

    Hello,
    While creating a new node and inserting as a leaf in the JTree, I use tree.makeVisible(newTreePath) to expand the new node and make visible. (Using expandPath() will not expand if a leaf was added).
    However now the jtree node refuses to collapse upon clicking the node handle.
    How do I get it to not insist on staying open - be able to collapse manually?
    thanks,
    Anil

    This is the JNI forum. I don't believe your post fits.
    then
    can I correctly assume that any class that
    "implements Cloneable" will handle making either a
    "shallow" or "deep" ... or even "semi-shallow" clone,
    respective to the class context .. right?
    It probably does something. The implementor might not have implemented anything though. And you have no idea what they implemented.
    No idea about your other question.
    You might want to think carefully about why you are cloning though.

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

  • Parse and display xml doc when click on JTree node?

    Ok so here is the code that I have now. You will have to make alot of html files to run the program, but they can be empty for now. What you can do is just put the same exact html file to be displayed in each node element. for example.
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));could be changed to
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "status.html"));And just keep adding the status.html page to each one of the nodes.
    anyway.
    For now when I click on the node, the html file is displayed in the JScrollPane rPane = new JScrollPane(htmlPane); and the htmlPane is a JEditorPane
    what I need it to do.
    When I click on the JTree node. I would like to go out to an xml file, parse the information in it, and display it to the pane.
    I will need to later, be able to add, edit, or delete information on the xml through the pane later.
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.JTree;
    import javax.swing.JPanel;
    import javax.accessibility.*;
    import javax.swing.UIManager;
    import javax.swing.JComponent;
    import javax.swing.JEditorPane;
    import javax.swing.tree.TreeSelectionModel;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.ImageIcon;
    import java.net.URL;
    import java.io.IOException;
    import java.awt.Dimension;
    * @author orozcom
    public class Example extends JFrame implements TreeSelectionListener
        private JEditorPane htmlPane;
        private URL helpURL;
        private static boolean DEBUG = false;
        private JTree tree;
        public Example()
            super("Example");
            setSize(1200,900);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JMenuBar jmb = new JMenuBar();
            JMenu fileMenu = new JMenu("File");
            JMenuItem openItem = new JMenuItem("Open");
            JMenuItem saveItem = new JMenuItem("Save");
            JMenuItem exitItem = new JMenuItem("Exit");
            exitItem.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    System.exit(0);
            fileMenu.add(openItem);
            fileMenu.add(saveItem);
            fileMenu.add(new JSeparator());
            fileMenu.add(exitItem);
            jmb.add(fileMenu);
            setJMenuBar(jmb);
            //  **************** start JTree ******************//       
            JPanel lPane =new JPanel();       
            lPane.setLayout(new BorderLayout());
            DefaultMutableTreeNode top = new DefaultMutableTreeNode(new ModuleInfo("Devices","splashScreen.html"));
            DefaultMutableTreeNode branch1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 1", "module1.html"));
            DefaultMutableTreeNode branch2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 2", "module2.html"));
            //DefaultMutableTreeNode branch3 =
                    //new DefaultMutableTreeNode(new ModuleInfo("Module 3", "module3.html"));
            //adding to the topmost node
            top.add(branch1);
            top.add(branch2);
            //top.add(branch3);
             *          BRANCH 1           *
            //adding to the First branch
            DefaultMutableTreeNode node1_b1
                    =new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
            //branch1.add(node1_b1);
                DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b1.add(n1_node1_b1);
                node1_b1.add(n2_node1_b1);
                node1_b1.add(n3_node1_b1);
                node1_b1.add(n4_node1_b1);    
            DefaultMutableTreeNode node2_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
            DefaultMutableTreeNode n1_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
            DefaultMutableTreeNode n2_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
            DefaultMutableTreeNode n3_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
            node4_b1.add(n1_node4_b1);
            node4_b1.add(n2_node4_b1);
            node4_b1.add(n3_node4_b1);
            DefaultMutableTreeNode node5_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch1.add(node1_b1);
            branch1.add(node2_b1);
            branch1.add(node3_b1);
            branch1.add(node4_b1);
            branch1.add(node5_b1);
             *          BRANCH 2           *
            //adding to the Second branch
            DefaultMutableTreeNode node1_b2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
                DefaultMutableTreeNode n1_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b2.add(n1_node1_b2);
                node1_b2.add(n2_node1_b2);
                node1_b2.add(n3_node1_b2);
                node1_b2.add(n4_node1_b2);
            DefaultMutableTreeNode node2_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
                DefaultMutableTreeNode n1_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
                node4_b2.add(n1_node4_b2);
                node4_b2.add(n2_node4_b2);
                node4_b2.add(n3_node4_b2);
            DefaultMutableTreeNode node5_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch2.add(node1_b2);
            branch2.add(node2_b2);
            branch2.add(node3_b2);
            branch2.add(node4_b2);
            branch2.add(node5_b2);
             *          BRANCH 3           *
            //adding to the Third branch
            DefaultMutableTreeNode node1_b3=new DefaultMutableTreeNode("Status");
            DefaultMutableTreeNode n1_node1_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node1_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node1_b3=new DefaultMutableTreeNode("Chassis");
            DefaultMutableTreeNode n4_node1_b3=new DefaultMutableTreeNode("Resources");
            node1_b3.add(n1_node1_b3);
            node1_b3.add(n2_node1_b3);
            node1_b3.add(n3_node1_b3);
            node1_b3.add(n4_node1_b3);
            DefaultMutableTreeNode node2_b3=new DefaultMutableTreeNode("Project Editor");
            DefaultMutableTreeNode node3_b3=new DefaultMutableTreeNode("Project Manager");
            DefaultMutableTreeNode node4_b3=new DefaultMutableTreeNode("Administration");
            DefaultMutableTreeNode n1_node4_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node4_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node4_b3=new DefaultMutableTreeNode("Users");
            node4_b3.add(n1_node4_b3);
            node4_b3.add(n2_node4_b3);
            node4_b3.add(n3_node4_b3);
            DefaultMutableTreeNode node5_b3=new DefaultMutableTreeNode("Logging");
            branch3.add(node1_b3);
            branch3.add(node2_b3);
            branch3.add(node3_b3);
            branch3.add(node4_b3);
            branch3.add(node5_b3);
            tree=new JTree(top,true);
            //tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
            //Set the icon for leaf nodes.       
            ImageIcon deviceIcon = createImageIcon("/device.gif");       
            if (deviceIcon != null)
                DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
                renderer.setLeafIcon(deviceIcon);
                tree.setCellRenderer(renderer);
            else
                System.err.println("Leaf icon missing; using default.");
            //Listen for when the selection changes.
            tree.addTreeSelectionListener(this);
            //Create the scroll pane and add the tree to it.
            //JScrollPane treeView = new JScrollPane(tree);
            tree.setToolTipText(" and ");
            lPane.add(tree);
            getContentPane().add(lPane);
            //  ****************  end  JTree  ******************//
            htmlPane = new JEditorPane();
            htmlPane.setEditable(false);       
            initHelp();
            JScrollPane rPane = new JScrollPane(htmlPane);
            JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, lPane, rPane);
            jsp.setDividerLocation(180);
            getContentPane().add(jsp, BorderLayout.CENTER);
            JPanel bPane = new JPanel();
            JButton okButton = new JButton("Ok");
            JButton applyButton = new JButton("Apply");
            JButton clearButton = new JButton("Clear");
            bPane.add(okButton);
            bPane.add(applyButton);
            bPane.add(clearButton);
            getContentPane().add(bPane, BorderLayout.SOUTH);
            setVisible(true);
        /** Required by TreeSelectionListener interface. */
        public void valueChanged(TreeSelectionEvent e)
            DefaultMutableTreeNode node = (DefaultMutableTreeNode)
            tree.getLastSelectedPathComponent();
            if (node == null) return;
            Object nodeInfo = node.getUserObject();
            if (node.isLeaf())
                ModuleInfo module = (ModuleInfo)nodeInfo;
                displayURL(module.moduleURL);
                if (DEBUG)
                    System.out.print(module.moduleURL + ":  \n    ");
            else
                displayURL(helpURL);
            if (DEBUG)
                System.out.println(nodeInfo.toString());
        private class ModuleInfo
            public String deviceName;
            public URL moduleURL;
            public ModuleInfo(String device, String filename)
                deviceName = device;
                moduleURL = (URL)Example.class.getResource("/" + filename);
                if (moduleURL == null)
                    System.err.println("Couldn't find file: "
                            + filename);
            public String toString()
                return deviceName;
        private void initHelp()
            String s = "YFDemoHelp.html";
            helpURL = Example.class.getResource("/" + s);
            if (helpURL == null)
                System.err.println("Couldn't open help file: " + s);
            else if (DEBUG)
                System.out.println("Help URL is " + helpURL);
            displayURL(helpURL);
        private void displayURL(URL url)
            try
                if (url != null)
                    htmlPane.setPage(url);
                else
                { //null url
                    htmlPane.setText("File Not Found");
                    if (DEBUG)
                        System.out.println("Attempted to display a null URL.");
            catch (IOException e)
                System.err.println("Attempted to read a bad URL: " + url);
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path)
            java.net.URL imgURL = Example.class.getResource(path);
            if (imgURL != null)
                return new ImageIcon(imgURL);
            else
                System.err.println("Couldn't find file: " + path);
                return null;
        public static void main(String args[])
            new Example();
            //new AssistiveExample();
    }Thanks orozcom

    yes i can at the time of MIRO u can see both
    go in SU01 for and user
    in Parameters enter IVFIDISPLAY in Parameter ID and X in Paramater Value
    thus for that user u will be able to c Invoice number and accounting number after saving MIRo
    u will get message like
    Invoice document 5105608893 was posted ( Accountng Documnt: 5100000000 )
    hope this helps

  • Ho to set different color to different Jtree Nodes

    hi,
    In a JTree I need to remark with a different color the leaves that bring
    different categories of information.
    I wrote this function to achieve this purpose:
    private void assignRenderToTrees(JTree jTree, String category) {
             // a different color depending from the category
            Color color = null;
            String ssttrr = category.substring(0, 1);
            if (ssttrr.compareTo("*") == 0) {
                color = Color.YELLOW;
             if (ssttrr.compareTo("^") == 0) {
                color = Color.BLUE;
            // the same icon to all nodes
            String pathXopen = "resources_toShowMouth/oneToothGoodMod.gif";
            URL imgURLXopen = MedidentStart.class.getResource(pathXclose);
            ImageIcon iconXopen = new ImageIcon(imgURLXopen);
            if (iconXopen != null) {
                DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
                renderer.setLeafIcon(null);
                renderer.setClosedIcon(iconXclose);
                renderer.setOpenIcon(iconXopen);
                renderer.setBackgroundNonSelectionColor(color);
                jTree.setCellRenderer(renderer);
            } else {
                System.err.println("Leaf icon missing; using default.");
        } // assignIconsToTree()But in this way, I don't get the selection for the leaf, depending for the category.
    Instead I get all the nodes with the same color.
    I can believe that this happen because I am getting the nodes of all the tree,
    instead the single nodes..., but I am not able to select a single node to
    assign the color...
    I would have an help to do it..
    thank you
    regards
    tonyMrsangelo.

    hi,
    thank you for your kind answer.
    You are right..., JTree are a large framework that I don't know very good.
    ..So often I try to arrange a solution witouth to know good the environment where I am working ...
    This is the reason I changed the approch to the problem in the different time when I posted my ask.
    At any rate now I reproduced the problem selecting a part of my program.
    To use tree.setCellRenderer(renderer) is I found in an example that I was not
    able to reproduce.
    I hope to know what is wrong in the code I posted...
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    public class SSCCE_ForPeriodontalCharting extends JFrame {
        PanelArcSupSx panelArcSupSx;//
        public SSCCE_ForPeriodontalCharting() {
            panelArcSupSx = new PanelArcSupSx();
            add(panelArcSupSx);
            setSize(900, 300);
            setVisible(true);
            this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        public static void main(String[] args) {
            SSCCE_ForPeriodontalCharting xxx = new SSCCE_ForPeriodontalCharting();
    } // class SSCCE_ForPeriodontalCharting
    class PanelArcSupSx extends JPanel {
        JScrollPane jScrollPane[];
        JTree jTreeForArcSS[];
        DefaultMutableTreeNode[] rootNodeArcSS;
        Dimension dimPrefSemiArcPanels = new Dimension(850, 140);
        Dimension treePrefDim = new Dimension(100, 110);
        Dimension dimMinSemiArcPanels = new Dimension(650, 90);
        String[] treesContents = {        "* aaaaa - 2",     "* bbbbb - 2",
            "^ ccccc - 2",    "ddddd - 3",     "* eeeee - 2",
            "fffff - 6",    "* ggggg - 6",     "* hhhhh - 5",
            "* iiiii - 5",   "* kkkkkkk - 1",   "^ llllll - 5",
            "^ mmmmmmm - 2",   "nnnnnnn - 4",    "^ oooooo - 4",
            "* pppppppp - 4"};
        public PanelArcSupSx() { // costruttore
            this.setMinimumSize(dimMinSemiArcPanels);
            this.setPreferredSize(dimPrefSemiArcPanels);
            setLayout(new FlowLayout());
            jScrollPane = new JScrollPane[8];
            jTreeForArcSS = new JTree[8];
            rootNodeArcSS = new DefaultMutableTreeNode[8];
            // arc sup Sx
            for (int i = 0; i < 8; i++) {
                rootNodeArcSS[i] = new DefaultMutableTreeNode("    " + i);
                jTreeForArcSS[i] = new JTree(rootNodeArcSS); // create le 8 roots
    // assignIconsToRootInTheTree(jTreeForArcSS[i]);
    jScrollPane[i] = new JScrollPane();
    jScrollPane[i].setViewportView(jTreeForArcSS[i]); // mette il nodo nel Viewport
    add(jScrollPane[i]); // mette il Viewport nel pannello
    jScrollPane[i].setPreferredSize(treePrefDim);
    // attiva gli ascoltatori ....
    jTreeForArcSS[i].addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
    activateDialogXshowTreatments();
    } // for
    fillTrees();
    expandTrees();
    } // costruttore
    private void fillTrees() {
    for (int i = 0; i < treesContents.length; i++) {
    String strNmbr = treesContents[i].substring(treesContents[i].length()-1, treesContents[i].length());
    int nmbr = Integer.parseInt(strNmbr);
    addToothNodeForArcSupSx(nmbr, treesContents[i]);
    private void expandTrees(){
    for (int i = 0; i < 8; i++) {
    jTreeForArcSS[i].expandRow(0);
    * @param toothNmbr
    * @param strTreatment
    private void addToothNodeForArcSupSx(int toothNmbr, String strTreatment) {
    DefaultMutableTreeNode newChild = new DefaultMutableTreeNode(strTreatment); // nuovo treatment da inserire
    DefaultTreeModel model = (DefaultTreeModel) jTreeForArcSS[toothNmbr].getModel();
    DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) model.getRoot();
    model.insertNodeInto(newChild, parentNode, 0); // 0 = assegnamo sempre come primo nodo
    assignColorToLeafInTheTree(model);
    } // assingTreatmentToTooth()
    private void assignColorToLeafInTheTree(DefaultTreeModel model) {
    MyCustomizedRendererForJTree renderer = new MyCustomizedRendererForJTree();
    JTree tree = new JTree(model);
    tree.setCellRenderer(renderer);
    } // assignIconsToLeafInTheTree()
    private void activateDialogXshowTreatments() {
    // do anithing
    private void assignIconsToRootInTheTree(JTree jTree) {
    // do nothing now
    } // assignIconsToTree()
    } // class PanelArcSupSx
    class MyCustomizedRendererForJTree extends DefaultTreeCellRenderer {
    @Override
    public Component getTreeCellRendererComponent(
    JTree tree,
    Object value,
    boolean sel,
    boolean expanded,
    boolean leaf,
    int row,
    boolean hasFocus) { // costruttore
    super.getTreeCellRendererComponent(
    tree, value, sel,
    expanded, leaf, row,
    hasFocus);
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    // String value = (String) val;
    String text = (String) node.getUserObject();
    String prefix = text.substring(0, 1);
    System.out.println("------------------ text = " + text + " prefix = " + prefix);
    // per quanto riguarda il colore ....
    if (prefix.compareTo("*") == 0) {
    setForeground(Color.YELLOW);
    setBackground(Color.YELLOW);
    // System.out.println("colore da usare giallo ");
    } else if (prefix.compareTo("^") == 0) {
    setForeground(Color.BLUE);
    setBackground(Color.BLUE);
    // System.out.println("colore da usare blu ");
    } else {
    setForeground(Color.BLACK);
    setBackground(Color.BLACK);
    // System.out.println("colore da usare bianco ");
    return this;
    } // costruttore

  • Cant get current node from TreeCellEditor isCellEditable().

    I have a custom TreeCellEditor but I do not want to allow the user to edit the root node.
    I was hoping to use isCellEditable() but I can not seem to get the node that is being edited from the EventObject.
    I can get the JTree, (from event.getSource(), but there is no way to get the node that is being tested. I have tried using:
    tree.getEditingPath()
    tree.getLastPathComponent()
    tree.getSelectionPath()But they all return null at the time isCellEditable() is called.
    Does anyone know of a way to get the node that is being tested?
    Thanks,
    Jerome.

    well, that method is meant to be generic such that it decides if editing is possible for the type of event.
    JTable has a separate isCellEditable method, but so does TableModel, so typically, you have a custom table model that implements the method there to return, and in that you know what cell.
    For JTree, I don't know why there's no similar method in the TreeModel interface. There is in JTree, but I really think that should be a function of the model, not the view.
    For JTable, I believe it's only there as a pass-thru, calling the table model's method underneath to get the value.

  • How to get each node in tree?

    how to get each node in tree?
    Message was edited by:
    NikisinProblem

    how to get each node in tree?
    Since (as far as I know) treeNode is an interface, the real question to me is how are you implementing your treeNodes? Are you overriding the toString() method?

  • How to get the Node Value from XmlValue result?

    Hi ,
    I am not able to get the Node Value from the result. In my XQuery im selecting till a Node, if i change my query as
    collection('PhoneBook')/phone_book/contact_person/address/string()", qc);
    im getting the node value, but here the problem is its not a Node so i cannot get the Node name.
    So how can i get the Node Name and Node value together?
    any help please ????
    XML :
    <?xml version="1.0" encoding="UTF-8"?>
    <phone_book>
    <contact_person>
    <name>
    <first_name>Michael</first_name>
    <second_name>Harrison</second_name>
    </name>
    <address city="yyyyy" pincode="600017" state="xxxxx">
    176 Ganesan street, Janakinagar, alwarthirunagar
    </address>
    </contact_person>
    <phone_number type="mobile">9881952233</phone_number>
    <phone_number type="home">044-24861311</phone_number>
    <phone_number type="office">080-12651174</phone_number>
    </phone_book>
    Code:
    XmlQueryContext qc = manager.createQueryContext();
    XmlResults rs = manager.query
    ("collection('PhoneBook')/phone_book/contact_person/address", qc);
    while(rs.hasNext()){
    XmlValue val = rs.next();
    System.out.println(val.getNodeName() + " = [ " + val.getNodeValue() + " ] ");
    Output
    address = [  ]

    You are right, this seemed un-intuitive to me too, but I finally understood how it's done.
    The "value" of a node is actually the total amount of text that is not contained in any of the node's child nodes (if any). So a node with child nodes can still have text value.
    To get the 'value' of an element node, you must therefore concatenate the values of all children of type "XmlValue::TEXT_NODE", of that node. Try it.
    In your example, the <address> node has no child elements, my guess is that BDB XML stores the address string "176 Ganesan street, Janakinagar, alwarthirunagar" inside a child node of <address> node (of type XmlValue::TEXT_NODE) because you wrote the string on a separate line.

  • Error while getting cluster node subtree

    Hi,
      We are on SP15.
    The console logs show the following error
    log generation timestamp : 2006_01_17_at_17_14_05
    java.rmi.RemoteException: Error while getting cluster node subtree of :name=ClusterNodeRepresentative,j2eeType=com.sap.engine.services.adminadapter.impl.ClusterNodeRepresentative,SAP_J2EEClusterNode=2053400,SAP_J2EECluster=""; nested exception is:
         com.sap.engine.services.jmx.exception.MBeanServerClusterException: Exception during invocation of remote MBeanServer method, target node: 2053400
         at com.sap.engine.services.adminadapter.impl.ConvenienceEngineAdministratorImpl.getClusterNodeSubTree(ConvenienceEngineAdministratorImpl.java:242)
         at com.sap.engine.services.adminadapter.impl.ConvenienceEngineAdministratorImplp4_Skel.dispatch(ConvenienceEngineAdministratorImplp4_Skel.java:99)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:304)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:193)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.services.jmx.exception.MBeanServerClusterException: Exception during invocation of remote MBeanServer method, target node: 2053400
         at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:816)
         at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.invoke(MBeanServerInterceptorChain.java:330)
         at com.sap.engine.services.adminadapter.impl.ConvenienceEngineAdministratorImpl.getClusterNodeSubTree(ConvenienceEngineAdministratorImpl.java:239)
         ... 10 more
    Caused by: com.sap.engine.services.jmx.exception.JmxConnectorException: Unable to de-serialize request parameters, message [ JMX request (java) v1.0 len: 345 |  src: cluster target-node: 2053400 req: invoke params-number: 4 params-bytes: 0 | :name=ClusterNodeRepresentative,j2eeType=com.sap.engine.services.adminadapter.impl.ClusterNodeRepresentative,SAP_J2EEClusterNode=2053400,SAP_J2EECluster="" null null null ]
         at com.sap.engine.services.jmx.MBeanServerConnectionImpl.invokeMbsInternal(MBeanServerConnectionImpl.java:680)
         at com.sap.engine.services.jmx.MBeanServerConnectionImpl.invoke(MBeanServerConnectionImpl.java:467)
         at com.sap.engine.services.jmx.MBeanServerConnectionSecurityWrapper.invoke(MBeanServerConnectionSecurityWrapper.java:221)
         at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:813)
         ... 12 more
    Caused by: javax.management.InstanceNotFoundException: MBean with name com.sap.default:name=ClusterNodeRepresentative,j2eeType=com.sap.engine.services.adminadapter.impl.ClusterNodeRepresentative,SAP_J2EEClusterNode=2053400,SAP_J2EECluster=XD1 not found in repository
         at com.sap.pj.jmx.server.MBeanServerImpl.getClassLoaderFor(MBeanServerImpl.java:1408)
         at com.sap.pj.jmx.server.interceptor.MBeanServerWrapperInterceptor.getClassLoaderFor(MBeanServerWrapperInterceptor.java:455)
         at com.sap.engine.services.jmx.CompletionInterceptor.getClassLoaderFor(CompletionInterceptor.java:567)
         at com.sap.pj.jmx.server.interceptor.BasicMBeanServerInterceptor.getClassLoaderFor(BasicMBeanServerInterceptor.java:438)
         at com.sap.jmx.provider.ProviderInterceptor.getClassLoaderFor(ProviderInterceptor.java:330)
         at com.sap.engine.services.jmx.RedirectInterceptor.getClassLoaderFor(RedirectInterceptor.java:501)
         at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.getClassLoaderFor(MBeanServerInterceptorChain.java:443)
         at com.sap.engine.services.jmx.RequestMessage.readParams(RequestMessage.java:523)
         at com.sap.engine.services.jmx.RequestMessage.getParams(RequestMessage.java:578)
         at com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:106)
         at com.sap.engine.services.jmx.JmxServiceConnectorServer.receiveWait(JmxServiceConnectorServer.java:173)
         at com.sap.engine.core.service630.context.cluster.message.MessageListenerWrapper.process(MessageListenerWrapper.java:81)
         at com.sap.engine.core.cluster.impl6.ms.MSListenerThread.run(MSListenerThread.java:47)
         at com.sap.engine.frame.core.thread.Task.run(Task.java:64)
         at com.sap.engine.core.thread.impl6.SingleThread.execute(SingleThread.java:78)
         at com.sap.engine.core.thread.impl6.SingleThread.run(SingleThread.java:148)
    java.lang.NullPointerException
         at com.sap.engine.services.adminadapter.gui.ClusterView.addGlobalDispatcherServiceProperties(ClusterView.java:455)
         at com.sap.engine.services.adminadapter.gui.ClusterView.createGlobalTrees(ClusterView.java:508)
         at com.sap.engine.services.adminadapter.gui.ClusterView.access$1200(ClusterView.java:29)
         at com.sap.engine.services.adminadapter.gui.ClusterView$4.run(ClusterView.java:420)
    java.rmi.RemoteException: Error while getting cluster node subtree of :name=ClusterNodeRepresentative,j2eeType=com.sap.engine.services.adminadapter.impl.ClusterNodeRepresentative,SAP_J2EEClusterNode=2053400,SAP_J2EECluster=""; nested exception is:
         com.sap.engine.services.jmx.exception.MBeanServerClusterException: Exception during invocation of remote MBeanServer method, target node: 2053400
         at com.sap.engine.services.adminadapter.impl.ConvenienceEngineAdministratorImpl.getClusterNodeSubTree(ConvenienceEngineAdministratorImpl.java:242)
         at com.sap.engine.services.adminadapter.impl.ConvenienceEngineAdministratorImplp4_Skel.dispatch(ConvenienceEngineAdministratorImplp4_Skel.java:99)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:304)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:193)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.services.jmx.exception.MBeanServerClusterException: Exception during invocation of remote MBeanServer method, target node: 2053400
         at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:816)
         at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.invoke(MBeanServerInterceptorChain.java:330)
         at com.sap.engine.services.adminadapter.impl.ConvenienceEngineAdministratorImpl.getClusterNodeSubTree(ConvenienceEngineAdministratorImpl.java:239)
         ... 10 more
    Caused by: com.sap.engine.services.jmx.exception.JmxConnectorException: Unable to de-serialize request parameters, message [ JMX request (java) v1.0 len: 345 |  src: cluster target-node: 2053400 req: invoke params-number: 4 params-bytes: 0 | :name=ClusterNodeRepresentative,j2eeType=com.sap.engine.services.adminadapter.impl.ClusterNodeRepresentative,SAP_J2EEClusterNode=2053400,SAP_J2EECluster="" null null null ]
         at com.sap.engine.services.jmx.MBeanServerConnectionImpl.invokeMbsInternal(MBeanServerConnectionImpl.java:680)
         at com.sap.engine.services.jmx.MBeanServerConnectionImpl.invoke(MBeanServerConnectionImpl.java:467)
         at com.sap.engine.services.jmx.MBeanServerConnectionSecurityWrapper.invoke(MBeanServerConnectionSecurityWrapper.java:221)
         at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:813)
         ... 12 more
    Caused by: javax.management.InstanceNotFoundException: MBean with name com.sap.default:name=ClusterNodeRepresentative,j2eeType=com.sap.engine.services.adminadapter.impl.ClusterNodeRepresentative,SAP_J2EEClusterNode=2053400,SAP_J2EECluster=XD1 not found in repository
         at com.sap.pj.jmx.server.MBeanServerImpl.getClassLoaderFor(MBeanServerImpl.java:1408)
         at com.sap.pj.jmx.server.interceptor.MBeanServerWrapperInterceptor.getClassLoaderFor(MBeanServerWrapperInterceptor.java:455)
         at com.sap.engine.services.jmx.CompletionInterceptor.getClassLoaderFor(CompletionInterceptor.java:567)
         at com.sap.pj.jmx.server.interceptor.BasicMBeanServerInterceptor.getClassLoaderFor(BasicMBeanServerInterceptor.java:438)
         at com.sap.jmx.provider.ProviderInterceptor.getClassLoaderFor(ProviderInterceptor.java:330)
         at com.sap.engine.services.jmx.RedirectInterceptor.getClassLoaderFor(RedirectInterceptor.java:501)
         at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.getClassLoaderFor(MBeanServerInterceptorChain.java:443)
         at com.sap.engine.services.jmx.RequestMessage.readParams(RequestMessage.java:523)
         at com.sap.engine.services.jmx.RequestMessage.getParams(RequestMessage.java:578)
         at com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:106)
         at com.sap.engine.services.jmx.JmxServiceConnectorServer.receiveWait(JmxServiceConnectorServer.java:173)
         at com.sap.engine.core.service630.context.cluster.message.MessageListenerWrapper.process(MessageListenerWrapper.java:81)
         at com.sap.engine.core.cluster.impl6.ms.MSListenerThread.run(MSListenerThread.java:47)
         at com.sap.engine.frame.core.thread.Task.run(Task.java:64)
         at com.sap.engine.core.thread.impl6.SingleThread.execute(SingleThread.java:78)
         at com.sap.engine.core.thread.impl6.SingleThread.run(SingleThread.java:148)
    java.lang.NullPointerException
         at com.sap.engine.services.adminadapter.gui.ClusterView.addGlobalDispatcherServiceProperties(ClusterView.java:455)
         at com.sap.engine.services.adminadapter.gui.ClusterView.createGlobalTrees(ClusterView.java:508)
         at com.sap.engine.services.adminadapter.gui.ClusterView.access$1200(ClusterView.java:29)
         at com.sap.engine.services.adminadapter.gui.ClusterView$4.run(ClusterView.java:420)
    Any clue whats it?
    rgds

    Go the same error
    + /usr/java14_64/bin/java -showversion -Duser.language=en -DP4ClassLoad=P4Connection -Dp4Cache=clean -jar go.jar
    java version "1.4.2"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
    Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX 5L for PowerPC (64 bit JVM) build caix64142ifx-20061222 (ifix 113727: SR7 + 112603) (JIT enabled: jitc))
    java.lang.NullPointerException
            at com.sap.engine.services.adminadapter.gui.ClusterView$4.run(ClusterView.java:405)
    Need some help!
    Bernard

  • 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.

  • How to get the node id of the content shown from campaign

    Hi
    Can any one please tell how to get the node id of the content shown by the campaign
    in jsp
    Thanks

    One option is to define a custom ad renderer, which is registered with the proper mime-type.
    The campaign would run your renderer if the campaign retrieved a node with a binary of the proper registered mime-type.
    This allows you to insert yourself into the call chain for the node rendering. You can access the nodeID at that point (and do the typical rendering-- providing a URL for the ShowPropertyServlet)
    -Steve

  • How to get a node selection in a table using Arraylist

    Hi All,
      Can someone help me with the code to get the node selected value from a table and then set that values to input fields?
    Early response would be much appreciated.
    Thanks
    Uday

    Dear Uday,
    Please user the isMultiSelected inside the for loop and iterate through all the rows selected to set in the arraylist.
    Refer to this might help: delete records from table
    if(wdContext.node<Node Name>().size()>0)
                // Iterate through the context Node
                for(int i=0;i<wdContext.node<Node Name>().size();i++)
           if(wdContext.node<Node Name>().isMultiSelected(i))  {
                      // Set the ArrayList here for the Lead Selected elements of the Table multiple selected rows
                            }else {
                                   // Set the ArrayList here for the Lead Selected elements of the Table single selected rows
    Best Regards
    Arun Jaiswal
    Edited by: Arun Jaiswal on Dec 10, 2011 2:04 PM

Maybe you are looking for