MY Flybean v1.00 documentation

xiaoxiao2021-03-06  44

Written in front: flybean is my sister's net name, she said that she will fly, I usually call her sister, although she is my wife, or she is two years old, this is my release The first open source thing is dedicated to her. - Sister, my brother loves you!

My Flybean v1.00 did not have a strict test, it was only successful in IE6.0, because I didn't have it, I would like to have a good test if there are many people like it. This will have a good test. Otherwise it is meaningless. I welcome friends to send me an email: huzhou-cq@163.com

Method's Note I try to make it clear, but the parameter or return value of the JavaScript method is not type. I can't say this is not good, but I may not be convenient to read the source code, so I added the class and type in Java. Describe these parameters or the type of return value. The JavaScript class has no access control, so you can directly access the properties in the class, but this may not be good, so if you want to access the property, try to use the method I offer, although this will add the code you write.

I have also added the function of directly editing the tree node, but later I found that this is not used, my sister thinks so, so I will fall. I also plan to add drag and drop, but I don't know how to use the onDragStart method, because the mouse is displayed as disabled when dragging and drop, I don't know how to make the mouse arrow as default. If you know, please give me an email, thank you very much. But it is easy to operate the node to add a tree that is changed, and it is not difficult to achieve drag and drop.

This tree can be displayed in the POPUP window, but the dynamic load subpost cannot be realized in POPUP. If I can solve this problem, I will reflect in the next version.

Some terms in the document may not be accurate, but I still have to argue what I mean: the so-called document object is the Document object. This is a term in the DOM. We often use window.document as a reference to this object (Reference " ). "HTML object" may be a term I found, which means some HTML elements, such as Table element objects. The ELEMENT class is also in the DOM, which is the type of element in HTML.

1. The FlyBean class This class is used to construct a tree object, depending on some HTML elements, and operate the state of these elements to implement the operation of the tree object. I also defined an element Checkbox, which represents the check box of the node in the tree. Below is the method of the FlyBean class and the properties that can be directly accessed, and some of which is actually not much.

1. The construction method of the tree object. FlyBean can be changed, if you may use my code in the future, please don't change. / ** * Tree object and load the CSS file and the icon resource of the tree * String Context application name, the default image resource of the tree in the * application's root directory, * / Context / images / trees / *. GIF to access, * If it is null, the default is "." * String ParentNodeID tree's ID, the so-called parent object, * actually the father of the HTML object relying on the tree The node, the tree will * display it in it, this value is a must-have * Document Doc, the document object for the tree object * String ID * String Target Link target frame * int Width tree width * int HEIGHT Tree High * Boolean ShowCheckbox Node Take check box * * Note: Generate the code of the tree and its nodes, there is no method such as Document.Write *, so you can specify the defer keyword in the Script tag, * Set the parameter Target as NULL or "_Self" to improve the resolution speed of HTML * / function flybean (CONTEXT, PARENTNODEID, DOC, ID, TARGET, WIDTH, TARGHT, ShowCheckbox) set the parameter Target as NULL or "_Self", while thinking that the link to open the node in the current window It may not be very useful, such as in Dialog, this may be my mistake, I escape this wrong way is to join , I didn't add you, because you It may be added. Of course, if the target is the name of the actual window, it will be useful. Although there are two parameters of Width and Height, even if I use this tree, I don't use them, I think they are not very useful, but you can still improve it according to your needs.

2. Retrieve the document object in the tree object, Document GetDocument ()

3. Search the HTML object of the tree dependent ELEMENT GETParentNode ()

4. Retrieving the HTML object dependent by the tree, Element GetTable ()

5. Search or set the ID value of the HTML object relying on the tree String getId () Void SetId (String ID)

6. Search or set the CSS of the HTML object of the tree, the value of the CSS of the HTML object, String getStyle () void setStyle (String classname)

7. Retrieve the icon of the tree imageList object, you can change the tree by operating this object to change the tree IMAGELIST GetImages ()

8. Retrieve the style table TreeStylesheet object of the tree object, you can change the style of the tree by operating this object, please see the trestylesheet class for the Trestylesheet Gettrestylesheet ()

9. Retrieve or set the default target framework for the link of the node in the tree, this property should set the string getTARGET () void setTarget before adding nodes in the tree.

10. Retrieve or set up the node in the tree to display the properties of the check box, this property change does not affect the nodes in the tree, the default is the node does not display the check box Boolean getShowCheckbox () Void getShowCheckBox (Boolean SC) 11 Retrieve or set the node check box status change in the tree, which affects the degree of child nodes, and defaults to not affect the parameter description of the int GETNODECHECHECKFORCE method, see the class property description of the FlyBean.

12. Retrieve the root node of the tree Treenode getRootnode ()

13. Add a root node / ** * String Text root node text * String Link root node link * String id * html object ID * String Target root node Link target framework * / Treenode appendrootnode (Text , Link, ID, Target

14. Search Tree Current Node Treenode getSelectedNode ()

15. Retrieve the check box Select the section Treenode [] getCheckedNodes ()

16. Expand all the nodes in the tree, but if there is a dynamically loaded node in the tree, the method is invalid vid expand ()

17. Return to the node object in the tree by the node's index Treenode getNodeByindex (int index)

18. Retrieve the node object according to the node ID value, if there are multiple nodes of the ID value equal to the incoming parameters, returns the array of these nodes Treenode getNodeByid (String ID) Treenode [] GetNodeById (String ID)

19. Delete the root node of the tree, the plus parameter is the same as the declaration of the Treenode's RemoveChild method, the method returns the method of deleting from the node Treenode RemoveChild (Treenode root)

20. Object information, this method only returns a string "[Object Tree]" String Tostring ()

21. The following two attributes are the callback method of the tree object mouse event. Its definition may be: function (Tree, Node), the event processor will introduce the tree object and the node of the current mouse event into this method, If you click the event not happen on a node, the second parameter will be null, if this method returns false, the event will be canceled, no more

l OnClick If you click on the node in the tree, call this method.

l OnContextMenu If you use the mouse to go back to the event of the node in the tree, call this method.

22. Class properties, the following class attribute indicates the influence of the node selection status by its parent node check box, which as the parameter of the call method setNodeCheckforce

l FlyBean.unaffected_on_check = 0; the child node is not affected by the selection node check box

l FlyBean.Affected_on_check = 1; the direct child node is affected when the node check box is selected.

l flybean.deep_affected_on_check = 2; all the children and grandchildren nodes are affected when the node check box is selected

l FlyBean.unaffected_on_cancel = 0; the sub-node is not affected when the Node check box is canceled.

l FlyBean.Affected_on_cancel = 256; Direct child node is affected when the Cancel Node check box is

l flybean.deep_affected_on_cancel = 512; All children and grandchildren are affected by it when the Cancel Node check box is removed:

(1) When selecting a node, it is also selected for its direct child node tree.setnodeCheckforce (flybean.affected_on_check)

(2) When the node is canceled, all of its children will be canceled Tree.SetNodeCheckforce (flybean.deep_affected_on_cancel)

(3) When selecting the node, select all the children and grandchildren's nodes, when the node is canceled, does not affect its child node tree.setnodeCheckforce (flybean.deep_affected_on_check | flybean.deep_affected_on_cancel)

转载请注明原文地址:https://www.9cbs.com/read-67043.html

New Post(0)