• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JSF: component-family, component type and renderer relation.

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am able to understand the concept of a render kit - which is something similar to different look feel in swing.

It is clear that a Component has a renderer associated with it for it to be rendered.

Why do we associate a renderer type with a component family?

Is it that many components can share the same renderer?

<renderer>
<component-family>javax.faces.Input</component-family>
<renderer-type>com.company.sometype</renderer-type>
<renderer-class>com.company.SomeRenderer</renderer-class>
</renderer>

Does it imply that there can be components whose renderer types are not set and in these cases we can get the renderer based on the component-family?

but why is the component-family specified with in the renderer and not in the component itself?

I am seriously missing the concept which connects the components, family and renderers

Any pointers to this would be very useful.

Thanks,
Vijay V
 
Author
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vijay Venkat:
Hi
I am able to understand the concept of a render kit - which is something similar to different look feel in swing.

It is clear that a Component has a renderer associated with it for it to be rendered.

Why do we associate a renderer type with a component family?

Is it that many components can share the same renderer?

<renderer>
<component-family>javax.faces.Input</component-family>
<renderer-type>com.company.sometype</renderer-type>
<renderer-class>com.company.SomeRenderer</renderer-class>
</renderer>

Does it imply that there can be components whose renderer types are not set and in these cases we can get the renderer based on the component-family?

but why is the component-family specified with in the renderer and not in the component itself?

I am seriously missing the concept which connects the components, family and renderers

Any pointers to this would be very useful.

Thanks,
Vijay V



This is tricky, and I explain it in much more detail in my book, but basically, this is how it works.

There may be many different render kits with renderers of the same type, say one with renderers for HTML and one for WML. Components are associates with renderer types (symbolic names for the renderers), so that by switching the render kit for a view, all components will use the same type of renderer from the new kit without having to reassign new renderers for the components.

Each components belongs to a component family, for instance "javax.faces.Command", and each renderer supports components that belong to the same family. This makes it possible to use the same renderer for all component classes with the same basic behavior, e.g., that of a "command". A concrete example, say you want to subclass the UICommand component to add additional behavior. By declaring that your subclass belongs to the "javax.faces.Command" family, you can automatically use the standard Link and Button renderers supporting this component family.

Hope this helps some. If not, you may want to ask for clarifications in Sun's JSF forum: http://forum.java.sun.com/forum.jsp?forum=427
 
Vijay Venkat
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once again Hans thanks for your explanation.
Couldn't get hold of a book today - should be getting it tomorrow.
Can you let me know in which chapter you talk about component-family and rendererType, render specific attributes in detail, so that i look directly in it.

Thanks,
Vijay V
 
Hans Bergsten
Author
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vijay Venkat:
Once again Hans thanks for your explanation.
Couldn't get hold of a book today - should be getting it tomorrow.
Can you let me know in which chapter you talk about component-family and rendererType, render specific attributes in detail, so that i look directly in it.

Thanks,
Vijay V



I sure can; it's in Chapter 13, Developing Custom Renderers and Other Pluggable Classes.
 
Vijay Venkat
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hans thanks a lot. Hmm.. couldn't find a Indian edition of your book :-(. Is there any plans for Indian edition of your book?
Vijay V
 
Hans Bergsten
Author
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vijay Venkat:
Hans thanks a lot. Hmm.. couldn't find a Indian edition of your book :-(. Is there any plans for Indian edition of your book?
Vijay V



I don't know. Translations are out of my control, but typically, a popular O'Reilly book is eventually translated to all languages there is demand for.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic