Dynamic | data | Database One, extensive application of directory tree
In order to this paragraph content, searches searches on Baidu, the content a chase, related unexpectedly did not have. Search What search? Is the usefulness not obvious? The management of Folder Explorer folders, the management of Multi-level forum in the Forum, the AWT in Java is lack of components including tree directory is limited to use ... Who is so impolite, not to give a little face, how can I say it? Cleared his throat:
In our project, we often have the autocorrelation data table, from the overall view, the entire table is presented as a tree-shaped data structure. When we display and edit this table, it would be awkward if we did not take good representations, and it would be a good idea to manage it with a tree-shaped directory.
(The axe swung round, and it felt great, and then said ...) The tree directory in the Web can be implemented with JavaScript, but some details such as Tree directory values (click on a child node, open the relevant link), multi-level directory and node increase, delete, drag on the various elbow. In fact, using a Third-party control is obviously a good idea.
Second, about the island of Intelligence directory tree control
OK, our hero today--the lightweight, Smart Island directory tree control (download address: Http://www.oapro.com/ostarocx/download/OTree.ocx) came out. It uses the vc++6.0 development, is the standard OCX control, may apply in the Windows environment VB, VC, PB, Dephi, ASP, JSP and so on programming language. It takes an XML file as an interface file, which can be either a ready-made file or a dynamically generated XML format file (in other words, a tree node can be dynamically generated based on a database). Chi Island The tree control supports replication, movement, renaming, and permission controls on nodes, and there is no limit on the number of levels of the directory. Introduced so much, presumably want to try more. In the ASP small test first:
Third, register add control
1. Registered Chi Island Directory tree control
Download (download address: http://www.oapro.com/ostarocx/download/OTree.ocx) Chi Island Directory tree control (with its file name Otree.ocx), register the control as follows:
Click "Start" → "run"; In the Run dialog box, enter the following command:
regsvr32 < otree.ocx file absolute path > registered Chi Island Directory tree control control
regsvr32/u < otree.ocx file absolute path > lifting Chi Island Directory tree Control Registration
2. Add the Smart Island tree control to the page
Add the following code to the page to insert the Chi Island directory tree control:
<object classid= "clsid:d835ed15-0bd0-4f24-ac76-a60175ae1137" id= "Otree" width= "0"
codebase= "Http://www.oapro.com/ostarocx/download/OTree.ocx" >
<param name= "_version" value= "65536" >
<param name= "_extentx" value= "2646" >
<param name= "_extenty" value= "1323" >
<param name= "_stockprops" value= "0" >
</object>
which
Width and Height: The display widths and heights of the accused pieces;
ID: The name of the accusation object that implements the operation of the control by that name;
CODEBASE: Refers to a client that does not have the Smart Island tree control installed automatically to download the address of the installation of the control when it runs the page.
Iii. generating a tree directory from an XML file
1. XML Document Format
XML is a good thing, but also to conform to a certain format Ah, otherwise the control can not be recognized Oh! The following is an XML document format:
<?xml version= "1.0" encoding= "GB2312"?>
<NaviTree>
<NodeItem>
<NodeName> </NodeName><!--node name-->
<NodeType> </NodeType><!--Node type-->
<NodeData> </NodeData><!--node Data-->
<ImageIndex> </ImageIndex><!--node picture-->
<Creator> </Creator><!--Creator-->
<rightdepartmen>| Development Department |</rightdepartmen><!--Department that has the right to this directory-->
<RightUser> </RightUser><!--Users who have the right to this directory-->
<Lock> </Lock><!--whether to lock 0/1-->
</NodeItem>
...
</NaviTree>
which
NodeName: Refers to the node name, if there is a parent node, to include the ancestor node name, the node name between the symbol "\" separated. Example "my desk \ Bulletin notification \ e-mail" indicates that the root node is "My desk", the parent node is "announcement notification" and this node is "e-mail". If ask you to contain five level of node name is how, hehe, don't take tomatoes to throw me!
NodeType: node type, generally refers to "href".
ImageIndex: A small icon that appears before the name of the node, where 0 represents a folder-like icon and 4 represents a data-table icon.
Here is an XML format document source code:
<?xml version= "1.0" encoding= "GB2312"?>
<NaviTree>
<NodeItem>
<NodeName> my desk </NodeName><!--node name-->
<NodeType>href</NodeType><!--Node Type-->
<NodeData>MyDesk.aps</NodeData><!--Node Data-->
<Lock>0</Lock><!--is locked 0/1-->
<ImageIndex>0</ImageIndex>
</NodeItem>
<NodeItem>
<NodeName> my desk \ Announcement Notification </NodeName><!--node name-->
<NodeType>href</NodeType><!--Node Type-->
<NodeData> Notice .aps</nodedata><!--node data-->
<Lock>0</Lock><!--is locked 0/1-->
<ImageIndex>0</ImageIndex>
</NodeItem>
<NodeItem>
<NodeName> my desk \ Bulletin notification \ e-mail </NodeName><!--node name-->
<ImageIndex>0</ImageIndex>
</NodeItem>
<NodeItem>
<NodeName> my desk/announcement notification \ e-mail inbox </NodeName><!--node name-->
<ImageIndex>4</ImageIndex>
</NodeItem>
<NodeItem>
<NodeName> my desk/announcement notification \ e-mail \ Outbox </NodeName><!--node name-->
<ImageIndex>4</ImageIndex>
</NodeItem>
<NodeItem>
<NodeName> my desk \ Bulletin notification \ e-mail \ Sent messages </NodeName><!--node name-->
</NodeItem>
<NodeItem>
<NodeName> my desk \ Schedule </NodeName><!--node name-->
<ImageIndex>0</ImageIndex>
</NodeItem>
<NodeItem>
<NodeName> my desk \ schedule \ calendar </NodeName><!--node name-->
</NodeItem>
</NaviTree>
2. Code implementation
Notify the Chi Island Directory tree control to open an XML document with the following statement: