<?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>Piece of mind</title>
	<atom:link href="http://uzza.pl/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://uzza.pl/blog</link>
	<description>of Łukasz Lipiński</description>
	<lastBuildDate>Sat, 29 May 2010 12:55:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ajax.org Platform 3.0 beta2 Released!</title>
		<link>http://uzza.pl/blog/2010/02/03/ajaxorg-platform-30-beta2-released/</link>
		<comments>http://uzza.pl/blog/2010/02/03/ajaxorg-platform-30-beta2-released/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 07:52:18 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Ajax.org Platform]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=331</guid>
		<description><![CDATA[I do not want to repeat over and over again the same things, so to get more informations please look at following articles:
Ruben Daniels blog:
http://www.rubendaniels.com/2010/02/01/ajaxorg-platform-30-beta2-released/
My blog (in polish)
http://uzza.pl/blog-javascript/2010/02/03/ajax-org-platform-3-0-beta-2-ujrzala-swiatlo-dzienne/
Stay tuned !
]]></description>
			<content:encoded><![CDATA[<p>I do not want to repeat over and over again the same things, so to get more informations please look at following articles:</p>
<p><b>Ruben Daniels</b> blog:<br />
<a href="http://www.rubendaniels.com/2010/02/01/ajaxorg-platform-30-beta2-released/">http://www.rubendaniels.com/2010/02/01/ajaxorg-platform-30-beta2-released/</a></p>
<p><b>My blog</b> (in polish)<br />
<a href="http://uzza.pl/blog-javascript/2010/02/03/ajax-org-platform-3-0-beta-2-ujrzala-swiatlo-dzienne/">http://uzza.pl/blog-javascript/2010/02/03/ajax-org-platform-3-0-beta-2-ujrzala-swiatlo-dzienne/</a></p>
<p>Stay tuned !</p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2010/02/03/ajaxorg-platform-30-beta2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a component for Javeline Platform &#8211; Part 3</title>
		<link>http://uzza.pl/blog/2009/06/24/how-to-create-a-component-for-javeline-platform-part-3/</link>
		<comments>http://uzza.pl/blog/2009/06/24/how-to-create-a-component-for-javeline-platform-part-3/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 11:59:13 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javeline Components]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javeline]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=275</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

You&#8217;ll find answers on following questions:

How to add events to elements, and how to call component&#8217;s methods by its



At begining i would like to remind You [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<p><b>You&#8217;ll find answers on following questions:</b></p>
<ul>
<li>How to add events to elements, and how to call component&#8217;s methods by its</li>
</ul>
<p><a target="_blank" href="http://uzza.pl/developer/examples/how-to-create-a-component-for-javeline-platform/demo/index3.php"><img src="http://www.uzza.pl/developer/examples/demo.png" title="Demo" alt=""></img></a></p>
<p><a target="_blank" href="http://uzza.pl/developer/examples/how-to-create-a-component-for-javeline-platform/files/chapter3.zip"><img src="http://www.uzza.pl/developer/examples/download.png" title="Files" alt=""></img></a></p>
<p>At begining i would like to remind You about that we base on files from previous part of this article. </p>
<p>Events should be added in $draw function. We can do this in very simple way, by setting attribute to button node. Javeline Platform assing a unique id to each of components instances. In that way we can call component&#8217;s methods using that id&#8217;s to identify component object.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">oButton.setAttribute(&quot;onmouseover&quot;, &quot;jpf.lookup(&quot; + this.uniqueId + &quot;).$setStyleClass(this, 'hover');&quot;);
oButton.setAttribute(&quot;onmouseout&quot;, &quot;jpf.lookup(&quot; + this.uniqueId + &quot;).$setStyleClass(this, '', ['hover']);&quot;);
oButton.setAttribute(&quot;onmousedown&quot;, &quot;jpf.lookup(&quot; + this.uniqueId + &quot;).selectButton(this.innerHTML);&quot;);</pre></div></div>

<p>In next step we&#8217;ll set captions to each of buttons. Why we didn&#8217;t do that when we was setting attributes ? Answer is simple, because we worked with xmlNodes.</p>
<p>So now we need to get htmlNodes (we will use this.oStatus in next steps) and define array with captions:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">this.oStatus = this.$getLayoutNode(&quot;main&quot;, &quot;status&quot;,  this.oExt);
this.oButtons = this.$getLayoutNode(&quot;main&quot;, &quot;buttons&quot;,  this.oExt);
&nbsp;
var captions = [
    1, 2, 3, 0, &quot;/&quot;, &quot;+&quot;,
    4, 5, 6, &quot;.&quot;, &quot;*&quot;, &quot;-&quot;,
    7, 8, 9, &quot;+/-&quot;, &quot;%&quot;, &quot;=&quot;,
];</pre></div></div>

<p>We are looking for row and button elements among child nodes of oButtons element and we are setting captions to buttons:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">var nodes1 = this.oButtons.childNodes;
for (var i = 0, l1 = nodes1.length, counter = 0; i &lt; l1; i++) {
    if ((nodes1[i].className || &quot;&quot;).indexOf(&quot;calcrow&quot;) != -1) {
        var nodes2 = nodes1[i].childNodes;
        for(var j = 0, l2 = nodes2.length; j &lt; l2; j++) {
            if ((nodes2[j].className || &quot;&quot;).indexOf(&quot;calcbtn&quot;) != -1) {
                nodes2[j].innerHTML = captions[counter++];
            }
        }
    }
}</pre></div></div>

<p>We can&#8217;t forget about selectButton function. In that way You can communicate with component. Of course You don&#8217;t need use innerHTML, it can be something else.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">this.selectButton = function(sChar) {
    this.oStatus.innerHTML += sChar;
};</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2009/06/24/how-to-create-a-component-for-javeline-platform-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a component for Javeline Platform &#8211; Part 2</title>
		<link>http://uzza.pl/blog/2009/06/23/how-to-create-a-component-for-javeline-platform-part-2/</link>
		<comments>http://uzza.pl/blog/2009/06/23/how-to-create-a-component-for-javeline-platform-part-2/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 09:47:11 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javeline Components]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=246</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

You&#8217;ll find answers on following questions:

How to add more elements to component
How to set CSS only for specific browsers



For add more elements to component we need [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<p><b>You&#8217;ll find answers on following questions:</b></p>
<ul>
<li>How to add more elements to component</li>
<li>How to set CSS only for specific browsers</li>
</ul>
<p><a target="_blank" href="http://uzza.pl/developer/examples/how-to-create-a-component-for-javeline-platform/demo/index2.php"><img src="http://www.uzza.pl/developer/examples/demo.png" title="Demo" alt=""></img></a></p>
<p><a target="_blank" href="http://uzza.pl/developer/examples/how-to-create-a-component-for-javeline-platform/files/chapter2.zip"><img src="http://www.uzza.pl/developer/examples/download.png" title="Files" alt=""></img></a></p>
<p>For add more elements to component we need to define its in skin file. If we want use its only one time (in component), we can add its to MAIN section:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:main container=&quot;.&quot; buttons=&quot;div[2]&quot; status=&quot;div[1]&quot;&gt;
    &lt;div class=&quot;calc&quot;&gt;
        &lt;div class=&quot;status&quot;&gt; &lt;/div&gt;
        &lt;div class=&quot;buttons&quot;&gt; &lt;/div&gt;
    &lt;/div&gt;
&lt;/j:main&gt;</pre></div></div>

<p>if more, better will be create a new section:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:calcrow&gt;
    &lt;div class=&quot;calcrow&quot;&gt; &lt;/div&gt;
&lt;/j:calcrow&gt;
&lt;j:calcbtn&gt;
    &lt;div class=&quot;calcbtn&quot;&gt; &lt;/div&gt;
&lt;/j:calcbtn&gt;</pre></div></div>

<p>Now we can use this elements in this.$draw method. At begining we get a status and buttons elements:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">var oButtons = this.$getLayoutNode(&quot;main&quot;, &quot;buttons&quot;, oExt);
var oStatus  = this.$getLayoutNode(&quot;main&quot;, &quot;status&quot;, oExt);</pre></div></div>

<p>First param sets a name of section from which we want to get a element, second a name of attribute which specify a XPath to it.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">status=&quot;div[1]&quot; //XPath to status element in &lt;div class=&quot;calc&quot;&gt;</pre></div></div>

<p>To switch section to which we are taking a data from and create a new instance of it, we need to use following function:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">this.$getNewContext(sectionName);</pre></div></div>

<p>In that way we can create more the same elements. Like here where we created 3 rows with 6 buttons:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">for (var i = 0; i &lt; 3; i++) {
    this.$getNewContext(&quot;calcrow&quot;);
    var oRow = oButtons.appendChild(this.$getLayoutNode(&quot;calcrow&quot;));
&nbsp;
    for (var j = 0; j &lt; 6; j++) {
        this.$getNewContext(&quot;calcbtn&quot;);
        var oButton = oRow.appendChild(this.$getLayoutNode(&quot;calcbtn&quot;));
    }
}</pre></div></div>

<p>Our component will be nothing if we won&#8217;t use CSS for it. Here is a simple CSS style to arrange buttons inline in rows and set some colors to elements.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:style&gt;&lt;![CDATA[
.calc {
    width    : 192px;
    height   : 118px;
    border   : 1px solid black;
    overflow : hidden;
    padding  : 0;
}
.calc .status {
    width  : 100%;
    height : 23px;
}
&nbsp;
.calc .calcrow {
&nbsp;
}
&nbsp;
.calc .calcbtn {
    width            : 30px;
    height           : 30px;
    background-color : silver;
    display          : inline-block;
    margin           : 1px;
}
]]&gt;&lt;/j:style&gt;</pre></div></div>

<p>Someone will tell &#8220;Ok, but this style is incorrect for Internet Exploerer&#8221;&#8230; Yes it is, now i need to introduct a simple way to specify CSS styles for specific browser. Here it is:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:style condition=&quot;jpf.isIE&quot;&gt;&lt;![CDATA[
.calc .calcbtn {
    float:left;
}
]]&gt;&lt;/j:style&gt;</pre></div></div>

<p>This code fix all problems with display:inline-block; option. </p>
<p>Of course we can use different conditions like:<br />
jpf.isOpera, jpf.isSafari, jpf.isKonqueror, jpf.isIphone, jpf.isChrome, jpf.isGecko, jpf.isGecko3 or jpf.isIE8. </p>
<p>You&#8217;ll find answers for Your all questions in Javeline Platform RefGuide at <a href="http://www.ajax.org/documentation/refguide/">http://www.ajax.org/documentation/refguide/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2009/06/23/how-to-create-a-component-for-javeline-platform-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a component for Javeline Platform &#8211; Part 1</title>
		<link>http://uzza.pl/blog/2009/06/23/how-to-create-a-component-for-javeline-platform-part-1/</link>
		<comments>http://uzza.pl/blog/2009/06/23/how-to-create-a-component-for-javeline-platform-part-1/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 07:01:12 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javeline Components]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javeline]]></category>
		<category><![CDATA[skin]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=219</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

You&#8217;ll find answers on following questions:

Which namespace should be used, and what files should be included
How default skin declaration looks
How much javascript code is needed to [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<p><b>You&#8217;ll find answers on following questions:</b></p>
<ul>
<li>Which namespace should be used, and what files should be included</li>
<li>How default skin declaration looks</li>
<li>How much javascript code is needed to create the simplest component</li>
</ul>
<p><a target="_blank" href="http://uzza.pl/developer/examples/how-to-create-a-component-for-javeline-platform/demo/index1.php"><img src="http://www.uzza.pl/developer/examples/demo.png" title="Demo" alt=""></img></a></p>
<p><a target="_blank" href="http://uzza.pl/developer/examples/how-to-create-a-component-for-javeline-platform/files/chapter1.zip"><img src="http://www.uzza.pl/developer/examples/download.png" title="Files" alt=""></img></a></p>
<p>I would like to show You in this article how easy is creating components. For example this will be a calc component. First of all we need to prepare a default html document with linked JPF library, skin file and our component js file. </p>
<p><b>index.html file</b></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns:j=&quot;http://www.javeline.com/2005/jml&quot; 
xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
    &lt;head&gt;
        &lt;title&gt;Calc component&lt;/title&gt;
        &lt;script src=&quot;jpf_release.js&quot;&gt;&lt;/script&gt;
        &lt;script src=&quot;jpf.calc.js&quot;&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;j:skin src=&quot;skins.xml&quot; icon-path=&quot;&quot;&gt;&lt;/j:skin&gt;
&nbsp;
        &lt;j:calc /&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>In next step we should create a skin file with 2 sections: Style and Presentation:</p>
<p><b>skin.xml file</b></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;?xml version='1.0'?&gt;
&lt;j:skin xmlns:j=&quot;http://www.javeline.com/2005/jml&quot; 
xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
    &lt;j:calc name=&quot;calc&quot;&gt;
        &lt;j:style&gt;&lt;![CDATA[
            .calc {
&nbsp;
            }
        ]]&gt;&lt;/j:style&gt;
        &lt;j:presentation&gt;
            &lt;j:main container=&quot;.&quot;&gt;
                &lt;div class=&quot;calc&quot;&gt; &lt;/div&gt;
            &lt;/j:main&gt;
        &lt;/j:presentation&gt;
    &lt;/j:calc&gt;
&lt;/j:skin&gt;</pre></div></div>

<p>As we see, there is a default declaration of skin for calc component:</p>
<p><b>Default declaration of skin</b></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:calc name=&quot;calc&quot;&gt;&lt;/j:calc&gt;</pre></div></div>

<p>If we&#8217;ll create more skins we need to change name attribute and CSS class name of main container. If these component will can contain other components, name of main and child containers should be realy unique, because they won&#8217;t be overwriting classes of contained components. (Remember, space between DIV tags should be there, this is not a misstake).</p>
<p><b>Class name of main container</b></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;calc&quot;&gt; &lt;/div&gt;</pre></div></div>

<p>And finaly, javascript code for new component should look like:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">jpf.calc = jpf.component(jpf.NODE_VISIBLE, function(){
    this.$draw  = function() {
        this.oExt = this.$getExternal(&quot;main&quot;, null, function(oExt) {
&nbsp;
        });
    };
}).implement(jpf.Presentation);</pre></div></div>

<p>We are getting a container from skin file, and we puting it to document body. Please check source (for example in firebug). You should have there an empty DIV element with class=&#8221;calc&#8221;. </p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2009/06/23/how-to-create-a-component-for-javeline-platform-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add style for &#8220;No items&#8221; state in Spreadsheet component</title>
		<link>http://uzza.pl/blog/2009/04/06/how-to-add-style-for-no-items-state-in-spreadsheet-component/</link>
		<comments>http://uzza.pl/blog/2009/04/06/how-to-add-style-for-no-items-state-in-spreadsheet-component/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 06:40:41 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javeline Components]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javeline]]></category>
		<category><![CDATA[skin]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=206</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

Spreadsheet component is depreciated since Ajax.org Platform 3.0.

Open Your skin file and add this in spreadsheet skin:

.spreadsheet .records div.empty {
    /* Here goes [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<div class="solution">Spreadsheet component is depreciated since Ajax.org Platform 3.0.</div>
<p></p>
<p>Open Your skin file and add this in spreadsheet skin:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">.spreadsheet .records div.empty {
    /* Here goes CSS code */
}</pre></div></div>

<p>If You don&#8217;t see results, go to <b>presentation</b> section and check what class name have this element:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:empty caption=&quot;.&quot;&gt;
    &lt;div class=&quot;empty&quot;&gt; &lt;/div&gt;
&lt;/j:empty&gt;</pre></div></div>

<p>If You still don&#8217;t see any changes, clear cache in Your browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2009/04/06/how-to-add-style-for-no-items-state-in-spreadsheet-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get data from database and fill datagrid with its using Zend Framework</title>
		<link>http://uzza.pl/blog/2009/04/01/how-to-fill-datagrid-with-fields-from-database-using-zend-framework/</link>
		<comments>http://uzza.pl/blog/2009/04/01/how-to-fill-datagrid-with-fields-from-database-using-zend-framework/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 12:43:13 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[datagrid]]></category>
		<category><![CDATA[javeline]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[teleport]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=142</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

I assume that user have installed Zend Framework and downloaded Javeline Platform. 


First we need to define Datagrid:

&#60;j:datagrid
    id     [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<p>I assume that user have installed Zend Framework and downloaded Javeline Platform. </p>
<p><a href="http://www.uzza.pl/developer/examples/how-to-fill-datagrid-with-fields-from-database-using-zend-framework/screencast/"><img src="http://www.uzza.pl/developer/examples/screencast.png" title="Example" alt=""></img></a></p>
<p><a href="http://www.uzza.pl/developer/examples/how-to-fill-datagrid-with-fields-from-database-using-zend-framework/files/files.zip"><img src="http://www.uzza.pl/developer/examples/download.png" title="Download files" alt=""></img></a></p>
<p>First we need to define <b>Datagrid</b>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:datagrid
    id      = &quot;DG&quot;
    options = &quot;sort|size&quot;
    top     = &quot;150&quot;
    left    = &quot;10&quot;
    right   = &quot;10&quot;
    height  = &quot;150&quot;
    model   = &quot;mdlDG&quot;
&gt; 
    &lt;j:bindings&gt;
        &lt;j:column caption=&quot;Username&quot; select=&quot;@username&quot; width=&quot;50%&quot;&gt;&lt;/j:column&gt;
        &lt;j:column caption=&quot;Email&quot; select=&quot;@email&quot; width=&quot;50%&quot;&gt;&lt;/j:column&gt;
        &lt;j:traverse select=&quot;user&quot; /&gt;
    &lt;/j:bindings&gt;
    &lt;j:model id=&quot;mdlDG&quot; &gt;
        &lt;data&gt;
        &lt;/data&gt;
    &lt;/j:model&gt;
&lt;/j:datagrid&gt;</pre></div></div>

<p>If we want set some default rows, we can do this between <b>data</b> tags.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;data&gt;
    &lt;user username=&quot;Somebody&quot; email=&quot;someone@gmail.com&quot;&gt;&lt;/user&gt;
&lt;/data&gt;</pre></div></div>

<p>Next, we need to define button, which will be used to refreshing datagrid.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:button left=&quot;10&quot; top=&quot;320&quot; width=&quot;70&quot; tooltip=&quot;Refresh datagrid&quot; onclick=&quot;refresh()&quot;&gt;Refresh&lt;/j:button&gt;</pre></div></div>

<p>When user clicked this button, <b>refresh()</b> function will be called.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">function refresh() {
    socket.getUsers();
}</pre></div></div>

<p>To communicating with server we&#8217;ll use <a href="http://www.ajax.org/documentation/refguide#element.teleport" target="_blank"><u>Javeline Teleport</u></a>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;j:teleport&gt;
    &lt;j:rpc id=&quot;socket&quot; protocol=&quot;cgi&quot;&gt;
        &lt;j:method
            name    = &quot;getUsers&quot;
            url        = &quot;users/index/&quot;
            receive  = &quot;afterGetUsers&quot;&gt;
         &lt;/j:method&gt;
     &lt;/j:rpc&gt;
&lt;/j:teleport&gt;</pre></div></div>

<p>Here we have created one method called <i>getUsers</i> refers to backend (PHP script). </p>
<p>Zend Framework understand &#8220;users/index&#8221; as: controller -> users, action -> index, of course we can put there link to &#8220;normal&#8221; script, for example: /modules/users.php.</p>
<p>After all, <i>afterGetUsers</i> function will be called automaticaly. getUsers and afterGetUsers its a javascript functions.</p>
<p><i>afterGetUsers</i> function will be used for reloading datagrid with new content</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">function afterGetUsers(data, state, extra) {
    if (state == jpf.SUCCESS) {
        DG.getModel().load(data);
    }
}</pre></div></div>

<h3>Creating backend</h3>
<p>Backend will be realy simple. We need to create one controller</p>
<p><i>application/controllers/UsersController.php</i></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;?php
class UsersController extends Zend_Controller_Action {
    public $_model;
&nbsp;
    public function indexAction() {
        $resp    = $this-&gt;getResponse();
&nbsp;
        $resp-&gt;setHeader('Content-Type', 'text/xml');
&nbsp;
        $model = $this-&gt;_getModel();
        $this-&gt;view-&gt;users = $model-&gt;getUsers();
&nbsp;
        $resp-&gt;setHttpResponseCode(200);
    }
&nbsp;
    protected function _getModel() {
        if (null === $this-&gt;_model) {
            require_once dirname(__FILE__).'/../models/Users.php';
            $this-&gt;_model = new Model_Users();
        }
        return $this-&gt;_model;
    }
}</pre></div></div>

<p>where we receive data from database agency model which have implemented function to get it.</p>
<p>Model (<i>application/models/Users.php</i>):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">class Model_Users {
    protected $_table;
&nbsp;
    public function getTable() {
        if (null === $this-&gt;_table) {
            require_once dirname(__FILE__) . '/DbTable/Users.php';
            $this-&gt;_table = new Model_DbTable_Users;
        }
        return $this-&gt;_table;
    }
&nbsp;
    public function getUsers() {
        $table = $this-&gt;getTable();
        $select = $table-&gt;getUsers();
&nbsp;
        return $table-&gt;fetchAll($select)-&gt;toArray();
    }
}</pre></div></div>

<p>Database table (<i>application/models/DbTable/Users.php</i>):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">class Model_DbTable_Users extends Zend_Db_Table_Abstract {
&nbsp;
    protected $_name = 'oda_user';
&nbsp;
    public function getUsers() {
        return parent::select();
    }
}</pre></div></div>

<p>If You want read more about it, please look at: <a href="http://framework.zend.com/docs/quickstart/create-a-model-and-database-table" target="_blank">Zend Framework Quick Start &#8211; Create a Model and Database Table</a></p>
<p>In next step we need to create view file, which parse our data to XML.</p>
<p>View (<i>application/views/users/index.phtml</i>):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$data = $this-&gt;users;
$len = count($data);
&nbsp;
$result = '&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;'.&quot;\n&quot;;
$result .= '&lt;data&gt;'.&quot;\n&quot;;
    if ($len &gt; 0) {
        for($i = 0; $i &lt; $len; $i++) {
            $result .= '&lt;user username=&quot;'.$data[$i][&quot;username&quot;].'&quot; email=&quot;'.$data[$i][&quot;email&quot;].'&quot;&gt;&lt;/user&gt;'.&quot;\n&quot;;
        }
    }
    else {
        //load empty row - You can leave this else
        $result .= '&lt;user /&gt;'.&quot;\n&quot;;
    }
echo $result .= '&lt;/data&gt;';</pre></div></div>

<p>If You have problems with getting new data, press <b>F9</b> button to open <b>JPF Debugger</b> (remember, You need to have included jpf_debug.js not jpf_release.js) and check request and received data. </p>
<p><b>Example &#8211; Requested and recived data</b><br />
<a href="http://www.uzza.pl/developer/examples/how-to-fill-datagrid-with-fields-from-database-using-zend-framework/images/debugger.jpg" target="_blank" title="Example: Recieving data from server"><img src="http://www.uzza.pl/developer/examples/how-to-fill-datagrid-with-fields-from-database-using-zend-framework/images/debugger_small.jpg" title="Example: Recieving data from server" alt=""></img></a></p>
<p>GL &#038; HF with JPF.</p>
<p>P.S. If You don&#8217;t know what GL &#038; HF means&#8230; check <a href="http://acronyms.thefreedictionary.com/Good+Luck,+Have+Fun" target="_blank">GL &#038; HF meaning</a></p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2009/04/01/how-to-fill-datagrid-with-fields-from-database-using-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add selecting rows in spreadsheet</title>
		<link>http://uzza.pl/blog/2009/04/01/how-to-add-selecting-rows-in-spreadsheet/</link>
		<comments>http://uzza.pl/blog/2009/04/01/how-to-add-selecting-rows-in-spreadsheet/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 10:51:31 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javeline Components]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javeline]]></category>
		<category><![CDATA[skin]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[spreadsheet]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=152</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

Spreadsheet component is depreciated since Ajax.org Platform 3.0.

This is very simple operation. Please open Your skin.xml file and find Spreadsheet skin.
Under:

.spreadsheet .records div &#123;   [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<div class="solution">Spreadsheet component is depreciated since Ajax.org Platform 3.0.</div>
<p></p>
<p>This is very simple operation. Please open Your skin.xml file and find <b>Spreadsheet</b> skin.</p>
<p>Under:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.spreadsheet</span> <span style="color: #6666ff;">.records</span> div <span style="color: #00AA00;">&#123;</span>     
 <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>add this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.spreadsheet</span> <span style="color: #6666ff;">.records</span> div<span style="color: #6666ff;">.selected</span> <span style="color: #00AA00;">&#123;</span>
     //css code for selected row when spreadsheet is not focused
 <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.spreadsheetFocus</span> <span style="color: #6666ff;">.records</span> div<span style="color: #6666ff;">.selected</span> <span style="color: #00AA00;">&#123;</span>
     //css code for selected row when spreadsheet is focused
 <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>That&#8217;s all.</p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2009/04/01/how-to-add-selecting-rows-in-spreadsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drag &amp; Drop in few lines of code</title>
		<link>http://uzza.pl/blog/2009/03/25/drag-drop-in-few-lines-of-code/</link>
		<comments>http://uzza.pl/blog/2009/03/25/drag-drop-in-few-lines-of-code/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 10:59:31 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[drag-drop]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=110</guid>
		<description><![CDATA[Implementing possiblity of moving elements on website seems to be hard for person with little experience with Javascript. Only thought is &#8220;i need to use some library&#8221;, it&#8217;s realy good idea&#8230; ? when we want add only one feature ? Probably not&#8230; I&#8217;ll show You 30 lines of code which does it.  
Download files
View [...]]]></description>
			<content:encoded><![CDATA[<p>Implementing possiblity of moving elements on website seems to be hard for person with little experience with Javascript. Only thought is &#8220;i need to use some library&#8221;, it&#8217;s realy good idea&#8230; ? when we want add only one feature ? Probably not&#8230; I&#8217;ll show You 30 lines of code which does it.  </p>
<p><a href="http://www.uzza.pl/development/javascript/drag_and_drop/files.zip">Download files</a></p>
<p><a href="http://www.uzza.pl/development/javascript/drag_and_drop/" target="_blank">View Example</a></p>
<p>Please open Your favourite text editor or other tool which You are using to write Your code and type:</p>
<p><b>Primary content of HTML file</b></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #000066;">xml:lang</span>=<span style="color: #ff0000;">&quot;pl&quot;</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">&quot;pl&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;head<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;meta</span> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #993333; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;title<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>Drag <span style="color: #ddbb00;">&amp;amp;</span> Drop<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/title<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/head<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;body<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/body<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/html<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Between of BODY tags add DIV element (with its drag indicator) which will be moved.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;div<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;drag_indicator&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span><span style="color: #993333; font-weight: bold;">&lt;/div<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/div<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In next order we are connecting style sheet and javascript file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;link</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;style.css&quot;</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #993333; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;dragdrop.js&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span><span style="color: #993333; font-weight: bold;">&lt;/script<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Body of .css file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">div.drag_indicator {
    width            : 100px;
    height           : 20px;
    background-color : yellow;
}
&nbsp;
#block1 {
    width            : 100px;
    height           : 100px;
    background-color : red;
    position         : absolute;
}</pre></div></div>

<p>In this way we defined red block of 100&#215;100 pixels dimension with absolute position relative to browser window and yellow block of 100&#215;20 pixels dimension.</p>
<p>In file with .js extension we are writing code which catch 3 actions in document object:</p>
<ul>
<li>onmousedown &#8211; when user press mouse button</li>
<li>onmousemove &#8211; when user move mouse cursor</li>
<li>onmouseup &#8211; when user release mouse button</li>
</ul>
<p>Please look, mouse movement will be supported only when mouse button is pressed, that&#8217;s why <b>onmousemove</b> event is captured in <b>onmousedown</b> event.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">document.onmousedown = function(e) {
    e = (e || event);
&nbsp;
    document.onmousemove = function(e) {
        e = (e || event);          
    }
};
&nbsp;
document.onmouseup = function(e) {
};</pre></div></div>

<p>Code which supports events in Internet Explorer browser</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">e = (e || event);</pre></div></div>

<p>When mouse button is pressed &#8220;onmousedown&#8221; event is activated. In first order we catch clicked object:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">var target = e.target || e.srcElement;</pre></div></div>

<p>If it is a HTML element, we break a code because this is highest embed element.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">if (target.tagName == 'HTML')
        return;</pre></div></div>

<p>In next step, we are looking for &#8220;drag_indicator&#8221; class in clicked element. If it haven&#8217;t, we are checking its parent nodes as long as we&#8217;ll found it or we came to the top of elements tree.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">while (target != document.body <span style="color: #ddbb00;">&amp;&amp; (target.className || &quot;&quot;).indexOf(&quot;drag_indicator&quot;) == -1) {</span>
<span style="color: #ddbb00;">    target = target.parentNode || target.parentElement;</span>
}</pre></div></div>

<p>If correct element haven&#8217;t been found, we break a script</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">if ((target.className || &quot;&quot;).indexOf(&quot;drag_indicator&quot;) == -1)
        return;</pre></div></div>

<p>When correct element has been clicked (div with block_indicator css class) script will go further. Because we wants to move entire block, not only a indicator we needs to find out its object. <b>block_indicator</b> is a child of block, so we needs to get it as follow:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">target = target.parentNode;</pre></div></div>

<p>In nexts lines we credit cursor position at the moment of click to <b>sx</b> and <b>sy</b> variables.  In <b>dx</b> and <b>dy</b> we&#8217;ll keeping alteration (default is 0) and in <b>l</b> and <b>t</b> current position of block element.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"> var sx = e.clientX, sy = e.clientY,
      dx = 0, dy = 0,
      l = target.offsetLeft,
      t = target.offsetTop;</pre></div></div>

<p>In Firefox browser we encount a inconvenience of moving block. We can solve this problem using that condition:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">if (e.preventDefault) {
    e.preventDefault();
}</pre></div></div>

<p>In this moment we have all initial values. Now time has come for implementing dragging.</p>
<p>When block is moving, this function is called</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">document.onmousemove = function(e) {
}</pre></div></div>

<p>To change a block position we need to read mouse cursor current position (e.clientX, e.clientY) and subtract it from initial values simultaneously saving it to <b>dx</b> i <b>dy</b>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">dx = e.clientX - sx;
dy = e.clientY - sy;</pre></div></div>

<p>Finaly, we need to set current position (last position + alteration) to block element.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">target.style.left = (l + dx) + &quot;px&quot;;
target.style.top  = (t + dy) + &quot;px&quot;;</pre></div></div>

<p>When mouse button will be release, following code will be ran:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">document.onmouseup = function(e) {
    document.onmousemove = null;
};</pre></div></div>

<p>In this way, we created cross-browser compatible code that is smaller than 1kB.</p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2009/03/25/drag-drop-in-few-lines-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notifier (Growl) Component</title>
		<link>http://uzza.pl/blog/2008/12/18/notifier-growl-component/</link>
		<comments>http://uzza.pl/blog/2008/12/18/notifier-growl-component/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 14:28:57 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javeline Components]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javeline]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=69</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

We know it good from Windows or OS X. This is a cloud which allows notifying user about some actions or conditions.
Example of Growl which will [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<p>We know it good from Windows or OS X. This is a cloud which allows notifying user about some actions or conditions.</p>
<p>Example of Growl which will be displayed when user choose Christmas Eve date.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:notifier</span> <span style="color: #000066;">position</span>=<span style="color: #ff0000;">&quot;bottom-right&quot;</span> <span style="color: #000066;">margin</span>=<span style="color: #ff0000;">&quot;10 10&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:event</span></span>
<span style="color: #009900;">        <span style="color: #000066;">when</span>=<span style="color: #ff0000;">&quot;{txtDrop.value == '2008-12-24'}&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Marry christmas !&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">icon</span>=<span style="color: #ff0000;">&quot;Reindeer.png&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">&quot;alert('something')&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/j:event<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/j:notifier<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Result:<br />
<img src="http://www.uzza.pl/developer/examples/notifier-growl-component/images/marry_christmas.jpg" alt="Example ilustration" /></p>
<p>In order to avoid any doubts, i&#8217;ll show <strong>Caldropdown</strong> component, from which this date is collected:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:caldropdown</span></span>
<span style="color: #009900;">    <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;txtDrop&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">output-format</span>=<span style="color: #ff0000;">&quot;yyyy-mm-dd&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/j:caldropdown<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Please remember about closing all tags, because Safari browser mind this.</p>
<p>In order to change growl&#8217;s skin, it&#8217;s enough to set <em>skin</em> attribute. Prepared are three:</p>
<ul>
<li>Notifer (default)</li>
<li>Smoke</li>
<li>Bubble</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:notifier</span></span>
<span style="color: #009900;">    <span style="color: #000066;">skin</span>=<span style="color: #ff0000;">&quot;bubble&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:event<span style="color: #993333; font-weight: bold;">&gt;</span></span><span style="color: #993333; font-weight: bold;">&lt;/j:event<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/j:notifier<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>&#8220;Default&#8221; means that, we musn&#8217;t set <em>skin</em> attribute for choosing it.</p>
<p>For all events which its defined in this component we can set too:</p>
<ul>
<li><strong>position</strong> &#8211; vertical and horizontal element&#8217;s start position, it can be changed in any time, default is &#8220;top-right&#8221;
<ul> Możliwe wartości:</p>
<li><strong>top-right</strong> or <strong>right-top</strong> &#8211; element is placed in top-right corner of browser window</li>
<li><strong>top-left</strong> or <strong>left-top</strong> &#8211; element is placed in top-left corner of browser window</li>
<li><strong>bottom-right</strong> or <strong>right-bottom</strong> &#8211; element is placed in bottom-right corner of browser window</li>
<li><strong>bottom-left</strong> or <strong>left-bottom</strong> &#8211; element is placed in bottom-left corner of browser window</li>
<li><strong>center-center</strong> &#8211; element is placed in the middle of browser window</li>
</ul>
</li>
<li><strong>margin</strong> &#8211; it&#8217;s a free space around popup element, default is 10px</li>
<li><strong>columnsize</strong> &#8211; specify element width and cols width where element will be displayed, default is 300 px</li>
<li><strong>arrange</strong> &#8211; popup elements can be displayed in rows or columns, default is &#8220;vertical&#8221;
<ul>
<li><strong>vertical</strong> &#8211; element will be displayed in rows</li>
<li><strong>horizontal</strong> &#8211; element will be displayed in columns</li>
</ul>
</li>
<li><strong>timeout</strong> &#8211; after the timeout has passed the popup will dissapear automatically, when the mouse hovers over the popup it doesn&#8217;t dissapear, default is 2 seconds</li>
</ul>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:notifier</span></span>
<span style="color: #009900;">    <span style="color: #000066;">position</span>=<span style="color: #ff0000;">&quot;top-right&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">margin</span>=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">timeout</span>=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">arrange</span>=<span style="color: #ff0000;">&quot;horizontal&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">columnsize</span>=<span style="color: #ff0000;">&quot;200&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:event<span style="color: #993333; font-weight: bold;">&gt;</span></span><span style="color: #993333; font-weight: bold;">&lt;/j:event<span style="color: #993333; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/j:notifier<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>For more details, please check documentation on <a href="http://www.ajax.org">www.ajax.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2008/12/18/notifier-growl-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slideshow Component</title>
		<link>http://uzza.pl/blog/2008/12/15/slideshow-component/</link>
		<comments>http://uzza.pl/blog/2008/12/15/slideshow-component/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 13:55:06 +0000</pubDate>
		<dc:creator>Łukasz Lipiński</dc:creator>
				<category><![CDATA[Javeline Components]]></category>
		<category><![CDATA[image viewer]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javeline]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://uzza.pl/blog/?p=22</guid>
		<description><![CDATA[This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit www.ajax.org for more details.

It&#8217;s a component designated for browsing various types of images. We are loading images using model in very easy way:

    &#60;j:model id=&#34;mdlImages&#34; save-original=&#34;true&#34; [...]]]></description>
			<content:encoded><![CDATA[<div class="solution">This article was written for Javeline Platform library. Examples contained therein are not fully compatible with the library Ajax.org Platform, which is the continuation of. Visit <a href="http://www.ajax.org">www.ajax.org</a> for more details.</div>
<p></p>
<p>It&#8217;s a component designated for browsing various types of images. We are loading images using model in very easy way:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">    &lt;j:model id=&quot;mdlImages&quot; save-original=&quot;true&quot; &gt;
        &lt;slideshow&gt;
            &lt;picture
                src=&quot;stuff/pic13.jpg&quot;
                thumb=&quot;stuff/pic13_small.jpg&quot;
                title=&quot;Landscape&quot;&gt;
           &lt;/picture&gt;
            ...
        &lt;/slideshow&gt;
    &lt;/j:model&gt;</pre></div></div>

<p>set path to image file, its thumbnail and discription. If we are loading images from database (that&#8217;s enough loaded PHP file as model, which will be generating an XML code) and we are not sure whether all images, its thumbnails or discriptions exists, we can set default values:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:slideshow</span></span>
<span style="color: #009900;">        <span style="color: #000066;">defaultimage</span>=<span style="color: #ff0000;">&quot;stuff/default_image.jpg&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">defaultthumb</span>=<span style="color: #ff0000;">&quot;stuff/default_thumb.jpg&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">defaulttitle</span>=<span style="color: #ff0000;">&quot;Some discription&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;/j:slideshow<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>If dimension of image is bigger than allowed size, it will be limited to maximal allowed size.</p>
<p>Using mouse we can move it in any direction to see rest of image. That overrun is signalized to user with &#8220;four arrows&#8221; icon in the left bottom corner of viewport.</p>
<p>Under viewport we will find three buttons. Two extreme buttons allows us changing images to next and previous. Centered button runs <i>slideshow</i> mode, that is automatic image swiching with some delay. Interval could be set in <b>delay</b> parameter.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:slideshow</span> <span style="color: #000066;">delay</span>=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span><span style="color: #993333; font-weight: bold;">&lt;/j:slideshow<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>which is expressed in seconds (default is 5 seconds). When this mode is active, extreme buttons its hided and <i>Play</i> button is changed to <i>Stop</i> button, which allows disabling this mode. During image is loading, &#8220;Loading&#8230;&#8221; is displaying, which could be set in <b>loadmsg</b> parameter.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:slideshow</span> <span style="color: #000066;">loadmsg</span>=<span style="color: #ff0000;">&quot;Loading...&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span><span style="color: #993333; font-weight: bold;">&lt;/j:slideshow<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In the bottom of browser window discription and thumbnails bars are placed.</p>
<p>Discription bar shows two informations. Image position on list and its discription. Of course We could choose what we want to display using <b>title</b> attribute:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:slideshow</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;number+text&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span><span style="color: #993333; font-weight: bold;">&lt;/j:slideshow<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Possible values:</p>
<ul>
<li>number &#8211; description contains only slide number on a list</li>
<li>text &#8211; description contains only text</li>
<li>number+text &#8211; description contains slide number on a list and text</li>
</ul>
<p>Thumbnails bar serve to browsing entire content without necessity of opening each picture. Using arrows placed on begining and on end we could scroll entire content.</p>
<p>Parameter <b>thumbheight</b> define thumbnails bar height.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #993333; font-weight: bold;">&lt;j:slideshow</span> <span style="color: #000066;">thumbheight</span>=<span style="color: #ff0000;">&quot;60&quot;</span><span style="color: #993333; font-weight: bold;">&gt;</span><span style="color: #993333; font-weight: bold;">&lt;/j:slideshow<span style="color: #993333; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Default is 50px. Dimensions less than 40px will need intervention into graphics, because some elements will be to big for displaying.</p>
<p>It&#8217;s possible to make choice with mousewheel, which is scrolling thumbnails bar and automaticly choose selected image and with left-right arrows from keyboard.</p>
]]></content:encoded>
			<wfw:commentRss>http://uzza.pl/blog/2008/12/15/slideshow-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
