Add a node to JTree== view change without collapse

I added a new node in a NodeTree structure.
And I want to view changes in JTree, without collapse.
What can I do?

You need to add the clustered resource into vmm, and not the individual file servers. Its the clustered resource that moves between nodes of the cluster.

Similar Messages

  • Add node to JTree

    I have an already populated JTree. At Runtime I add one or more node to JTree, using something like
    parentNode.add(newNode)....
    If I call a repaint method, the new node isn't visible, I have to reload model using
    DefaultTreeModel dtm = ((DefaultTreeModel)myTree.getModel());
    TreeNode rootNode = (TreeNode) dtm.getRoot();
    dtm.reload(rootNode);
    Unfortunately this method cause the lost of focus on the currently selected node and the collapse of all JTree around its root node; If I change an existing node (for example changing its text or icon) I must reload the model too!!!
    Does exist an other more "soft" method to change the aspect of a JTree without reload the entire model?

    You must use or implement the
        public void valueForPathChanged(javax.swing.tree.TreePath path,java.lang.Object newNode) {
            Object[]    p = path.getPath();
            Object[]    pp = p;
            //insert node here
            int[] ci = new int[] {index};
            Object[] cc = new Object[] {node};
            fireTreeNodesChanged(this, pp, ci, cc);
            fireTreeStructureChanged(this, pp, ci, cc);
        }from the TreeModel. To fire the last two is essensial.
    I implemented a GP in JAVA so i had the same problem wehn i started.

  • Icon was changed to default icon when editting a node on JTree

    I have a tree with icon on nodes. However, when I edit the node, the icon is changed to default icon.
    I don't known how to write the treeCellEditor to fix that one.
    The following is my code:
    package description.ui;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.ToolTipManager;
    import javax.swing.WindowConstants;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellEditor;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreePath;
    import javax.swing.tree.TreeSelectionModel;
    public class Tree extends javax.swing.JPanel {
         private JTree tree;
         private JScrollPane jScrollPane1;
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              frame.getContentPane().add(new Tree());
              frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              frame.pack();
              frame.show();
         public Tree() {
              super();
              initGUI();
         private void initGUI() {
              try {
                   BorderLayout thisLayout = new BorderLayout();
                   this.setLayout(thisLayout);
                   setPreferredSize(new Dimension(400, 300));
                    jScrollPane1 = new JScrollPane();
                    this.add(jScrollPane1, BorderLayout.CENTER);
                        DefaultMutableTreeNode rootNode = createNode();
                        tree = new JTree(rootNode);
                        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
                        jScrollPane1.setViewportView(tree);
                        ToolTipManager.sharedInstance().registerComponent(tree);
                        MyCellRenderer cellRenderer = new MyCellRenderer();
                        tree.setCellRenderer(cellRenderer);
                        tree.setEditable(true);
                        tree.setCellEditor(new DefaultTreeCellEditor(tree, cellRenderer));
                        //tree.setCellEditor(new MyCellEditor(tree, cellRenderer));
              } catch (Exception e) {
                   e.printStackTrace();
         private void btRemoveActionPerformed(ActionEvent evt) {
             TreePath path = tree.getSelectionPath();
             DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)path.getLastPathComponent();
             ((DefaultTreeModel)tree.getModel()).removeNodeFromParent(selectedNode);
         private DefaultMutableTreeNode createNode() {
             DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Doc");
             DefaultMutableTreeNode ch1 = createChuongNode(rootNode, "Ch1");
             DefaultMutableTreeNode ch2 = createChuongNode(rootNode, "Ch2");
             createTextLeafNode(ch1, "title");
             return rootNode;
         private DefaultMutableTreeNode createChuongNode(DefaultMutableTreeNode parent, String name) {
             DefaultMutableTreeNode node = new DefaultMutableTreeNode(new ChapterNodeData(name));
             parent.add(node);
             return node;
         private DefaultMutableTreeNode createTextLeafNode(DefaultMutableTreeNode parent, String name) {
             DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TitleNodeData(name));
             parent.add(node);
             return node;
          private class MyCellRenderer extends DefaultTreeCellRenderer {
                 ImageIcon titleIcon;
                 ImageIcon chapterIcon;
                 public MyCellRenderer() {
                     titleIcon = new ImageIcon(getClass().getClassLoader()
                            .getResource("description/ui/icons/Text16.gif"));
                     chapterIcon = new ImageIcon(getClass().getClassLoader()
                            .getResource("description/ui/icons/Element16.gif"));
                 public Component getTreeCellRendererComponent(
                                     JTree tree,
                                     Object value,
                                     boolean sel,
                                     boolean expanded,
                                     boolean leaf,
                                     int row,
                                     boolean hasFocus) {
                     super.getTreeCellRendererComponent(
                                     tree, value, sel,
                                     expanded, leaf, row,
                                     hasFocus);
                     if (isChapterNode(value)) {
                         setIcon(chapterIcon);
                         setToolTipText("chapter");
                     } else if (isTextLeafNode(value)) {
                         setIcon(titleIcon);
                         setToolTipText("title");
                     return this;
                 protected boolean isChapterNode(Object node) {
                     return ((DefaultMutableTreeNode)node).getUserObject() instanceof ChapterNodeData;
                 protected boolean isTextLeafNode(Object node) {
                     return ((DefaultMutableTreeNode)node).getUserObject() instanceof TitleNodeData;
          private class MyCellEditor extends DefaultTreeCellEditor {
                 ImageIcon titleIcon;
                 ImageIcon chapterIcon;
              public MyCellEditor(JTree tree, DefaultTreeCellRenderer renderer) {
                  super(tree, renderer);
                  titleIcon = new ImageIcon(getClass().getClassLoader()
                         .getResource("description/ui/icons/Text16.gif"));
                  titleIcon = new ImageIcon(getClass().getClassLoader()
                         .getResource("description/ui/icons/Element16.gif"));
              public Component getTreeCellEditorComponent(
                           JTree tree,
                           Object value,
                           boolean isSelected,
                           boolean expanded,
                           boolean leaf,
                           int row) {
                  super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
                  return this.editingComponent;
          abstract class NodeData{
              String name;
              public NodeData(String name) {
                  this.name = name;
              public String getName() {
                  return name;
              public void setName(String name) {
                  this.name = name;
              public String toString() {
                  return name;
          class ChapterNodeData extends NodeData {
              public ChapterNodeData(String s) {
                  super(s);
          class TitleNodeData extends NodeData {
              public TitleNodeData(String attr) {
                  super(attr);
    }

    Arungeeth wrote:
    I know the name of the node... but i cant able to find that nodeHere is some sample code for searching and selecting a node:
        TreeModel model = jtemp.getModel();
        if (model != null) {
            Object root = model.getRoot();
            search(model, root, "Peter");//search for the name 'Peter'
            System.out.println(jtemp.getSelectionPath().getLastPathComponent());
        } else {
            System.out.println("Tree is empty.");
    private void search(TreeModel model, Object o, String argSearch) {
        int cc;
        cc = model.getChildCount(o);
        for (int i = 0; i < cc; i++) {
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(o, i);
            if (model.isLeaf(child)) {
                TreeNode[] ar = child.getPath();
                String currentValue = Arrays.toString(ar);
                if (currentValue.contains(argSearch)) {
                    jtemp.setSelectionPath(new TreePath(ar));
            } else {
                search(model, child, argSearch);
    }

  • JTree refresh without collapsing my nodes

    Hello,
    I have a JTree using a custom TreeModel. I've also extended the TreeNode.
    What is the most elegant method to refresh the tree or only a node without
    collapsing the currently expanded nodes?
    Please note that there are multiple types of TreeNodes each representing
    a different object to display in the tree and contains an object that represents its
    value. Also the node has a method createChildren() to determine and create
    the child TreeNodes. Children are loaded from a business delegate. I need the
    tree to re-query the model (maybe for only one node) about the data and redisplay
    the changes without affecting the collapsed/expanded state of the nodes that
    are not changed (not supposed to refresh).
    My model actually asks the node for data like getChildsCount(), isLeaf() etc, etc.
    I'd like to say:
    myCustomNodeInstance.refresh();
    or
    myCustomTreeModelInstance.refresh(myCustomNodeInstance);
    and all nodes that are not children of myCustomNodeInstance to preserve
    their state.
    Thanx

    Did you try to call repaint() method on JTree ?

  • How to add nodes to JTree???

    Hi ,
    i'm developing an application using the NetBeans 6.0. I was trying to add the Nodes on the "JMenuItem" Click event.
    I know how to add the customized code to the JTree, but while adding following code to the JMenuItem's Click, does'nt work
    Code :
    private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt)
                       DefaultMutableTreeNode dm =new DefaultMutableTreeNode("Root Element");
                       dm.add(new DefaultMutableTreeNode("Child Node"));
                       Treeview=new javax.swing.JTree(dm);
    }        Please help me out where i should write the code so that it will add the nodes to the JTree on JMenuItem's Click.
    Thanks in Advance
    - Hitesh

    Read the tutorial: [Dynamically Changing a Tree|http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#dynamic]

  • Can we add JComponents as nodes to JTree

    Hi:
    can we add some components to JTree. Say for example Can I show buttons as JTree Nodes?

    You can add anything to a tree or list component. You have to provide your own TreeCellRenderer (extend DefaultTreeCellRenderer and look up some examples on the web), or ListCellRenderer. To allow inline editing of data, you provide a DefaultTreeCellEditor derived implementation. Set these on the tree, and each will handle the rendering and/or editing of nodes. As far as I know, you would only have one renderer, but you can chain them if in your constructor you provide a parameter of TreeCellRenderer, OR you can call upon super.xxx() to use the super class your class extends. Ideally one renderer and one editor is all you need. You just have to write code in the getCellRenderer() and getCellEditor() methods (forget if that is their name off the top of my head..but look att TreeCellRenderer interface and TreeCellEditor interface for the method you must implement).
    When you provide a cell editor, you can actually return a JPanel component, and put all kinds of components in that panel. Set the tree row height size to 0, and when a node goes into edit mode, it calls upon your cell editor to make sure it can be edited (and the tree setEditable(true) must have been called), and you can actually "grow" the node inline to whatever size for the editor. Once editing is done, it goes back to the renderer to draw the node again, so that you may show a normal sized node.

  • How can I add a node with with a user-chosen name  to JTree in one action

    The functionality that I would like to implement is to add a new node to a tree (JTree with DefaultTreeModel), that during the adding process of the the new node the user will type the node name.
    I am using the following documentation as a reference: http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#select
    but in this example (as well as all the other examples that I found on net) the user can add first a new node with a constant name (like "NewNode").
    and then in a seperated action the user can edit this node. I'd like to perfrom it in one action.
    one solution that could be implemented is on the end of the adding node invoking beginning of editing action that will be triggered in code instead of forcing the user to click with the mouse on the selected node. The question is how can I do it? how can I trigger an edit action on a selected node in a JTree?
    Edited by: Rotshield on Aug 23, 2008 2:21 AM
    Edited by: Rotshield on Aug 23, 2008 2:24 AM
    Edited by: Rotshield on Aug 23, 2008 2:29 AM
    Edited by: Rotshield on Aug 23, 2008 2:29 AM

    Ah, well.
    You can lead a horse to the water but you can't make it drink.
    Just to provide some background, I'm not a developer, just a hobby programmer and first took up Java less than 14 months ago. I didn't know the answer to your problem, but on reading the API it was fairly clear which method I'd have to make use of. In less than half an hour of coding, I had a JFrame with a JTree and a JButton to add a node, which was immediately in editing condition.
    Try to find another profession, Rotshield. Or at least don't disgrace the community by calling yourself a Java developer (for 4 years lol) until (if ever) you learn how to read and apply an API.
    db

  • Problem inserting new node into JTree with depthFirstEnumeration()

    Hello,
    I'm currently trying to use depthFirstEnumeration() to add and delete nodes for a simple JTree. I've written a method to handle this, but it keeps coming back with an exception saying that 'new child is an ancestor'.
    All I'm trying to do is add and delete nodes from a JTree using add and remove buttons within a swing program. When a user adds the new node the JTree needs to be updated with new labels in sequential order dependent upon a depthFirst traversal of the JTree.
    My current code for the add button is as follows,
    public void actionPerformed(ActionEvent event) 
            DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
            Enumeration e = rootNode.depthFirstEnumeration();
            if(event.getSource().equals(addButton))
                if (selectedNode != null)
                    while (e.hasMoreElements()) {
                    // add the new node as a child of a selected node at the end
                    DefaultMutableTreeNode newNode = (DefaultMutableTreeNode)e.nextElement();
                     // treeModel.insertNodeInto(newNode, selectedNode, selectedNode.getChildCount());
                    //System.out.print(newNode.getUserObject() + "" + newNodeSuffix++);
                    String label = "Node"+i;
                    treeModel.insertNodeInto(newNode, selectedNode, selectedNode.getChildCount());
                    i++;
                      //make the node visible by scrolling to it
                    TreeNode[] totalNodes = treeModel.getPathToRoot(newNode);
                    TreePath path = new TreePath(totalNodes);
                    tree.scrollPathToVisible(path);
                    //System.out.println();
            else if(event.getSource().equals(deleteButton))
                //remove the selected node, except the parent node
                removeSelectedNode();           
        } As you can see in the above code, I've tested the incrementing of the new nodes in a System.out.print() statement and they appear to be incrementing correctly. I just can't see how to correctly output the labels for the nodes.
    Any help and advice always appreciated.

    This is about the 5th posting on the same question. Here is the link to the last posting so you can see what has already been suggested so you don't waste your time making the same suggestion.
    http://forum.java.sun.com/thread.jspa?threadID=704980
    The OP doesn't seem to understand that nodes don't just rename themselves and that renderers will only display the text of the current node. If you want the text displayed to changed, then you need to change the text associated with each node, which means iterating through the entire tree to update each node with new text. Then again, maybe I don't understand the question, but the OP keeps posting the same question without any additional information.

  • JTree - sorting without collapsing

    i have a JTree which represents data stored in my data layer. if this data changes, i do not only have to update the view part in the tree but also resort it to certain criteria. as far as well, this works fair enough, my problem is, that with every resorting, i remove/add children in the JTree which leads to structure changes. notifying them to the JTree results in the collapsing of all the branches under the event source. how can i prevent that? i'd like to just resort the nodes on one level and leave the collapse/expand of the nodes as it was.
    tnx for the help!

    Thanks for your advice, i tried that but it doesn't seem to work with my code, the effect stays the same. what do i have to change?
    Note:
    snippetComparator cmp = new MyComparator();
    SortedSet sorted = new TreeSet(cmp);
    sorted.addAll(this.children);
    int i = 0;
    for (Iterator it = sorted.iterator(); it.hasNext(); i++) {
    DefaultMutableTreeNode element = (DefaultMutableTreeNode)it.next();
    this.treeModel.removeNodeFromParent(element);
    this.treeModel.insertNodeInto(element, this, i);
    <<snippet
    this is all i do, no manual creation of any TreeEvents.

  • How to add new columns in materialized view

    We are using Oracle 10g Release2.
    We need to add new columns to a prebuilt fast refresh materialized view. We want to add 4 new columns in this table and make them part of select statement in the materialized view. We can drop the view but we cannot do complete refresh after that because the paymentsInfo table has a creation_timestamp column which is populated by before row insert trigger with systimestamp. If we did the complete refresh, all values in this column shall be changed.
    CREATE MATERIALIZED VIEW  paymentsInfo
    ON PREBUILT TABLE
    REFRESH FAST
      ON DEMAND
      START WITH SYSDATE
      NEXT SYSDATE+5/1440
      WITH PRIMARY KEY
    DISABLE QUERY REWRITE AS
    SELECT PAYMENT_ID,BATCH_REFERENCE, TRANSACTION_REFERENCE, NO_OF_TRANSACTIONS, DEBIT_ACC_NUM,... from payment@dblink
    I want to know is there any other way to add new columns without losing any changes from the master table.
    Thanks.

    There is no way to add new Columns to Materialized view. To add new columns, it has to be dropped and re-built again.
    Extract from Oracle Documentaion:
    Use the ALTER MATERIALIZED VIEW statement to modify an existing materialized view in one or more of the following ways:
      To change its storage characteristics
      To change its refresh method, mode, or time
      To alter its structure so that it is a different type of materialized view
      To enable or disable query rewrite
    If you have a problem of Complete refresh, then It may be beneficial to get the backup of the MView; Drop and re-create it with modified definition; Restore the backup data leaving the new columns untouched (assuming they are to be kept as fetched from the Master site).

  • Unable to update nodes in JTree

    Hi all,
    I have a JTree, which I have passed in a DefaultMutableTreeNode in the constructor. I have added 3 elements inside this "root". So the JTree looks like this :
    Root
    ->Element 1
    ->Element 2
    ->Element 3
    However, when I want to actually delete these 3 nodes and add in another 2 nodes, it doesn't work for me, a sample :
    //JTree which is created, using DefaultMutableTreeNode
    DefaultMutableTreeNode node = new DefaultMutableTreeNode("Root");
    //add 3 nodes inside first
    node.add(new DefaultMutableTreeNode("Element 1"));
    node.add(new DefaultMutableTreeNode("Element 2"));
    node.add(new DefaultMutableTreeNode("Element 3"));
    JTree jtree = new JTree(node);
    //get the root (which has 3 elements now)
    DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode)jtree.getModel().getRoot();
    //delete the 3 elements
    rootNode.removeAllChildren();
    //then add in another 2 more nodes
    rootNode.add(new DefaultMutableTreeNode("New Element 1"));
    rootNode.add(new DefaultMutableTreeNode("New Element 2"));
    The jtree created does display the first 3 elements, however when after adding in 2 more new elements, the tree doesnt change.
    Any tips and comments will be greatly appreciated! Thanks.

    Oops, yeah. My mistake was, The tree should have a model, instead of just nodes connecting to nodes... that's why it wasnt able to update... i've should used a model from the start. its the correct way isnt it :) i can continue my project now .. thanks all

  • Trying to add a node in a TreeByNestingTableColumn

    Hello All,
    I'm still having problems doing this!
    I followed the tutorial step by step on how to Integrate a Tree structure in Web Dynpro table.
    I'm using NWDS 7.0.18 on EP 7.0
    The tutorial can be found [here|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/de59f7c2-0401-0010-f08d-8659cef543ce]
    I changed mine around a little bit to use Levels.java instead of Catalog.java.
    I got it working fine. Now the next step I want to do is add a toolbar button that will add a node in the tree structure. So I created the relevant button with an action onActionInsertNode and its signature its the same as the signature for Loading children nodes
    public void onActionInsertNode(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent,
    com.sjm.wdp.wdp.IPrivateTreeAppCompView.ILEVELElement element )
        //@@begin onActionInsertNode(ServerEvent)
        addNewLevel(element.nodeCHILD_LEVEL(), element.getID()); // Null pointer exception here
        //@@end
    I created a new method called addNewLevel to add a single element which is the new node. It looks like this
    public void addNewLevel( com.sjm.wdp.wdp.IPrivateTreeAppCompView.ILEVELNode node,
    java.lang.String parentId )
        //@@begin addNewLevel()
         IPrivateTreeAppCompView.ILEVELElement newLevelElement;
         if(parentId.equals(Levels.getParentId(node.LEAD_SELECTION)))
              newLevelElement = wdContext.nodeLEVEL().createLEVELElement();
              node.addElement(newLevelElement);
        //@@end
    Now when I click the Insert Node button, I want to insert a new node underneath the selected node, ie I want to make it the child of the selected node. node.LEAD_SELECTION. If I look at my code it seems as if I'm following the same logic as the code provided by the tutorial, except the tutorial loops thru the multidimensional array in the Java file and I'm just trying to add a single child node.
    I get a null pointer exception when the onActionInsertNode fires, Ive indicated above where.
    Can someone kindly please explain what I am doing wrong?
    Thanks in advance.
    PS. I forgot to mention that when I created my action onActionInsertNode, I did NOT check the without validation checkbox. I don't actually know what this checkbox does, but in the tutorial is asks you to check this box when you create onActionLoadChildren.

    Hi Armin,
    So using what you have given me so far here is how the getTreeSelection().index() is returning
    context                      getTreeSelection().index()
    -Root                                       -1   
      - child1                                   0
        - gchild1_1                            0
          - leaf1_1                             0
          - leaf1_2                             1
        - gchild1_2                            1
        - gchild1_3                            2
      - child2                                   1
        - gchild2_1                            0
        - gchild2_2                            1
    Here is my code to add a node into the desired position in the tree.
    public void onActionInsertNode(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent,
    com.sjm.wdp.wdp.IPrivateTreeAppCompView.ILEVELElement element )
        //@@begin onActionInsertNode(ServerEvent)
        //addNewLevel(element.nodeCHILD_LEVEL(), element.getID());
        if(wdContext.nodeLEVEL().getLeadSelection() != IWDNode.NO_SELECTION)
             try
              IPrivateTreeAppCompView.ILEVELElement newChildElem =
                                                     wdContext.createLEVELElement();
              wdContext.nodeLEVEL().addElement
                                   (wdContext.nodeLEVEL().getTreeSelection().index(), newChildElem);
         catch(Exception e)
        //@@end
    However, despite specifying where to add the node, the node keeps getting created and added at the root level. Please help out.
    Marshall.

  • XML nodes into multiple views.

    Hello everybody.
    First of all i want to say that i'm a beginner in Flex Mobile.
    I want to make an application that can read an XML file and change views through XML nodes.
    Here is an example of how it should look after reading an XML file.
    Here is the XML example. I want to read all of the nodes but only show a few of them.
    <?xml version="1.0" encoding="utf-8"?>
    <items>
         <item>
              <title>Item 1</title>
              <image>url</image>
              <description>Lorem ipsum</description>
              <subitems>
                   <subitem_title>Item 1.1</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 1.2</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 1.3</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 1.4</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 1.5</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
         </item>
         <item>
              <title>Item 2</title>
              <image>url</image>
              <description>Lorem ipsum</description>
              <subitems>
                   <subitem_title>Item 2.1</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 2.2</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 2.3</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 2.4</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 2.5</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
         </item>
         <item>
              <title>Item 3</title>
              <image>url</image>
              <description>Lorem ipsum</description>
              <subitems>
                   <subitem_title>Item 3.1</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 3.2</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 3.3</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 3.4</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 3.5</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
         </item>
         <item>
              <title>Item 4</title>
              <image>url</image>
              <description>Lorem ipsum</description>
              <subitems>
                   <subitem_title>Item 4.1</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 4.2</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 4.3</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 4.4</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
              <subitems>
                   <subitem_title>Item 4.5</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
                   <subitem_image>url</subitem_image>
              </subitems>
         </item>
    </items>
    All i could find about reading XML in a list and adding a change handler was only for 2 views, i need for 3 views and show subitems for each item. Showing subitems for each item from an XML file was very tricky and didn't worked for me.
    I could use some little help or advice!

    Follow this tutorial to learn how to get data from XML files remotelly!
         http://www.youtube.com/watch?v=Cksp7IyVNk4
    Use the XML from first post on this topic, but, at every <item></item> add an <id> field like this (make sure every item has an unique id):
    <items>
         <item>
              <id>0</id>
              <title>Item 1</title>
              <image>url</image>
              <description>Lorem ipsum</description>
              <subitems>
                   <subitem_title>Item 1.1</subitem_name>
                   <subitem_description>Lorem ipsum</subitem_description>
    Then, create 3 views (New->MXML Component)!
    List.mxml - SubList.mxml - Details.xml
    After you create them go to List.mxml create a list and import you're XML (follow tutorial before, to know how to do this).
    After you import you're XML file and show it in that list, you have to create a change handler for that list (when an item is selected we whant to change view).
    And, of course, follow Duane's tutorial to know how to do that. You will want to change view to SubList.mxml. In this view you'll have a list of childs for primary node (item node).
    Then,go to SubList.xml and create a list.
    Then, the tricky part here is that you need to drag/drop same getData():XML_data() that u used in first list. A popup window will show. Here u have to let "New service call" checked and at "Data provider" u have to select de subitem node of the XML file. And, of course, u'll have to select you're Label field.
    When u done this, go to code viewer and find the <s:AsyncListView.... code line.
    u'll have to add an .[id]. there like this:
    <s:AsyncListView list="{getDataResult2.lastResult[id].subitem}"/>
    In this way, you're list will show only entries from XML file with ITEM ID = ?!
    Then follow Duane's tutorial again.
    PS: in views u'll have to add some [Bindable] vars and a function for that view to recognize the id.
    Here's a model!
    <fx:Script>
            <![CDATA[
                        import valueObjects.XML_FIELD_type;
                        [Bindable] var id:String;
                        private function init():void
                    var thisID:XML_FIELD_type = data as XML_FIELD_type
                    id = thisID.id;
              ]]>
        </fx:Script>
    After u did this u'll have to add a viewActivate to <s:View> declaration like this:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:XML_FILE_OR_FIELD="services.XML_FILE_OR_FIELD.*"
            title="Title"
            viewActivate="init()"
            cachePolicy="on"
            destructionPolicy="never">
    XML_FILE_OR_FIELD is generated automatically.
    All of these things u'll find on Duane's tutorial except the 3 view part and parsing that data. Follow it and u will solve you're problem!
    Hope it helped!
    Cheers,
    Daniel

  • Adding nodes to JTree (algorithm needed)...

    Hi,
    I hope someone can give me a solution or at least a hint on how to solve the following problem:
    I've a JTree with a DefaultMutableTreeNode as the root node. Now I'll have to add nodes dynamically in a specified order. The numbers in brackets are node ids. Here's an example:
    [73691178][73691179]
    [73691178][73691179][73359970]
    [73691178][73691179][73359970][1762]
    [73691178][73691179][73359970][3092]
    [73691178][73691179][73359970][1396]
    [73691178][73691179][73359970][2301]
    [73691178][73691180]
    [73691178][73691180][73359972]
    [73691178][73691180][73359972][1762]
    [73691178][73691180][73359972][3092]
    [73691178][61262304]
    ...The first part specifies the root node (73691178) of my JTree, the next part specifies the node directly below the root node etc. - now I'll have to collect these values and build up my tree accordingly.
            private void buildUpTreeNodes(DefaultMutableTreeNode root) {
              if (root != null) {
                   List childTreeNodes = new NamedQueriesDAOHibernate().fetchChildTreeNodes(_rootNodeId, _mcId);
                   for (Iterator treeNodesIter = childTreeNodes.iterator(); treeNodesIter.hasNext();) {
                        NodeBean bean = (NodeBean) treeNodesIter.next();
                        DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(bean);
                        List nodeIds = SwingUtil.extractNodeIdsFromNpath(bean.getNPathChild());
                        for (Iterator nodeIdsIter = nodeIds.iterator(); nodeIdsIter.hasNext();) {
                             Long nodeId = (Long) nodeIdsIter.next();
                             if (!_rootNodeId.equals(nodeId)) {
                                  // not sure, what to do...
                        root.add(newNode);
    childTreeNodes is a list with beans which contain the path information ([73691178][73691180], see above) among other things. The posting above adds every node to the root node which is not correct (the root node has to be changed according to the path information). Perhaps recursion is the only way to solve the problem but I'm not quite sure...
    Can anyone show some kind of algorithm on how to build up my tree in correct order?
    Thanks a lot and best regards
    - Stephan

    assuming you want to read in the ids from a text file (in the format shown),
    perhaps something like this might do
    import java.awt.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    class Testing
      java.util.Map<String,DefaultMutableTreeNode> nodes = new java.util.HashMap<String,DefaultMutableTreeNode>();
      JTree tree;
      public void buildGUI()
        String rootNode = "73691178";
        nodes.put(rootNode,new DefaultMutableTreeNode(rootNode));
        tree = new JTree(nodes.get(rootNode));
        loadTree();
        tree.expandRow(0);
        JFrame f = new JFrame();
        f.getContentPane().add(new JScrollPane(tree));
        f.setSize(200,200);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public void loadTree()
        try
          BufferedReader br = new BufferedReader(new FileReader("NodeIDs.txt"));
          String line = "";
          while ((line = br.readLine()) != null)
            String[] ids = line.replaceAll("\\[","").split("\\]");
            String newID = ids[ids.length-1];
            String parentID = ids[ids.length-2];
            nodes.put(newID,new DefaultMutableTreeNode(newID));
            nodes.get(parentID).add(nodes.get(newID));
          br.close();
        catch(IOException ioe){ioe.printStackTrace();}
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • Can't view changed data in journal data

    Hi,
    I have implemented JKM Oracle 10g Consistent Logminer on Oracle 10g with the following option.
    - Asynchronous_mode : yes
    - Auto_configuration : yes
    1. Change Data Capture -> Add to CDC, 2.Subscriber->subscribe (sunopsis),
    3. Start Journal
    The journal has been started correctly wothout errors. The journalized table has always the symbol "green clock". All is gook working.
    And then i inserted 1 record in source table, but i can't view changed data in journal data. I can't understand why journal data was generated.
    There are no errors.
    Help me !!!

    Did your designer was on the good context ?
    Look the list box at the top right of the Designer interface.
    You must have the same as the one where you define your journalization.

Maybe you are looking for

  • HP Officejet Pro 8500 - won't go to "sleep" anymore / occasional mechanical noise

    Hi- I have a HP Officejet Pro 8500 all-in-one wired network printer.  Until recently, it used to go into a "sleep" type mode where the screen would go blank and I assume it would entered some sort of power saving mode.  Recently, it has stopped doing

  • Can't View Multiple Pages of a Document in Cover Flow

    According to the various Steve Jobs demonstrations and the accompanying manual, I thought we would be able to see multiple pages of a document in cover flow. The manual on p. 13 states: "Move the pointer over an item to view a movie or see the pages

  • Encrypt query string parameters

    Hi All,  I have a SharePoint designer workflow email. I want to send encrypted link to users within email. Is there any way to send encrypted query string parameters?  Please guide me how to send parameters with url in email so that users cannot see

  • Help ! bypass forms login for .fmx form !

    Hello friends, I need your expert advice on a Forms 6i Login Form issue, I have spent many miserable days now trying to figure it out........ Is there anyway to bypass the forms logon when a user clicks on a custom logon.fmx form that I have created.

  • 2 in one Lists User Interface

    I would like to create a list of items with 2 variables in it. eg. Item Amount - aaa xxx - bbbccc yyy These following two lines are made out of List and the user can select the one of the item from the list to get a detail view on that particular ite