def data alist=nil
      # if nothing passed, print an empty root, rather than crashing
      alist = [] if alist.nil?
      @data = alist # data given by user
      case alist
      when Array
        @treemodel = Canis::DefaultTreeModel.new("/")
        @treemodel.root.add alist
      when Hash
        @treemodel = Canis::DefaultTreeModel.new("/")
        @treemodel.root.add alist
      when TreeNode
        # this is a root node
        @treemodel = Canis::DefaultTreeModel.new(alist)
      when DefaultTreeModel
        @treemodel = alist
      else
        if alist.is_a? DefaultTreeModel
          @treemodel = alist
        else
          raise ArgumentError, "Tree does not know how to handle #{alist.class} "
        end
      end
      # we now have a tree
      raise "I still don't have a tree" unless @treemodel
      set_expanded_state(@treemodel.root, true)
      convert_to_list @treemodel
      
      # added on 2009-01-13 23:19 since updates are not automatic now
      #@list.bind(:LIST_DATA_EVENT) { |e| list_data_changed() }
      #create_default_list_selection_model TODO
      fire_dimension_changed
      self
    end
def data alist=nil
      # if nothing passed, print an empty root, rather than crashing
      alist = [] if alist.nil?
      @data = alist # data given by user
      case alist
      when Array
        @treemodel = Canis::DefaultTreeModel.new("/")
        @treemodel.root.add alist
      when Hash
        @treemodel = Canis::DefaultTreeModel.new("/")
        @treemodel.root.add alist
      when TreeNode
        # this is a root node
        @treemodel = Canis::DefaultTreeModel.new(alist)
      when DefaultTreeModel
        @treemodel = alist
      else
        if alist.is_a? DefaultTreeModel
          @treemodel = alist
        else
          raise ArgumentError, "Tree does not know how to handle #{alist.class} "
        end
      end
      # we now have a tree
      raise "I still don't have a tree" unless @treemodel
      set_expanded_state(@treemodel.root, true)
      convert_to_list @treemodel
      
      # added on 2009-01-13 23:19 since updates are not automatic now
      #@list.bind(:LIST_DATA_EVENT) { |e| list_data_changed() }
      #create_default_list_selection_model TODO
      fire_dimension_changed
      self
    end
def data alist = nil # if nothing passed, print an empty root, rather than crashing alist = [ ] if alist . nil? @data = alist # data given by user case alist when Array @treemodel = Canis :: DefaultTreeModel . new ( "/" ) @treemodel . root . add alist when Hash @treemodel = Canis :: DefaultTreeModel . new ( "/" ) @treemodel . root . add alist when TreeNode # this is a root node @treemodel = Canis :: DefaultTreeModel . new ( alist ) when DefaultTreeModel @treemodel = alist else if alist . is_a? DefaultTreeModel @treemodel = alist else raise ArgumentError , "Tree does not know how to handle #{alist.class} " end end # we now have a tree raise "I still don't have a tree" unless @treemodel set_expanded_state ( @treemodel . root , true ) convert_to_list @treemodel # added on 2009-01-13 23:19 since updates are not automatic now #@list.bind(:LIST_DATA_EVENT) { |e| list_data_changed() } #create_default_list_selection_model TODO fire_dimension_changed self end
pass data to create this tree model
 used to be list
pass data to create this tree model used to be list