We will add new property "favorite fruit" to the
Contact class.First we create a new Fruit class:
public class Fruit {
private String name;
public Fruit(String name) {
this.name = name;
}
public String getName() {
return name;
}
}Then we add the
favoriteFruit property: public class Contact {
...
private Fruit favoriteFruit;
...
public Fruit getFavoriteFruit() {
return favoriteFruit;
}
public void setFavoriteFruit(Fruit fruit) {
this.favoriteFruit = fruit;
}
}In the
richclient-application-context.xml we have to define the ListSelectionDialogBinder for properties of the type Fruit:
<bean id="binderSelectionStrategy" class="org.springframework.richclient.form.binding.swing.SwingBinderSelectionStrategy">
<property name="bindersForPropertyTypes">
<map>
<entry>
<key><value type="java.lang.Class">org.springframework.richclient.samples.simple.domain.Fruit</value></key>
<bean class="org.springframework.richclient.selection.binding.ListSelectionDialogBinder"/>
</entry>
</map>
</property>
</bean>
The only thing that's left is the
ContactForm.For the
ListSelectionDialogBinder it's necessary to build a context to feed to the binding.A context is nothing more than a
Map.Map fruitContext = new HashMap();
Here we build the list of fruits the user can choose from, but in real life this will probably come from the database ...
List fruits = new ArrayList();
fruits.add(new Fruit("apple"));
fruits.add(new Fruit("banana"));
fruits.add(new Fruit("kiwi"));
fruits.add(new Fruit("orange"));
fruits.add(new Fruit("pear"));
We use the fruit in the selectable items:
fruitContext.put(ListSelectionDialogBinder.SELECTABLE_ITEMS_KEY, fruits);
The following code will use the name of the fruit as label, and will show "<no>" for
null values: fruitContext.put(ListSelectionDialogBinder.LABEL_PROVIDER_KEY, new LabelProvider() {
public String getLabel(Object item) {
Fruit bean = (Fruit) item;
return bean == null ? "" : bean.getName();
}
}); If you want filtering, add the following entries. This will allow the user to filter the dialog on the name property of the fruit.
fruitContext.put(ListSelectionDialogBinder.FILTERED_KEY, Boolean.TRUE);
fruitContext.put(ListSelectionDialogBinder.FILTER_PROPERTIES_KEY,
new String[] { "name" });
And finally we add the binding to the form:
formBuilder.addSeparator("Fun stuff");
formBuilder.row();
formBuilder.add(getBindingFactory().createBinding("favoriteFruit", fruitContext),
"colSpan=1");And this is the result:
Nothing selected:

And when we click on the select button:

And select "orange" we get this:
47 comments:
Excellent post. I'd love to see more of these. Question: how would you envisage a system where the list would vary AFTER the screen has been created?
Would replacing the values in the context be enough via ListSelectionDialogBinder.SELECTABLE_ITEMS_KEY
I think it would be a good follow-up on this article.
Thanks
there is an error in your post... instead of
[code]
fruitContext.put(ListSelectionDialogBinder.SELECTABLE_ITEMS_KEY, fruits);
[/code]
one have to code
[code]
fruitContext.put(ListSelectionDialogBinder.SELECTABLE_ITEMS_HOLDER_KEY, new ValueHolder(fruits));
[/code]
also it would be nice if you could also post the sample application (zip/tgz) additionally to the screenshots.
thx,
dominik
Very usefull post !!
Going on that road, I think it would be even more intuitive w/o the dialog window. I imagine instead the list popping up, like google does (or any Ajax web application). Don't know the feasibility of this though, and what factors make this approach difficult/impossible ?
Thanks ur information
web design company, web designer,
web design India,website design,web design
new houston house houston house tx stains removal dye
stains removal clothes stains removal teeth whitening
teeth whiteningbright teeth jennifer grey nose
jennifer nose jobs calebrities nose jobs Women with Big Noses
Women hairstyles Big Nose Women, hairstylesdvd player troubleshootingtroubleshooting with the dvd player
dessicant air dryer pediatric asthma asthma specialist
carpet cleaning dallas tx carpet cleaners dallas carpet cleaning dallas
beach vacations your beach vacations
bob hairstyle
bob haircuts bob layered pob hairstyle
bobbed classic bob Care for Curly Hair
Tips for Curly Hair curly hair 12r 22.5 best price
tires truck bus tires 12r 22.5 washington new house
new house Houston new house san Antonio new house ventura
sealy air beds portable portables air beds
antique doorknobs drying desiccant
air drying desiccantlipitor allergic reactionsApple prodam iphone prahaflorida headache clinic
cheap beach vacationsnight vision binoculars bargains
The using of the list selection dialog blinder is a very good tutorial, i am thinking to add the information about these kind of tutorials in my websites!
Thanks for sharing this useful post!
cheers mate!
-J.
graphic design company
HI
Good and some useful information about Web Solutions you have shared.
Thanks for the nice information. I am sure, I will tweet this to my twitter account. This will help a lot of users. iPad Development,iPad App Development,iPad Apps Development,iPad Application Development,iPad Game Development
Really nice blog, very informative. Thanks dude for wonderful posting. Keep it up in the future as well. SEO Services UK
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company
I got very good blog to read ofter a long time on this topic. thank you.
- Tanya
Web Design Firm
@ ObjectLab
"Would replacing the values in the context be enough via ListSelectionDialogBinder.SELECTABLE_ITEMS_KEY"
This applies to whole data?
- John Devis
Magento Themes
A great post for sure in describing as too what all is the use of a list selection dialog binder.....
Magento Themes
I can see that you’re an expert in this region. I am starting an internet site soon, and your information will be very helpful for me.. Thank you for all of your help and wishing you all the success inside your business.
Kiosk Manufacturers
Hi, interesting post. I have been wondering about this topic, so thanks for posting. I’ll definitely be subscribing to your site. Keep up the good posts
Lose Weight Running
You’ve some really useful information written here. Excellent job and keep posting terrific stuff.
virtual assistant
excellenct information you give
Thank
Regards
Poh
Cuisinart TOB-195
Acne Conglobata
Acer 11.6 Netbook
500 payday loan
acne inversa
VIZIO M261VP
checkmate payday loans
Cuisinart TOB-195
Cuisinart TOB-195
Cuisinart TOB-195
Cuisinart TOB-195
Acne Conglobata
Acne Conglobata
Acne Conglobata
Acer 11.6 Netbook
Acer 11.6 Netbook
Acer 11.6 Netbook
500 payday loan
500 payday loan
acne inversa
VIZIO M261VP
VIZIO M261VP
VIZIO M261VP
checkmate payday loans
checkmate payday loans
checkmate payday loans
Thank
Regards
Poh
Counter Depth French Door Refrigerator
How to Get Into Acting
Breville Smart Oven
How to Impress Woman
Picking Lottery Numbers
Canon Powershot A800
Adidas Barricade
Adidas Barricade 6.0
Cuisinart TOB-195
Acne Conglobata
Acer 11.6 Netbook
500 payday loan
acne inversa
VIZIO M261VP
checkmate payday loans
Pengurusan Masa
now that great
Thank
Regards
Poh
Counter Depth French Door Refrigerator
How to Get Into Acting
Breville Smart Oven
How to Impress Woman
Picking Lottery Numbers
Canon Powershot A800
Adidas Barricade
Adidas Barricade 6.0
Cuisinart TOB-195
Acne Conglobata
Acer 11.6 Netbook
500 payday loan
acne inversa
VIZIO M261VP
checkmate payday loans
Pengurusan Masa
This is a good common sense article. Very helpful to one who is just finding the resources about this part. It will certainly help educate me.
Vasectomy
Wow a great post, the information posted about as how to use a link dialog binder is great.....
Commercial Buildings for Sale
Counter Depth French Door Refrigerator
How to Get Into Acting
Breville Smart Oven
How to Impress Woman
Picking Lottery Numbers
Canon Powershot A800
Adidas Barricade
Cuisinart TOB-195
Acne Conglobata
Acer 11.6 Netbook
500 payday loan
acne inversa
VIZIO M261VP
checkmate payday loans
Pengurusan Masa
How To Stop Panic Attacks
Didik anak
Langsing
Adidas Barricade 6.0
Adidas Barricade V
I’ve learned a lot from your blog here, Keep on going, my friend, I will keep an eye on it,
Nassau County business coach
Another informative blog… Thank you for sharing it… Best of luck for further endeavor too.Dropshipper
This Blog is going places, the people, the layout, amazing to see such dedication and focus.
Hotpoint RFA52S
Keep doing nice work. I am waiting for some fresh helpful posts.
rushmore casino
List selection dialog binder!! that is what for which i was looking for. Thanks
Party Casino Bonus
Thank you, thats very interesting information. I need to share with my friends.
Fort Lauderdale criminal lawyer
I am really inspired together with your writing abilities as smartly as with the structure for your weblog. Keep up the excellent quality writing, it's uncommon to see a nice blog like this one nowadays.joomla development | joomla developers
This Blog is going places, the people, the layout, amazing to see such dedication and focus.
Vancouver Internet Marketing
Great Post with the ability to explain things very well, Thanks for sharing it.
Iraqi Dinar
I am not that much familiar with this information. So I can't understand. Can you explain me with more information? buy domain name India
An excellent post really amazing things found here.Thanks for this great blog sharing..
web designing company
amazing post love your blog
party casino bonus code
thanks for the great post
PokerStars Review
Nice posting dear...
Migraine headaches relief
Thanks for such a great blog. Keep it up..
Miranda Kerr Workout
This is a good common sense Blog. Very helpful to one who is just finding the resources about this part. It will certainly help educate me.
Advanced Amino Acids
Thank you for sharing the knowledge
Magento extensions Magento extension Magento modules Magento Magento gift card Magento blog Magento tutorial Magento affiliate Magento menu Magento SEO
Really your blog is very interesting.... it contains great and unique information. I enjoyed to visiting your blog. It's just amazing.... Thanks very much for the share.
This internet site is my intake , rattling wonderful design and style and perfect subject material.
Magento Checkout
Magento Facebook
Magento tutorials
Magento tutorial for beginners
Canon EOS T4i
Canon EOS Rebel T4i
canon EOS T4i is a powerful camera and this is show the detail info, video how to use canon eos t4i and the user review.
Magento Jewelry Theme
Magento Printing Website Theme
Magento Facebook Login
Magento Themes
Magento Extensions
Post a Comment