﻿Ext.ux.CloudMetadataGridPanel = Ext.extend(Ext.ux.MetadataGridPanel, {

    // standard initializer
    initComponent: function() {
        Ext.ux.CloudMetadataGridPanel.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.CloudMetadataGridView({ 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.CloudMetadataGridPanel.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.addMetadataStreamingMenuItems(contextMenu, rowIndex);

        // add any generic menu items
        contextMenu = this.addGenericMenuItems(grid, contextMenu, rowIndex);

        return contextMenu;
    }
});

Ext.ux.CloudMetadataGridView = Ext.extend(Ext.ux.MetadataGridView, {
});

Ext.ux.CloudMetadataGridDragZone = Ext.extend(Ext.ux.MetadataGridDragZone, {  
});