Documentation ¶
Index ¶
- type IdTree
- func (t *IdTree) Add(parent Ider, child Ider)
- func (t *IdTree) Children(parent Ider) []Ider
- func (t *IdTree) Clear()
- func (t *IdTree) Get(id string) Ider
- func (t *IdTree) GetAll() []Ider
- func (t *IdTree) Parent(child Ider) Ider
- func (t *IdTree) Remove(item Ider)
- func (t *IdTree) RemoveChildren(parent Ider)
- func (t *IdTree) Root(child Ider) Ider
- type Ider
- type LruCache
- type TreeNode
- func (n *TreeNode) AddChildNode(c TreeNodeI)
- func (n *TreeNode) ChildNodes() []TreeNodeI
- func (n *TreeNode) Init(self TreeNodeI)
- func (n *TreeNode) ParentNode() TreeNodeI
- func (n *TreeNode) RemoveAllChildNodes()
- func (n *TreeNode) RemoveChildNode(c TreeNodeI)
- func (n *TreeNode) SetParent(p TreeNodeI)
- func (n *TreeNode) TopNode() TreeNodeI
- type TreeNodeI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IdTree ¶
The IdTree is a collection of Ider objects in a tree structure. Objects must have a unique id within the structure. It is likely that each of your objects will need a pointer to the IdTree to manipulate it, but that is an implementation dependant thing
func (*IdTree) RemoveChildren ¶
Remove all child controls
type Ider ¶
type Ider interface {
ID() string
}
Any object that returns a string id can be stored in the tree.
type LruCache ¶
LruCache is a kind of LRU cache. Objects that are too old are removed, and if the cache is full, the oldest item(s) will be removed. When an item is set more than once, it is pushed to the end so its last to be removed. Limits are approximate, as garbage collecting will randomly happen. Also, in order to prevent memory thrashing, strict order is not preserved, but items will fall out more or less in LRU order. Someday we may offer a backing store version to extend the size of the cache to disk or some other kind of storage
func NewLruCache ¶
Create and return a new cache. maxItemCount is the maximum number of items the cache can hold ttl is the age in seconds past when items will be removed
type TreeNode ¶
type TreeNode struct {
// contains filtered or unexported fields
}
A kind of mixin for anything that controls child controls, which are all controls, but also the top level form or page Creates a parent/child tree of controls that is used by the drawing code to draw the controls
func (*TreeNode) AddChildNode ¶
addChildNode adds the given node as a child of the current node
func (*TreeNode) ChildNodes ¶
func (*TreeNode) ParentNode ¶
func (*TreeNode) RemoveAllChildNodes ¶
func (n *TreeNode) RemoveAllChildNodes()
func (*TreeNode) RemoveChildNode ¶
The central removal function. Manages the entire remove process. Other removal functions should call here.
type TreeNodeI ¶
type TreeNodeI interface { AddChildNode(TreeNodeI) RemoveAllChildNodes() RemoveChildNode(TreeNodeI) ParentNode() TreeNodeI SetParent(TreeNodeI) TopNode() TreeNodeI ChildNodes() []TreeNodeI }
An interface and structure together that can turn any struct into a tree structure with parent/child relationships To use it, simply embed the TreeNode structure into another structure and call Init. This TreeNodeI structure will be convertable to the parent object