| Author |
Custom UIComponent?
|
Virgil Green
Greenhorn
Joined: Mar 05, 2008
Posts: 1
|
|
I'm just starting to work with JSF on a project. I have one requirement that I'm thinking might be best met by building a custom UIComponent (or finding one already written), but I'm not familiar enough with JSF to know if I'm heading down the right path. This would be a component for numeric fields that can be null in the database and for which values from elsewhere in a hierarchy would be used when a given field's value is null. The catch is that I want to be able to show the user that the default is being used, allow them to override it or revert back to the hierarchical default, and to have this visualized for them on the JSF page. The planned presentation is to have (1) a input text field that shows the current value being used and allows overrides to that field. Next to that field, (2) a checkbox that would indicate whether the value is the default value (null on the db for the current record) or is a local (not null) value, and (3) a hidden input text field that retains the default value. Note that a local value may be equal to the default value, but that just means that the local value has been locked in and not subject to changes in the default value. This component needs to be able to have multiple instances on the JSF page for different fields and must also be usable in a datatable so that multiple records of a particular database table can be on the page at the same time, editable by the user. For UI behavior, I'd like to be able to automatically generate javascript so that if the user executes any keystrokes (except navigation) in the input field that the checkbox is automically turned off. However, if the user manually turns off the check box it would then mean that the value is to be localized and if the user manually turns on the check box it would mean that the value in the input field should be replaced immediately (on screen) by the value from the hidden input field. So, this is basically a UIComponent that would render three HTML controls (an input field, a check box, and a hidden input field) and the javascript to manage the user's interaction with the input field and the checkbox. Has anyone built a similar component? Does this sound like a JSF custom UIComponent is the correct answer? Are there any requirements above that can't be met with a custom JSF component? Thanks for any thoughts. - Virgil
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 12513
|
|
I think a custom component is probably the way to go. However, as a general rule, NULL items in databases are things to be kept to a minimum. They tend to cause all sorts of confusion.
|
One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
|
 |
 |
|
|
subject: Custom UIComponent?
|
|
|