How can i can add tree node ?

h want like to add tree node in the run time mode and commit it into database

use ftree.ADD_TREE_NODE for adding new nodes.
But what do you want to save in the db ?

Similar Messages

  • How to get Value of tree node without Reload Page

    hi,
    i worked with apex 4.2 and i created Tree and tabular form to retrieve the date according the value of tree select node the code of tree something like this
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "ENAME" as title,
    null as icon,
    "EMPNO" as value,
    null as tooltip,
    'f?p=36648:34:5234984107903::::P40_SELECTED_NODE:'||empno as link
    from "DEPT"."EMP"
    start with "MGR" is null
    connect by prior "EMPNO" = "MGR"
    order siblings by "ENAME
    and i put Selected Node Page Item: P40_SELECTED_NODE . the tree worked good and retrieve the data into tabular form according to tree node value
    my Question :
    1- i want to retrieve the data without submit the page where each time i select value from tree make page reload to update the tabular form with new value ,there is any way to pass the value of tree node to P40_SELECTED_NODE item and refresh tabular form without page reload .
    2- i want when selected from tree run page process according to value of tree node i tray to create Dynamic action with *(jquery selector : div.tree li>a)* but the Value of node incorrect.
    Regards
    Ahmed;

    look at this link
    Re: How to get Value of tree node without Reload Page ..!

  • How to Programatically select a Tree Node ?

    Hi,
    JDV = 11.1.1.6
    I don't know about the answer yet! but the question is simple ;)
    say I'm viewing departments Info in a tree (Code , Name)
    How can I select a particular node in my tree using "Code" value as the parameter?
    Thank you ,
    Shahab

    Hi Shahab,
    Please find below a custom method to programmatically select a node during a disclose event by the user:
    public void onRowDisclosure(RowDisclosureEvent rowDisclosureEvent) {
         RichTree tree = (RichTree)rowDisclosureEvent.getSource();
         RowKeySet disclosedRows = rowDisclosureEvent.getAddedSet();
         RowKeySet selectedRows = tree.getSelectedRowKeys();
         selectedRows.clear();
         if (disclosedRows.size() == 1){
         Object disclosedNode = disclosedRows.iterator().next();
         selectedRows.add(disclosedNode);
         makeCurrent(tree, disclosedRows);
         tree.setSelectedRowKeys(selectedRows);
         AdfFacesContext adfFacesContext =
         AdfFacesContext.getCurrentInstance();
         adfFacesContext.addPartialTarget(tree.getParent());
    Hope this helps in your requirement.
    Best Regards,
    Ankit Gupta

  • How to resize a custom tree node like you would a JFrame window?

    Hello,
    I am trying to resize a custom tree node like you would a JFrame window.
    As with a JFrame, when your mouse crosses the Border, the cursor should change and you are able to drag the edge to resize the node.
    However, I am faced with a problem. Border cannot detect this and I dont want to use a mouse motion listener (with a large number of nodes, I fear it will be inefficient, calculating every node's position constantly).
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Insets;
    import java.util.EventObject;
    import javax.swing.BorderFactory;
    import javax.swing.Box;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellEditor;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreeSelectionModel;
    public class ResizeNode extends JPanel {
           AnilTreeCellRenderer2 atcr;
           AnilTreeCellEditor2 atce;
           DefaultTreeModel treeModel;
           JTree tree;
           DefaultMutableTreeNode markedNode = null;
         public ResizeNode() {
                super(new BorderLayout());
                   treeModel = new DefaultTreeModel(null);
                   tree = new JTree(treeModel);          
                  tree.setEditable(true);
                   tree.getSelectionModel().setSelectionMode(
                             TreeSelectionModel.SINGLE_TREE_SELECTION);
                   tree.setShowsRootHandles(true);
                  tree.setCellRenderer(atcr = new AnilTreeCellRenderer2());
                  tree.setCellEditor(atce = new AnilTreeCellEditor2(tree, atcr));
                   JScrollPane scrollPane = new JScrollPane(tree);
                   add(scrollPane,BorderLayout.CENTER);
         public void setRootNode(DefaultMutableTreeNode node) {
              treeModel.setRoot(node);
              treeModel.reload();
           public static void main(String[] args){
                ResizeNode tb = new ResizeNode();
                tb.setPreferredSize(new Dimension(400,200));
                  JFrame frame = new JFrame("ResizeNode");
                  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                  frame.setContentPane(tb);
                  frame.setSize(400, 200);
                  frame.pack();
                  frame.setVisible(true);
                  tb.populate();
         private void populate() {
              TextAreaNode2 r = new TextAreaNode2(this);
               setRootNode(r);
               TextAreaNode2 a = new TextAreaNode2(this);
               treeModel.insertNodeInto(a, r, r.getChildCount());          
    class AnilTreeCellRenderer2 extends DefaultTreeCellRenderer{
    TreeBasic panel;
    DefaultMutableTreeNode currentNode;
      public AnilTreeCellRenderer2() {
         super();
    public Component getTreeCellRendererComponent
       (JTree tree, Object value, boolean selected, boolean expanded,
       boolean leaf, int row, boolean hasFocus){
         TextAreaNode2 currentNode = (TextAreaNode2)value;
         NodeGUI2 gNode = (NodeGUI2) currentNode.gNode;
        return gNode.box;
    class AnilTreeCellEditor2 extends DefaultTreeCellEditor{
      DefaultTreeCellRenderer rend;
      public AnilTreeCellEditor2(JTree tree, DefaultTreeCellRenderer r){
        super(tree, r);
        rend = r;
      public Component getTreeCellEditorComponent(JTree tree, Object value,
       boolean isSelected, boolean expanded, boolean leaf, int row){
        return rend.getTreeCellRendererComponent(tree, value, isSelected, expanded,
         leaf, row, true);
      public boolean isCellEditable(EventObject event){
        return true;
    class NodeGUI2 {
         final ResizeNode view;
         Box box = Box.createVerticalBox();
         final JTextArea aa = new JTextArea( 1, 5 );
         final JTextArea aaa = new JTextArea( 1, 8 );
         NodeGUI2( ResizeNode view_ ) {
              this.view = view_;
              box.add( aa );
              aa.setBorder( BorderFactory.createMatteBorder( 0, 0, 1, 0, Color.GREEN ) );
              box.add( aaa );
              box.setBorder( BorderFactory.createMatteBorder( 5, 5, 5, 5, Color.CYAN ) );
         private Dimension getEditorPreferredSize() {
              Insets insets = box.getInsets();
              Dimension boxSize = box.getPreferredSize();
              Dimension aaSize = aa.getPreferredSize();
              Dimension aaaSize = aaa.getPreferredSize();
              int height = aaSize.height + aaaSize.height + insets.top + insets.bottom;
              int width = Math.max( aaSize.width, aaaSize.width );
              if ( width < boxSize.width )
                   width += insets.right + insets.left + 3;     // 3 for cursor
              return new Dimension( width, height );               
    class TextAreaNode2 extends DefaultMutableTreeNode {  
         NodeGUI2 gNode;
         TextAreaNode2(ResizeNode view_) {     
              gNode = new NodeGUI2(view_);
    }

    the node on the tree is only painted on using the
    renderer to do the painting work. A mouse listener
    has to be added to the tree, and when moved over an
    area, you have to determine if you are over the
    border and which direction to update the cursor and
    to know which way to resize when dragged. One of the
    BasicRootPaneUI has some code that can help determine
    that.Thanks for replying. What is your opinion on this alternative idea that I just had?
    I am wondering if it might be easier to have a toggle button in the node that you click when you want to resize the node. Then a mouse-down and dragging the mouse will resize the node. Mouse-up will reset the toggle button, and so will mouse down in an invalid area.
    Anil

  • Add tree node problem

    Hi guys, I'm trying to add nodes programatically but I have the same wrong behavior:
    1. I displayed a tree which will be updated from a data block and Selected say NODE1.
    2. After I displayed it I EXECUTE QUERY on the DATA BLOCK next to it, so I can choose a candidate record to belong to the tree structure.
    3. I add the record via a button which has the addMyNode code.
    4. It adds the node correctly. (say NODE11).
    5. I add another node just behind the new node (NODE11) say NODE 111.
    6. With my mouse I selected the father(NODE1) of NODE11 and add a brother of NODE 11, say NODE12, but this node is added next to NODE111.
    7. If I navigate a little while through the tree after step number 5, and then return to NODE1 with my mouse, I can add it perfectly.
    What's wrong with my code:??
    AddMyNode (in a PushButton):
    PROCEDURE AddMyNode IS
    htree ITEM;
    top_node FTREE.NODE;
    new_node FTREE.NODE;
    item_value VARCHAR2(120);
    num_selected NUMBER;
    current_node FTREE.NODE;
    ncl_centro      NUMBER;
    BEGIN
    htree := Find_Item('DB_ARBOL.HT_ARBOL');
    num_selected := Ftree.Get_Tree_Property(htree, Ftree.SELECTION_COUNT);
    FOR j IN 1..num_selected LOOP
    current_node := Ftree.Get_Tree_Selection(htree, j); Long postings are being truncated to ~1 kB at this time.

    Hi guys, I'm trying to add nodes programatically but I have the same wrong behavior:
    1. I displayed a tree which will be updated from a data block and Selected say NODE1.
    2. After I displayed it I EXECUTE QUERY on the DATA BLOCK next to it, so I can choose a candidate record to belong to the tree structure.
    3. I add the record via a button which has the addMyNode code.
    4. It adds the node correctly. (say NODE11).
    5. I add another node just behind the new node (NODE11) say NODE 111.
    6. With my mouse I selected the father(NODE1) of NODE11 and add a brother of NODE 11, say NODE12, but this node is added next to NODE111.
    7. If I navigate a little while through the tree after step number 5, and then return to NODE1 with my mouse, I can add it perfectly.
    What's wrong with my code:??
    AddMyNode (in a PushButton):
    PROCEDURE AddMyNode IS
    htree ITEM;
    top_node FTREE.NODE;
    new_node FTREE.NODE;
    item_value VARCHAR2(120);
    num_selected NUMBER;
    current_node FTREE.NODE;
    ncl_centro      NUMBER;
    BEGIN
    htree := Find_Item('DB_ARBOL.HT_ARBOL');
    num_selected := Ftree.Get_Tree_Property(htree, Ftree.SELECTION_COUNT);
    FOR j IN 1..num_selected LOOP
    current_node := Ftree.Get_Tree_Selection(htree, j); Long postings are being truncated to ~1 kB at this time.

  • Dynamic add tree node and thread

    Hi,
    I implemented a thread by using SwingWorker class to execute the time-consuming file loading and processing task instead of the event-dispatching thread. However, I need to dynamically add node to a tree by using data returned by the file loader in my project's main frame like following:
    if (source == loadAffyItem) {
        //load affy file data to the application
        loader = new AffyFileLoader();
        //dynamically add node to the tree after data loading
        rawDataNode = treePanel.addObject(null, "Raw Data");
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(new UserData("Pixel",   loader.getPixelMatrix()));
        pixelNode = treePanel.addObject(rawDataNode, node);
        node = new DefaultMutableTreeNode(new UserData("Signal", loader.getSignalMatrix()));
        signalNode = treePanel.addObject(rawDataNode, node);
    }However, I always get a NullPointer error by doing this way since the code to dynamically add node to the tree using data returned from loader, but the loader is executed
    in another thread and not finished yet. How could I make that code executed after the loader class is finished? Hope you could enlight me about this issue?
    thanks in advance!
    Jenny

    You'll have to redesign a bit. You could either have the separate thread add the node when it's finished (using SwingUtilities invokeLater to ensure you're updating the GUI in the Event Dispatch thread), or you could have the separate thread call-back or send an event when it's finished (and your main thread would listen).

  • How to set the default tree node in JTree?

    I want to set a default tree node in JTree when start the program,
    what is the method or the function to call?
    Thanks~

    If you by "default" mean "selected", then you can use one of the setSelectionXXX methods in the JTree API.
    If you by "default" mean something else, never mind this post :-)

  • How to programmatically click a tree node(make it selected)?

    in my program, i want to make a tree node "clicked" by codes, so that the valueChanged(TreeSelectionEvent tse e) method of the TreeSelectionListener can be invoked.
    thanks a lot!!

        private Robot robot;
        private void triggerMouseClick(TreePath treePath) {
            if (robot == null) {
                try {
                    robot = new Robot();
                    robot.setAutoDelay(60);
                catch (AWTException e) {
                    e.printStackTrace();
            Rectangle rect = this.getPathBounds(treePath);
            Point point = new Point(rect.x+1, rect.y+1);
            SwingUtilities.convertPointToScreen(point, this);
            robot.mouseMove(point.x, point.y);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
        }

  • How to alter the alv tree node text?

    hi
      i want to alter the alv tree node text, many people say it cann't be changed, but
    i look into the sample code 'BCALV_TREE_04', the average funtion(select a column and then select average function in the tool bar) can alter the tree node text dynamically.
      i try to look into the source code, the it's the sap standard code, all the funtions that user input, it goes to the statement "  CALL METHOD cl_gui_cfw=>dispatch.", and i don't understand what this statement do, can someone helps me?

    hi
    good
    The ALV tree report produces uses OBJECT METHOD functionality in-order to produce a
    tree structured ALV output. 
    The creation of an ALVtree report first requires the creation of a simple program to build the ALV
    details such as the fieldcatalog and to call a screen which will be used to display the ALVTree.
    The screen should be created with a 'custom control' where you wish the ALVtree report to appear.
    For the following example it will have the name 'SCREEN_CONTAINER'.
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
    reward point if helpful.
    thanks
    mrutyun^

  • Using Java, How can I Update, Add, Delete nodes in XML Files.

    Hi,
    I want to store the student record (like Name, Age, school name, total mark etc.,) as nodes in the XMLfile. Also I should able to Update, Add, Delete any nodes (student record) in the XML file. How can I achieve this...using Java
    I am able to read the content of the xml file using xml-parser. But my problem is
    updating the xml file.
    pls suggest some solutions or links with " example source code"
    Thanks :-)

    There are 2 kinds of XML parsers : SAX and DOM. DOM seems to suit your need. You can use JAXP APIs to add, delete or change nodes or attributes.
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/TOC.html provides contents that would satisfy most of the needs.
    To save a DOM modified XML file use java IO APIs to write to the same file from which it was read using a Document object ( doc.getNodeValue() ).

  • How to highlight/indicate particular tree Node in Tree UI element

    Hi All
    Can anybody let us know how to highlight/indicate specific node in a tree struture.
    currently i am able to display the tree struture with all the nodes & elements but it is always tasking firstnode as highlighted one or indicated one.
    if i want to highlight specific node in a tree struture...what was the procedure or any sample code then it would be great help to us.
    Thanks
    Trisha rani

    Hi Krishna
    Thanks for your reply
    I displayed the tree structure and i want to highlight specific parent node/child element , what was the sample code??
    for example my tree was displayed in the below struture and at the runtime specific child node i wanted to be highlighted i want to make selectable particular nodeType......
    Can you pls send sample codee code??
    my requirement
    A
    A1
       A2
       A3
    B
    B1      
       B2
       B3
       B4
       B5     
    now i want to make selectable or highlighted B4,B5 etc  or A2,A3 at runtime.
    The other guy who replied for this thread it is working for Parent nodes to make highlighted  like it is working for parent nodes which is have child nodes. i am able to hightlight at runtime for Nodes A,B etc .
    Now i want to highlight or make selected one for B4,A3 etc, pls provide sample code??
    it  would be great help to us
    Thanks
    Trisha Rani

  • How to create a new tree node with the initial edit function

    Hi all,
    I would like to mimic the Windows system when the user creates a new node. The newly created node should be in the edit mode, i.e.it should
    be highlighted and the cursor should be appear at the end of
    the newly created node name.
    I have the folloing code after I create the new node and set its selection:
    TreePath selectionPath = getTree().getSelectionPath();
    tree.startEditingAtPath(selectionPath);
    However, this only partially does what I want, the cursor does not appear at the end of the node's name and I am not sure how to select the text name of the new node.
    I hope someone can help.
    Kanita

    I haven't tried myself but my guess is that you need to customize your tree cell editor for putting
    cursor at specific position, etc.

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

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

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

  • How to store  tree nodes in data base

    i am creating a tree with create node and delete node dynamically
    how can i store the tree nodes in the data base and how can i retrive them from data base to tree and tree table

    Thank s for replay
    I am tring to the tree nodes and Dynamically creating and removing the nodes from the tree that tree structure have to store in the data base and after wards retrive the tree structure from the database and display as the tree

  • How to cut, copy and paste a tree node in JTree?????

    Hi, Java GUI guru. Thank you for your help in advance.
    I am working on a File Explorer project with JTree. There are cut, copy and paste item menus in my menu bar. I need three EventAction methods or classes to implements the three tasks. I tried to use Clipboard to copy and paste tree node. But I can not copy any tree node from my tree.
    Are there any body has sample source code about cut, copy, and paste for tree? If possible, would you mind send me your sample source code to [email protected]
    I would appreciate you very very much for your help!!!!
    X.G.

    Hi, Paul Clapham:
    Thank you for your quick answer.
    I store the node in a DefaultMutableTreeNode variable, and assign it to another DefaultMutableTreeNode variable. I set up two classes (CopyNode and PasteNode). Here they are as follows:
    //CopyNode class
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class CopyNode implements ActionListener{
    private TreeList jtree;
    String treeNodeName;
    TreePath currentSelection;
    DefaultMutableTreeNode currentNode;
    public CopyNode(TreeList t){
    jtree = t;
    public void actionPerformed(ActionEvent e){
    currentSelection = jtree.tree.getSelectionPath();
    if(currentSelection != null){
    currentNode = (DefaultMutableTreeNode)(currentSelection.getLastPathComponent());
    treeNodeName = currentNode.toString();
    //PasteNode class
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class PasteNode extends DefaultMutableTreeNode{
    private TreeList jtree;
    CopyNode copyNode;
    public PasteNode(TreeList t){
    jtree = t;
    copyNode = new CopyNode(t);
    public DefaultMutableTreeNode addObject(Object child){
    DefaultMutableTreeNode parentNode = null;
    TreePath parentPath = jtree.tree.getSelectionPath();
    if(parentPath == null){
    parentNode = jtree.root;
    else{
    parentNode = (DefaultMutableTreeNode)parentPath.getLastPathComponent();
    return addObject(parentNode, child, true);
    public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, Object child, boolean shouldBeVisible){
    DefaultMutableTreeNode childNode = copyNode.currentNode;
    if(parent == null){
    parent = jtree.root;
    jtree.treemodel.insertNodeInto(childNode, parent, parent.getChildCount());
    if(shouldBeVisible){
    jtree.tree.scrollPathToVisible(new TreePath(childNode.getPath()));
    return childNode;
    I used these two classes objects in "actionPerformed(ActionEvent e)" methods in my tree:
    //invoke copyNode
    copyItem = new JMenuItem("Copy");
    copyItem.addActionListener(copyNode);
    //invoke pasteNode
    pasteItem = new JMenuItem("Paste");
    pasteItem.addActionListener(
    new ActionListener(){
    public void actionPerformed(ActionEvent e){
    pasteName.addObject(copyName.treeNodeName);
    When I run the drive code, making a copy some node from my tree list, I got bunch of error messages.
    Can you figour out what is wrong in my two classes? If you have sample code, would you mind mail me for reference.
    Thank you very much in advance.
    X.G.

Maybe you are looking for

  • Imessaging won't work after yosemite update...how do I fix this?

    I'm connected to wi-fi, yet imessages won't send or receive. It worked until I updated my MacPro to Yosemite. How do I fix this?

  • Measuremen​t of the In-rush current

    Measurement of the in-rush current slope of a Switch Mode Power Supply when switched on: Detail: I am trying to measure the In-rush current slope of a Switch Mode Power Supply' Mains when switched-on. The current is measured on the mains live using a

  • Onscroll event?

    Using forms 9.0.2.4 Users access the forms through Jinitiator 1.3.1.13 My question is users wish to be able to scroll through forms using their mouse wheel however I have not been successful in locating a way to do this. Is this possible? Any help is

  • Can't Unbundle By Name slider

    Hey, I'm trying to use a slider control with two sliders. The Unbundle By Name does not seem to work correctly. Is this expected behavior, or has it already been fixed in 8.5? Error: "Some items in the cluster input to this Bundle/Unbundle By Name fu

  • Connecting Query variable with Table Values

    Hi all,, I'm trying to connect a query variable to table column contents. The problem is, there is an additional Date as input which is single value. As a result, the query does not get executed. It gives an error that it expects a single value for t