-
1. Re: Newbie Question: Javascript Files in Richfaces
nbelaevski Aug 21, 2008 9:25 PM (in response to gwzoller)Hello Greg,
That happens in component renderers. There are renderers of two origins in Richfaces:
1. Fully Java-coded. Such renderers are used for relatively simple components that doesn't produce complex markup. Also Java-coded renderers are used as base classes for the second origin renderers:
2. CDK (Component Development Kit) templates. That are the JSP-like files compiled into Java code during project build.
Javascript initialization code of inplaceSelect component comes from template, here it is: http://fisheye.jboss.org/browse/RichFaces/trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx?r=10169. Please see lines 202-237 .
Please note that there only a few components that are fully drawn using Javascript (calendar & dragIndicator are the only ones I can remember now). Renderers output HTML code for components and then script makes components live.
P.S. CDK guide that might be interesting to you will appear here soon: http://www.jboss.org/jbossrichfaces/docs/ .
You can get it here for now: http://snapshots.jboss.org/maven2/org/richfaces/docs/cdkguide/en/3.2.2-SNAPSHOT/ (un-jar the latest file) -
2. Re: Newbie Question: Javascript Files in Richfaces
gwzoller Aug 25, 2008 11:38 PM (in response to gwzoller)Thank you so much, this file though a work in progress, contained exactly the information I needed to fill the biggest gaps in my understanding.
So now I have completed my modification to InplaceSelect. I'm quite happy to use it myself but was wondering how I might submit the change back into the main code base (if anyone else cares about this functionality).
What it does is this: Have you ever wanted to use a select widget in a situation where you have limited horizontal real estate--perhaps in a table of some kind? In this situation you'd love to have the pull-down display verbose descriptions of each option but when the user selects an option merely show the (presumably short) value in the field.
Every select widget I found populated by SelectItems either let you show the value (by having null label) or a label, but not mix 'n match the two. My mod (new attribute showValueInView) allows this.
For example a InplaceSelect widget may contain value/label pairs like this:
"DFW", "(DFW) Dallas Regional Center"
"RDU", "(RDU) Raleigh Mid-Eastern Center"
"ATL", "(ATL) Atlanta South-Eastern Center"
My modded InplaceSelect w/showValueInView=true will show the long label descriptions in the pull-down but only show the short value in the input field when an item is selected. Value sent to the backing bean is unaffected--value as usual.
It's a little different, but trust me, if you're cramped for space this little tweak is a life-saver.