<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Andreas Höhmann&#039;s Weblog &#187; Richfaces</title>
	<atom:link href="http://ahoehma.wordpress.com/category/softwareentwicklung/java/jsf/richfaces-jsf/feed/" rel="self" type="application/rss+xml" />
	<link>http://ahoehma.wordpress.com</link>
	<description></description>
	<lastBuildDate>Thu, 26 Nov 2009 15:53:12 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ahoehma.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/6b74f500a29ea048aa3d7a14adc1a24f?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Andreas Höhmann&#039;s Weblog &#187; Richfaces</title>
		<link>http://ahoehma.wordpress.com</link>
	</image>
			<item>
		<title>Richfaces modal panel default formular action</title>
		<link>http://ahoehma.wordpress.com/2009/11/16/richfaces-modal-panel-default-formular-action/</link>
		<comments>http://ahoehma.wordpress.com/2009/11/16/richfaces-modal-panel-default-formular-action/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 14:35:01 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[hotkey]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[panel]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=479</guid>
		<description><![CDATA[Each input dialog should have a default action for good useability.
If the user hit &#8216;Enter&#8217; then the default action should execute.
Here is my example of a richfaces modal edit dialog for such a requirement &#8230;
The dialog have input fields and 3 actions:

save &#8211; is the default action if the user hit &#8216;Enter&#8216; anywhere in the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=479&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Each input dialog should have a default action for good useability.</p>
<p>If the user hit &#8216;Enter&#8217; then the default action should execute.</p>
<p>Here is my example of a richfaces modal edit dialog for such a requirement &#8230;</p>
<p>The dialog have input fields and 3 actions:</p>
<ul>
<li>save &#8211; is the default action if the user hit &#8216;<strong>Enter</strong>&#8216; anywhere in the formular</li>
<li>cancel &#8211; is  the default action if the user hit &#8216;<strong>Esc</strong>&#8216; anywhere in the formular</li>
<li>reset</li>
</ul>
<pre class="brush: xml;">
&lt;rich:modalPanel id=&quot;edit_dialog&quot;&gt;

   &lt;a4j:form id=&quot;edit_form&quot; ajaxSubmit=&quot;true&quot;&gt;

     &lt;h:outputLabel value=&quot;What's your title:&quot; for=&quot;title&quot;/&gt;
     &lt;h:inputText  id=&quot;title&quot; value=&quot;#{bean.title}&quot;/&gt;
     &lt;h:outputLabel value=&quot;What's your name:&quot; for=&quot;name&quot;/&gt;
     &lt;h:inputText  id=&quot;name&quot; value=&quot;#{bean.name}&quot;/&gt;

       ...

     &lt;a4j:commandButton id=&quot;save&quot;
          value=&quot;Save&quot;
          action=&quot;#{save}&quot;
          type=&quot;submit&quot;
          oncomplete=&quot;if(#{facesContext.maximumSeverity==null})Richfaces.hideModalPanel('edit_dialog')&quot;/&gt;

     &lt;a4j:commandButton id=&quot;reset&quot;
          value=&quot;Reset&quot;
          action=&quot;#{bean.reset}&quot;
          limitToList=&quot;true&quot;
          reRender=&quot;edit_form&quot;
          ajaxSingle=&quot;true&quot;
          type=&quot;reset&quot;/&gt;

     &lt;a4j:commandButton id=&quot;cancel&quot;
          value=&quot;Cancel&quot;
          action=&quot;#{bean.cancel}&quot;
          ajaxSingle=&quot;true&quot;
          oncomplete=&quot;Richfaces.hideModalPanel('edit_dialog')&quot;/&gt;

     &lt;rich:hotKey key=&quot;return&quot;
         selector=&quot;#edit_form&quot;
         handler=&quot;${rich:element('edit_form:save')}.click();event.stopPropagation();event.preventDefault(); return false;&quot;
         disableInInput=&quot;false&quot;/&gt;

      &lt;rich:hotKey key=&quot;esc&quot;
         selector=&quot;#edit_form&quot;
         handler=&quot;${rich:element('edit_form:cancel')}.click();event.stopPropagation();event.preventDefault(); return false;&quot;
         disableInInput=&quot;false&quot;/&gt;

   &lt;/a4j:form&gt;

&lt;/rich:modalPanel&gt;
</pre>
<p>It&#8217;s important to define <strong>ajaxSubmit=&#8221;true&#8221;</strong> for the form! This avoid &#8220;none ajax submit of html formulars&#8221;. I will explain this in a later blog <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>With <a href="http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_hotKey.html" target="_blank">rich:hotKey</a> I bind 2 key events to the edit formular:</p>
<ul>
<li>on &#8216;enter&#8217; &#8211; the handler click the save button</li>
<li>on &#8216;esc&#8217; &#8211; the handler click the cancel button</li>
</ul>
<p>Try it <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/479/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=479&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/11/16/richfaces-modal-panel-default-formular-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Richfaces modal panel autofocus first input element</title>
		<link>http://ahoehma.wordpress.com/2009/11/16/richfaces-modal-panel-autofocus-first-input-element/</link>
		<comments>http://ahoehma.wordpress.com/2009/11/16/richfaces-modal-panel-autofocus-first-input-element/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 13:57:28 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[panel]]></category>
		<category><![CDATA[rich]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=468</guid>
		<description><![CDATA[With jQuery it&#8217;s easy to focus the first visible input element (textfield, textarea or selectbox) for a rich:modalPanel:

&#60;rich:modalPanel onshow=&#34;autofocus('dialog_content')&#34;&#62;
  &#60;h:panelGrid id=&#34;dialog_content&#34; columns=&#34;1&#34; width=&#34;100%&#34; cellpadding=&#34;0&#34; cellspacing=&#34;0&#34;&#62;
     &#60;a4j:form ajaxSubmit=&#34;true&#34;&#62;
       &#60;h:outputLabel value=&#34;What's your name:&#34; for=&#34;name&#34;/&#62;
       &#60;h:inputText  id=&#34;name&#34; value=&#34;#{bean.name}&#34;/&#62;
   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=468&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>With <a href="http://docs.jquery.com/Selectors" target="_blank">jQuery</a> it&#8217;s easy to focus the first visible input element (textfield, textarea or selectbox) for a <a href="http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_modalPanel.html" target="_blank">rich:modalPanel</a>:</p>
<pre class="brush: xml;">
&lt;rich:modalPanel onshow=&quot;autofocus('dialog_content')&quot;&gt;
  &lt;h:panelGrid id=&quot;dialog_content&quot; columns=&quot;1&quot; width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
     &lt;a4j:form ajaxSubmit=&quot;true&quot;&gt;
       &lt;h:outputLabel value=&quot;What's your name:&quot; for=&quot;name&quot;/&gt;
       &lt;h:inputText  id=&quot;name&quot; value=&quot;#{bean.name}&quot;/&gt;
       ...
       &lt;a4j:commandButton id=&quot;save&quot; value=&quot;Save my name&quot; action=&quot;save&quot;/&gt;
     &lt;/a4j:form&gt;
  &lt;/h:panelGrid&gt;
&lt;/rich:modalPanel&gt;
</pre>
<pre class="brush: jscript;">
function autofocus(containerId) {
  var element = jQuery(&quot;:input:not(:button):visible:enabled:first&quot;, '#'+containerId);
  if (element != null) {
    element.focus().select();
  }
}
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/468/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=468&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/11/16/richfaces-modal-panel-autofocus-first-input-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Disable backspace key in a Richfaces application</title>
		<link>http://ahoehma.wordpress.com/2009/11/06/disable-backspace-key-in-a-richfaces-application/</link>
		<comments>http://ahoehma.wordpress.com/2009/11/06/disable-backspace-key-in-a-richfaces-application/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 13:50:12 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[backspace]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[hotkey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=451</guid>
		<description><![CDATA[If you want disable the Backspace key in your JSF Richfaces application put this in your view:

&#60;rich:hotKey key=&#34;backspace&#34; handler=&#34;return false;&#34; disableInInput=&#34;true&#34;/&#62;

This will register a jQuery Hotkey handler for the document. The handler is not reqistered for input elements because in input fields you need the backspace  . Tested for FF3 and IE6.
Then I found [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=451&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you want disable the Backspace key in your JSF Richfaces application put this in your view:</p>
<pre class="brush: xml;">
&lt;rich:hotKey key=&quot;backspace&quot; handler=&quot;return false;&quot; disableInInput=&quot;true&quot;/&gt;
</pre>
<p>This will register a <a href="http://code.google.com/p/js-hotkeys/wiki/about" target="_blank">jQuery Hotkey</a> handler for the document. The handler is not reqistered for input elements because in input fields you need the backspace <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . Tested for FF3 and IE6.</p>
<p>Then I found out that the following snippet doesn&#8217;t work:</p>
<pre class="brush: xml;">
&lt;rich:hotKey key=&quot;backspace&quot;
             disableInInput=&quot;true&quot;
             handler=&quot;alert('Backspace is disabled'); return false;&quot; /&gt;
</pre>
<p>The Browser open the alert box and go to the previous page (in background?!). But there is a fix for that:</p>
<pre class="brush: xml;">
&lt;rich:hotKey key=&quot;backspace&quot;
             disableInInput=&quot;true&quot;
             handler=&quot;alert('Backspace is disabled'); event.stopPropagation(); event.preventDefault(); return false;&quot; /&gt;
</pre>
<p>The <strong>event</strong> variable is available in the handler function (see org.richfaces.renderkit.html.HotKeyRenderer method doEncodeEnd).</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/451/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/451/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/451/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=451&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/11/06/disable-backspace-key-in-a-richfaces-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Customized Richfaces Tree</title>
		<link>http://ahoehma.wordpress.com/2009/09/10/customized-richfaces-tree/</link>
		<comments>http://ahoehma.wordpress.com/2009/09/10/customized-richfaces-tree/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 11:42:02 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[collapse]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[expand]]></category>
		<category><![CDATA[rich faces]]></category>
		<category><![CDATA[Tree]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=361</guid>
		<description><![CDATA[Yesterday I had to customize the Richfaces tree component, because my client wants a special layout. My solution is a little bit strange. I share it here for someone which is in the same situation   Here is the story &#8230;
Per default the rich:tree looks like a standard tree browser (i.e. explorer, eclipse, whatever):

But [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=361&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Yesterday I had to customize the <strong>Richfaces</strong> tree component, because my client wants a special layout. My solution is a little bit strange. I share it here for someone which is in the same situation <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Here is the story &#8230;</p>
<p>Per default the rich:tree looks like a standard tree browser (i.e. explorer, eclipse, whatever):</p>
<p><img class="aligncenter size-full wp-image-364" title="rich_tree_standard" src="http://ahoehma.files.wordpress.com/2009/09/rich_tree_standard.png?w=173&#038;h=185" alt="rich_tree_standard" width="173" height="185" /></p>
<p>But I want this look:</p>
<p><img class="aligncenter size-full wp-image-363" title="rich_tree_customized" src="http://ahoehma.files.wordpress.com/2009/09/rich_tree_customized.png?w=141&#038;h=177" alt="rich_tree_customized" width="141" height="177" /></p>
<p>You see that the expand/collapse icon (<img class="alignnone size-full wp-image-365" title="rich_tree_expand" src="http://ahoehma.files.wordpress.com/2009/09/rich_tree_expand.png?w=16&#038;h=16" alt="rich_tree_expand" width="16" height="16" />) is on the same level with the node-icon (<img class="alignnone size-full wp-image-366" title="rich_tree_leaf" src="http://ahoehma.files.wordpress.com/2009/09/rich_tree_leaf.png?w=16&#038;h=16" alt="rich_tree_leaf" width="16" height="16" />). That&#8217;s very hard to fix this with CSS (it&#8217;s possible but i prefer my strange solution <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ). The <a href="http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_tree.html" target="_blank">Richfaces documentation</a> describes which parts of a tree could be customize.</p>
<p><img class="aligncenter" src="http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/images/treeNode_cn.png" alt="" /></p>
<p>We have:</p>
<ul>
<li><em>rich-tree-node-handle</em> and <em>rich-tree-node-handleicon</em> &#8211; a td which contains a link and a image to expand/collapse the node (only possible for a node not a leaf)</li>
<li><em>rich-tree-node-icon</em> &#8211; is a td which contains the image for a node (a node with children)</li>
<li><em>rich-tree-node-icon-leaf</em> &#8211; is a td which contains the image for a leaf (a node without children)</li>
</ul>
<p>I decide to move the expand/collapse icon from the <span style="color:#ff0000;">handle-td</span> to the <span style="color:#0000ff;">icon-td</span> and &#8220;simulate&#8221; the user-click with Javascript:</p>
<p><img class="aligncenter size-full wp-image-371" title="rich_tree_expand_move" src="http://ahoehma.files.wordpress.com/2009/09/rich_tree_expand_move.png?w=165&#038;h=182" alt="rich_tree_expand_move" width="165" height="182" /></p>
<h4>Listing 1 tree.xhtml:</h4>
<pre class="brush: xml;">
&lt;rich:tree id=&quot;tree&quot;
              binding=&quot;#{treeBean.tree}&quot;
              var=&quot;item&quot;
              switchType=&quot;ajax&quot;
              ajaxSubmitSelection=&quot;true&quot;
              toggleOnClick=&quot;false&quot;
              showConnectingLines=&quot;false&quot;
              disableKeyboardNavigation=&quot;true&quot;&gt;

    &lt;f:facet name=&quot;iconCollapsed&quot;&gt;
       &lt;!-- no image for collapsed --&gt;
       &lt;rich:spacer width=&quot;0&quot;  height=&quot;0&quot; style=&quot;border: none;&quot;/&gt;
    &lt;/f:facet&gt;
    &lt;f:facet name=&quot;iconExpanded&quot;&gt;
       &lt;!-- no image for expanded --&gt;
       &lt;rich:spacer width=&quot;0&quot;  height=&quot;0&quot; style=&quot;border: none;&quot;/&gt;
    &lt;/f:facet&gt;

    &lt;f:facet name=&quot;icon&quot;&gt;
       &lt;!--  use normal node icon to toggle expand/collapse --&gt;
       &lt;h:panelGroup&gt;
          &lt;h:graphicImage value=&quot;#{item.isLeaf ? '/images/leaf.gif' : '/images/collapsed.gif'}&quot;
                                 onclick=&quot;myToggleTreeNode(this);&quot;
                                 rendered=&quot;#{!treeBean.isExpanded}&quot;/&gt;
          &lt;h:graphicImage value=&quot;#{item.isLeaf ? '/images/leaf.gif' : '/images/expanded.gif'}&quot;
                                 onclick=&quot;myToggleTreeNode(this);&quot;
                                 rendered=&quot;#{treeBean.isExpanded}&quot;/&gt;
       &lt;/h:panelGroup&gt;
    &lt;/f:facet&gt;

    &lt;f:facet name=&quot;iconLeaf&quot;&gt;
       &lt;h:graphicImage value=&quot;/images/leaf.gif&quot;/&gt;
    &lt;/f:facet&gt;

    &lt;rich:recursiveTreeNodesAdaptor roots=&quot;#{treeBean.roots}&quot; var=&quot;item&quot; nodes=&quot;#{item.children}&quot;&gt;
       &lt;rich:treeNode&gt;
          &lt;h:outputText value=&quot;#{item.name}&quot;/&gt;
       &lt;/rich:treeNode&gt;
    &lt;/rich:recursiveTreeNodesAdaptor&gt;
&lt;/rich:tree&gt;
</pre>
<h4>Listing 2 tree.js:</h4>
<pre class="brush: jscript;">
function myToggleTreeNode(element) {
  var elem = jQuery(element);
  // img -&gt; span -&gt; td
  var parent = elem.parent().parent();
  var elementId = parent.attr(&quot;id&quot;);
  // i.e. j_id31:tree:j__id39:18::j_id40:icon -&gt; the td arround the icon-image
  var index = elementId.lastIndexOf(&quot;:icon&quot;);
  var treeNodeId = elementId.substring(0, index);
  // i.e. j_id31:tree:j__id39:18::j_id40:handle -&gt; the td arround the original expand/collapse-image
  var handleId = treeNodeId+':handle';
  // pure jQuery not working here
  var expandElement = jQuery($(handleId));
  expandElement.trigger(&quot;click&quot;);
}
</pre>
<h4>Listing 3 tree.css:</h4>
<pre class="brush: css;">
.rich-tree-node-handleicon {
  display: none;
}
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/361/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=361&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/09/10/customized-richfaces-tree/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>

		<media:content url="http://ahoehma.files.wordpress.com/2009/09/rich_tree_standard.png" medium="image">
			<media:title type="html">rich_tree_standard</media:title>
		</media:content>

		<media:content url="http://ahoehma.files.wordpress.com/2009/09/rich_tree_customized.png" medium="image">
			<media:title type="html">rich_tree_customized</media:title>
		</media:content>

		<media:content url="http://ahoehma.files.wordpress.com/2009/09/rich_tree_expand.png" medium="image">
			<media:title type="html">rich_tree_expand</media:title>
		</media:content>

		<media:content url="http://ahoehma.files.wordpress.com/2009/09/rich_tree_leaf.png" medium="image">
			<media:title type="html">rich_tree_leaf</media:title>
		</media:content>

		<media:content url="http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/images/treeNode_cn.png" medium="image" />

		<media:content url="http://ahoehma.files.wordpress.com/2009/09/rich_tree_expand_move.png" medium="image">
			<media:title type="html">rich_tree_expand_move</media:title>
		</media:content>
	</item>
		<item>
		<title>ViewExpiredException in JSF 1 and 2</title>
		<link>http://ahoehma.wordpress.com/2009/09/07/viewexpiredexception-in-jsf-1-and-2/</link>
		<comments>http://ahoehma.wordpress.com/2009/09/07/viewexpiredexception-in-jsf-1-and-2/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 07:55:24 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[JSF 2]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[ViewExpiredException]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=344</guid>
		<description><![CDATA[Ed Burns beschreibt in seinem Blog wie man in JSF 2 selbst eine ViewExpiredException&#8217;s behandeln kann.
Momentan (JSF &#60; 2) kann die Standard-Fehlerbehandlung natürlich auch angepasst werden, z.B. durch Festlegung einer bestimmten Location pro Exception-Typ:

&#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62;
&#60;web-app version=&#34;2.5&#34; xmlns=&#34;http://java.sun.com/xml/ns/javaee&#34; xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34;
  xsi:schemaLocation=&#34;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#34;&#62;
  ...
  &#60;error-page&#62;
    &#60;exception-type&#62;javax.faces.application.ViewExpiredException&#60;/exception-type&#62;
    &#60;location&#62;/pages/error/sessionexpired.xhtml&#60;/location&#62;
  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=344&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ed Burns beschreibt in seinem <a href="http://weblogs.java.net/blog/edburns/archive/2009/09/03/dealing-gracefully-viewexpiredexception-jsf2" target="_blank">Blog</a> wie man in <strong>JSF 2</strong> selbst eine ViewExpiredException&#8217;s behandeln kann.</p>
<p>Momentan (JSF &lt; 2) kann die Standard-Fehlerbehandlung natürlich auch angepasst werden, z.B. durch Festlegung einer bestimmten Location pro Exception-Typ:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app version=&quot;2.5&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;&gt;
  ...
  &lt;error-page&gt;
    &lt;exception-type&gt;javax.faces.application.ViewExpiredException&lt;/exception-type&gt;
    &lt;location&gt;/pages/error/sessionexpired.xhtml&lt;/location&gt;
  &lt;/error-page&gt;
  ...
</pre>
<p>In der von Ed vorgestellten Lösung wird ein eigener <code>ViewExpiredExceptionHandler</code> registriert, welcher den ursprünglichen Handler kapselt. In der dort überschriebenen <code>void handle()</code> wir eine <code>ViewExpiredException</code> mit einem Redirect (via Navigation-Handler) auf eine Fehlerseite beantwortet. In der Fehlerseite können Variable, die im Handler gesetzt wurden, für eine sinnvolle Fehlerbeschreibung verwendet werden.</p>
<p>Beim Einsatz von Richfaces kann man diese Art von Fehler auch auf der Clientseite behandeln, beschrieben wird dies im Detail <a href="http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html_single/index.html#RequestErrorsAndSessionExpirationHandling" target="_blank">hier</a>. Das Ganze ist mit zwei Erweiterungen machbar:</p>
<p>1. die Funktion für den Client aktivieren</p>
<pre class="brush: xml;">
&lt;context-param&gt;
  &lt;param-name&gt;org.ajax4jsf.handleViewExpiredOnClient&lt;/param-name&gt;
  &lt;param-value&gt;true&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
<p>2. den Javascript-Code für die Behandlung zur Verfügung stellen:</p>
<pre class="brush: jscript;">
if (typeof(A4J) !== 'undefined' &amp;&amp; typeof(A4J.AJAX) !== 'undefined'){
   // richfaces is available
   A4J.AJAX.onExpired = function(loc,expiredMsg) {
      var confirmMsg = 'Session expired.\n\nReload?';
      if (confirm(confirmMsg)) {
         window.location.reload();
      }
      // return false to inform &quot;link-commands&quot;, that the user doesn't want to reload the page
      return false;
   };
};
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/344/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/344/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/344/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/344/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/344/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/344/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/344/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/344/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/344/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/344/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=344&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/09/07/viewexpiredexception-in-jsf-1-and-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Fadein and Fadeout a Richfaces ModalPanel</title>
		<link>http://ahoehma.wordpress.com/2009/07/22/fadein-and-fadeout-a-richfaces-modalpanel/</link>
		<comments>http://ahoehma.wordpress.com/2009/07/22/fadein-and-fadeout-a-richfaces-modalpanel/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 15:59:13 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[ModalPanel]]></category>
		<category><![CDATA[Effect]]></category>
		<category><![CDATA[Scriptaculous]]></category>
		<category><![CDATA[Fadein]]></category>
		<category><![CDATA[Appear]]></category>
		<category><![CDATA[Fadeout]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=253</guid>
		<description><![CDATA[Today i explain you a cool combination for rich:modalPanel and rich:effect.
In the richfaces forum i found a article about a modalpanel with scriptaculous-effects (&#8220;fade-in a modalpanel&#8221;). The answer was a link to the official richfaces demo-application (photoalbum). There we can find a login-dialog (svn source) with a &#8220;appear-effect&#8221;:

&#60;rich:modalPanel id=&#34;loginPanel&#34;
onshow=&#34;applyModalPanelEffect('loginPanel', appearFunc,{delay: 0.5, afterFinish: function(){$('loginPanelForm:username').focus();}})&#34;
styleClass=&#34;login-panel&#34;
showWhenRendered=&#34;#{authenticator.loginFailed}&#34;
width=&#34;400&#34; height=&#34;150&#34; autosized=&#34;true&#34;&#62;
&#60;f:facet [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=253&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Today i explain you a cool combination for rich:modalPanel and rich:effect.</p>
<p>In the richfaces forum i found a <a href="http://www.jboss.org/index.html?module=bb&amp;op=viewtopic&amp;p=4243264#4243264" target="_blank">article</a> about a modalpanel with scriptaculous-effects (&#8220;fade-in a modalpanel&#8221;). The answer was a link to the official richfaces demo-application (photoalbum). There we can find a <em>login-dialog</em> (<a href="http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/login.xhtml" target="_blank">svn source</a>) with a &#8220;appear-effect&#8221;:</p>
<pre class="brush: xml;">
&lt;rich:modalPanel id=&quot;loginPanel&quot;
onshow=&quot;applyModalPanelEffect('loginPanel', appearFunc,{delay: 0.5, afterFinish: function(){$('loginPanelForm:username').focus();}})&quot;
styleClass=&quot;login-panel&quot;
showWhenRendered=&quot;#{authenticator.loginFailed}&quot;
width=&quot;400&quot; height=&quot;150&quot; autosized=&quot;true&quot;&gt;
&lt;f:facet name=&quot;header&quot;&gt;#{messages['login.login']}&lt;/f:facet&gt;
&lt;f:facet name=&quot;controls&quot;&gt;
&lt;h:panelGroup id=&quot;loginPanelHideControl&quot;&gt;
&lt;h:graphicImage value=&quot;/img/modal/close.png&quot; style=&quot;cursor:pointer&quot;
id=&quot;loginPanelhidelink&quot; onclick=&quot;#{rich:component('loginPanel')}.hide();&quot;/&gt;
&lt;/h:panelGroup&gt;
&lt;/f:facet&gt;
...
&lt;rich:effect type=&quot;Appear&quot; name=&quot;appearFunc&quot;/&gt;
...
</pre>
<p>The javascript method applyModalPanelEffect can be found in the <em>photoalbum.js</em> (<a href="http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/scripts/photoalbum.js" target="_blank">svn source</a>):</p>
<pre class="brush: jscript;">
function applyModalPanelEffect(panelId, effectFunc, params) {
 if (panelId &amp;&amp; effectFunc) {
 var modalPanel = $(panelId);
 if (modalPanel &amp;&amp; modalPanel.component) {
 var component = modalPanel.component;
 var div = component.getSizedElement();
 Element.hide(div);
effectFunc.call(this, Object.extend({targetId: div.id}, params || {}));}}
}
</pre>
<p>With this the rich:modalPanel will not shown immediately &#8230; it appears <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  This was the &#8220;fade-in part&#8221;.</p>
<p>I improved the code for the &#8220;fade-out part&#8221;, first the dialog:</p>
<pre class="brush: xml;">

&lt;!-- first the effects --&gt;
&lt;rich:effect type=&quot;Appear&quot; name=&quot;appearDialog&quot;/&gt;
 &lt;rich:effect type=&quot;Fade&quot; name=&quot;disappearDialog&quot;/&gt;

&lt;!-- to keep the dialog-code clean --&gt;
&lt;c:set var=&quot;closeDialog&quot; value=&quot;hideModalPanelWithEffect('myDialog',disappearDialog,{delay:0.1,duration:0.5})&quot;/&gt;

&lt;rich:modalPanel id=&quot;myDialog&quot;
 onshow=&quot;showModalPanelWithEffect('myDialog',appearDialog,{delay:0.1,duration:0.5})&quot;
 width=&quot;610&quot; height=&quot;350&quot; minHeight=&quot;350&quot; autosized=&quot;true&quot; shadowDepth=&quot;0&quot;&gt;
&lt;f:facet name=&quot;controls&quot;&gt;
&lt;h:panelGroup&gt;
&lt;h:graphicImage value=&quot;/img/modal/close.png&quot; style=&quot;cursor:pointer&quot; onclick=&quot;#{closeDialog}&quot;/&gt;
&lt;/h:panelGroup&gt;
&lt;/f:facet&gt;
&lt;/rich:modalPanel&gt;
</pre>
<p>and the javascript:</p>
<pre class="brush: jscript;">
function applyModalPanelEffect(panelId, effectFunc, params, hide) {
 if (panelId &amp;&amp; effectFunc) {
 var modalPanel = $(panelId);
 if (modalPanel &amp;&amp; modalPanel.component) {
 var component = modalPanel.component;
 var div = component.getSizedElement();
 if (hide) {
 Element.hide(div);
 }
 effectFunc.call(this, Object.extend( {targetId : div.id}, params || {}));}}
}

function showModalPanelWithEffect(panelId, showEffect, params) {
 applyModalPanelEffect(panelId, showEffect, params, true);
}

function hideModalPanelWithEffect(panelId, hideEffect, params) {
 var _params = params;
_params['afterFinish'] = function(){Richfaces.hideModalPanel(panelId)};
 applyModalPanelEffect(panelId, hideEffect, params, false);
}
</pre>
<p>Now the dialog call <strong>showModalPanelWithEffect</strong> to fade-in and <strong>hideModalPanelWithEffect</strong> to fade-out.</p>
<p>Try it <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/253/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/253/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/253/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=253&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/07/22/fadein-and-fadeout-a-richfaces-modalpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Clear JSF Input Components</title>
		<link>http://ahoehma.wordpress.com/2009/06/22/clear-jsf-input-components/</link>
		<comments>http://ahoehma.wordpress.com/2009/06/22/clear-jsf-input-components/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 15:13:02 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[ModalPanel]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[Reset]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=194</guid>
		<description><![CDATA[Beim Implementieren einer einfachen CRUD Anwendung mit Hilfe von Richfaces Datatable und ModalPanel bin ich über ein &#8220;Problem&#8221; mit validierten (leeren) Eingabefeldern gestolpert.
Das Problem ist eigentlich kein richtiges Problem, sondern das Standardverhalten von JSF   Unschön wird es wenn man einen rich:modalPanel als Edit-Dialog einsetzt und diesen wiederverwendet.
Der grobe Aufbau:

eine DataTable zeigt eine Liste [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=194&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Beim Implementieren einer einfachen CRUD Anwendung mit Hilfe von Richfaces Datatable und ModalPanel bin ich über ein &#8220;Problem&#8221; mit <strong>validierten (leeren) Eingabefeldern</strong> gestolpert.</p>
<p>Das Problem ist eigentlich kein richtiges Problem, sondern das Standardverhalten von JSF <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Unschön wird es wenn man einen <strong>rich:modalPanel</strong> als Edit-Dialog einsetzt und diesen <strong>wiederverwendet</strong>.</p>
<p>Der grobe Aufbau:</p>
<ul>
<li>eine <strong>DataTable </strong>zeigt eine Liste von Entities (z.B. mit Hilfe eine DAOs geladen)</li>
<li> jedes Entity hat eine eindeutige ID (z.B. PrimaryKey aus JPA)</li>
<li>pro Tabellenzeile gibt es einen &#8220;Edit&#8221;-CommandLink der eine <strong>rich:modalPanel</strong> für das Editieren eines Entity öffnet</li>
<li>vor jedem <strong>Edit</strong> muss die gewünschte Entity in einen <strong>CrudManager</strong> (Session-Scoped Bean) gelangen, aus der sich der Edit-Dialog mit Daten versorgen kann und mit dessen Hilfe die eigentliche Edit-Aktion durchgeführt wird</li>
</ul>
<p>Nun sollen bestimmte Eingabefelder im Edit-Dialog validiert werden (z.B. mit einer @NotEmpty Annotation an den ensprechenden Properties der Entitiy-Klasse). Wenn man nun den Dialog für eine Entity mir der ID &#8216;1&#8242; öffnet und eine Validierungsfehler auslöst, z.B. durch das Abschicken mit leeren Eingabefeldern, wird dieser Fehler ausgegeben &#8230; soweit so gut. Der Dialog kann dann geschlossen werden. Soll nun Entity mit der ID &#8216;2&#8242; mit dem gleichen Dialog editiert werden, sind die Eingabefelder immer noch leer und nicht wie gewünscht mit den Werten aus Entity-2 gefüllt. Warum?!</p>
<p>Nach einer kurzen Googlesuche landete ich auf der Seite http://wiki.apache.org/myfaces/ClearInputComponents die den Effekt beschreibt. Der Grund für das Verhalten ist die Zwischenspeicherung von &#8220;SubmitedValues&#8221; in den jeweiligen UIComponents (z.B. h:inputText). Die werden den eigentlichen Modeldaten vorgezogen.</p>
<p>Will man nun einen immer aktuellen Edit-Dialog haben, gibt es verschiedene Möglichkeiten (siehe MyFaces). Ich habe mich für die &#8220;radikal einfache&#8221; Lösung entschieden &#8230; lösche alle Elemente innerhalb des Edit-Dialogs und lasse sie immer neu erzeugen.</p>
<p>Die Entity-Liste besteht aus einer rich:dataTable, pro Zeile ein a4j:commandButton:</p>
<pre class="brush: xml;">

&lt;rich:dataTable value=&quot;#{tableManager.model}&quot; var=&quot;dataItem&quot;&gt;

&lt;!-- Edit-Command Column --&gt;
&lt;rich:column sortable=&quot;false&quot;&gt;
&lt;a4j:commandButton ajaxSingle=&quot;true&quot; limitToList=&quot;true&quot;
reRender=&quot;foobar_editPanel&quot;
oncomplete=&quot;Richfaces.showModalPanel('foobar_editPanel')&quot;
 actionListener=&quot;#{crudManager.onEdit}&quot;&gt;
 &lt;f:attribute name=&quot;onEditClearTarget&quot; value=&quot;foobar_editPanel&quot;/&gt;
 &lt;f:setPropertyActionListener value=&quot;#{dataItem}&quot; target=&quot;#{crudManager.currentEntity}&quot; /&gt;
&lt;/a4j:commandButton&gt;

&lt;!-- more Columns ... --&gt;
&lt;/rich:dataTable&gt;
</pre>
<p>Der <strong>tableManager</strong> liefert die Entity-Daten, also eine Liste von Entity-Beans, jede Bean hat eine eindeutige ID. Der crudManager enthält stellt die gesamte CRUD Funktionalität zur Verfügung. Für eine Edit muss er mit einer Entity &#8220;initialisiert&#8221; werden, dies geschieht via <strong>f:setPropertyActionListener</strong>. Das reRender bewirkt, dass der Edit-Dialog aktuallisiert wird.</p>
<p>Der Edit-Dialog wird mit Hilfe von rich:modalPanel erzeugt (foobar_editPanel) und enthält eine Reihe von h:inputText Elementen. Diese sind wiederum an den crudManager gebunden.</p>
<p>Der Code für das Zurücksetzen der Inputelemente im Edit-Dialog ist ebenfalls im <strong>crudManager</strong> verborgen und sieht folgendermaßen aus:</p>
<pre class="brush: java;">

public abstract class AbstractCrudManager {

public static final String ONEDIT_ATTRIBUTE_CLEARTARGET = &quot;onEditClearTarget&quot;; //$NON-NLS-1$

/**
 * Event-handler will be triggered on &lt;tt&gt;edit&lt;/tt&gt;. This method is used as a
 * {@link ActionListener} and will be called before a &lt;tt&gt;edit-view&lt;/tt&gt; is
 * shown. So here we can do some &quot;initializations&quot; for the edit-view, i.e.
 * reset input-fields.
 *
 *
 * This base implementation will call {@link #clearEditTarget(UIComponent)}.
 *
 *
 * @param aEvent
 *          is never &lt;code&gt;null&lt;/code&gt;
 */
public void onEdit(final ActionEvent aEvent) {
clearEditTarget(aEvent.getComponent());
 }

/**
 * This method handle a edit-form-clear. Per default the command-button which delegates to the
 * edit-view could have a attribute {@link #ONEDIT_ATTRIBUTE_CLEARTARGET}.
 *
 * @param theSourceComponent
 *          is never &lt;code&gt;null&lt;/code&gt;
 */
 protected void clearEditTarget(final UIComponent theSourceComponent) {
 final String onEditTarget = (String) theSourceComponent.getAttributes().get(ONEDIT_ATTRIBUTE_CLEARTARGET);
 if (onEditTarget == null) {
 return;
 }
 final UIComponent editTarget = FacesContext.getCurrentInstance().getViewRoot().findComponent(onEditTarget);
 if (editTarget == null) {
 return;
 }
 editTarget.getChildren().clear();
 }

...

}
</pre>
<p>Damit ist auch klar was das &lt;f:attribute name=&#8221;onEditClearTarget&#8221; value=&#8221;#{id}_editPanel&#8221;/&gt; bewirkt &#8230; es definiert die UI-Komponente die vor dem Öffnen des Dialogs zurückgesetzt werden soll.</p>
<p>Damit wird bei jedem Klick auf &#8220;Edit&#8221; ein Ajax-Request zum Server geschickt, dort wird die aktuelle Entity in den crudManager hinterlegt, es wird onEdit aufgerufen und damit der Inhalt des Edit-Dialogs gelöscht. JSF sorgt dann beim RenderResponse wieder dafür, dass alle UI Componenten korrekt erzeugt werden. Da dann alle Eingabeelement noch vollkommen &#8220;neu&#8221; sind, zeigen diese auch die Werte aus dem Modell an.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=194&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/06/22/clear-jsf-input-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Realworld JSF Application Story</title>
		<link>http://ahoehma.wordpress.com/2009/04/27/realworld-jsf-application-story/</link>
		<comments>http://ahoehma.wordpress.com/2009/04/27/realworld-jsf-application-story/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 10:30:00 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[Facelets]]></category>
		<category><![CDATA[Realworld]]></category>
		<category><![CDATA[Siemens]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=139</guid>
		<description><![CDATA[Vielleicht hatte ich es in einem früheren Posting schonmal erwähnt, ich arbeite momentan für Siemens an einem Web 2.0 Projekt und das ist jetzt fertig  .
Los ging es November 2007 und nun konnten wir planmässig im April 2009 live gehen. Wir konnten dabei all die wunderbaren &#8220;neuen&#8221; Technologien einsetzen und ausprobieren, u.a. JSF und [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=139&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Vielleicht hatte ich es in einem früheren Posting schonmal erwähnt, ich arbeite momentan für Siemens an einem Web 2.0 Projekt und das ist jetzt fertig <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
<p>Los ging es November 2007 und nun konnten wir planmässig im April 2009 live gehen. Wir konnten dabei all die wunderbaren &#8220;neuen&#8221; Technologien einsetzen und ausprobieren, u.a. JSF und damit eine funktionsfähige (also den Anforderungen des Kunden voll entsprechende) und zugleich performante &#8220;Web 2.0&#8243; Applikation bauen. Die Applikation nimmt sich dem Thema &#8220;Sicherheitstechnik&#8221; (für die Auskenner: <span><span style="color:black;">ISO 13849-1 und IEC 62061) an.</span></span></p>
<p><span><span style="color:black;">Mal kurz zu den verwendeten &#8220;Technologien/Frameworks/Tools/Ideen&#8221;:</span></span></p>
<ul>
<li><span><span style="color:black;">Daten ziehen wir aus einer SAP Knowledgebase (selbst gestrickt) und aus einer Datenbank via OpenJPA</span></span></li>
<li><span><span style="color:black;"> Services/Manager sind &#8220;normale&#8221; Javaklassen (Stichwort Design-Pattern),<br />
als Kleber verwenden wir Spring (Stichwort Dependency Injection)</span></span></li>
<li><span><span style="color:black;">UI mit JBoss Richfaces (Stichwort Ajax), JSF + Facelets (Stichwort Xhtml-Template), jQuery, CSS, etc.<br />
</span></span></li>
<li><span><span style="color:black;">Buildsystem, Projektseiten mit Maven2</span></span></li>
<li><span><span style="color:black;">Continues Integration via TeamCity und Maven2</span></span></li>
<li><span><span style="color:black;">Tests hauptsächlich mit TestNG aber teilweise auch mit JUnit</span></span></li>
<li><span><span style="color:black;">Laden/Speichern von Benutzerdaten via XStream (FileupLoad via Tomahawk), das alles noch Versionskompatibel, d.h. selbsgestrickte XML-Transformationskette für DomainModell-Updates<br />
</span></span></li>
<li><span><span style="color:black;">PDF Reportgenerierung mit iText</span></span></li>
<li><span><span style="color:black;">Anbindung an Siemens &#8220;Single Sign On&#8221; System via Spring Security, Webservices<br />
</span></span></li>
</ul>
<p>Im Rückblick kann ich sagen, dass eigentlich alles ohne größere Probleme miteinander funktioniert hat<br />
&#8230; so soll es sein <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><a title="Safety Evaluation Tool" href="https://www.automation.siemens.com/cd/safety/html_00/produkte/si_normen/tool.htm" target="_blank">https://www.automation.siemens.com/cd/safety/html_00/produkte/si_normen/tool.htm</a></p>
<p>(Für die Applikation muss man sich registrieren)</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=139&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/04/27/realworld-jsf-application-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Show Richfaces Version</title>
		<link>http://ahoehma.wordpress.com/2009/03/04/show-richfaces-version/</link>
		<comments>http://ahoehma.wordpress.com/2009/03/04/show-richfaces-version/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 16:04:03 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Richfaces]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=131</guid>
		<description><![CDATA[Richfaces provide his version in the el-variable a4j.
So put a #{a4j} in a facelets-template and you will see a version-string like this
Jboss Richfaces by richfaces.org, version v.3.3.0.GA SVN $Revision: 12244 $ $Date: 2009-01-13 05:40:53 +0200 $
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=131&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Richfaces provide his version in the el-variable <strong><em>a4j</em></strong>.</p>
<p>So put a <strong><em>#{a4j}</em></strong> in a facelets-template and you will see a version-string like this</p>
<p><em><strong>Jboss Richfaces by richfaces.org, version v.3.3.0.GA SVN $Revision: 12244 $ $Date: 2009-01-13 05:40:53 +0200 $</strong></em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=131&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2009/03/04/show-richfaces-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
		<item>
		<title>Richfaces internal Tree Node Selection Howto</title>
		<link>http://ahoehma.wordpress.com/2008/09/09/richfaces-internal-tree-node-selection-howto/</link>
		<comments>http://ahoehma.wordpress.com/2008/09/09/richfaces-internal-tree-node-selection-howto/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 21:12:45 +0000</pubDate>
		<dc:creator>Andreas Höhmann</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[Adapter]]></category>
		<category><![CDATA[Node]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[Tree]]></category>

		<guid isPermaLink="false">http://ahoehma.wordpress.com/?p=80</guid>
		<description><![CDATA[Waffel beschreibt in seinem neuesten Blogbeitrag wie man den Richfaces Tree auch aus dem System heraus ansprechen kann um eine bestimmte Node zu selektieren und sichtbar zu machen. So auf anhieb findet sich bisher keine vernünftige Dokumentation zu dem Thema.
Er kombiniert in seinem Beispiel den Tree mit einem TreeNodeAdapter (um das lästige Erstellen der Nodeklassen [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=80&subd=ahoehma&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Waffel beschreibt in seinem <a href="http://thomaswabner.wordpress.com/2008/09/09/expanding-richfaces-tree-an-datamodel-changes/" target="_blank">neuesten Blogbeitrag</a> wie man den Richfaces Tree auch aus dem System heraus ansprechen kann um eine bestimmte Node zu selektieren und sichtbar zu machen. So auf anhieb findet sich bisher keine vernünftige Dokumentation zu dem Thema.</p>
<p>Er kombiniert in seinem Beispiel den Tree mit einem <a href="http://livedemo.exadel.com/richfaces-demo/richfaces/treeNodesAdaptor.jsf?c=recursiveTreeNodesAdaptor" target="_blank">TreeNodeAdapter</a> (um das lästige Erstellen der Nodeklassen zu überspringen) und benutzt schließlich einen TreeWalker um die gewünschte Node zu finden und aufzuklappen.</p>
<p>Vielleicht wird in einer der nächsten RF-Versionen das Handling mit dem Baum ja noch einfacher. Aus Benutzersicht (UI) läßt der Baum ja kaum noch Wünsche offen. Serverseitig sieht es da schon etwas dünner aus. Aber wenn man sich einmal bissl tiefer reingewühlt hat, wird auch da manches klarer <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ahoehma.wordpress.com/80/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ahoehma.wordpress.com/80/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ahoehma.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ahoehma.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ahoehma.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ahoehma.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ahoehma.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ahoehma.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ahoehma.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ahoehma.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ahoehma.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ahoehma.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ahoehma.wordpress.com&blog=1781916&post=80&subd=ahoehma&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ahoehma.wordpress.com/2008/09/09/richfaces-internal-tree-node-selection-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/438fe36eabd9440a47ba9463aa194ac1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ahoehma</media:title>
		</media:content>
	</item>
	</channel>
</rss>