<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Saki's Blog</title>
	<atom:link href="http://blog.extjs.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.extjs.eu</link>
	<description>For good of all productive developers</description>
	<lastBuildDate>Sun, 21 Nov 2010 01:36:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to add an IP address to loopback interface on Mac</title>
		<link>http://blog.extjs.eu/know-how/how-to-add-an-ip-address-to-loopback-interface-on-mac/</link>
		<comments>http://blog.extjs.eu/know-how/how-to-add-an-ip-address-to-loopback-interface-on-mac/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 01:36:03 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Know-how]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=649</guid>
		<description><![CDATA[<br/>Create file /Library/LaunchDaemons/yourname.plist with the following content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
&#60;plist version=&#34;1.0&#34;&#62;
  &#60;dict&#62;
    &#60;key&#62;Label&#60;/key&#62;
      &#60;string&#62;Your Label&#60;/string&#62;
    &#60;key&#62;ProgramArguments&#60;/key&#62;
      &#60;array&#62;
        &#60;string&#62;/sbin/ifconfig&#60;/string&#62;
        &#60;string&#62;lo0&#60;/string&#62;
        &#60;string&#62;alias&#60;/string&#62;
 [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Create file /Library/LaunchDaemons/yourname.plist with the following content:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plist</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Label<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Your Label<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ProgramArguments<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;array<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/sbin/ifconfig<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>lo0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>alias<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>127.0.0.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>netmask<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>255.255.255.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/array<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>RunAtLoad<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;true</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>and reboot the machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/know-how/how-to-add-an-ip-address-to-loopback-interface-on-mac/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My thanks to all visitors of my blog</title>
		<link>http://blog.extjs.eu/uncategorized/my-thanks-to-all-visitors-of-my-blog/</link>
		<comments>http://blog.extjs.eu/uncategorized/my-thanks-to-all-visitors-of-my-blog/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 23:16:01 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=641</guid>
		<description><![CDATA[<br/>I would like to thank all visitors of my blog for ever increasing interest.
When I was creating the blog back in 2008 I thought it would be a good idea to have notes of my know-how I have learn while writing my Ext applications. Something to refer to so I do not need to reinvent [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I would like to thank all visitors of my blog for ever increasing interest.</p>
<p>When I was creating the blog back in 2008 I thought it would be a good idea to have notes of my know-how I have learn while writing my Ext applications. Something to refer to so I do not need to reinvent the wheel over and over.</p>
<p>The next idea was to share this knowledge to make the life of other Ext developers easier. </p>
<p>Both ideas have proven to be successful; I myself have a pool of knowledge, tricks, patterns and good practices and the following graph shows that this pool is valuable also for you Ext fans and pros.</p>
<p>I will continue to maintain it and publish whatever valuable I run into.</p>
<p>Thank you once again.</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2010/10/blog-stat-shadow1.jpg"><img src="http://blog.extjs.eu/wp-content/uploads/2010/10/blog-stat-shadow1-600x243.jpg" alt="Visitors of my blog as of September 2010" title="Visitors of my blog as of September 2010" width="600" height="243" class="aligncenter size-large wp-image-644" /></a></p>
<p>Saki.</p>
<p><a name="fb_share" type="button" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/uncategorized/my-thanks-to-all-visitors-of-my-blog/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Ext Extension with Factory Functions File Pattern</title>
		<link>http://blog.extjs.eu/patterns/file-patters/ext-extension-with-factory-functions-file-pattern/</link>
		<comments>http://blog.extjs.eu/patterns/file-patters/ext-extension-with-factory-functions-file-pattern/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 00:01:43 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[File Patters]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=634</guid>
		<description><![CDATA[<br/>See also:


Writing a Big Application in Ext

Abstract classes with Ext JS

Factory Functions in Ext Extensions (Abstract Classes)


// vim: ts=4:sw=4:nu:fdc=2:nospell
/*global Ext:true, AbstractPanel:true */
/*jslint browser:true, laxbreak:true */
&#160;
// create namespace
Ext.ns&#40;'AbstractPanel'&#41;;
&#160;
/**
 * @class AbstractPanel
 * @extends Ext.Panel
 *
 * AbstractPanel File Pattern
 *
 * @author    Ing. Jozef Sakáloš
 * @copyright (c) 2010, Ing. Jozef Sakáloš
 * [...]]]></description>
			<content:encoded><![CDATA[<br/><p>See also:</p>
<ul>
<li>
<a target="_blank" href="http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/">Writing a Big Application in Ext</a>
</li>
<li><a target="_blank" href="http://tdg-i.com/364/abstract-classes-with-ext-js">Abstract classes with Ext JS</a>
</li>
<li><a target="_blank" href="http://blog.extjs.eu/know-how/factory-functions-in-ext-extensions/">Factory Functions in Ext Extensions (Abstract Classes)</a></li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// vim: ts=4:sw=4:nu:fdc=2:nospell</span>
<span style="color: #009966; font-style: italic;">/*global Ext:true, AbstractPanel:true */</span>
<span style="color: #009966; font-style: italic;">/*jslint browser:true, laxbreak:true */</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// create namespace</span>
Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'AbstractPanel'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">/**
 * @class AbstractPanel
 * @extends Ext.Panel
 *
 * AbstractPanel File Pattern
 *
 * @author    Ing. Jozef Sakáloš
 * @copyright (c) 2010, Ing. Jozef Sakáloš
 * @version   1.0
 * @date      &lt;ul&gt;
 * &lt;li&gt;21. September 2010&lt;/li&gt;
 * &lt;/ul&gt;
 * @revision  $Id$
 * @depends   
 *
 * @see       http://tdg-i.com/364/abstract-classes-with-ext-js
 * @see       http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/
 * @see       http://blog.extjs.eu/know-how/factory-functions-in-ext-extensions/
 *
 * @license   This file is released under the
 * &lt;a target=&quot;_blank&quot; href=&quot;http://www.gnu.org/licenses/gpl.html&quot;&gt;GNU GPL 3.0&lt;/a&gt;
 * license. It’s free for use in GPL and GPL compatible open source software, 
 * but if you want to use the component in a commercial software (closed source),
 * you have to get a commercial license.
 */</span>
AbstractPanel <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">Panel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// default options - can be overridden on instantiation</span>
    <span style="color: #006600; font-style: italic;">// Do NOT put arrays or objects here</span>
     border<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// {{{</span>
    <span style="color: #006600; font-style: italic;">// private</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// create config object</span>
        <span style="color: #003366; font-weight: bold;">var</span> config <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// build config</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildConfig</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// apply config</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initialConfig</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// call parent</span>
        AbstractPanel.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
    <span style="color: #006600; font-style: italic;">// }}}</span>
    <span style="color: #006600; font-style: italic;">// {{{</span>
    <span style="color: #006600; font-style: italic;">/**
     * Builds the config object
     * @param {Object} config The config object is passed here
     * from initComponent by reference. Do not create or return
     * a new config object, add to the passed one instead.
     *
     * You can override this function if you need to customize it
     * or you can override individual build functions called.
     */</span>
    <span style="color: #339933;">,</span>buildConfig<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildTbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildBbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildConfig</span>
    <span style="color: #006600; font-style: italic;">// }}}</span>
    <span style="color: #006600; font-style: italic;">// {{{</span>
    <span style="color: #006600; font-style: italic;">/**
     * Builds items
     * @param {Object} config The config object is passed here
     * from buildConfig by reference. Do not create or return
     * a new config object, add to the passed one instead.
     *
     * You can override this function if you need to customize it.
     */</span>
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
    <span style="color: #006600; font-style: italic;">// }}}</span>
    <span style="color: #006600; font-style: italic;">// {{{</span>
    <span style="color: #006600; font-style: italic;">/**
     * Builds buttons
     * @param {Object} config The config object is passed here
     * from buildConfig by reference. Do not create or return
     * a new config object, add to the passed one instead.
     *
     * You can override this function if you need to customize it.
     */</span>
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">buttons</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
    <span style="color: #006600; font-style: italic;">// }}}</span>
    <span style="color: #006600; font-style: italic;">// {{{</span>
    <span style="color: #006600; font-style: italic;">/**
     * Builds top toolbar and its items
     * @param {Object} config The config object is passed here
     * from buildConfig by reference. Do not create or return
     * a new config object, add to the passed one instead.
     *
     * You can override this function if you need to customize it.
     */</span>
    <span style="color: #339933;">,</span>buildTbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">tbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildTbar</span>
    <span style="color: #006600; font-style: italic;">// }}}</span>
    <span style="color: #006600; font-style: italic;">// {{{</span>
    <span style="color: #006600; font-style: italic;">/**
     * Builds bottom toolbar and its items
     * @param {Object} config The config object is passed here
     * from buildConfig by reference. Do not create or return
     * a new config object, add to the passed one instead.
     *
     * You can override this function if you need to customize it.
     */</span>
    <span style="color: #339933;">,</span>buildBbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">bbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildBbar</span>
    <span style="color: #006600; font-style: italic;">// }}}</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// eof</span></pre></div></div>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="js02@aariadne.com" /><input type="hidden" name="item_number" value="Blog Donation" /><input type="hidden" name="currency_code" value="EUR" /><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/patterns/file-patters/ext-extension-with-factory-functions-file-pattern/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>I would like to say, Thank you!</title>
		<link>http://blog.extjs.eu/philosophy/i-would-like-to-say-thank-you/</link>
		<comments>http://blog.extjs.eu/philosophy/i-would-like-to-say-thank-you/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 09:50:37 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Philosophy]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=627</guid>
		<description><![CDATA[<br/>Recently I&#8217;ve received very nice Private Message on Sencha Forums from Sosy and I&#8217;d like to share it with you (with the author&#8217;s permission). Here it is:

Hello Saki, i would like to say, thank you!
I am new to ExtJS, comming from the PHP/MySQL side (still loving it, but its different already now) (sounds familiar?).
Started for [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Recently I&#8217;ve received very nice Private Message on Sencha Forums from <a target="_blank" href="http://www.sencha.com/forum/member.php?156557-sosy">Sosy</a> and I&#8217;d like to share it with you (with the author&#8217;s permission). Here it is:</p>
<hr />
<p>Hello Saki, i would like to say, t<strong>hank you!</strong></p>
<p>I am new to ExtJS, comming from the PHP/MySQL side (still loving it, but its different already now) (sounds familiar?).</p>
<p>Started for 3 weeks with ExtJS, didn&#8217;t like Javascript, cause to abstract for my eyes and head. Read a lot in this forum, started try and error, loaded a lot of <a target="_blank" href="http://examples.extjs.eu">examples</a>, tried to figure out why what works and how.</p>
<p>And above all, i am using a lot of your scripts to learn, i love it how you did things.</p>
<p>Tomorrow i started reading about Extjs again (that is my start in the morning, coffee (my own, because i am an coffeeroaster, Firefox, google -> ExtJS) And then read anything what i can find about it.</p>
<p>Bought a book, (ExtJS cookbook, which sucks, nothing in it to use for me) and so on.</p>
<p>But the highlight of tomorrow, or even better, since i started with Ext, was in your blog, found under philosophy.</p>
<p>First of all the <a target="_blank" href="http://blog.extjs.eu/philosophy/leading-comma-or-trailing-comma-that-is-the-question/">leading commata issue</a>, men, Saki i almost had spoken some curses on you as i start to struggle with your code and saw the leading commata. </p>
<p>What i thought was, geee, it says Author: Ing. Jozef Sakalos, well only an Ing. can be this abstract, no wonder that he can programm in Ext.</p>
<p>Then (i only admit this to you, but more on that later) i started to reorder your scripts, remove the leading commata. (*shame*). But for me that was a good start to go through the code, the calls and so on.</p>
<p>Now it comes, why i want to say thank you!</p>
<p>Then i read your second post under philosophy, <a target="_blank" href="http://blog.extjs.eu/philosophy/changing-viewpoing-to-ext/">Changing viewpoint to Ext</a>&#8230;</p>
<p>I started reading and, for the first time in 3 weeks i saw some light at the end of the tunnel, reading that you came from the PHP/MySQL side, and how you discriped the fact of what and how you assume it has to work, in reflect to Ext (exactly as how i see it) and on how it has to be.</p>
<p>This all together is changing my thoughts incredibly, even the leading commata thing, i still can believe that i will do that, because it looks really, really ugly for me, but i am also someone who can lay down old habits, if there are really good argumenst.</p>
<p><strong>Thanks Saki, you gave me hope on keep programming in Ext and try to learn it.</strong></p>
<p>Regards from an Dutch guy living in Germany,</p>
<p>Paul Willemsen aka Sosy.</p>
<p><a name="fb_share" type="button" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/philosophy/i-would-like-to-say-thank-you/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Experience: Ext Component loading can be slow</title>
		<link>http://blog.extjs.eu/philosophy/experience-ext-component-loading-can-be-slow/</link>
		<comments>http://blog.extjs.eu/philosophy/experience-ext-component-loading-can-be-slow/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 21:35:40 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Know-how]]></category>
		<category><![CDATA[Philosophy]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=615</guid>
		<description><![CDATA[<br/>This spring I was contacted by one company with the request of consulting on their application developed in PHP and ExtJS Javascript Library. They wanted to come on site, stay with them one week and advise. I usually take such jobs but I always want to know what product is expected so I know in [...]]]></description>
			<content:encoded><![CDATA[<br/><p>This spring I was contacted by one company with the request of consulting on their application developed in PHP and ExtJS Javascript Library. They wanted to come on site, stay with them one week and advise. I usually take such jobs but I always want to know what product is expected so I know in advance if I can deliver it to the full satisfaction.</p>
<p>These guys succeeded to keep it covered and I was only told: &#8220;Come here and work with us for a week.&#8221; Being curious enough I succumbed to the temptation and taken the job.</p>
<p>The evening I came they had shown me a beautiful application with many windows, forms, grids, accordions. The application was very complex and I immediately knew that I&#8217;m going to work with pros. Uttering words of commendations I was still in a mystery because I still didn&#8217;t know what I was there for.</p>
<p>So I asked: &#8220;What do you expect from me that you were able to develop this alone?&#8221; They said: &#8220;Well, it is slow!&#8221;</p>
<p>Indeed, Ext window with a form and grid took around 4 seconds to show all it contents before the user could interact with it. And it was intranet! No slow internet connection bottlenecks.</p>
<p>&#8220;Yes, that&#8217;s too much! Let&#8217;s start tomorrow to find out why&#8221;, I said.</p>
<p>Next day I dug into the bowels of the application and I found that they generated javascript code on the server and then they loaded it to the client. I mean, not only JSON data but the full javascript executable code with the application.</p>
<p>I was not fully sure if this alone could cause the slowness so we started some profiling of both PHP and Javascript code and finally we decided to rewrite the application to adhere to <a href="http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/">Writing a Big Application in Ext</a>.</p>
<p>To keep it short, by the end of the week, when done, the very same Ext window opened in less than 500ms. Well done, isn&#8217;t it.</p>
<p>Anyway, what could be the reasons why it was that slow in the first place?</p>
<ol>
<li>The server needs some time to generate the javascript. It may not be a lot, however, if you count all database accesses, decision logic and javascript code generation it is probably more than to create a JSON string with data only.
</li>
<li>
The embedded javascript adds to the size of server-client data transfers. This didn&#8217;t attribute too much to the time in this particular case but it can get worse if the internet connection is slower.
</li>
<li>
The embedded javascript cannot be cached at client. If the application is in a referenced javascript file then, if the server is configured properly, it is cached at client. Of course, the initial load takes longer but then only the html markup and JSON data are actually transferred from the server.
</li>
<li>And probably worst: In this kind of loading a request is sent to deliver a component, let&#8217;s say a grid. The grid code is returned, the grid is instantiated and rendered and now it needs data. So another request is sent to deliver the JSON data. It&#8217;s just too much.
</li>
</ol>
<p>Take this please as <i>my</i> observation and <i>my</i> experience. There may be cases when component loading can work better and faster and I&#8217;ll be only glad if I&#8217;ll have an opportunity to see such application.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="js02@aariadne.com" /><input type="hidden" name="item_number" value="Blog Donation" /><input type="hidden" name="currency_code" value="EUR" /><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/philosophy/experience-ext-component-loading-can-be-slow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Factory Functions in Ext Extensions (Abstract Classes)</title>
		<link>http://blog.extjs.eu/know-how/factory-functions-in-ext-extensions/</link>
		<comments>http://blog.extjs.eu/know-how/factory-functions-in-ext-extensions/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 13:37:15 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Know-how]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=546</guid>
		<description><![CDATA[<br/>I have recently run across one of the the Jay Garcia&#8217;s excellent screencasts Abstract classes with Ext JS. (Thank you Jay for your effort of educating Ext JS community.)
I&#8217;ve been consulting in a company at that time &#8211; developers of the client, after seeing the screencast, immediately asked me: &#8220;So what should we use? The [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I have recently run across one of the the <a href="http://tdg-i.com/">Jay Garcia&#8217;s</a> excellent screencasts <a href="http://tdg-i.com/364/abstract-classes-with-ext-js">Abstract classes with Ext JS</a>. (Thank you Jay for your effort of educating Ext JS community.)</p>
<p>I&#8217;ve been consulting in a company at that time &#8211; developers of the client, after seeing the screencast, immediately asked me: &#8220;So what should we use? The <a href="http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/">&#8216;xtype&#8217; style</a> or Abstract classes?&#8221;</p>
<p>The curt answer would be: &#8220;Use whatever you prefer.&#8221; or &#8220;Use both&#8221;. </p>
<p>However, decisions based on mere &#8220;preference&#8221; or on &#8220;I use it because it is available&#8221; are often not fully rational and can lead to troubles as the application grows. Thus, let&#8217;s take a deeper look to see if there are any pitfalls and to find how can we get most of both methods. </p>
<p><b><i>Note:</i></b> Before you continue, read <a href="http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/">&#8220;Writing a big application in Ext&#8221;</a>,  watch the J<a href="http://tdg-i.com/364/abstract-classes-with-ext-js">ay&#8217;s screencast</a> and understand both, otherwise, the following text won&#8217;t make any sense to you.</p>
<h1>Abstract ExtJS Class</h1>
<p>Abstract classes are not to be used directly but they serve more like templates that specify methods and properties to be implemented in classes derived from them. They are very useful in object oriented programming because they force developers to implement all mandatory methods with same signature (signature = arguments the method or function accepts) and return values so there is a greater chance to develop a bug free code.</p>
<p>However, in ExtJS (and JavaScript that is scripting language where source is not compiled but directly interpreted), there is no mechanism to warn developer &#8220;you haven&#8217;t implemented method XY&#8221; or &#8220;your implementation has wrong signature&#8221; so we need to take care ourselves.</p>
<p>Nevertheless, the idea of abstract classes is useful also in JavaScript/ExtJS environment because:</p>
<ol>
<li>
logic and configuration common to all expected descendants can be put in the abstract base class that eliminates the code duplication, speeds up development and debugging, and increases future code maintainability greatly
</li>
<li>
abstract classes tell us which methods to implement
</li>
<li>
it increases the human readability of the code (Remember, we always try to write the code to be readable and understandable by us and others in the future.)
</li>
</ol>
<h1>The Basic Idea</h1>
<p>The basic idea Jay presents in his great screencast is to extend an Ext Component, FormPanel for example, and add stub methods to it:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">AbstractFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">form</span>.<span style="color: #660066;">FormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     submitUrl<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
             items<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">,</span>buttons<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        MyApp.<span style="color: #660066;">AbstractFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
&nbsp;
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span></pre></div></div>

<p>The empty &#8220;buildXxx&#8221; methods will be implemented in the abstract class extension.</p>
<h1>Tweaking the Abstract Class example</h1>
<p>While perfect for the educational purposes, we need to tweak this code if want to use it in the production quality application. I shall walk you through recommended improvements.</p>
<h2>initialConfig</h2>
<p>Ext.Component takes the config object passed to its constructor and saves it in the object variable <code>initialConfig</code> when it instantiates. Although items and buttons in combination with the FormPanel in the above example do not rely on it, so the example runs as expected, <code>initialConfig</code> is used on the Ext.Component level so it may be used by any of Component descendants. </p>
<p>Let&#8217;s take care of it and modify <code>initComponent</code> as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// create config object</span>
        <span style="color: #003366; font-weight: bold;">var</span> config <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// build config properties</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
             items<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">,</span>buttons<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// apply config</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initialConfig</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// call parent</span>
        MyApp.<span style="color: #660066;">AbstractFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span></pre></div></div>

<h2>Return Values</h2>
<p>Abstract methods in the example return empty arrays. That is no problem for items or buttons but if we want to have also <code>buildTbar</code> or <code>buildBbar</code> factory functions that return empty arrays [] then top and bottom toolbars are always created, but empty, if methods are not implemented in derived classes. (Empty toolbars are quite ugly when rendered.)</p>
<p>Therefore, always return undefined from the abstract methods. For now, the class could look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">AbstractFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">form</span>.<span style="color: #660066;">FormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     submitUrl<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// create config object</span>
        <span style="color: #003366; font-weight: bold;">var</span> config <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// build config properties</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
             items<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">,</span>buttons<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">,</span>tbar<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildTbar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">,</span>bbar<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildBbar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// apply config</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initialConfig</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// call parent</span>
        MyApp.<span style="color: #660066;">AbstractFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
&nbsp;
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
&nbsp;
    <span style="color: #339933;">,</span>buildTbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildTbar</span>
&nbsp;
    <span style="color: #339933;">,</span>buildBbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildBbar</span></pre></div></div>

<h2>Passing <code>config</code> to Abstract Factory Methods</h2>
<p>If we pass <code>config</code> object to abstract methods then we can apply the created items, buttons, toolbar items directly to it. That has no great benefit in itself, however, if we create a sequence or interceptor of these methods we can use the config object directly.</p>
<p>So now we have:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">AbstractFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">form</span>.<span style="color: #660066;">FormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     submitUrl<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// create config object</span>
        <span style="color: #003366; font-weight: bold;">var</span> config <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// build config properties</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildTbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildBbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// apply config</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initialConfig</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// call parent</span>
        MyApp.<span style="color: #660066;">AbstractFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
&nbsp;
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">buttons</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
&nbsp;
    <span style="color: #339933;">,</span>buildTbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">tbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildTbar</span>
&nbsp;
    <span style="color: #339933;">,</span>buildBbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">bbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildBbar</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span></pre></div></div>

<h1>The Final Touch</h1>
<p>If you look in the <code>initComponent</code> now you see that we call a series of &#8220;build&#8221; functions in it. Let&#8217;s move it into another factory method:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">AbstractFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">form</span>.<span style="color: #660066;">FormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     submitUrl<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// create config object</span>
        <span style="color: #003366; font-weight: bold;">var</span> config <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// build config</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildConfig</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// apply config</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initialConfig</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// call parent</span>
        MyApp.<span style="color: #660066;">AbstractFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
&nbsp;
    <span style="color: #339933;">,</span>buildConfig<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildTbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildBbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildConfig</span>
&nbsp;
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">buttons</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
&nbsp;
    <span style="color: #339933;">,</span>buildTbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">tbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildTbar</span>
&nbsp;
    <span style="color: #339933;">,</span>buildBbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">bbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildBbar</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span></pre></div></div>

<p>The above gives you the flexibility of implementing or overriding of the whole <code>buildConfig</code> function or individual items, buttons, bars functions. It also takes care of <code>initialConfig</code> problem.</p>
<p>It&#8217;s a kind of a &#8220;pattern&#8221; and I will publish it in my &#8220;file patterns&#8221; series on this blog with more code comments.</p>
<h1>Example</h1>
<p>If we build upon Jay&#8217;s example, using the pattern above, we get:</p>
<p><code>AbstractFormPanel.js</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">AbstractFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">form</span>.<span style="color: #660066;">FormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     defaultType<span style="color: #339933;">:</span><span style="color: #3366CC;">'textfield'</span>
    <span style="color: #339933;">,</span>frame<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span>
    <span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">300</span>
    <span style="color: #339933;">,</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">200</span>
    <span style="color: #339933;">,</span>labelWidth<span style="color: #339933;">:</span><span style="color: #CC0000;">75</span>
    <span style="color: #339933;">,</span>submitUrl<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span>
    <span style="color: #339933;">,</span>submitT<span style="color: #339933;">:</span><span style="color: #3366CC;">'Submit'</span>
    <span style="color: #339933;">,</span>cancelT<span style="color: #339933;">:</span><span style="color: #3366CC;">'Cancel'</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// create config object</span>
        <span style="color: #003366; font-weight: bold;">var</span> config <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
            defaults<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>anchor<span style="color: #339933;">:</span><span style="color: #3366CC;">'-10'</span><span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// build config</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildConfig</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// apply config</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initialConfig</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// call parent</span>
        MyApp.<span style="color: #660066;">AbstractFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
&nbsp;
    <span style="color: #339933;">,</span>buildConfig<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildTbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildBbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildConfig</span>
&nbsp;
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">buttons</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
             text<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">submitT</span>
            <span style="color: #339933;">,</span>scope<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>
            <span style="color: #339933;">,</span>handler<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onSubmit</span>
            <span style="color: #339933;">,</span>iconCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'icon-disk'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             text<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">cancelT</span>
            <span style="color: #339933;">,</span>scope<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>
            <span style="color: #339933;">,</span>handler<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onCancel</span>
            <span style="color: #339933;">,</span>iconCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'icon-undo'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
&nbsp;
    <span style="color: #339933;">,</span>buildTbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">tbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildTbar</span>
&nbsp;
    <span style="color: #339933;">,</span>buildBbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">bbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildBbar</span>
&nbsp;
    <span style="color: #339933;">,</span>onSubmit<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Ext.<span style="color: #660066;">MessageBox</span>.<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Submit'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">submitUrl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function onSubmit</span>
&nbsp;
    <span style="color: #339933;">,</span>onCancel<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">el</span>.<span style="color: #660066;">mask</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This form is canceled'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function onCancel</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span></pre></div></div>

<p>Mention please that I moved hard-wired button texts to class properties. The reason is that this way we can easily localize (translate) these texts to another languages. I didn&#8217;t take care of messages of handlers though. You will do in your localizable applications, won&#8217;t you?</p>
<p><code>AddressFormPanel.js</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">AddressFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>MyApp.<span style="color: #660066;">AbstractFormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Edit address data'</span>
    <span style="color: #339933;">,</span>submitUrl<span style="color: #339933;">:</span><span style="color: #3366CC;">'addressAction.asp'</span>
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'address1'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'Address 1'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'address2'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'Address 2'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'city'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'city'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">'combo'</span>
            <span style="color: #339933;">,</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'state'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'State'</span>
            <span style="color: #339933;">,</span>store<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'MD'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'VA'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'DC'</span><span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">'numberfield'</span>
            <span style="color: #339933;">,</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'zip'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'Zip Code'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// eof</span></pre></div></div>

<p><code>NameFormPanel.js</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">NameFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>MyApp.<span style="color: #660066;">AbstractFormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Edit name data'</span>
    <span style="color: #339933;">,</span>submitUrl<span style="color: #339933;">:</span><span style="color: #3366CC;">'nameAction.asp'</span>
    <span style="color: #339933;">,</span>okT<span style="color: #339933;">:</span><span style="color: #3366CC;">'OK'</span>
&nbsp;
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'firstName'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'First Name'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'lastName'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'Last Name'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'middleName'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'Middle Name'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">'datefield'</span>
            <span style="color: #339933;">,</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'dob'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'DOB'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">//Extension</span>
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// let parent build buttons first</span>
        MyApp.<span style="color: #660066;">NameFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">buildButtons</span>.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> arguments<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// tweak the submit button</span>
        config.<span style="color: #660066;">buttons</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">text</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">okT</span><span style="color: #339933;">;</span>
        config.<span style="color: #660066;">buttons</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">handler</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onOkBtn</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">//Override</span>
    <span style="color: #339933;">,</span>onOkBtn<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        console.<span style="color: #660066;">info</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'OK btn pressed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function onOkBtn</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// eof</span></pre></div></div>

<p>With this setup, we can even create instance of AbstractForm panel directly passing some/all build functions inline:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> nameForm <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> MyApp.<span style="color: #660066;">AbstractFormPanel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
     title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Name Form Panel configured inline'</span>
    <span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">300</span>
    <span style="color: #339933;">,</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">200</span>
    <span style="color: #339933;">,</span>renderTo<span style="color: #339933;">:</span>Ext.<span style="color: #660066;">getBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'firstName'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'First Name'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'lastName'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'Last Name'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'middleName'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'Middle Name'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">'datefield'</span>
            <span style="color: #339933;">,</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'dob'</span>
            <span style="color: #339933;">,</span>fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">'DOB'</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><i><b>Note:</b></i> Although the above works, it violates the rule of not instantiating an abstract class directly. It&#8217;s up to you if you will do it or not.</p>
<h1>Combining with &#8220;xtypes&#8221;</h1>
<p>Now, do not succumb to the temptation of &#8220;putting everything&#8221; in factory functions. Abstract classes are just a programming style, not an universal solvent.</p>
<p>Imagine, you have your own carefully crafted Submit and Cancel buttons so if you would &#8220;put everything&#8221; in the factory functions you would need to copy buttons configurations many times because also toolbars, grids, data views, etc can contain them.</p>
<p>Create extensions (xtypes) for those buttons instead. The following illustrates the approach:</p>
<p><code>SubmitButton.js</code></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">SubmitButton</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">Button</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     text<span style="color: #339933;">:</span><span style="color: #3366CC;">'Submit'</span>
    <span style="color: #339933;">,</span>iconCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'icon-disk'</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        MyApp.<span style="color: #660066;">SubmitButton</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> arguments<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span>
&nbsp;
Ext.<span style="color: #660066;">reg</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'submitbutton'</span><span style="color: #339933;">,</span> MyApp.<span style="color: #660066;">SubmitButton</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// eof</span></pre></div></div>

<p><code>CancelButton.js</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">CancelButton</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">Button</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     text<span style="color: #339933;">:</span><span style="color: #3366CC;">'Cancel'</span>
    <span style="color: #339933;">,</span>iconCls<span style="color: #339933;">:</span><span style="color: #3366CC;">'icon-undo'</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        MyApp.<span style="color: #660066;">CancelButton</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> arguments<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span>
&nbsp;
Ext.<span style="color: #660066;">reg</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cancelbutton'</span><span style="color: #339933;">,</span> MyApp.<span style="color: #660066;">CancelButton</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// eof</span></pre></div></div>

<p>and <code>AbstractFormPanel.js</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyApp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MyApp.<span style="color: #660066;">AbstractFormPanel</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">form</span>.<span style="color: #660066;">FormPanel</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
     defaultType<span style="color: #339933;">:</span><span style="color: #3366CC;">'textfield'</span>
    <span style="color: #339933;">,</span>frame<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span>
    <span style="color: #339933;">,</span>width<span style="color: #339933;">:</span><span style="color: #CC0000;">300</span>
    <span style="color: #339933;">,</span>height<span style="color: #339933;">:</span><span style="color: #CC0000;">200</span>
    <span style="color: #339933;">,</span>labelWidth<span style="color: #339933;">:</span><span style="color: #CC0000;">75</span>
    <span style="color: #339933;">,</span>submitUrl<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span>
    <span style="color: #339933;">,</span>initComponent<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// create config object</span>
        <span style="color: #003366; font-weight: bold;">var</span> config <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
            defaults<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>anchor<span style="color: #339933;">:</span><span style="color: #3366CC;">'-10'</span><span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// build config</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildConfig</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// apply config</span>
        Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initialConfig</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// call parent</span>
        MyApp.<span style="color: #660066;">AbstractFormPanel</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">initComponent</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function initComponent</span>
&nbsp;
    <span style="color: #339933;">,</span>buildConfig<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildItems</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildButtons</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildTbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">buildBbar</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildConfig</span>
&nbsp;
    <span style="color: #339933;">,</span>buildItems<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">items</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildItems</span>
&nbsp;
    <span style="color: #339933;">,</span>buildButtons<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">buttons</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
             xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">'submitbutton'</span>
            <span style="color: #339933;">,</span>scope<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>
            <span style="color: #339933;">,</span>handler<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onSubmit</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
             xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">'cancelbutton'</span>
            <span style="color: #339933;">,</span>scope<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>
            <span style="color: #339933;">,</span>handler<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onCancel</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildButtons</span>
&nbsp;
    <span style="color: #339933;">,</span>buildTbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">tbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildTbar</span>
&nbsp;
    <span style="color: #339933;">,</span>buildBbar<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        config.<span style="color: #660066;">bbar</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function buildBbar</span>
&nbsp;
    <span style="color: #339933;">,</span>onSubmit<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Ext.<span style="color: #660066;">MessageBox</span>.<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Submit'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">submitUrl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function onSubmit</span>
&nbsp;
    <span style="color: #339933;">,</span>onCancel<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">el</span>.<span style="color: #660066;">mask</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This form is canceled'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo function onCancel</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// eo extend</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// eof</span></pre></div></div>

<p><b><i>Note:</i></b> The above buttons are far too simple to be extended in the real world but you get the point, right?</p>
<h1>Conclusion</h1>
<p>Abstract classes, as Jay Garcia defines and presents them, are a very useful ExtJS programming technique and if you use them in the information provided in this post your code will be clean, flexible and maintainable. That is what all we developers want.</p>
<p>Happy coding!</p>
<p>Further reading:</p>
<ol>
<li>
<a href="http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/">Writing a Big Application in Ext</a>
</li>
<li><a href="http://tdg-i.com/364/abstract-classes-with-ext-js">Abstract classes with Ext JS</a>
</li>
</ol>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="js02@aariadne.com" /><input type="hidden" name="item_number" value="Blog Donation" /><input type="hidden" name="currency_code" value="EUR" /><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/know-how/factory-functions-in-ext-extensions/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>New Example &#8211; Grid in Card Layout</title>
		<link>http://blog.extjs.eu/examples/new-example-grid-in-card-layout/</link>
		<comments>http://blog.extjs.eu/examples/new-example-grid-in-card-layout/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 12:49:17 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[ext]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=540</guid>
		<description><![CDATA[<br/>Hi all,
I&#8217;ve just uploaded new example of Grid in Card Layout
Enjoy!
]]></description>
			<content:encoded><![CDATA[<br/><p>Hi all,</p>
<p>I&#8217;ve just uploaded new example of <a target="_blank" href="http://examples.extjs.eu/?ex=gridincard">Grid in Card Layout</a></p>
<p>Enjoy!</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="js02@aariadne.com" /><input type="hidden" name="item_number" value="Blog Donation" /><input type="hidden" name="currency_code" value="EUR" /><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/examples/new-example-grid-in-card-layout/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Convert DVD to iPhone Video with Subtitles and Chapters on Linux</title>
		<link>http://blog.extjs.eu/multimedia/how-to-convert-dvd-to-iphone-video-with-subtitles-and-chapters-on-linux/</link>
		<comments>http://blog.extjs.eu/multimedia/how-to-convert-dvd-to-iphone-video-with-subtitles-and-chapters-on-linux/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 21:02:44 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=506</guid>
		<description><![CDATA[<br/>iPhone can play video that contains multiple streams and chapters:

video
multiple audio streams (languages)
multiple subtitles (languages)
chapters for easy navigation

After some googling and many trials and errors I found a multiplatform software that can create videos with all the above features. The software is HandBrake. HandBrake for (openSUSE) Linux can be downloaded from Packman.
Let&#8217;s convert our DVD [...]]]></description>
			<content:encoded><![CDATA[<br/><p>iPhone can play video that contains multiple streams and chapters:</p>
<ul>
<li>video</li>
<li>multiple audio streams (languages)</li>
<li>multiple subtitles (languages)</li>
<li>chapters for easy navigation</li>
</ul>
<p>After some googling and many trials and errors I found a multiplatform software that can create videos with all the above features. The software is <a target="_blank" href="http://handbrake.fr">HandBrake</a>. HandBrake for (openSUSE) Linux can be downloaded from <a target="_blank" href="http://packman.links2linux.org">Packman</a>.</p>
<p>Let&#8217;s convert our DVD to the iPhone video. For that insert an original DVD in the drive, start HandBrake and select source.</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-011.png"><img src="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-011.png" alt="dvd2ipod-01" title="dvd2ipod-01" width="600" class="aligncenter size-full wp-image-520" /></a></p>
<p>Select <i>iPhone &amp; iPod Touch</i> preset and type the file name and the destination directory.</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-02.png"><img src="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-02.png" alt="dvd2ipod-02" title="dvd2ipod-02" width="600" class="aligncenter size-full wp-image-521" /></a></p>
<p>There is not too much to set on Video tab, however, you can play with quality if you want.</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-03.png"><img src="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-03.png" alt="dvd2ipod-03" title="dvd2ipod-03" width="600" class="aligncenter size-full wp-image-522" /></a></p>
<p>In Audio tab, add as many audio tracks as you want:</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-04.png"><img src="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-04.png" alt="dvd2ipod-04" title="dvd2ipod-04" width="600" class="aligncenter size-full wp-image-523" /></a></p>
<p>If you want to &#8220;burn&#8221; subtitles into video, just select one from the original DVD and you&#8217;re done. More difficult is if you want Closed Captioning subtitles (that can be turned off on iPhone). For that you need external files with subtitles in <code>srt</code> format. You can download them from <a target="_blank" href="http://opensubtitles.org">opensubtitles.org</a>. The problem can be that the downloaded subtitles may not be in sync with you video. I haven&#8217;t found a better way only to encode the DVD and, if subtitles are out of sync, use <a target="_blank" href="http://subcomposer.sourceforge.net">Subtitle Composer</a> to adjust the timing(s) and re-encode.</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-05.png"><img src="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-05.png" alt="dvd2ipod-05" title="dvd2ipod-05" width="600" class="aligncenter size-full wp-image-524" /></a></p>
<p>Default settings in H.264 tab do not need any change.</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-06.png"><img src="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-06.png" alt="dvd2ipod-06" title="dvd2ipod-06" width="600" class="aligncenter size-full wp-image-525" /></a></p>
<p>Rename chapters if you want. Names are sometimes on DVD covers, sometimes not.</p>
<p><a href="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-07.png"><img src="http://blog.extjs.eu/wp-content/uploads/2009/10/dvd2ipod-07.png" alt="dvd2ipod-07" title="dvd2ipod-07" width="600" class="aligncenter size-full wp-image-526" /></a></p>
<p>Start encoding, wait an hour or so and then download the resulting video to your iPhone with iTunes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/multimedia/how-to-convert-dvd-to-iphone-video-with-subtitles-and-chapters-on-linux/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How to extract subtitles from DVD</title>
		<link>http://blog.extjs.eu/multimedia/how-to-extract-subtitles-from-dvd/</link>
		<comments>http://blog.extjs.eu/multimedia/how-to-extract-subtitles-from-dvd/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 09:11:09 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Multimedia]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=504</guid>
		<description><![CDATA[<br/>
mencoder dvd://1 -oac copy -ovc copy -o /dev/null -vobsubout output -sid 1

Then use avidemux2_qt4
]]></description>
			<content:encoded><![CDATA[<br/>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mencoder dvd:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #000000;">1</span> <span style="color: #660033;">-oac</span> copy <span style="color: #660033;">-ovc</span> copy <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">-vobsubout</span> output <span style="color: #660033;">-sid</span> <span style="color: #000000;">1</span></pre></div></div>

<p>Then use <code>avidemux2_qt4</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/multimedia/how-to-extract-subtitles-from-dvd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keeping modified records of EditorGridPanel while paging</title>
		<link>http://blog.extjs.eu/patterns/code-patterns/keeping-modified-records-of-editorgridpanel-while-paging/</link>
		<comments>http://blog.extjs.eu/patterns/code-patterns/keeping-modified-records-of-editorgridpanel-while-paging/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 08:59:44 +0000</pubDate>
		<dc:creator>Saki</dc:creator>
				<category><![CDATA[Code Patterns]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Know-how]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://blog.extjs.eu/?p=498</guid>
		<description><![CDATA[<br/>If you modify records of an editable grid with paging and if you then page-out, your changes are lost. Well, they are not lost in fact unless you have set pruneModifiedRecords:true on the strore. The modifications are still available so we just need to apply them. Here is the code fragment that does it:

var grid [...]]]></description>
			<content:encoded><![CDATA[<br/><p>If you modify records of an editable grid with paging and if you then page-out, your changes are lost. Well, they are not lost in fact unless you have set <code><a target="_blank" href="http://www.extjs.com/deploy/dev/docs/?class=Ext.data.Store&#038;member=pruneModifiedRecords">pruneModifiedRecords:true</a></code> on the strore. The modifications are still available so we just need to apply them. Here is the code fragment that does it:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> grid <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">grid</span>.<span style="color: #660066;">EditorGridPanel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    store<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">Store</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
         listeners<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>
            load<span style="color: #339933;">:</span><span style="color: #009900;">&#123;</span>scope<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> fn<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>store<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                <span style="color: #006600; font-style: italic;">// loop through modified records</span>
                <span style="color: #003366; font-weight: bold;">var</span> modified <span style="color: #339933;">=</span> store.<span style="color: #660066;">getModifiedRecords</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> modified.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                    <span style="color: #006600; font-style: italic;">// see if we have a record with same id </span>
                    <span style="color: #006600; font-style: italic;">// and apply changes if yes</span>
                    <span style="color: #003366; font-weight: bold;">var</span> r <span style="color: #339933;">=</span> store.<span style="color: #660066;">getById</span><span style="color: #009900;">&#40;</span>modified<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #003366; font-weight: bold;">var</span> changes <span style="color: #339933;">=</span> modified<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getChanges</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>p <span style="color: #000066; font-weight: bold;">in</span> changes<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>changes.<span style="color: #660066;">hasOwnProperty</span><span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                r.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span>p<span style="color: #339933;">,</span> changes<span style="color: #009900;">&#91;</span>p<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                            <span style="color: #009900;">&#125;</span>
                        <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo changes loop</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo modified loop</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo load listener</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// eo listeners</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// rest of store configuration</span>
&nbsp;
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// rest of grid configuration</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// eo grid</span></pre></div></div>

<p><b>pruneModifiedRecords must be false (the default) for this to work.</b></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.extjs.eu/patterns/code-patterns/keeping-modified-records-of-editorgridpanel-while-paging/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

