Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom message tag quite like (or utilizing) t:message  RSS feed

 
Thorsten Duhn
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need something quite simple, I want my custom tag (called "messageIcon") to define my own way of showing the error message for an input component, a graphical icon with TITLE and JavaScript popup showing the message. In addition it needs to have at least one feature of the Tomahawk message compponent, the great "replaceIdWithLabel" feature.

What is the best way to code such. There is one major problem I can't solve. And looking at the Tomahawk implementation is really confusing, they have at least twelve files for the (Html)Message while I think three should be enought to create a custom tag (in my case: MessageIconTag, UIMessageIcon, MessageIconRenderer).

I do have a working prototype, but this deals with a major problem, so I think my whole concept is wrong. The problem is how to address the related components, the input and the label. They are all linked by the id-attribute of the input and the for-attributes of label and message(Icon). But what I have when rendering the message is the pure id from the for-attribute and the jsf generated clientIds of getClientIdsWithMessages(). What is the way to get the belonging input component. It can't be based on literal matching (as I do now). Especially within a list the ids defined in jsp code are not unique (the JSF generated clientIds are, but how to match them?).

A stupid little idea I have (to work around all this internals) is to actually use a Tomahawk HtmlMessage (in UIMessageIcon) and with a bit heavy magic get its values (the current error message, including resolved label) without rendering it (in MessageIconRenderer), to use this values on my own to render components (HtmlOutputLink and HtmlGraphicImage). Is this possible?

On the other hand for another component I need to get the related input component as well (to get it's required value to display an required mark - or not). So a way to solve this would really be great.

Or just some hints to find my way through the Tomahawk code...

Regards,
Thorsten
[ August 25, 2006: Message edited by: Thorsten Duhn ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66143
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Thorsten",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Thorsten Duhn
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

okay, I've done the trick myself. Just using findComponent() does it, it's obviously clever enough to be aware of it's context, in lists for example. And for my needed "replaceIdWithLabel" feature the solution is in org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.getOutputLabelMap().

Regards,
Thorsten
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!