13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='Ext-panel-Header'>/**
</span> * Simple header class which is used for on {@link Ext.panel.Panel} and {@link Ext.window.Window}.
 */
Ext.define('Ext.panel.Header', {
    extend: 'Ext.container.Container',
    uses: ['Ext.panel.Tool', 'Ext.util.CSS', 'Ext.layout.component.Body', 'Ext.Img'],
    alias: 'widget.header',
 
<span id='Ext-panel-Header-property-isHeader'>    /**
</span>     * @property {Boolean} isHeader
     * `true` in this class to identify an object as an instantiated Header, or subclass thereof.
     */
    isHeader       : true,
<span id='Ext-panel-Header-cfg-defaultType'>    defaultType    : 'tool',
</span><span id='Ext-panel-Header-property-indicateDrag'>    indicateDrag   : false,
</span><span id='Ext-panel-Header-property-weight'>    weight         : -1,
</span><span id='Ext-panel-Header-cfg-componentLayout'>    componentLayout: 'body',
</span>
<span id='Ext-panel-Header-cfg-titleAlign'>    /**
</span>     * @cfg {String} [titleAlign]
     * The alignment of the title text within the available space between the
     * icon and the tools.
     *
     * May be `&quot;left&quot;`, `&quot;right&quot;` or `&quot;center&quot;`. Defaults to the browser's natural
     * behavior depending on the css direction property - `&quot;left&quot;` when direction
     * is ltr  and `&quot;right&quot;` when direction is rtl
     * (see {@link Ext.AbstractComponent#rtl}).
     */
 
    childEls: [
        'body'
    ],
 
<span id='Ext-panel-Header-cfg-renderTpl'>    renderTpl: [
</span>        '&lt;div id=&quot;{id}-body&quot; class=&quot;{headerCls}-body {baseCls}-body {bodyCls} {bodyTargetCls}',
        '&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-body-{parent.ui}-{.}&lt;/tpl&gt;&quot;',
        '&lt;tpl if=&quot;bodyStyle&quot;&gt; style=&quot;{bodyStyle}&quot;&lt;/tpl&gt;&gt;',
            '{%this.renderContainer(out,values)%}',
        '&lt;/div&gt;'
    ],
 
<span id='Ext-panel-Header-property-headingTpl'>    headingTpl: [
</span>        // unselectable=&quot;on&quot; is required for Opera, other browsers inherit unselectability from the header
        '&lt;span id=&quot;{id}-textEl&quot; class=&quot;{headerCls}-text {cls}-text {cls}-text-{ui}&quot; unselectable=&quot;on&quot;&gt;{title}&lt;/span&gt;'
    ],
 
<span id='Ext-panel-Header-cfg-shrinkWrap'>    shrinkWrap: 3,
</span>
<span id='Ext-panel-Header-cfg-title'>    /**
</span>     * @cfg {String} title
     * The title text to display.
     */
 
<span id='Ext-panel-Header-cfg-titlePosition'>    /**
</span>     * @cfg {Number} [titlePosition]
     * The ordinal position among the header items (tools and other components specified using the {@link #cfg-items} config)
     * at which the title component is inserted. See {@link Ext.panel.Panel#cfg-header Panel's header config}.
     *
     * If not specified, the title is inserted after any {@link #cfg-items}, but *before* any {@link Ext.panel.Panel#tools}.
     *
     * Note that if an {@link #icon} or {@link #iconCls} has been configured, then the icon component will be the
     * first item before all specified tools or {@link #cfg-items}. This configuration does not include the icon.
     */
    titlePosition: 0,
 
<span id='Ext-panel-Header-cfg-iconCls'>    /**
</span>     * @cfg {String} iconCls
     * CSS class for an icon in the header. Used for displaying an icon to the left of a title.
     */
 
<span id='Ext-panel-Header-cfg-icon'>    /**
</span>     * @cfg {String} icon
     * Path to image for an icon in the header. Used for displaying an icon to the left of a title.
     */
 
<span id='Ext-panel-Header-cfg-glyph'>    /**
</span>     * @cfg {Number/String} glyph
     * A numeric unicode character code to use as the icon for the panel header. The
     * default font-family for glyphs can be set globally using
     * {@link Ext#setGlyphFontFamily Ext.setGlyphFontFamily()}. Alternatively, this
     * config option accepts a string with the charCode and font-family separated by the
     * `@` symbol. For example '65@My Font Family'.
     */
 
<span id='Ext-panel-Header-property-headerCls'>    // a class for styling that is shared between panel and window headers
</span>    headerCls: Ext.baseCSSPrefix + 'header',
 
<span id='Ext-panel-Header-method-initComponent'>    initComponent: function() {
</span>        var me = this,
            hasPosition = me.hasOwnProperty('titlePosition'),
            items = me.items,
            titlePosition = hasPosition ? me.titlePosition : (items ? items.length : 0),
            uiClasses = [me.orientation, me.getDockName()],
            ownerCt = me.ownerCt;
 
        me.addEvents(
<span id='Ext-panel-Header-event-click'>            /**
</span>             * @event click
             * Fires when the header is clicked. This event will not be fired
             * if the click was on a {@link Ext.panel.Tool}
             * @param {Ext.panel.Header} this
             * @param {Ext.EventObject} e
             */
            'click',
 
<span id='Ext-panel-Header-event-dblclick'>            /**
</span>             * @event dblclick
             * Fires when the header is double clicked. This event will not
             * be fired if the click was on a {@link Ext.panel.Tool}
             * @param {Ext.panel.Header} this
             * @param {Ext.EventObject} e
             */
            'dblclick'
        );
 
        me.indicateDragCls = me.headerCls + '-draggable';
        me.title = me.title || '&amp;#160;';
        me.tools = me.tools || [];
        items = me.items = (items ? Ext.Array.slice(items) : []);
        me.orientation = me.orientation || 'horizontal';
        me.dock = (me.dock) ? me.dock : (me.orientation == 'horizontal') ? 'top' : 'left';
 
        if (ownerCt ? (!ownerCt.border &amp;&amp; !ownerCt.frame) : !me.border) {
            uiClasses.push(me.orientation + '-noborder');
        }
        me.addClsWithUI(uiClasses);
        me.addCls([me.headerCls, me.headerCls + '-' + me.orientation]);
 
        if (me.indicateDrag) {
            me.addCls(me.indicateDragCls);
        }
 
        // Add Icon
        if (me.iconCls || me.icon || me.glyph) {
            me.initIconCmp();
            // If we didn't provide a position or items, the icon should
            // appear before the title
            if (!hasPosition &amp;&amp; !items.length) {
                ++titlePosition;
            }
            items.push(me.iconCmp);
        }
 
        // Add Title
        me.titleCmp = new Ext.Component({
            ariaRole  : 'heading',
            focusable : false,
            noWrap    : true,
            flex      : 1,
            rtl       : me.rtl,
            id        : me.id + '_hd',
            style     : me.titleAlign ? ('text-align:' + me.titleAlign) : '',
            cls       : me.headerCls + '-text-container ' +
                        me.baseCls + '-text-container ' +
                        me.baseCls + '-text-container-' + me.ui,
            renderTpl : me.getTpl('headingTpl'),
            renderData: {
                title: me.title,
                cls  : me.baseCls,
                headerCls: me.headerCls,
                ui   : me.ui
            },
            childEls  : ['textEl'],
            autoEl: {
                // Required for Opera
                unselectable: 'on'
            },
            listeners: {
                render: me.onTitleRender,
                scope: me
            }
        });
        me.layout = (me.orientation == 'vertical') ? {
            type : 'vbox',
            align: 'center',
            alignRoundingMethod: 'ceil'
        } : {
            type : 'hbox',
            align: 'middle',
            alignRoundingMethod: 'floor'
        };
 
        // Add Tools
        Ext.Array.push(items, me.tools);
        // Clear the tools so we can have only the instances. Intentional mutation of passed in array
        // Owning code in Panel uses this array as its pubic tools property.
        me.tools.length = 0;
        me.callParent();
 
        if (items.length &lt; titlePosition) {
            titlePosition = items.length;
        }
        me.titlePosition = titlePosition;
 
        // Insert the titleComponent at the specified position
        me.insert(titlePosition, me.titleCmp);
 
        me.on({
            dblclick: me.onDblClick,
            click: me.onClick,
            element: 'el',
            scope: me
        });
    },
 
<span id='Ext-panel-Header-method-initIconCmp'>    initIconCmp: function() {
</span>        var me = this,
            cls = [me.headerCls + '-icon', me.baseCls + '-icon', me.iconCls],
            cfg;
       
        if (me.glyph) {
            cls.push(me.baseCls + '-glyph');
        }
 
        cfg = {
            focusable: false,
            src: Ext.BLANK_IMAGE_URL,
            cls: cls,
            baseCls: me.baseCls + '-icon',
            id: me.id + '-iconEl',
            iconCls: me.iconCls,
            glyph:  me.glyph
        };
 
        if (!Ext.isEmpty(me.icon)) {
            delete cfg.iconCls;
            cfg.src = me.icon;
        }
 
        me.iconCmp = new Ext.Img(cfg);
    },
 
<span id='Ext-panel-Header-method-beforeRender'>    beforeRender: function() {
</span>        this.protoEl.unselectable();
        this.callParent();
    },
 
<span id='Ext-panel-Header-method-afterLayout'>    afterLayout: function() {
</span>        var me = this,
            frameBR, frameTR, frameTL, xPos;
 
        if (me.orientation === 'vertical') {
            me.adjustTitlePosition();
            frameTR = me.frameTR;
            if (frameTR) {
                // The corners sprite currently requires knowledge of the vertical header's
                // width to correctly set the background position of the bottom right corner.
                // TODO: rearrange the sprite so that this can be done with pure css.
                frameBR = me.frameBR;
                frameTL = me.frameTL;
                xPos = (me.getWidth() - frameTR.getPadding('r') -
                    ((frameTL) ? frameTL.getPadding('l') : me.el.getBorderWidth('l'))) + 'px';
                frameBR.setStyle('background-position-x', xPos);
                frameTR.setStyle('background-position-x', xPos);
            }
            if (Ext.isIE7 &amp;&amp; Ext.isStrict &amp;&amp; me.frame) {
                // EXTJSIV-7283: framed header background is initally off in IE7 strict
                // unless we repaint
                me.el.repaint();
            }
        }
    },
 
<span id='Ext-panel-Header-method-beforeLayout'>    beforeLayout: function () {
</span>        this.callParent();
        this.syncBeforeAfterTitleClasses();
    },
 
<span id='Ext-panel-Header-method-adjustTitlePosition'>    adjustTitlePosition: function() {
</span>        var titleCmp = this.titleCmp,
            titleEl;
 
        if (!Ext.isIE9m &amp;&amp; titleCmp) { // some Headers don't have a titleCmp, e.g. TabBar
            // In IE9 and below we use a BasicImage filter to rotate the title
            // element 90 degrees.  The result is that what was the bottom left
            // corner is positioned exactly where the top left corner was
            // originally.  Since this is the desired result, no additional
            // positioning is needed in IE9 and below.  In modern browsers,
            // however, we use transform: rotate(90deg) to rotate the element.
            // CSS3 also provides a way to specify the position the rotated element
            // by changing the axis on which it is rotated using the transform-origin
            // property, but the required transform origin varies based on the
            // elements size, and would require some complex math to calculate.
            // To achieve the desired rotated position in modern browsers we use
            // a transform-origin of &quot;0, 0&quot; which means the top left corner of
            // the element is the rotation axis. After rotating 90 degrees we
            // simply move the element to the right by the same number of pixels
            // as its width.
            titleEl = titleCmp.el;
            titleEl.setStyle('left', titleEl.getWidth() + 'px');
        }
    },
 
<span id='Ext-panel-Header-method-onTitleRender'>    onTitleRender: function() {
</span>        if (this.orientation === 'vertical') {
            this.titleCmp.el.setVertical(90);
        }
    },
 
<span id='Ext-panel-Header-method-addUIClsToElement'>    // inherit docs
</span>    addUIClsToElement: function(cls) {
        var me = this,
            result = me.callParent(arguments),
            classes = [me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
            array, i;
 
        if (me.bodyCls) {
            array = me.bodyCls.split(' ');
 
            for (i = 0; i &lt; classes.length; i++) {
                if (!Ext.Array.contains(array, classes[i])) {
                    array.push(classes[i]);
                }
            }
 
            me.bodyCls = array.join(' ');
        } else {
            me.bodyCls = classes.join(' ');
        }
 
        return result;
    },
 
<span id='Ext-panel-Header-method-removeUIClsFromElement'>    // inherit docs
</span>    removeUIClsFromElement: function(cls) {
        var me = this,
            result = me.callParent(arguments),
            classes = [me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
            array, i;
 
        if (me.bodyCls) {
            array = me.bodyCls.split(' ');
 
            for (i = 0; i &lt; classes.length; i++) {
                Ext.Array.remove(array, classes[i]);
            }
 
            me.bodyCls = array.join(' ');
        }
 
        return result;
    },
 
<span id='Ext-panel-Header-method-addUIToElement'>    // inherit docs
</span>    addUIToElement: function() {
        var me = this,
            array, cls;
 
        me.callParent(arguments);
 
        cls = me.baseCls + '-body-' + me.ui;
        if (me.rendered) {
            if (me.bodyCls) {
                me.body.addCls(me.bodyCls);
            } else {
                me.body.addCls(cls);
            }
        } else {
            if (me.bodyCls) {
                array = me.bodyCls.split(' ');
 
                if (!Ext.Array.contains(array, cls)) {
                    array.push(cls);
                }
 
                me.bodyCls = array.join(' ');
            } else {
                me.bodyCls = cls;
            }
        }
 
        if (me.titleCmp &amp;&amp; me.titleCmp.rendered) {
            me.titleCmp.addCls(me.baseCls + '-text-container-' + me.ui);
        }
    },
 
<span id='Ext-panel-Header-method-removeUIFromElement'>    // inherit docs
</span>    removeUIFromElement: function() {
        var me = this,
            array, cls;
 
        me.callParent(arguments);
 
        cls = me.baseCls + '-body-' + me.ui;
        if (me.rendered) {
            if (me.bodyCls) {
                me.body.removeCls(me.bodyCls);
            } else {
                me.body.removeCls(cls);
            }
        } else {
            if (me.bodyCls) {
                array = me.bodyCls.split(' ');
                Ext.Array.remove(array, cls);
                me.bodyCls = array.join(' ');
            } else {
                me.bodyCls = cls;
            }
        }
 
        if (me.titleCmp &amp;&amp; me.titleCmp.rendered) {
            me.titleCmp.removeCls(me.baseCls + '-text-container-' + me.ui);
        }
    },
 
<span id='Ext-panel-Header-method-onClick'>    onClick: function(e) {
</span>        this.fireClickEvent('click', e);
    },
 
<span id='Ext-panel-Header-method-onDblClick'>    onDblClick: function(e){
</span>        this.fireClickEvent('dblclick', e);
    },
 
<span id='Ext-panel-Header-method-fireClickEvent'>    fireClickEvent: function(type, e){
</span>        var toolCls = '.' + Ext.panel.Tool.prototype.baseCls;
        if (!e.getTarget(toolCls)) {
            this.fireEvent(type, this, e);
        }
    },
 
<span id='Ext-panel-Header-method-getFocusEl'>    getFocusEl: function() {
</span>        return this.el;
    },
 
<span id='Ext-panel-Header-method-getTargetEl'>    getTargetEl: function() {
</span>        return this.body || this.frameBody || this.el;
    },
 
<span id='Ext-panel-Header-method-applyTargetCls'>    applyTargetCls: function(targetCls) {
</span>        this.bodyTargetCls = targetCls;
    },
 
<span id='Ext-panel-Header-method-setTitle'>    /**
</span>     * Sets the title of the header.
     * @param {String} title The title to be set
     */
    setTitle: function(title) {
        var me = this,
            titleCmp = me.titleCmp;
 
        me.title = title;
        if (titleCmp.rendered) {
            titleCmp.textEl.update(me.title || '&amp;#160;');
            titleCmp.updateLayout();
        } else {
            me.titleCmp.on({
                render: function() {
                    me.setTitle(title);
                },
                single: true
            });
        }
    },
 
<span id='Ext-panel-Header-method-getMinWidth'>    /**
</span>     * @private
     * Used when shrink wrapping a Panel to either content width or header width.
     * This returns the minimum width required to display the header, icon and tools.
     * **This is only intended for use with horizontal headers.**
     */
    getMinWidth: function() {
        var me = this,
            textEl = me.titleCmp.textEl.dom,
            result,
            tools = me.tools,
            l, i;
 
        // Measure text width as inline element so it doesn't stretch
        textEl.style.display = 'inline';
        result = textEl.offsetWidth;
        textEl.style.display = '';
 
        // Add tools width
        if (tools &amp;&amp; (l = tools.length)) {
            for (i = 0; i &lt; l; i++) {
                if (tools[i].el) {
                    result += tools[i].el.dom.offsetWidth;
                }
            }
        }
 
        // Add iconWidth
        if (me.iconCmp) {
            result += me.iconCmp.el.dom.offsetWidth;
        }
 
        // Return with some space between title and tools/end of header.
        return result + 10;
    },
 
<span id='Ext-panel-Header-method-setIconCls'>    /**
</span>     * Sets the CSS class that provides the icon image for this header.  This method will replace any existing
     * icon class if one has already been set.
     * @param {String} cls The new CSS class name
     */
    setIconCls: function(cls) {
        var me = this,
            isEmpty = !cls || !cls.length,
            iconCmp = me.iconCmp;
 
        me.iconCls = cls;
        if (!me.iconCmp &amp;&amp; !isEmpty) {
            me.initIconCmp();
            me.insert(0, me.iconCmp);
        } else if (iconCmp) {
            if (isEmpty) {
                me.iconCmp.destroy();
                delete me.iconCmp;
            } else {
                iconCmp.removeCls(iconCmp.iconCls);
                iconCmp.addCls(cls);
                iconCmp.iconCls = cls;
            }
        }
    },
 
<span id='Ext-panel-Header-method-setIcon'>    /**
</span>     * Sets the image path that provides the icon image for this header.  This method will replace any existing
     * icon if one has already been set.
     * @param {String} icon The new icon path
     */
    setIcon: function(icon) {
        var me = this,
            isEmpty = !icon || !icon.length,
            iconCmp = me.iconCmp;
 
        me.icon = icon;
        if (!me.iconCmp &amp;&amp; !isEmpty) {
            me.initIconCmp();
            me.insert(0, me.iconCmp);
        } else if (iconCmp) {
            if (isEmpty) {
                me.iconCmp.destroy();
                delete me.iconCmp;
            } else {
                iconCmp.setSrc(me.icon);
            }
        }
    },
 
<span id='Ext-panel-Header-method-setGlyph'>     /**
</span>     * Sets glyph that provides the icon image for this header.  This method will replace any existing
     * glyph if one has already been set.
     * @param {Number/String} glyph the numeric charCode or string charCode/font-family.
     * This parameter expects a format consistent with that of {@link #glyph}
     */
    setGlyph: function(glyph) {
        var me = this,
            iconCmp = me.iconCmp;
        
        if (!me.iconCmp) {
            me.initIconCmp();
            me.insert(0, me.iconCmp);
        } else if (iconCmp) {
            if (glyph) {
                me.iconCmp.setGlyph(glyph);
            } else {
                me.iconCmp.destroy();
                delete me.iconCmp;
            }
        }
    },
 
<span id='Ext-panel-Header-method-getTools'>    /**
</span>     * Gets the tools for this header.
     * @return {Ext.panel.Tool[]} The tools
     */
    getTools: function(){
        return this.tools.slice();
    },
 
<span id='Ext-panel-Header-method-addTool'>    /**
</span>     * Add a tool to the header
     * @param {Object} tool
     */
    addTool: function(tool) {
        // Even though the defaultType is tool, it may be changed,
        // so let's be safe and forcibly specify tool
        this.add(Ext.ComponentManager.create(tool, 'tool'));
    },
 
<span id='Ext-panel-Header-method-syncBeforeAfterTitleClasses'>    syncBeforeAfterTitleClasses: function() {
</span>        var me = this,
            items = me.items,
            childItems = items.items,
            titlePosition = me.titlePosition,
            itemCount = childItems.length,
            itemGeneration = items.generation,
            syncGen = me.syncBeforeAfterGen,
            afterCls, beforeCls, i, item;
 
        if (syncGen === itemGeneration) {
            return;
        }
        me.syncBeforeAfterGen = itemGeneration;
 
        for (i = 0; i &lt; itemCount; ++i) {
            item = childItems[i];
 
            afterCls  = item.afterTitleCls  || (item.afterTitleCls  = item.baseCls + '-after-title')
            beforeCls = item.beforeTitleCls || (item.beforeTitleCls = item.baseCls + '-before-title')
 
            if (!me.title || i &lt; titlePosition) {
                if (syncGen) {
                    item.removeCls(afterCls);
                } // else first time we won't need to remove anything...
                item.addCls(beforeCls);
            } else if (i &gt; titlePosition) {
                if (syncGen) {
                    item.removeCls(beforeCls);
                }
                item.addCls(afterCls);
            }
        }
    },
 
<span id='Ext-panel-Header-method-onAdd'>    /**
</span>     * @protected
     * Set up the `tools.&lt;tool type&gt;` link in the owning Panel.
     * @param component
     * @param index
     */
    onAdd: function(component, index) {
        var tools = this.tools;
        this.callParent(arguments);
        if (component.isTool) {
            tools.push(component);
            tools[component.type] = component;
        }
    },
 
<span id='Ext-panel-Header-method-initRenderData'>    /**
</span>     * Add bodyCls to the renderData object
     * @return {Object} Object with keys and values that are going to be applied to the renderTpl
     * @private
     */
    initRenderData: function() {
        return Ext.applyIf(this.callParent(), {
            bodyCls: this.bodyCls,
            bodyTargetCls: this.bodyTargetCls,
            headerCls: this.headerCls
        });
    },
 
<span id='Ext-panel-Header-method-getDockName'>    getDockName: function() {
</span>        return this.dock;
    },
    
<span id='Ext-panel-Header-method-getFramingInfoCls'>    getFramingInfoCls: function(){
</span>        var me = this,
            cls = me.callParent(),
            owner = me.ownerCt;
            
        if (!me.expanding &amp;&amp; (owner &amp;&amp; owner.collapsed) || me.isCollapsedExpander) {
            cls += '-' + owner.collapsedCls; 
        }
        return cls + '-' + me.dock;
    }
});
</pre>
</body>
</html>