/**
 * @author Tomasz Śmietanka
 */
Ext.ns('Ext.parafiada');

Ext.parafiada.PrintPreview = Ext.extend(Ext.Window, {
    title: 'Podgląd Wydruku',
    initComponent: function(){
        // hard coded (cannot be changed from outside)
        this.iframe = new Ext.ux.ManagedIframePanel({
            collapsible: false,
            loadMask: true,
            frameConfig: {
                scrolling: 'yes'
            },
            listeners: {
                domready: function(frame){
                	console.log('DOMREADY', frame);
                },
                documentloaded: function(frame){
                    console.log('docloaded', frame);
                }
            },
			autoLoad: {
				url: this.url+'html',
				params: this.params
				}
        });
        var config = {
            layout: 'fit',
            width: 640,
            height: 480,
            shim: false,
            animCollapse: false,
            constrainHeader: false,
            items: [this.iframe],
            buttons: [{
                text: 'Drukuj',
                handler: function(){
                    this.iframe.getFrame().print();
                },
                scope: this
            }, {
                text: 'Anuluj',
                handler: function(){
                    this.close();
                },
                scope: this
            }]
        };
        Ext.apply(this, config);
        Ext.apply(this.initialConfig, config);
        Ext.parafiada.PrintPreview.superclass.initComponent.apply(this, arguments);
    }
});

