﻿Ext.ux.ClientFileGridPanel = Ext.extend(Ext.ux.GenericDeviceGridPanel, {

    // standard initializer
    initComponent: function() {
        Ext.ux.ClientFileGridPanel.superclass.initComponent.apply(this, arguments);

        // args have to go here as base class initComponent doesn't get called for some reason
        var config = {
            view: new Ext.ux.ClientFileGridView({ scrollOffset: g_gridScrollOffset })
        };

        Ext.apply(this, config);
        Ext.apply(this.initialConfig, config);

        this.on('rowcontextmenu', this.onRowContextMenu, this);
    },


    // ------ event handler functions ------ //
    
    // row context menu
    onRowContextMenu: function(grid, rowIndex, e) {
        this.contextMenu = this.createActionsContextMenu(grid, rowIndex);

        Ext.ux.ClientFileGridPanel.superclass.onRowContextMenu.call(this, grid, rowIndex, e);
    },


    // ------ context menu creation helper functions ------ //

    // create the context menu
    createActionsContextMenu: function(grid, rowIndex) {
        var contextMenu = this.createEmptyActionsContextMenu();
        
        contextMenu = this.addStreamingMenuItems(contextMenu, rowIndex);

        // add any generic menu items
        contextMenu = this.addGenericMenuItems(grid, contextMenu, rowIndex);

        return contextMenu;
    }
});

Ext.ux.ClientFileGridView = Ext.extend(Ext.ux.GenericDeviceGridView, { 
});

Ext.ux.ClientFileGridDragZone = Ext.extend(Ext.ux.GenericDeviceGridDragZone, {
});