Source: control/ToolBarSeparator.js

/**
 * Created with IntelliJ IDEA.
 * User: seeker910
 * Date: 13-10-24
 * Time: 下午10:20
 * To change this template use File | Settings | File Templates.
 */
/*
 * */
Rsd.define('Rsd.control.ToolBarSeparator', {
    extend: 'Rsd.control.Component',
    xtype: 'tbSeparator',
    cls: 'x-tool-bar',
    separatorText:'|',
    src:'',
    ctrlTagName:'nobr',
    items: [],
    layout: {
        type: 'hbox',
        align: 'center'
    },
    width: 30,
    height: 30,
    /**
     * 
     * @param {*} config 
     */
    constructor: function constructor(config) {
        config = config || {};
        this.apply(config);
        var me = this;
        if(me.src && me.src.length > 0)
        {
            me.ctrlTagName = 'img';
        }
        me.on('afterrender',function(){
            if( me.ctrlTagName == 'img'){
                me.ctrl.element.src = me.src;
            }
             if( me.ctrlTagName == 'nobr')
             {
                 me.ctrl.element.appendChild(document.createTextNode(me.separatorText));
                 me.ctrl.element.style.textAlign = "center";
             }
        });
    },
     /**
     * 
     */
    onAfterLayout:function onAfterLayout()
    {
        if(Rsd.isNumber(this.height))
        {
            this.ctrl.element.style.lineHeight = this.height+ 'px';
            this.label.element.style.lineHeight = this.height+ 'px';
        }
        this.callParent();
    }
});