The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gtk2::Ex::TreeMaker::FlatInterface - This module is not to be used directly. It is called from Gtk2::Ex::TreeMaker as a utility module.

DESCRIPTION

This module contains a utility method sub flat_to_tree. This utility method will accept an array of arrays (a set of relational records) as its input and then return a treelike data structure that is in-turn used by the Gtk2::Ex::TreeMaker to spin the Gtk2::TreeModel.

METHODS

Gtk2::Ex::TreeMaker::FlatInterface->new

Accepts no arguments. Just returns a reference to the object

Gtk2::Ex::TreeMaker::FlatInterface->flat_to_tree

Accepts an array of arrays (a set of relational records) as its input. Returns a special tree-like data structure that is then used by the Gtk2::Ex::TreeMaker to spin the Gtk2::TreeModel.

Here is a sample input:

        my $recordset = [
                ['Texas','Dallas','Fruits','Dec-2003','300',0,1,'red'],
                ['Texas','Dallas','Veggies','Jan-2004','120',1,0,'blue'],
                ['Texas','Austin','Fruits','Nov-2003','310',1,1,'white'],
        ];

Here is the corresponding output:

   my $output = {
          'Node' => [
                      {
                        'Node' => [
                                    {
                                      'Node' => [
                                                  {
                                                    'Node' => [
                                                                {
                                                                  'text' => '310',
                                                                  'editable' => 1,
                                                                  'background' => 'white',
                                                                  'hyperlinked' => 1,
                                                                  'Name' => 'Nov-2003'
                                                                }
                                                              ],
                                                    'Name' => 'Fruits'
                                                  }
                                                ],
                                      'Name' => 'Austin'
                                    },
                                    {
                                      'Node' => [
                                                  {
                                                    'Node' => [
                                                                {
                                                                  'text' => '120',
                                                                  'editable' => 1,
                                                                  'background' => 'blue',
                                                                  'hyperlinked' => 0,
                                                                  'Name' => 'Jan-2004'
                                                                }
                                                              ],
                                                    'Name' => 'Veggies'
                                                  },
                                                  {
                                                    'Node' => [
                                                                {
                                                                  'text' => '300',
                                                                  'editable' => 0,
                                                                  'background' => 'red',
                                                                  'hyperlinked' => 1,
                                                                  'Name' => 'Dec-2003'
                                                                }
                                                              ],
                                                    'Name' => 'Fruits'
                                                  }
                                                ],
                                      'Name' => 'Dallas'
                                    }
                                  ],
                        'Name' => 'Texas'
                      }
                    ],
          'Name' => 'ROOT'
        };

This data structure is really the key input into the Gtk2::Ex::TreeMaker module. If you can provide this data structure through external means, then we can build Gtk2::Ex::TreeMaker using that. More on this later...

AUTHOR

Ofey Aikon, <ofey.aikon at gmail dot com>

BUGS

You tell me. Send me an email !

ACKNOWLEDGEMENTS

To the wonderful gtk-perl-list

COPYRIGHT & LICENSE

Copyright 2004 Ofey Aikon, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.