def traverse node=@root, level=0
      icon = node.is_leaf? ? "-" : "+"
      puts "%*s %s" % [ level+1, icon,  node.user_object ]
      node.children.each do |e| 
        traverse e, level+1
      end
    end
def traverse node=@root, level=0
      icon = node.is_leaf? ? "-" : "+"
      puts "%*s %s" % [ level+1, icon,  node.user_object ]
      node.children.each do |e| 
        traverse e, level+1
      end
    end
def ask_search_forward
regex = get_string "Enter regex to search for:"
ix = get_list_data_model.find_match regex
if ix.nil?
alert("No matching data for: #{regex}")
else
set_focus_on(ix)
end
end
 continues previous search

def find_match regex, ix0=0, ix1=row_count()
$log.debug " find_match got #{regex} #{ix0} #{ix1}"
@last_regex = regex
@search_start_ix = ix0
@search_end_ix = ix1
@data.each_with_index do |row, ix|
next if ix < ix0
break if ix > ix1
if row.grep(/#{regex}/) != []
if !row.match(regex).nil?
@search_found_ix = ix
return ix
end
end
return nil
end
def find_prev regex=@last_regex, start = @search_found_ix
raise "No previous search" if @last_regex.nil?
$log.debug " find_prev #{@search_found_ix} : #{@current_index}"
start -= 1 unless start == 0
@last_regex = regex
@search_start_ix = start
start.downto(0) do |ix|
row = @data[ix]
if row.grep(/#{regex}/) != []
@search_found_ix = ix
return ix
end
end
return nil
return find_match @last_regex, start, @search_end_ix
end
 dtm findnext
def find_next
raise "No more search" if @last_regex.nil?
start = @search_found_ix && @search_found_ix+1 || 0
return find_match @last_regex, start, @search_end_ix
end
 just a test program