class Tk::BLT::Tree::Node
Constants
- TreeNodeID_TBL
Public Class Methods
Source
# File lib/tkextlib/blt/tree.rb, line 23 def self.id2obj(tree, id) tpath = tree.path TreeNodeID_TBL.mutex.synchronize{ if TreeNodeID_TBL[tpath] if TreeNodeID_TBL[tpath][id] TreeNodeID_TBL[tpath][id] else begin # self.new(tree, nil, 'node'=>Integer(id)) id = Integer(id) if bool(tk_call(@tpath, 'exists', id)) (obj = self.allocate).instance_eval{ @parent = @tree = tree @tpath = tpath @path = @id = id TreeNodeID_TBL[@tpath] = {} unless TreeNodeID_TBL[@tpath] TreeNodeID_TBL[@tpath][@id] = self } obj else id end rescue id end end else id end } end
Source
# File lib/tkextlib/blt/tree.rb, line 55 def self.new(tree, parent, keys={}) keys = _symbolkey2str(keys) tpath = tree.path TreeNodeID_TBL.mutex.synchronize{ TreeNodeID_TBL[tpath] ||= {} if (id = keys['node']) && (obj = TreeNodeID_TBL[tpath][id]) keys.delete('node') tk_call(tree.path, 'move', id, parent, keys) if parent return obj end (obj = self.allocate).instance_eval{ initialize(tree, parent, keys) TreeNodeID_TBL[tpath][@id] = self } obj } end
Source
# File lib/tkextlib/blt/tree.rb, line 75 def initialize(tree, parent, keys={}) @parent = @tree = tree @tpath = @parent.path if (id = keys['node']) && bool(tk_call(@tpath, 'exists', id)) @path = @id = id keys.delete('node') tk_call(@tpath, 'move', @id, parent, keys) if parent else parent = tk_call(@tpath, 'root') unless parent @path = @id = tk_call(@tpath, 'insert', parent, keys) end end
Public Instance Methods
Source
# File lib/tkextlib/blt/tree.rb, line 93 def apply(keys={}) @tree.apply(@id, keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 102 def copy(parent, keys={}) @tree.copy(@id, parent, keys) end
Source
# File lib/tkextlib/blt/tree.rb, line 105 def copy_to(dest_tree, parent, keys={}) @tree.copy_to(@id, dest_tree, parent, keys) end
Source
# File lib/tkextlib/blt/tree.rb, line 126 def dump_to_file(file) @tree.dump_to_file(@id, file) self end
Source
# File lib/tkextlib/blt/tree.rb, line 131 def exist?(keys={}) @tree.exist?(@id, keys) end
Source
# File lib/tkextlib/blt/tree.rb, line 135 def find(keys={}) @tree.find(@id, keys) end
Source
# File lib/tkextlib/blt/tree.rb, line 139 def find_child(label) @tree.find_child(@id, label) end
Source
# File lib/tkextlib/blt/tree.rb, line 143 def first_child() @tree.first_child(@id) end
Source
# File lib/tkextlib/blt/tree.rb, line 150 def get_value(key, default_val=None) @tree.get_value(@id, key, default_val) end
Source
# File lib/tkextlib/blt/tree.rb, line 172 def label(text = nil) @tree.label(@id, nil) end
Source
# File lib/tkextlib/blt/tree.rb, line 175 def label=(text) @tree.label(@id, text) end
Source
# File lib/tkextlib/blt/tree.rb, line 179 def last_child() @tree.last_child(@id) end
Source
# File lib/tkextlib/blt/tree.rb, line 183 def move(dest, keys={}) @tree.keys(@id, dest, keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 192 def next_sibling() @tree.next_sibling(@id) end
Source
# File lib/tkextlib/blt/tree.rb, line 212 def prev_sibling() @tree.prev_sibling(@id) end
Source
# File lib/tkextlib/blt/tree.rb, line 216 def restore(str, keys={}) @tree.restore(@id, str, keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 225 def restore_from_file(file, keys={}) @tree.restore_from_file(@id, file, keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 220 def restore_overwrite(str, keys={}) @tree.restore_overwrite(@id, str, keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 229 def restore_overwrite_from_file(file, keys={}) @tree.restore_overwrite_from_file(@id, file, keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 239 def set(data) @tree.set(@id, data) self end
Source
# File lib/tkextlib/blt/tree.rb, line 248 def sort(keys={}) @tree.sort(@id, keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 257 def unset(*keys) @tree.unset(@id, *keys) self end
Source
# File lib/tkextlib/blt/tree.rb, line 262 def values(key=None) @tree.values(@id, key) end