-
1. Re: Custom component: Multiple values (with JBoss Seam)
nbelaevski Feb 6, 2009 5:30 PM (in response to looseleaf)1) What is hno:inputTNM - Facelets template, self-written component? Also please post some more information about "getting those attributes": all attributes are available through component getters and setters. How did you try to get them?
2) I think this should work ok. You can try with the simpler component like h:outputText if you're not sure whether your component is functioning well. -
2. Re: Custom component: Multiple values (with JBoss Seam)
looseleaf Feb 7, 2009 6:31 AM (in response to looseleaf)"nbelaevski" wrote:
1) What is hno:inputTNM - Facelets template, self-written component? Also please post some more information about "getting those attributes": all attributes are available through component getters and setters. How did you try to get them?
Yes, it's a self written component. We are completely new to JBoss, seam and RichFaces. We used the CDK guide and the inputDate example there as guide for the component. The difference between the TNM component and the inputDate component is, roughly, that the TNM component shall offer three edit fields <input type="text" ...> each of them holding a value.
I can't post code right now, as we developed it on another PC at another location. But I'll gladly post when I get a hold of the files again, if needed.2) I think this should work ok. You can try with the simpler component like h:outputText if you're not sure whether your component is functioning well.
Passing only one text from one input field works well. We're having problems understanding where or how to pass more than one piece of data from the RichFace to the application.
Stefan
p.s.: Sorry for not disabling HTML in my original post -
3. Re: Custom component: Multiple values (with JBoss Seam)
nbelaevski Feb 8, 2009 7:29 AM (in response to looseleaf)You should write code to update several fields manually, e.g.: http://fisheye.jboss.org/browse/RichFaces/trunk/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java?r=12261 - updateModel(FacesContext context) method. Superclass method is here:
http://fisheye.jboss.org/browse/RichFaces/trunk/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java?r=12319 - updateModel(FacesContext context, UpdateModelCommand command) -
4. Re: Custom component: Multiple values (with JBoss Seam)
looseleaf Feb 8, 2009 8:16 AM (in response to looseleaf)"nbelaevski" wrote:
You should write code to update several fields manually, [...]
Thanks for those pointers. [...]
So if I understand it correctly, the component has attributes activeItem, sourceSelection, ... that can be used in the Seam page like <ns:listShuttle activeItem="#{someBean.active}" sourceSelection="#{someBean.source}" ... />?
If so, I think I get the idea.
Another question: Would it be "cleaner" to implement multiple values in one class so that our component looked like:
<hno:inputTNM value="#{someBean.aggregatedTNM}" ...>
where aggregatedTNM would be a class containing the T, N and M value.
Then we'd have to use a converter to somehow mangle the values into a HTTP parameter and back into a class. Right?
Thanks for your help,
Stefan -
5. Re: Custom component: Multiple values (with JBoss Seam)
nbelaevski Feb 8, 2009 3:05 PM (in response to looseleaf)"looseleaf" wrote:
Yes, you are right. I can also say that this can be used either with Seam or without it - these attributes are just standard JSF attributes and have no special handling in Seam."nbelaevski" wrote:
You should write code to update several fields manually, [...]
Thanks for those pointers. [...]
So if I understand it correctly, the component has attributes activeItem, sourceSelection, ... that can be used in the Seam page like <ns:listShuttle activeItem="#{someBean.active}" sourceSelection="#{someBean.source}" ... />?"looseleaf" wrote:
Yes, this will be a "cleaner" approach (in the sense that you can reuse existing code), however sometimes business requirements may be satisfied only by introduction of several attributes. Choose the approach you like more.
Another question: Would it be "cleaner" to implement multiple values in one class so that our component looked like:
<hno:inputTNM value="#{someBean.aggregatedTNM}" ...>
where aggregatedTNM would be a class containing the T, N and M value."looseleaf" wrote:
Processing incoming HTTP parameters is usually done by renderer class (in decode method they're read from request and in encode* methods they're output back to the client as form fields being submitted by the sequential request).
Then we'd have to use a converter to somehow mangle the values into a HTTP parameter and back into a class. Right? -
6. Re: Custom component: Multiple values (with JBoss Seam)
nbelaevski Feb 8, 2009 3:16 PM (in response to looseleaf)You can read this for more information on how JSF components work: http://books.google.com/books?id=Iv9r-CT6ZwwC&printsec=frontcover&dq=ajax+jsf#PPP1,M1
-
7. Re: Custom component: Multiple values (with JBoss Seam)
looseleaf Feb 8, 2009 3:20 PM (in response to looseleaf)Thanks for your elaborations, I really appreciate them.
Coming from a completely different field of software development, starting with JBoss Seam means being confronted with a *lot* of new frameworks and architecture, where it's easy to lose orientation.
Thanks again!
Stefan -
8. Re: Custom component: Multiple values (with JBoss Seam)
icampista Mar 4, 2009 2:16 PM (in response to looseleaf)
I'm having the same difficulty. But I kinda understood now.
Actually a small correction to the links:
The superclass is UIInput. The code is coming in my case from MyFaces core implementation.
With this code below it means that only the value attr is updated. (WHAT WE DONT WANT), so now is just to overwrite it in you component java class. (usually the class that extends UIInput)
public void updateModel(FacesContext context)
{
if (!isValid())
{
return;
}
if (!isLocalValueSet())
{
return;
}
ValueExpression expression = getValueExpression("value");
if (expression == null)
{
return;
}
try
{
expression.setValue(context.getELContext(), getLocalValue());
setValue(null);
setLocalValueSet(false);
}
catch (Exception e)
{
context.getExternalContext().log(e.getMessage(), e);
_MessageUtils.addErrorMessage(context, this, UPDATE_MESSAGE_ID,
new Object[]
{ _MessageUtils.getLabel(context, this) });
setValid(false);
/*
* we are not allowed to throw exceptions here - we still need the
* full stack-trace later on to process it later in our
* error-handler
*/
queueExceptionInRequest(context, expression, e);
}
}
Cheers,
Igor