<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: New to JavaFX 1.3: Cells</title>
	<atom:link href="http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/feed/" rel="self" type="application/rss+xml" />
	<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/</link>
	<description>Sharing the Experience of JavaFX</description>
	<lastBuildDate>Wed, 08 Feb 2012 17:43:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Narayan gopal</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-9015</link>
		<dc:creator>Narayan gopal</dc:creator>
		<pubDate>Sun, 22 Aug 2010 16:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-9015</guid>
		<description>You are awesome.
The css was so fun..
It was so easy i didn&#039;t even know.

Thanks
for the grt post!</description>
		<content:encoded><![CDATA[<p>You are awesome.<br />
The css was so fun..<br />
It was so easy i didn&#8217;t even know.</p>
<p>Thanks<br />
for the grt post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Bair</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-8778</link>
		<dc:creator>Richard Bair</dc:creator>
		<pubDate>Mon, 09 Aug 2010 03:58:49 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-8778</guid>
		<description>The problem with this is that if you have, say, 2000 items in your list, then you would have 2000 HBoxes &amp; Labels &amp; Buttons when only 10 or so would be visible. This is a huge waste of memory and clearly doesn&#039;t scale up (suppose you had 30,000 items in your list. Or 3 million).

Being able to have a cell factory is crucial to virtualization, which is itself crucial for virtualization.</description>
		<content:encoded><![CDATA[<p>The problem with this is that if you have, say, 2000 items in your list, then you would have 2000 HBoxes &#038; Labels &#038; Buttons when only 10 or so would be visible. This is a huge waste of memory and clearly doesn&#8217;t scale up (suppose you had 30,000 items in your list. Or 3 million).</p>
<p>Being able to have a cell factory is crucial to virtualization, which is itself crucial for virtualization.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Bair</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-8777</link>
		<dc:creator>Richard Bair</dc:creator>
		<pubDate>Mon, 09 Aug 2010 03:56:28 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-8777</guid>
		<description>That is the one weakness with our approach, in that the cell factory produces a cell that needs to work with every row rather than providing, say, a row index and having the developer return a different cell based on the index or item at that index. However, the reason we didn&#039;t do that is because then you&#039;d have to maintain a cache of cells and be notified whenever they are in use or released and manage that pool yourself, which is really complicated.

So instead, what you have to do is return a single Cell which is capable of rendering any of the items. If you have, say, 2 different types of cells you want to display, then each Cell has to have 2 different sub-scenegraphs and then choose which one to use as the &quot;node&quot; based on the current index. SO for example:

cellFactory: function() {
    def cell:ListCell = ListCell {
        node: bind if (cell.item instanceof Customer) { /* some node to represent it*/ }
                         else if (cell.item instanceof Order) { /* some node to represent the Order */ }
    }
}

Or you can just have your custom cell have a variable for each type of sub-scene and lazily create them on demand, and then in the onUpdate callback do the switch there instead of using &quot;bind&quot; as the above code would create &amp; throw away the subscenes pretty frequently.

My calculation here was that it was better to provide a very simple cell factory interface rather than force developers to manage a pool of cells manually, with the assumption that there would typically not be a very large number of different renderings in a single list. If you find you have a use case where you really do have a lot of different cell types in a single list, then you could go all the way if you wanted to by doing something like a ListCellComposite subclass of ListCell that would take a sequence of ListCells, or have a ListCellCreator subclass that would have cell-pool functions built into it and a shared HashMap or something of cells.

For example, suppose you had 100 different cell types to render. Under the basic API we provide, if the ListView needed 20 cells, it would end up creating 20 cells which would potentially have 100 different sub-scenes -- and that 2000 different subscenes could be quite taxing on memory and such. Instead, suppose your implementation of the ListCell could refer to a pool of subscenes. When it needs one, it checks it out and assigns it to its node. When it is done with it, it puts it back. In this way you have 20 cells and only another 20 sub-scenes at first. Over time if every variation was used you could get up to all 2000 different subscenes, but it is unlikely, so you would probably save memory. Of course they could be housed in soft references so they are free&#039;d if memory gets tight.

Anyway, something to stew on :-)</description>
		<content:encoded><![CDATA[<p>That is the one weakness with our approach, in that the cell factory produces a cell that needs to work with every row rather than providing, say, a row index and having the developer return a different cell based on the index or item at that index. However, the reason we didn&#8217;t do that is because then you&#8217;d have to maintain a cache of cells and be notified whenever they are in use or released and manage that pool yourself, which is really complicated.</p>
<p>So instead, what you have to do is return a single Cell which is capable of rendering any of the items. If you have, say, 2 different types of cells you want to display, then each Cell has to have 2 different sub-scenegraphs and then choose which one to use as the &#8220;node&#8221; based on the current index. SO for example:</p>
<p>cellFactory: function() {<br />
    def cell:ListCell = ListCell {<br />
        node: bind if (cell.item instanceof Customer) { /* some node to represent it*/ }<br />
                         else if (cell.item instanceof Order) { /* some node to represent the Order */ }<br />
    }<br />
}</p>
<p>Or you can just have your custom cell have a variable for each type of sub-scene and lazily create them on demand, and then in the onUpdate callback do the switch there instead of using &#8220;bind&#8221; as the above code would create &#038; throw away the subscenes pretty frequently.</p>
<p>My calculation here was that it was better to provide a very simple cell factory interface rather than force developers to manage a pool of cells manually, with the assumption that there would typically not be a very large number of different renderings in a single list. If you find you have a use case where you really do have a lot of different cell types in a single list, then you could go all the way if you wanted to by doing something like a ListCellComposite subclass of ListCell that would take a sequence of ListCells, or have a ListCellCreator subclass that would have cell-pool functions built into it and a shared HashMap or something of cells.</p>
<p>For example, suppose you had 100 different cell types to render. Under the basic API we provide, if the ListView needed 20 cells, it would end up creating 20 cells which would potentially have 100 different sub-scenes &#8212; and that 2000 different subscenes could be quite taxing on memory and such. Instead, suppose your implementation of the ListCell could refer to a pool of subscenes. When it needs one, it checks it out and assigns it to its node. When it is done with it, it puts it back. In this way you have 20 cells and only another 20 sub-scenes at first. Over time if every variation was used you could get up to all 2000 different subscenes, but it is unlikely, so you would probably save memory. Of course they could be housed in soft references so they are free&#8217;d if memory gets tight.</p>
<p>Anyway, something to stew on <img src='http://fxexperience.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-8773</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Mon, 09 Aug 2010 01:02:10 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-8773</guid>
		<description>Great article (as usual)!

Are there limits to the flexibility that the cell factories support?  If I have a really heterogeneous sequence of data to be rendered in a single list how would I go about creating wildly different nodes based on the type of data?

Thanks,
Keith</description>
		<content:encoded><![CDATA[<p>Great article (as usual)!</p>
<p>Are there limits to the flexibility that the cell factories support?  If I have a really heterogeneous sequence of data to be rendered in a single list how would I go about creating wildly different nodes based on the type of data?</p>
<p>Thanks,<br />
Keith</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rk tumuluri</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-7828</link>
		<dc:creator>rk tumuluri</dc:creator>
		<pubDate>Fri, 02 Jul 2010 06:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-7828</guid>
		<description>Awesome hidden power in these ListView controls. Very deceptive. 
Good article to showcase the power.

Articles such as this re-affirm my faith in the JavaFX platform. 

Go JavaFX ...</description>
		<content:encoded><![CDATA[<p>Awesome hidden power in these ListView controls. Very deceptive.<br />
Good article to showcase the power.</p>
<p>Articles such as this re-affirm my faith in the JavaFX platform. </p>
<p>Go JavaFX &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaFX 1.3: Células</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-6445</link>
		<dc:creator>JavaFX 1.3: Células</dc:creator>
		<pubDate>Tue, 11 May 2010 12:20:35 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-6445</guid>
		<description>[...] JavaFX News, Demos and Insight // FX Experience   Compartilhe                               Dicas, Tutorial Dicas, [...]</description>
		<content:encoded><![CDATA[<p>[...] JavaFX News, Demos and Insight // FX Experience   Compartilhe                               Dicas, Tutorial Dicas, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Farrukh</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-6422</link>
		<dc:creator>Farrukh</dc:creator>
		<pubDate>Mon, 10 May 2010 12:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-6422</guid>
		<description>i want to know what is the motivation behind using cellfactory clousure i think u can use that syntax as well for example

Listview{
    items:[
           HBox{
                content:[
                     Label{}
                     Button{}
                ]
           }
    ]
}</description>
		<content:encoded><![CDATA[<p>i want to know what is the motivation behind using cellfactory clousure i think u can use that syntax as well for example</p>
<p>Listview{<br />
    items:[<br />
           HBox{<br />
                content:[<br />
                     Label{}<br />
                     Button{}<br />
                ]<br />
           }<br />
    ]<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-6360</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Thu, 06 May 2010 07:53:15 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-6360</guid>
		<description>+1 for liking the idea of having a single concept for many components.  I haven&#039;t experimented with JavaFX too much yet, but I&#039;ve read a ton of articles like this and it&#039;s starting to impress me.

For me, this implementation does a very good job of giving me the control I need to make a component useful while shielding me from a lot of the complexity that would normally have me over engineering things in plain old Java.

I think you guys are striking a nice balance of flexibility vs complexity.  I can see JavaFX being a very productive platform.

Good job!
Ryan</description>
		<content:encoded><![CDATA[<p>+1 for liking the idea of having a single concept for many components.  I haven&#8217;t experimented with JavaFX too much yet, but I&#8217;ve read a ton of articles like this and it&#8217;s starting to impress me.</p>
<p>For me, this implementation does a very good job of giving me the control I need to make a component useful while shielding me from a lot of the complexity that would normally have me over engineering things in plain old Java.</p>
<p>I think you guys are striking a nice balance of flexibility vs complexity.  I can see JavaFX being a very productive platform.</p>
<p>Good job!<br />
Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaFX + Facebook &#171; Java, JavaFX and beyond&#8230;</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-6303</link>
		<dc:creator>JavaFX + Facebook &#171; Java, JavaFX and beyond&#8230;</dc:creator>
		<pubDate>Tue, 04 May 2010 05:40:53 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-6303</guid>
		<description>[...] and client_id to JavaFX Applet. The view is implemented using ListView. Please refer to New to JavaFX 1.3: Cells for usage on ListView + ListCell [...]</description>
		<content:encoded><![CDATA[<p>[...] and client_id to JavaFX Applet. The view is implemented using ListView. Please refer to New to JavaFX 1.3: Cells for usage on ListView + ListCell [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaFX + Facebook &#171; Java, JavaFX and beyond&#8230;</title>
		<link>http://fxexperience.com/2010/04/new-to-javafx-1-3-cells/comment-page-1/#comment-6286</link>
		<dc:creator>JavaFX + Facebook &#171; Java, JavaFX and beyond&#8230;</dc:creator>
		<pubDate>Mon, 03 May 2010 10:10:20 +0000</pubDate>
		<guid isPermaLink="false">http://fxexperience.com/?p=644#comment-6286</guid>
		<description>[...] passing of access_token to JavaFX Applet. The view is implemented using ListView. Please refer to New to JavaFX 1.3: Cells for usage on ListView + ListCell [...]</description>
		<content:encoded><![CDATA[<p>[...] passing of access_token to JavaFX Applet. The view is implemented using ListView. Please refer to New to JavaFX 1.3: Cells for usage on ListView + ListCell [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

