2013-02-09 Created by Baoxinjian
I. Summary
Developer 6.0 and above provides the concept of hierarchy tree (hierarchical trees), htree controls are very handy and require minimal programming for the purpose of displaying hierarchies.
The following are some of the more important properties of a tree
1. Multiple selection (multi-selection)
Whether to allow multiple nodes of the tree to be selected at one time. If not allowed, the first selected node is deselected when the second node is selected.
2. Recordset (Record Group)
Specifies the name of the record group for the spanning tree.
Ii. Common methods of tree
FUNCTION Get_tree_node_property (Item_name VARCHAR2, node node, property number);
Function: Gets the properties of the tree node
2. FUNCTION Get_tree_property (item_name varchar2,property number);
Function: Get the properties of the tree
3. PROCEDURE Set_tree_node_property (item_name varchar2,node ftree. Node,property number,value VARCHAR2);
Features: Setting the properties of a tree node
4. PROCEDURE Set_tree_property (item_name varchar2,property number, value VARCHAR2);
Features: Setting the properties of a tree
5. PROCEDURE Populate_tree (Item_name VARCHAR2);
Function: Empties existing data in the tree and regenerates the tree based on a record group or data query.
6. PROCEDURE add_tree_data (item_name varchar2,node ftree. NODE, Offset_type number,offset number,data_source number,data VARCHAR2);
Function: Add the data in the tree under the specified node
7. FUNCTION Find_tree_node (item_name varchar2,earch_string VARCHAR2, Search_type number,search_by number,search_root Node,start_point NODE);
Function: Find the node that displays text or values that match search_string.
8. FUNCTION Add_tree_node (item_name varchar2,node ftree. NODE, Offset_type number,offset number,state number,label VARCHAR2, Icon Varchar2,value VARCHAR2);
Function: Adds a tree node.
9. PROCEDURE Delete_tree_node (item_name varchar2,node NODE);
Function: Delete tree node
FUNCTION get_tree_node_parent (item_name varchar2,node NODE);
Function: Gets the parent node of the specified node.
One. FUNCTION get_tree_selection (item_name varchar2,selection number);
Function: Gets the node in the selected state.
PROCEDURE set_tree_selection (item_name varchar2,node node, selection_type number);
Function: Specifies the selected state of a single node
Iii. triggers in the tree run
Trigger for the form run State:
1. when-tree-node-activated: The user double-clicks the node or fires when the [ENTER] key is pressed when the nodes are selected.
2. when-tree-node-expanded: Trigger when node expands or shrinks
3. when-tree-node-selected: Triggers when node is selected or deselected
Iv. A simple example of tree operation
Description: Find_tree_node finds the specified node, Add_tree_node to add its subordinate nodes.
Cons: Programming is more complex, operation is not flexible, and error-prone.
Advantages: You can control the process of adding nodes, and realize some special requirements.
--Dept_cur the cursor of the employee for the cursor,emp_cur of the pickup unitHtree:=Find_item ('tree_view.tree_emp');OPENdept_cur; LOOPFETCHDept_cur intoAA; EXIT whenDept_cur%NotFound;
Del_node:=Ftree.find_tree_node (Htree, AA.KJMC, Ftree.find_next, Ftree.node_label, Ftree.root_node, Ftree.root_node); --Delete a unit node and its child nodes IF notFtree.id_null (Del_node) ThenFtree.delete_tree_node (Htree, Del_node); END IF;END LOOP;CLOSEdept_cur;--The first node of the spanning tree based on the units obtained with the cursorOPENdept_cur; LOOPFETCHDept_cur intoAA; EXIT whenDept_cur%NotFound; New_node:=Ftree.add_tree_node (Htree, Ftree.root_node, Ftree.parent_offset, Ftree.last_child, Ftree.expanded_node, Aa.dname,"', Aa.deptno);END LOOP;CLOSEdept_cur;--under employee cursor spanning tree's lower nodeOPENemp_cur; LOOPFETCHEmp_cur intob; EXIT whenEmp_cur%NotFound; Find_node:=Ftree.find_tree_node (Htree, BB.KJBH, Ftree.find_nextfind_next,ftree.node_value, Ftree.root_node, Ftree.root_ node); New_node:=Ftree.add_tree_node (Htree, Find_node, Ftree.parent_offset, Ftree.last_child, Ftree.expanded_node, Bb.ename, "', bb.empno);END LOOP;CLOSEemp_cur;--get the root node of the treeSS:=Ftree.get_tree_property (htree,ftree.node_count);--Loop until all nodes of the tree are expanded forJinch 1.. SS LOOP Exp_node:=Ftree.find_tree_node (Htree,"'); State:=Ftree.get_tree_node_property (Htree, J, Ftree.node_state); IFState=Ftree.collapset_node ThenFtree.set_tree_node_property (Htree, J, Ftree.node_state, Ftree.expanded_node); END IF;ENDLOOP;
Reference: TECHWIND-HTTP://WWW.TECHWIND.NET/VIEWTHREAD.PHP?TID=1689&PAGE=1&EXTRA=PAGE%3D1
Introduction to Form_form tree structure (case)