TabgenNavigationPanel = function()
{
    //-----< create tree nodes >------------------------------------------------
    this.root_node = new Ext.tree.TreeNode({
        text: 'Tabellengenerator',
        draggable:false,
        id:0
    });
    this.step1_node = new Ext.tree.TreeNode({
        text:'1 Start',
        iconCls:'file',
        leaf:true,
        draggable:false,
        id:1
    });
    this.step2_node = new Ext.tree.TreeNode({
        text:'2 Merkmale',
        iconCls:'file',
        leaf:true,
        disabled:true,
        draggable:false,
        id:2
    });
    this.step3_node = new Ext.tree.TreeNode({
        text:'3 Regionaleinheiten',
        iconCls:'file',
        leaf:true,
        disabled:true,
        draggable:false,
        id:3
    });
    this.step4_node = new Ext.tree.TreeNode({
        text:'4 Zeiteinheiten',
        iconCls:'file',
        leaf:true,
        disabled:true,
        draggable:false,
        id:4
    });
    this.step5_node = new Ext.tree.TreeNode({
        text:'5 Fertigstellen',
        iconCls:'file',
        leaf:true,
        disabled:true,
        draggable:false,
        id:5
    });
    this.root_node.appendChild(this.step1_node);
    this.root_node.appendChild(this.step2_node);
    this.root_node.appendChild(this.step3_node);
    this.root_node.appendChild(this.step4_node);
    this.root_node.appendChild(this.step5_node);
    //-----< call parent constructor >------------------------------------------
    ArticleNavigationPanel.superclass.constructor.call(this, {
        animate : true,
        enableDD : false,
        rootVisible : false,
        lines : false,
        border : true,
        autoScroll : true,
        collapseFirst : false,
        singleExpand : false,
        root : this.root_node,
        tbar : [{
            text : 'Neue Tabelle',
            disabled : false,
            handler : this.onToolbarNewTableButtonClick,
            scope : this
        }]
    });
    //-----< additional tasks after parents constructor has run >---------------
    this.addEvents({newtable:true});
    this.addEvents({selectstep:true});
    this.on('click', this.onClick, this);
    this.on('show', this.onShowMe, this);
};

//-----< define new class MerkmalePanel >---------------------------------------
Ext.extend(TabgenNavigationPanel, Ext.tree.TreePanel,
{

    // private
    onShowMe : function(panel)
    {
        if(!(this.step1_node.disabled))
        {
            this.step1_node.select();
        }
    },

    // private
    onClick : function(node)
    {
        if(node.disabled)
        {
            // prevent selection change
            return(false);
        }
        else
        {
            return(this.fireEvent('selectstep', (node.id - 1) ));
        }
    },

    setActive : function(state)
    {
        if(state)
        {
            this.step2_node.enable();
            this.step3_node.enable();
            this.step4_node.enable();
            this.step5_node.enable();
            this.step2_node.select();
            this.step1_node.disable();
            this.fireEvent('selectstep', (this.step2_node.id - 1) );
        }
        else
        {
            this.step1_node.enable();
            this.step1_node.select();
            this.step2_node.disable();
            this.step3_node.disable();
            this.step4_node.disable();
            this.step5_node.disable();
            this.fireEvent('selectstep', (this.step1_node.id - 1) );
        }
    },

    gotoStep : function(step)
    {
        if(step==1)
        {
            this.step2_node.select();
        }
        else if(step==2)
        {
            this.step3_node.select();
        }
        else if(step==3)
        {
            this.step4_node.select();
        }
        else if(step==4)
        {
            this.step5_node.select();
        }
    },

    // private
    onToolbarNewTableButtonClick : function()
    {
        Ext.MessageBox.confirm('Bestätigen','Hiermit gehen alle Ihre bisherigen Einstellungen verloren.<br>Möchten Sie fortfahren?',this.onToolbarNewTableButtonConfirm,this);
    },

    // private
    onToolbarNewTableButtonConfirm : function(btn)
    {
        if(btn != 'yes')
        {
            return;
        }
        this.fireEvent('newtable');
    }

});
