Click on the searched  hierachical tree node

Hi,
when i search the hierarchical tree for a string then all the matching nodes come selected.Then when i click on any of the search result nodes it does not work and otherwise i have to click on a non selected node and then click on the desired node .
For example i have created a tree for material used for manufacturing purpose.i want to display the related suppliers names in an adjacent grid by clicking on the node in the tree. how can i do that directly after getting the search node.??

Bibekananda wrote:
Hi,
when i search the hierarchical tree for a string then all the matching nodes come selected.Then when i click on any of the search result nodes it does not work and otherwise i have to click on a non selected node and then click on the desired node .
For example i have created a tree for material used for manufacturing purpose.i want to display the related suppliers names in an adjacent grid by clicking on the node in the tree. how can i do that directly after getting the search node.??hi
i hope i get you
i think you have a form contain a block for tree and another block build on a database table and you want to execute query on the block when you select a node
and you have a search item to seach for a node and want to go to the block record when you clock on search without go to the node and select
try this in search button or when-validate-item of the search key
-- create a pkg specifiaction called tree_pkg and define the follwing variable
--node ftree.node;
PROCEDURE select_node IS
     node ftree.node;
     htree item;
     node_label varchar2(3000);
node_val varchar2(3000);
     state varchar2(3000);
begin
     htree := find_item('BLOCK.TREE_ITEM');
     node := Ftree.Find_Tree_Node(htree, '');
ftree.set_tree_selection(htree,node,ftree.select_on) ;
WHILE NOT Ftree.ID_NULL(node) LOOP
     state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
node_label := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_label);
node_val := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_value);
if upper(node_label) like <your search item> then
ftree.set_tree_selection(htree,node,ftree.select_on) ;
tree_pkg.node := node;
exit;
end if;
node := Ftree.Find_Tree_Node(htree, '', ftree.find_NEXT,Ftree.NODE_LABEL,'', node);
END LOOP;
---- now you have the node number that result from search
node_val := Ftree.Get_Tree_Node_Property(htree, tree_pkg.node, Ftree.NODE_value);
-- then use this value in execute query on the supplier block
END;
try and respond

Similar Messages

  • How to I stop safari from automatically resizing the bookmark bar when I click on the search bar?

    there is probably an eloquent way to ask this but I don't even know what the feature is called.
    Here is what it's doing:
    I'm using safari in landscape mode on my iPad.
    I click on the search bar and then the bookmarks come up below.
    It takes a second to automatically resize to a size that make no sense, usually cutting off bookmark titles...and the delay of it resizes drives me nuts.
    Safari did not used to do this until I guess ios 8. Any ideas how to stop this annoying "feature"??

    Try deleting the Cache.db...
    Quit Safari.
    Go to ~/Library/Caches/com.apple.Safari/Cache.db
    Move the Cache.db file from the com.apple.Safari folder to the Trash.
    Relaunch Safari ...
    You may want to try the Safari Reading List as an alternative to tabs.
    Click the eyeglass icon just to the left of the Bookmarks icon top left side of the Safari window.
    Drag the url to the window or click Add Page

  • Cannot click in the Search field

    I cannot click in the Search field and perform a search in the Store.

    File -> New -> New Smart Album is the way to do that.
    Regards
    TD

  • I keep geting re-directed to a wrong site after I click on the search result site. How can I prevent that?

    I keep geting re-directed to a wrong site after I click on the search result site. How can I prevent that?

    iPad or Mac?

  • AutoScroll Tree View while searching a Tree Node

    HI all,
    I have two Tabs Tab1 contains JTree (with JScrollPane) , Tab 2 contains some data (which are available in tree node name in Tab 1) which is to be searched in tree in Tab1 & highlight node in red Color & its sub-nodes are in expanded state .
    I Click some Button on my Tab2 & i search the node & Display Tab1 with selected Node
    I have completed the above said functionality but, the node to be searched is far below (i.e. visible only if scrolled)
    I need to Scroll it manually so see the highlighted Node , i want the scroller should be automatically adjusted!!
    when i click Search button in Tab 2
    Similar to functionality in JTree like - if you resize the window very small and keep the node (not in view) & try to type the node name JTree adjust the scroller & display the node.

    Yes. rite i just found answer aftre posting the question
    tree.scrollPathToVisible(path);

  • Useful Code of the Day:  Hideable Tree Nodes

    Someone posted about how they could selectively hide tree nodes, and I already had this AbstractTreeModel class (which does some things DefaultTreeModel does and some it doesn't) and a concrete subclass for TreeNode objects, so I was thinking how one could do hideable nodes. So I came up with this solution.
    There's 4 classes here:
    - AbstractTreeModel is the base for the concrete TreeNodeTreeModel
    - TreeNodeTreeModel extends AbstractTreeModel to support TreeNodes (DefautlMutableTreeNode, etc.)
    - HideableMutableTreeNode which is a DefautlMutableTreeNode subclass which has a visible field (with is/set methods, of course).
    - HideableTreeModel is the hideable model which is a subclass of TreeNodeTreeModel.
    A HideableMutableTreeNode can be set invisible directly, but the tree still needs to be notified to update. So it's best to use the methods in HideableTreeModel which set a node's visibility which notify the tree of changes accordingly. Methods are also provided to check a full path's visibility or ensure a node including all parent nodes are visible.
    A HideableTreeModel can take any TreeNode class, it doesn't have to be all HideableMutableTreeNodes, but only HideableMutableTreeNodes can be made invisible, of course. Any other TreeNode type would just be considered visible.
    Hiding nodes works basically by making the tree think there's less nodes then there are. And to do this, the node counts and child index search just works by looping thru the parent's children. This has potential perfomance drawbacks of course, since one has to loop thru the node's children to get nodes every time. This could be alleviated by not supporting non-hideable nodes changing the internal maintenance of HideableMutableTreeNode contents. But I'll leave that to whoever really needs it. It shouldn't be a problem if there are are a relatively small set of child nodes in any given parent.
    Also, note that the root node in the model cannot be made invisible, cuz it'd be redundant since JTree can be set to hide the root node.
    // *** HideableTreeModel ***
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    * <code>HideableTreeModel</code> is an <code>TreeNodeTreeModel</code>
    * implementation for <code>HideableMutableTreeNode</code> objects.  The
    * model can also take any other <code>javax.swing.tree.TreeNode</code>
    * objects. 
    public class HideableTreeModel extends TreeNodeTreeModel {
          * Creates a new <code>HideableTreeModel</code> object.
          * @param  root  the root node
         public HideableTreeModel(TreeNode root) {
              super(root);
          * Checks if the specified node is visible.  A node can only be
          * hidden if the node is an instance of <code>HideableMutableTreeNode</code>.  <br />
          * <br />
          * Note that this only test the visibility of the specified node, not
          * whether a parent node is visible.  Use <code>isPathToNodeVisible(Object)</code>
          * to check if the full path is visible. 
          * @param  node  the node
          * @param  true if the node is visible, else false
         public boolean isNodeVisible(Object node) {
              if(node != getRoot()) {
                   if(node instanceof HideableMutableTreeNode) {
                        return ((HideableMutableTreeNode)node).isVisible();
              return true;
          * Sets the specified node to be hidden.  A node can only be made hidden
          * if the node is an instance of <code>HideableMutableTreeNode</code>.  <br />
          * <br />
          * Note that this method will notify the tree to reflect any changes to
          * node visibility.  <br />
          * <br />
          * Note that this will not alter the visibility of any nodes in the
          * specified node's path to the root node.  Use
          * <code>ensurePathToNodeVisible(Object)</code> instead to make sure the
          * full path down to that node is visible.  <br />
          * <br />
          * Note that this method will notify the tree to reflect any changes to
          * node visibility. 
          * @param  node  the node
          * @param  v     true for visible, false for hidden
          * @param  true if the node's visibility could actually change, else false
         public boolean setNodeVisible(Object node, boolean v) {
              // can't hide root
              if(node != getRoot()) {
                   if(node instanceof HideableMutableTreeNode) {
                        HideableMutableTreeNode n = (HideableMutableTreeNode)node;
                        // don't fix what ain't broke...
                        if(v != n.isVisible()) {
                             TreeNode parent = n.getParent();
                             if(v) {
                                  // need to get index after showing...
                                  n.setVisible(v);
                                  int index = getIndexOfChild(parent, n);
                                  super.nodeInserted(parent, n, index);
                             } else {
                                  // need to get index before hiding...
                                  int index = getIndexOfChild(parent, n);
                                  n.setVisible(v);
                                  super.nodeRemoved(parent, n, index);
                        return true;
              return false;
          * Checks if the specified node is visible and all nodes above it are
          * visible. 
          * @param  node  the node
          * @param  true if the path is visible, else false
         public boolean isPathToNodeVisible(Object node) {
              Object[] path = getPathToRoot(node);
              for(int i = 0; i < path.length; i++) {
                   if(!isNodeVisible(path)) {
                        return false;
              return true;
         * Sets the specified node and all nodes above it to be visible.
         * Note that this method will notify the tree to reflect any changes to
         * node visibility.
         * @param node the node
         public void ensurePathToNodeVisible(Object node) {
              Object[] path = getPathToRoot(node);
              for(int i = 0; i < path.length; i++) {
                   setNodeVisible(path[i], true);
         * Returns the child of parent at index index in the parent's child array.
         * @param parent the parent node
         * @param index the index
         * @return the child or null if no children
         public Object getChild(Object parent, int index) {
              if(parent instanceof TreeNode) {
                   TreeNode p = (TreeNode)parent;
                   for(int i = 0, j = -1; i < p.getChildCount(); i++) {
                        TreeNode pc = (TreeNode)p.getChildAt(i);
                        if(isNodeVisible(pc)) {
                             j++;
                        if(j == index) {
                             return pc;
              return null;
         * Returns the number of children of parent.
         * @param parent the parent node
         * @return the child count
         public int getChildCount(Object parent) {
              int count = 0;
              if(parent instanceof TreeNode) {
                   TreeNode p = (TreeNode)parent;
                   for(int i = 0; i < p.getChildCount(); i++) {
                        TreeNode pc = (TreeNode)p.getChildAt(i);
                        if(isNodeVisible(pc)) {
                             count++;
              return count;
         * Returns the index of child in parent.
         * @param parent the parent node
         * @param child the child node
         * @return the index of the child node in the parent
         public int getIndexOfChild(Object parent, Object child) {
              int index = -1;
              if(parent instanceof TreeNode && child instanceof TreeNode) {
                   TreeNode p = (TreeNode)parent;
                   TreeNode c = (TreeNode)child;
                   if(isNodeVisible(c)) {
                        index = 0;
                        for(int i = 0; i < p.getChildCount(); i++) {
                             TreeNode pc = (TreeNode)p.getChildAt(i);
                             if(pc.equals(c)) {
                                  return index;
                             if(isNodeVisible(pc)) {
                                  index++;
              return index;
         * Main method for testing.
         * @param args the command-line arguments
         public static void main(String[] args) {
              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              HideableMutableTreeNode root = new HideableMutableTreeNode("root");
              root.add(new HideableMutableTreeNode("child_1"));
              final HideableMutableTreeNode c2 = new HideableMutableTreeNode("child_2");
              c2.setVisible(false);
              final HideableMutableTreeNode c2a = new HideableMutableTreeNode("child_2_A");
              c2.add(c2a);
              c2.add(new HideableMutableTreeNode("child_2_B"));
              root.add(c2);
              HideableMutableTreeNode c3 = new HideableMutableTreeNode("child_3");
              HideableMutableTreeNode cC = new HideableMutableTreeNode("child_3_C");
              cC.setVisible(false);
              c3.add(cC);
              c3.add(new HideableMutableTreeNode("child_3_D"));
              root.add(c3);
              root.add(new HideableMutableTreeNode("child_4"));
              root.add(new HideableMutableTreeNode("child_5"));
              DefaultMutableTreeNode c6 = new DefaultMutableTreeNode("child_6");
              c6.add(new DefaultMutableTreeNode("child_6_A"));
              c6.add(new DefaultMutableTreeNode("child_6_B"));
              root.add(c6);
              final HideableTreeModel model = new HideableTreeModel(root);
              JTree tree = new JTree(model);
              f.getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
              JButton b = new JButton("toggle");
              b.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        model.setNodeVisible(c2, !model.isNodeVisible(c2));
                        //model.ensurePathToNodeVisible(c2a);
              f.getContentPane().add(b, BorderLayout.SOUTH);
              f.pack();
              f.setSize(300, 500);
              f.show();
    // *** HideableMutableTreeNode ***
    import javax.swing.*;
    import javax.swing.tree.*;
    * <code>HideableMutableTreeNode</code> is a <code>DefaultMutableTreeNode</code>
    * implementation that works with <code>HideableTreeModel</code>.
    public class HideableMutableTreeNode extends DefaultMutableTreeNode {
         * The node is visible flag.
         public boolean visible = true;
         * Creates a tree node that has no parent and no children, but which
         * allows children.
         public HideableMutableTreeNode() {
              super();
         * Creates a tree node with no parent, no children, but which allows
         * children, and initializes it with the specified user object.
         * @param userObject - an Object provided by the user that
         * constitutes the node's data
         public HideableMutableTreeNode(Object userObject) {
              super(userObject);
         * Creates a tree node with no parent, no children, initialized with the
         * specified user object, and that allows children only if specified.
         * @param userObject - an Object provided by the user that
         * constitutes the node's data
         * @param allowsChildren - if true, the node is allowed to have child
         * nodes -- otherwise, it is always a leaf node
         public HideableMutableTreeNode(Object userObject, boolean allowsChildren) {
              super(userObject, allowsChildren);
         * Checks if the node is visible.
         * @return true if the node is visible, else false
         public boolean isVisible() {
              return this.visible;
         * Sets if the node is visible.
         * @param v true if the node is visible, else false
         public void setVisible(boolean v) {
              this.visible = v;
    // *** TreeNodeTreeModel ***
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    * <code>TreeNodeTreeModel</code> is an <code>AbstractTreeModel</code>
    * implementation for <code>javax.swing.tree.TreeNode</code> objects.
    public class TreeNodeTreeModel extends AbstractTreeModel {
         * Creates a new <code>TreeNodeTreeModel</code> object.
         * @param root the root node
         public TreeNodeTreeModel(TreeNode root) {
              super();
              setRoot(root);
         * Returns the parent of the child node.
         * @param node the child node
         * @return the parent or null if root
         public Object getParent(Object node) {
              if(node != getRoot() && (node instanceof TreeNode)) {
                   return ((TreeNode)node).getParent();
              return null;
         * Returns the child of parent at index index in the parent's child array.
         * @param parent the parent node
         * @param index the index
         * @return the child or null if no children
         public Object getChild(Object parent, int index) {
              if(parent instanceof TreeNode) {
                   return ((TreeNode)parent).getChildAt(index);
              return null;
         * Returns the number of children of parent.
         * @param parent the parent node
         * @return the child count
         public int getChildCount(Object parent) {
              if(parent instanceof TreeNode) {
                   return ((TreeNode)parent).getChildCount();
              return 0;
         * Returns the index of child in parent.
         * @param parent the parent node
         * @param child the child node
         * @return the index of the child node in the parent
         public int getIndexOfChild(Object parent, Object child) {
              if(parent instanceof TreeNode && child instanceof TreeNode) {
                   return ((TreeNode)parent).getIndex((TreeNode)child);
              return -1;
         * Returns true if node is a leaf.
         * @param node the node
         * @return true if the node is a leaf
         public boolean isLeaf(Object node) {
              if(node instanceof TreeNode) {
                   return ((TreeNode)node).isLeaf();
              return true;
         * Main method for testing.
         * @param args the command-line arguments
         public static void main(String[] args) {
              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
              root.add(new DefaultMutableTreeNode("child_1"));
              DefaultMutableTreeNode c2 = new DefaultMutableTreeNode("child_2");
              c2.add(new DefaultMutableTreeNode("child_2_A"));
              c2.add(new DefaultMutableTreeNode("child_2_B"));
              root.add(c2);
              root.add(new DefaultMutableTreeNode("child_3"));
              root.add(new DefaultMutableTreeNode("child_4"));
              JTree tree = new JTree(new TreeNodeTreeModel(root));
              f.getContentPane().add(new JScrollPane(tree));
              f.pack();
              f.setSize(300, 500);
              f.show();
    // *** AbstractTreeModel ***
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    public abstract class AbstractTreeModel implements TreeModel {
         * The list of tree model listeners.
         private Vector modelListeners = new Vector();
         * The root object of the tree.
         private Object root = null;
         * Basic no-op constructor.
         public AbstractTreeModel() {
         * Gets the root object of the tree.
         * @return the root object
         public Object getRoot() {
              return this.root;
         * Sets the root object of the tree.
         * @param r the root object
         protected void setRoot(Object r) {
              this.root = r;
         * Gets the path to the root node for the specified object.
         * @param node the root node
         * @return the path to the object or <CODE>null</CODE>
         public Object[] getPathToRoot(Object node) {
              return getPathToRoot(node, 0);
         * Gets the path to the root node for the specified object.
         * @param node the root node
         * @param i the current index
         * @return the path to the object or <CODE>null</CODE>
         private Object[] getPathToRoot(Object node, int i) {
              Object anode[];
              if(node == null) {
                   if(i == 0) {
                        return null;
                   anode = new Object[i];
              } else {
                   i++;
                   if(node == getRoot()) {
                        anode = new Object[i];
                   } else {
                        anode = getPathToRoot(getParent(node), i);
                   anode[anode.length - i] = node;
              return anode;
         * Gets the parent object of the specified object. This method is not
         * part of the <code>javax.swing.tree.TreeModel</code> interface, but is
         * required to support the <code>getPathToRoot(Object)</code> method,
         * which is widely used in this class. Therefore, it is important to
         * correctly implement this method.
         * @param obj the object
         * @parma the parent object or null if no parent or invalid object
         protected abstract Object getParent(Object obj);
         * Adds a listener for the <CODE>TreeModelEvent</CODE> posted after the
         * tree changes.
         * @param l the tree model listener
         public void addTreeModelListener(TreeModelListener l) {
              modelListeners.addElement(l);
         * Removes a listener previously added with addTreeModelListener().
         * @param l the tree model listener
         public void removeTreeModelListener(TreeModelListener l) {
              modelListeners.removeElement(l);
         * Forces the tree to reload. This is useful when many changes occur
         * under the root node in the tree structure.
         * <b>NOTE:</b> This will cause the tree to be collapsed. To maintain
         * the expanded nodes, see the <code>getExpandedPaths(JTree)</code>
         * and <code>expandPaths(JTree, ArrayList)</code> methods.
         * @see #getExpandedPaths(JTree)
         * @see #expandPaths(JTree, ArrayList)
         public void reload() {
              reload(getRoot());
         * Forces the tree to repaint. This is useful when many changes occur
         * under a specific node in the tree structure.
         * <b>NOTE:</b> This will cause the tree to be collapsed below the
         * updated node.
         * @param node the node that changed
         public void reload(Object node) {
              if(node != null) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   fireTreeStructureChanged(new TreeModelEvent(this, tp));
         * Messaged when the user has altered the value for the item identified
         * by <CODE>path</CODE> to <CODE>newValue</CODE>.
         * @param path the path to the changed object
         * @param newValue the new value
         public void valueForPathChanged(TreePath path, Object newValue) {
              nodeChanged(path.getLastPathComponent());
         * Notifies the tree that nodes were inserted. The index is looked up
         * automatically.
         * @param node the parent node
         * @param child the inserted child node
         public void nodeInserted(Object node, Object child) {
              nodeInserted(node, child, -1);
         * Notifies the tree that nodes were inserted.
         * @param node the parent node
         * @param child the inserted child node
         * @param index the index of the child
         public void nodeInserted(Object node, Object child, int index) {
              if(index < 0) {
                   index = getIndexOfChild(node, child);
              if(node != null && child != null && index >= 0) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   int[] ai = { index };
                   Object[] ac = { child };
                   fireTreeNodesInserted(new TreeModelEvent(this, tp, ai, ac));
         * Notifies the tree that nodes were removed. The index is required
         * since by this point, the object will no longer be in the tree.
         * @param node the parent node
         * @param child the removed child node
         * @param index the index of the child
         public void nodeRemoved(Object node, Object child, int index) {
              if(node != null && child != null && index >= 0) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   int[] ai = { index };
                   Object[] ac = { child };
                   fireTreeNodesRemoved(new TreeModelEvent(this, tp, ai, ac));
         * Notifies the tree that a node was changed.
         * @param node the changed node
         public void nodeChanged(Object node) {
              if(node != null) {
                   TreePath tp = new TreePath(getPathToRoot(node));
                   fireTreeNodesChanged(new TreeModelEvent(this, tp, null, null));
         * Fires "tree nodes changed" events to all listeners.
         * @param event the tree model event
         protected void fireTreeNodesChanged(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeNodesChanged(event);
         * Fires "tree nodes inserted" events to all listeners.
         * @param event the tree model event
         protected void fireTreeNodesInserted(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeNodesInserted(event);
         * Fires "tree nodes removed" events to all listeners.
         * @param event the tree model event
         protected void fireTreeNodesRemoved(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeNodesRemoved(event);
         * Fires "tree structure changed" events to all listeners.
         * @param event the tree model event
         protected void fireTreeStructureChanged(TreeModelEvent event) {
              for(int i = 0; i < modelListeners.size(); i++) {
                   ((TreeModelListener)modelListeners.elementAt(i)).treeStructureChanged(event);
         * Records the list of currently expanded paths in the specified tree.
         * This method is meant to be called before calling the
         * <code>reload()</code> methods to allow the tree to store the paths.
         * @param tree the tree
         * @param pathlist the list of expanded paths
         public ArrayList getExpandedPaths(JTree tree) {
              ArrayList expandedPaths = new ArrayList();
              addExpandedPaths(tree, tree.getPathForRow(0), expandedPaths);
              return expandedPaths;
         * Adds the expanded descendants of the specifed path in the specified
         * tree to the internal expanded list.
         * @param tree the tree
         * @param path the path
         * @param pathlist the list of expanded paths
         private void addExpandedPaths(JTree tree, TreePath path, ArrayList pathlist) {
              Enumeration enum = tree.getExpandedDescendants(path);
              while(enum.hasMoreElements()) {
                   TreePath tp = (TreePath)enum.nextElement();
                   pathlist.add(tp);
                   addExpandedPaths(tree, tp, pathlist);
         * Re-expands the expanded paths in the specified tree. This method is
         * meant to be called before calling the <code>reload()</code> methods
         * to allow the tree to store the paths.
         * @param tree the tree
         * @param pathlist the list of expanded paths
         public void expandPaths(JTree tree, ArrayList pathlist) {
              for(int i = 0; i < pathlist.size(); i++) {
                   tree.expandPath((TreePath)pathlist.get(i));

    Hey
    I'm not trying to show anyone up here, but having just built a tree model for displaying an XML document in a tree, I thought this seemed like a neat exercise.
    I implemented this very differently from the @OP. I only have one class, HiddenNodeTreeModel. All the hidden node data is stored in the model itself in my class. The advantage of what I've created is it will work with any TreeModel. The disadvantage is that I think it's not going to be very scalable - the additional computing to get the number of child nodes and to adjust indexes is heavy. So if you need a scalable solution definitely don't use this.
    Anyway here you go
    HiddenNodeTreeModel.java
    ======================
    package tjacobs.ui.tree;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.Iterator;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JTree;
    import javax.swing.event.TreeModelListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreeModel;
    import javax.swing.tree.TreePath;
    import tjacobs.ui.WindowUtilities;
    public class HiddenNodeTreeModel implements TreeModel {
         TreeModel mModel;
         ArrayList<Object> mHidden = new ArrayList<Object>();
         public HiddenNodeTreeModel (TreeModel model) {
              mModel = model;
         public void addTreeModelListener(TreeModelListener arg0) {
              mModel.addTreeModelListener(arg0);
         private ArrayList<Integer> getHiddenChildren(Object parent) {
              ArrayList<Integer> spots = new ArrayList<Integer>();
              Iterator _i = mHidden.iterator();
              while (_i.hasNext()) {
                   Object hidden = _i.next();
                   int idx = mModel.getIndexOfChild(parent, hidden);
                   if (idx != -1) {
                        spots.add(idx);
              return spots;
         public Object getChild(Object arg0, int index) {
              ArrayList<Integer> spots = getHiddenChildren(arg0);
              Collections.sort(spots);
              Iterator<Integer> _i = spots.iterator();
              while (_i.hasNext()) {
                   int num = _i.next();
                   if (num <= index) {
                        index++;
              return mModel.getChild(arg0, index);
         public int getChildCount(Object arg0) {
              ArrayList list = getHiddenChildren(arg0);
              System.out.println("size = " + list.size());
              return mModel.getChildCount(arg0) - list.size();
         public int getIndexOfChild(Object arg0, Object arg1) {
              int index = mModel.getIndexOfChild(arg0, arg1);
              ArrayList<Integer> spots = getHiddenChildren(arg0);
              Collections.sort(spots);
              Iterator<Integer> _i = spots.iterator();
              int toSub = 0;
              while (_i.hasNext()) {
                   int num = _i.next();
                   if (num <= index) {
                        toSub++;
              return index - toSub;
         public Object getRoot() {
              // TODO Auto-generated method stub
              return mModel.getRoot();
         public boolean isLeaf(Object arg0) {
              // TODO Auto-generated method stub
              return mModel.isLeaf(arg0);
         public void removeTreeModelListener(TreeModelListener arg0) {
              mModel.removeTreeModelListener(arg0);
         public void valueForPathChanged(TreePath arg0, Object arg1) {
              mModel.valueForPathChanged(arg0, arg1);
         public void hideNode(Object node) {
              if (node instanceof TreePath) {
                   node = ((TreePath)node).getLastPathComponent();
              mHidden.add(node);
         public void showNode(Object node) {
              mHidden.remove(node);
         public void showAll() {
              mHidden.clear();
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              DefaultMutableTreeNode A = new DefaultMutableTreeNode("A");
              DefaultMutableTreeNode B = new DefaultMutableTreeNode("B");
              DefaultMutableTreeNode C = new DefaultMutableTreeNode("C");
              DefaultMutableTreeNode D = new DefaultMutableTreeNode("D");
              DefaultMutableTreeNode E = new DefaultMutableTreeNode("E");
              DefaultMutableTreeNode F = new DefaultMutableTreeNode("F");
              A.add(B);
              B.add(C);
              B.add(D);
              B.add(E);
              E.add(F);
              DefaultTreeModel model = new DefaultTreeModel(A);
              final HiddenNodeTreeModel hmodel = new HiddenNodeTreeModel(model);
              final JTree tree = new JTree(hmodel);
              JFrame jf = new JFrame("HiddenNodeTreeModel Test");
              jf.add(tree);
              JMenuBar bar = new JMenuBar();
              jf.setJMenuBar(bar);
              JMenu menu = new JMenu("Options");
              bar.add(menu);
              final JMenuItem hide = new JMenuItem("Hide");
              final JMenuItem show = new JMenuItem("ShowAll");
              menu.add(hide);
              menu.add(show);
              ActionListener al = new ActionListener() {
                   public void actionPerformed(ActionEvent ae) {
                        if (ae.getSource() == hide) {
                             hmodel.hideNode(tree.getSelectionPath());
                             tree.updateUI();
                        else {
                             hmodel.showAll();
                             tree.updateUI();
              hide.addActionListener(al);
              show.addActionListener(al);
              jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              jf.setBounds(100,100,100,100);
              jf.setVisible(true);
    }

  • Google add-on search: A lot of the time when I click on the search results, it sends me to a site called "Infomash"!?

    Don't know what I've done wrong, all I can think of is update firefox in the past few months. I use Malwarebytes and bitdefender. I also have Stinger installed. Nothing is picking up a hijacker or anything. However, everyday...when I use firefox (only browser I use) I do a search through the google add on, and the results show up. I click on the one I want, and about 1 out of 5 times a site called "infomash" pops up. I hit back, click on the same result...and I get what I wanted. NOTHING will detect this!
    All of a sudden tonight, I've been searching things for a video game. Looking where to find a gun for the game. CLEARLY state the name of the game and everything in the google search.
    I click on this link: (Not actual link, but search result above it)
    http://fallout.wikia.com/wiki/Xuanlong_assault_rifle
    And it takes me to this link!
    http://www.brownells.com/
    I hit the back button, click on the link search result above again....and that time it takes me to the right one.
    I don't play games on this pc, don't have several things installed. Mainly just use it for email (don't download hardly anything from email), facebook, amazon, ebay, and work.

    This is indeed caused by a virus - and that I'm 99.99% sure (beware of the 0.01% though) - I've searched some forums around and it really seems to be malware.
    Edit: Be sure to update your current paid antivirus and to perform an on-demand scan before buying another.
    You're gonna need other security tools to test this, since your infection is probably TDSS or others. These kinds of malware tend to install more malware, that installs more malware, and so on.
    Your best bet here is a paid antivirus, but there are more antivirus in this world that you haven't tried, such as,
    [http://www.safer-networking.org ],
    [http://www.spywareterminator.com] ,
    [http://www.microsoft.com/security/malwareremove/default.aspx]
    If none of these work, I'd highly recommend a paid antivirus (this is a potential rootkit, not exactly the easiest thing to detect)
    Good antivirus to choose from:
    -TrustPort*
    -GDATA*
    -Kaspersky
    -AVIRA
    -F-Secure -ESET
    -BitDefender (the one you own) -eScan
    Antiviruses marked with * are partially based on BitDefender, and it might be best to look into others.
    (in order of my personal recommendation in terms of detection-it might not be worth anything and it doesnt account for speed of scanning)
    There are some free tools that have been "claimed" to solve this issue.
    BEWARE: THESE TOOLS ARE A MERE PART OF RESEARCH AND ARE NOT ENDORSED BY MOZILLA. USE AT YOUR OWN RISK.
    [http://support.kaspersky.com/viruses/solutions?qid=208280684]
    [http://forums.majorgeeks.com/showthread.php?t=182559]
    That took long to write!
    Thanks for asking.

  • Why can't I go directly to the web address by clicking on the search result?

    When I type something into search box, I get my search results page; when I click on the result I get sent to another search page. Only way I can open the website is to highlight it at the bottom of the search response and then right click "open link".

    Do a malware check with some malware scanning programs.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Urgent! the name of tree node can't show  completely

    I create a tree dynamicly using data from database;when i want to add a new node to the tree.it will be added at the right place imediately but it's name will not show completely.
    for example, i want to add a new node which name is "department",but the name on the tree it shown will be "departm...", i don't know what cause the 3 dot followed and how to remove the dot.
    Can anybody tell me why? Thanks a lot

    I use a IconNode which extend DefaultMutableTreeNode to create the node.
    following is the IconNode:
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    * @version 1.1 06/19/99
    public class IconNode extends DefaultMutableTreeNode {
    protected Icon icon;
    protected String iconName;
    protected boolean isActive=false;
    public IconNode() {
    this(null);
    public IconNode(Object userObject) {
    this(userObject, true, null);
    public IconNode(Object userObject, boolean allowsChildren
    , Icon icon) {
    super(userObject, allowsChildren);
    this.icon = icon;
    public void setIcon(Icon icon) {
    this.icon = icon;
    public Icon getIcon() {
    return icon;
    public boolean isActive(){
    return this.isActive;
    public void setActive(boolean flag){
    this.isActive=flag;
    public String getIconName() {
    if (iconName != null) {
    return iconName;
    else {
    String str = userObject.toString();
    int index = str.lastIndexOf(".");
    if (index != -1) {
    return str.substring(++index);
    else {
    return str;
    public void setIconName(String name) {
    iconName = name;
    following is the operation of adding node:
    private IconNode addObject(Object child) {
    IconNode parentNode = null;
    TreePath parentPath = appQueueTree.getSelectionPath();
    if (parentPath == null) {
    parentNode = rootNode;
    else {
    parentNode = (IconNode)
    (parentPath.getLastPathComponent());
    return addObject(parentNode, child, true);
    private IconNode addObject(IconNode parent,
    Object child,
    boolean shouldBeVisible) {
    IconNode childNode = new IconNode(child);
    // TreeNodeData is a value object contains the data of node.
    TreeNodeData temp=(TreeNodeData)child;
    int flag=temp.getNodeType();// get the type of node
    //to set the right icon of node
    switch(flag){
    case 1://childNode.setIcon();
    break;
    case 2:childNode.setIcon(leafIcon);
    break;
    case 3:childNode.setIcon(connectedDepartmentIcon);
    if (parent == null) {
    parent = rootNode;
    treeModel.insertNodeInto(childNode, parent,
    parent.getChildCount());
    //Make sure the user can see the lovely new node.
    if (shouldBeVisible) {
    //to scroll the tree path to node newly be added.
    appQueueTree.scrollPathToVisible(new TreePath(childNode.getPath()));
    return childNode;

  • Hierachical Tree node(help me please)

    Hi experts,
    JDEV 11.1.2.0.0
    i hav 3 tables say category_1 ,category_2(FK - cat1_code), & category_3( FK - cat1_code&cat2_code)......
    I created a BC from these tables and also created a view link from category_1 to category_2 & another view link from category_2 to category_3....
    then i made a hirearchical tree stucture to display database items....i converted all node to a Command link....
    My usecase is follows.......
    when i click each hierarchical link(data fetched from table) it should navigate to its master form for creating a new master a record.....means , if i clicked a category_1 data , it should navigate to category_1 master form to create a new record.....
    I almost done for my use case.....but i dnt knw how we can get corresponding iterator binds from tree definition ......this my page data binding definition
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="11.1.2.60.17" id="categoryPageDef"
    Package="pages">
    <parameters/>
    <executables>
    <variableIterator id="variables"/>
    *<iterator Binds="Iascat1View1" RangeSize="25" DataControl="AppModuleDataControl" id="Iascat1View1Iterator"/>*
    *<iterator id="Iascat2View1Iterator" Binds="Iascat2View1" DataControl="AppModuleDataControl" RangeSize="25"/>*
    *<iterator id="Iascat3View1Iterator" Binds="Iascat3View1" DataControl="AppModuleDataControl" RangeSize="25"/>* </executables>
    <bindings>
    *<tree IterBinding="Iascat1View1Iterator" id="Iascat1View1">*
    *<nodeDefinition DefName="inv.EntityVO.Iascat1View" Name="Iascat1View10"*
    *TargetIterator="${bindings.Iascat1View1Iterator}">*
    <AttrNames>
    <Item Value="Cat1Code"/>
    <Item Value="Cat1Name"/>
    </AttrNames>
    <Accessors>
    <Item Value="Iascat2View"/>
    </Accessors>
    </nodeDefinition>
    *<nodeDefinition DefName="inv.EntityVO.Iascat2View" Name="Iascat1View11"*
    *TargetIterator="${bindings.Iascat2View1Iterator}">*
    <AttrNames>
    <Item Value="Cat2Code"/>
    <Item Value="Cat2Name"/>
    </AttrNames>
    <Accessors>
    <Item Value="Iascat3View"/>
    </Accessors>
    </nodeDefinition>
    *<nodeDefinition DefName="inv.EntityVO.Iascat3View" Name="Iascat1View12"*
    *TargetIterator="${bindings.Iascat3View1Iterator}">*
    <AttrNames>
    <Item Value="Cat3Code"/>
    <Item Value="Cat3Name"/>
    </AttrNames>
    </nodeDefinition>
    </tree>
    </bindings>
    </pageDefinition>
    *how can i achieve this? OR*
    *Suggest any Other Way?*
    PMS
    Edited by: pms on Jan 30, 2012 3:49 PM
    Edited by: pms on Jan 30, 2012 4:07 PM
    Edited by: pms on Jan 30, 2012 4:13 PM
    Edited by: pms on Jan 30, 2012 4:49 PM
    Edited by: pms on Jan 30, 2012 4:58 PM

    Hi john,
    Im sorry , if i did against rules of the forum....
    Actually i stucked on my work , thats why i did like this to get response from forum members.....
    PMS

  • Apex Tree Node Search

    Hi guys,
    I want to search a tree node by using a textbox and a button item. I have implemented all required items and regions into my page. I think that, i can do this by using dynamic action. So I wrote a small script (jquery) to use in dynamic action in button click event. It gets the value of the textbox item and tries to use this value in tree's search method. By the way I specified a static ID for my tree region. (As you can see it is TREEID). But it doesn't work. Maybe usage of the method is different.
    So ,
    1 : The method usage is right?
    2 : Do you have any other idea about how can i do this search stuff.
    $("#TREEID").tree("search", document.getElementById("P300_SEARCH_TEXT").value);
    Database : Oracle11g
    Apex version : 4.1
    Thanks

    Mimi gave a very good start though. I have not worked with a tree before, but those tips guided me to the documentation, and i was able to take it from there. I can't see how the documentation would be lacking for you though, i find it to be clear. However, if you don't have some experience with javascript/jquery, this will not be straightforward.
    I made a new tree page, based this on EMP.
    When you want to do a search, you will first need the tree object, since the search function is a function of that object. I opened Firebug and ran this in my console:
    jQuery.tree.focused()This is in the docs. "This functions returns the currently focused tree instance."
    If you would have more trees, you could always use
    jQuery.tree.reference(needle)This functions returns a specific tree instance by an ID or contained node.
    Arguments:
    mixed needle
    This can be either the instance ID (the ID of the container node), an ID of any contained DOM element,
    an actual DOM element contained within the tree, or a jQuery extended DOM node container within the tree.>
    Now you have your tree object. Let's do a search. There are 2 employees with 'LL' in their names. I want to grab those.
    $.tree.focused().search("LL")This'll do "nothing". Why? Take a look at the documentation:
    Searches all nodes whose titles match a given string. If async is used a request is made to the server, the response should contain the comma-separated IDs of nodes that need to be opened so that all nodes that match the search string are visible.
    The search string is provided in the request. The function triggers the onsearch callback, with the nodes found as a parameter.
    Arguments:
    string needle
    The search string.
    string compare_function
    Optional argument. The jQuery function to be used for comparing titles to the string - defaults to "contains".>
    What is of importance here is this: The function triggers the onsearch callback
    +(oh, and please note that the search is looking for a match in the TITLE of the nodes!)+
    So, taking a look at onsearch:
    callback.onsearch Triggered after a search is performed and results are ready.
    Receives two parameters - a jQuery collection of nodes matching the search and a reference to the tree instance.
    *Default is: function(NODES, TREE_OBJ) { NODES.addClass("search");* }
    >
    So the default action of a search is something very simple: it assigns a class to the nodes which match the search criteria.
    If you would want more complex things to happen, you can simply provide another function to the tree object for the onsearch callback, and that is what Mimi meant with changing it. But you don't have to if the class-adding is sufficient.
    So, running from my firebug console:
    $(".search").css({"background-color":"red"})Grab all elements with class 'search', and give them a red background color. My nodes are now red for "ALLEN" and "MILLER".
    It also helps to use something like firebug, have knowledge of jquery, DOM and being able to inspect it, and read docs. I did not do anything special except applying some knowledge and taking my lead from those docs. Of course, Mimi mentioned this aswell, but the docs are at *\apex_images\libraries\jquery-jstree\0.9.9a2\documentation.html*
    Hope that helps you forward.

  • Displaying data in tableview on click of a tree node

    Hi,
    I am new to BSP. I created a tree structure having the tablenames as tree nodes, and now if I click on a node I want to display corresponding table data in a tableview. How can I acheive this....??
    Thanks in advance,
    Ravindra.

    Hi Ravindra,
    You can achieve this by reading the node clicked OnInput Processing and You can assign name of your table in "onNodeClick" attribute .
    then onInputprocessing you can read the name of your table from
    "event->server_event" .
    Check this sample code .
    ****************OnLayout*******************************
    <htmlb:content design="design2003">
      <htmlb:page title = " ">
        <htmlb:form>
            <htmlb:tree     id          = "myTree1"
                             title       = "Tree"
                             tooltip     = "Tooltip for myTree1">
                <htmlb:treeNode id="NODE1" text="TABLE1" isOpen="true" onNodeClick="TABLE1">
                  </htmlb:treeNode>
                  <htmlb:treeNode id="NODE2" text="TABLE2" isOpen="true" onNodeClick="TABLE2">
                 </htmlb:treeNode>
                    <htmlb:treeNode id="NODE3" text="TABLE3" onNodeClick="TABLE3"/>
                    <htmlb:treeNode id="NODE4" text="TABLE4"onNodeClick="TABLE4" />              
                  <htmlb:treeNode id="NODE5" text="TABLE5" isOpen="false" onNodeClick="TABLE5">
                  </htmlb:treeNode>
                    <htmlb:treeNode id="NODE6" text="TABLE6" onNodeClick="TABLE6"/>
            </htmlb:tree>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    *****************OnInputProcessing****************
    CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
    Data: TABLE_NAME type STRING.
    Optional: test that this is an event from HTMLB library.
    IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
    Scenario 1: Read event from manager.
      DATA: event TYPE REF TO CL_HTMLB_EVENT.
      event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
      IF event IS NOT INITIAL AND event->name = 'tree'.
        DATA: tree_event TYPE REF TO CL_HTMLB_EVENT_TREE.
        tree_event ?= event.
       TABLE_NAME = event->server_event.
      ENDIF.
    ENDIF.
    Check examples given in "SBSPEXT_HTMLB" bsp application.
    I hope this will help.
    Regards,
    Monica

  • When I search for videos in google, it takes me to the different website after clicking the search

    I installed FF 4 and I was happy with the look and feel and performance untill oneday I tried to google some vedios.
    When I click on the search results which most of the time suggests to be youtube link, it takes me to altogether different website which I never heard of. I expect when the search result shows me source as youtube, I should be able to go to youtube on clicking on the results.

    1. You need to use Firefox at the Adobe website to get the NPAPI version of Flash for non-IE browsers.
    Download the Flash plugin from the Adobe [http://get.adobe.com/flashplayer/thankyou/ Thank You!] page via:
    '''If it does not start, [http://www.adobe.com/go/fptroubleshoot click here] for troubleshooting information.'''
    On the [http://www.adobe.com/products/flashplayer/support/index.html troubleshooting page] click the link at the bottom:
    If you are still having problems, [http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player_ax.exe click here to download].
    Save it to your Desktop.
    2. Close Firefox using File > Exit
    then check the Task Manager > Processes tab to make sure '''firefox.exe''' is closed,
    3. Then run the Flash setup file from your Desktop.
    * On Vista and Windows 7 you may need to run the plugin installer as Administrator by starting the installer via the right-click context menu if you do not get an UAC prompt to ask for permission to continue (i.e nothing seems to happen).
    See this:
    [http://vistasupport.mvps.org/run_as_administrator.htm]
    You also need to update Java - Firefox 3.6+ version need 1.6.0_10 or higher, for the Next Generation plugin.
    http://www.java.com/en/download/index.jsp

  • How to hide the default arrow icon of af:tree node

    Hi All,
    I am using Oracle JDeveloper 11g R2.
    I want to hide the arrow icon which is displayed by default with af:tree node. The use case is to display custom icons for all the nodes. The problem is that when I am customizing icons of tree node, it is showing arrow as well as the icon with each node. Which doesn't seems fine. Can any one help/guide on how to hide the default af:tree node arrow icon.
    Thanks in advance.
    Regards
    Bilal
    Edited by: Bilal on 29-May-2012 01:32

    Hi,
    Use Css to change the icon style:
    af|treeTable::expanded-icon {
    content: url("/adf/1.gif");//content : none;
    outline: none ;
    af|treeTable::collapsed-icon {
    content: url("/adf/2.gif");//content : none;
    outline: none ;
    af|treeTable::leaf-icon {
    content: url("/adf/3.gif");//content : none;
    outline: none ;
    Regards,
    Raj Gopal K

  • Invalid b-tree node and the disk can't be repaired.  Is it worth the reformat or is the hard drive trashed?  This is a Mac mini, I've had it since 2010 and already had to replace the hard drive once.

    Swapped out the monitor on my Mac mini tonight and it wouldn't start back up.  Managed to boot off the install disk and run disk utility, which gave the invalid b tree node error.  Wasn't able to repair the disk, suggested a reformat.  Is this worth my time?  Or is the disk toasted?  I got it in 2010, it's out of warranty and has already had the hard drive replaced once.  Thanks!
    -laura

    If you want to save the data from the drive, Phoenix might be able to copy (clone) it off on another volume. You can check it out at:
    http://scsc-online.com/Phoenix.html
    Phoenix does a file copying cloning, not block copy cloning, so a new index is generated on the drive when the copy is being made. If none of the files got lost, meaning just the index is screwed up, I would think this would work.
    Regarding the hard drive an index problem isn't a hard drive problem. That hard drive may be in perfect working order, especially since it's fairly new.

Maybe you are looking for

  • Folder metadata in Word document

    In document library I have one folder and that folder has it own metadata. Inside of that folder is one word document. Is it possible to get metadata of that folder and write them in word document automatically when word is opened with no programming

  • Is it possible to convert only select statement into procedure in Oracle

    Hi, Just i wanted to convert the below query in to procedure.Procedure input is 'P.Column1' SELECT P.Column1 AS PRODUCT, D.Column2 AS Column2N, D.Column3 AS LongColumn2iption, P.Column4 AS PRODUCICE, D.Column5 AS BilliuctID, E.Column6 As Impaenue, C.

  • How can I use two I pod from 1 PC

    I have two Ipods which i want to use from the same PC.One of them is already installed, but I wondered if i have to install an other software for the other one as well or is there a way I can somhow connect it to the same software which is alreadiy i

  • Generate unicode for a string

    Hi frnz I have a string of a language, how can I generate unicode for the same thnks alpesh

  • Can I create a pick-list of customised colors in Cap 5?

    Hi Folks I am using Cap 5. I am creating/updating a set of presentations. I can only use 5 specific colors as laid out in my employers brand guidelines. I would like to create these 5 colors and add them to the color pick list that appears for text a