<?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>Code3 &#187; Richfaces</title>
	<atom:link href="http://www.code3.dk/tag/richfaces/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.code3.dk</link>
	<description>Techchat</description>
	<lastBuildDate>Thu, 17 Nov 2011 13:10:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>(Reusable) Dependent dropdowns in Seam and Richfaces</title>
		<link>http://www.code3.dk/reusable-dependent-dropdowns-in-seam-and-richfaces/</link>
		<comments>http://www.code3.dk/reusable-dependent-dropdowns-in-seam-and-richfaces/#comments</comments>
		<pubDate>Thu, 07 May 2009 13:26:06 +0000</pubDate>
		<dc:creator>AN</dc:creator>
				<category><![CDATA[Techchat]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[Seam]]></category>

		<guid isPermaLink="false">http://www.code3.dk/?p=293</guid>
		<description><![CDATA[In the previous post I had some code to illustrate how I do dependent dropdowns with seam and richfaces. I [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous post I had some code to illustrate how I do dependent dropdowns with seam and richfaces. I cleaned it up to focus on the important stuff and I am not sure to which degree it compiles and runs. However, you may have noticed one thing that is certainly odd. Most of the operations are on the object named &#8220;vendormodelselector&#8221; which is described in the post. But the search action is on &#8220;searcher&#8221;. This is because I include the seam file on multiple pages with &#8220;ui:include&#8221; (xmlns:ui=&#8221;http://java.sun.com/jsf/facelets&#8221;). and with &#8220;ui:param&#8221; I can pass a different searcher object depending on the page. Like this</p>
<pre class="brush: xml">
&lt;ui:include src=&quot;vendormodelmenu.xhtml&quot;&gt;
	&lt;ui:param name=&quot;vendormodelheader&quot; value=&quot;Appropriate header&quot;/&gt;
	&lt;ui:param name=&quot;searcher&quot; value=&quot;#{searcher_object_name}&quot;/&gt;
&lt;/ui:include&gt;
</pre>
<p>Neat!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.code3.dk/reusable-dependent-dropdowns-in-seam-and-richfaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dependent dropdowns in Seam and Richfaces</title>
		<link>http://www.code3.dk/dependent-dropdowns-in-seam-and-richfaces/</link>
		<comments>http://www.code3.dk/dependent-dropdowns-in-seam-and-richfaces/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 10:45:51 +0000</pubDate>
		<dc:creator>AN</dc:creator>
				<category><![CDATA[Techchat]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Richfaces]]></category>
		<category><![CDATA[Seam]]></category>

		<guid isPermaLink="false">http://www.code3.dk/?p=279</guid>
		<description><![CDATA[It is not uncommon to want to make a combobox with choices that depend on another combobox. But it often [...]]]></description>
			<content:encoded><![CDATA[<p>It is not uncommon to want to make a combobox with choices that depend on another combobox. But it often seems very complicated to actually do this. So here is a piece of example code that I use with <a href="http://www.seamframework.org/">Seam</a> and <a href="http://www.jboss.org/jbossrichfaces/">Richfaces</a>. Imagine we have different vendors Vendors each with different Models of something.</p>
<p>The somewhat large blurb of Richfaces markup is to make two ordinary input textfields feel like two ajaxy comboboxes. It sucks a bit, but on the other hand the Java code is nice and clean.</p>
<p>How do you make dependent gui elements?</p>
<pre class="brush: xml">

xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;
xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
xmlns:f=&quot;http://java.sun.com/jsf/core&quot;
xmlns:s=&quot;http://jboss.com/products/seam/taglib&quot;
xmlns:rich=&quot;http://richfaces.org/rich&quot;
xmlns:a4j=&quot;http://richfaces.org/a4j&quot;&gt;
&lt;div class=&quot;dialog&quot;&gt;
Vendor&lt;/div&gt;
&lt;div class=&quot;dialog&quot;&gt;
Model

&lt;br class=&quot;clear&quot; /&gt;&lt;/div&gt;
</pre>
<pre class="brush: java">package test;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Remove;
import javax.ejb.Stateful;

import org.jboss.labs.seam.guice.Guice;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.log.Log;

import com.google.inject.Inject;

import dk.telenor.tacs.api.DBApi;
import dk.telenor.tacs.db.Model;
import dk.telenor.tacs.db.Vendor;

@Stateful
@Scope(ScopeType.SESSION)
@Name(&quot;vendormodelselector&quot;)
@Guice
public class VendorModelSelectorBeanImpl implements VendorModelSelectorBean {

@Inject	private DBApi dbApi;

@Out(required = false, value=&quot;model&quot;)
private Model model = new Model();

@Out(required = false, value=&quot;vendor&quot;)
private Vendor vendor = new Vendor();

public List autocompleteVendor(){
return dbApi.getMatches(new Vendor());
}

public List autocompleteModel(){
if (vendor == null || vendor.getName() == null) {
return new ArrayList();
}
return dbApi.getMatches( new Model(vendor, null) );
}

public void setVendor(final Vendor vendor){
this.vendor = vendor;
}

public void setModel(final Model Model){
this.model = model;
}

public Model getModel(){
return model;
}

public boolean isReady(){
return model.getId() != null;
}

@Remove
public void destroy(){}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.code3.dk/dependent-dropdowns-in-seam-and-richfaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

