Quick suggestion:
<tr:table
id="tblx"
value="#{bean.collection}"
binding="#{bean.coreTable}"
var="entry" >
<tr:column>
<tr:inputText value="#{entry.prop1} id="prop1">
<my:NotNullIfOtherNotNull others="prop2,prop3,prop4"/>
</tr:inputText>
</tr:column>
<tr:column>
<tr:inputText value="#{entry.prop2}" id="prop2" >
....
as for the content of the cutsom my:NotNullIfOtherNotNull, i suggest you
look at code of "validateEqual" in tomahawk, that check 2 component
value are same. You can do similar thing with null.
That way, non need to limit your check to the use of a UIData.
En l'instant précis du 20/07/07 12:56, Graeme Steyn s'exprimait en ces
termes:
> Hi,
>
> I have a <tr:table> component that is displaying rows from an
> ArrayLIst containing instances of class X. I would like to introduce
> a validator that checks that if information is entered for any
> property, then all properties must be populated for that row. ANy
> rows that have no data entered or all data entered are thus valid. At
> present I have the arrangement provided below, but I appear to be
> getting the instances of X from the original collection, rather than
> the table components local values. Thus when the view is first
> displayed, I can enter data in row 1 cell 1 and press next to invoke a
> POST back and the validation. Using the debugger, I find that the
> first iteration through the loop returns an instance of X, but without
> the posted back data (everything is null). I do not appear to be
> getting at the local converted value.
>
> Any help would be greatly appreciated.
>
> Thank you,
>
> Regards,
>
> Graeme.
>
> PS.
> I came across a related query located at
> http://mail-archives.apache.org/mod_mbox/myfaces-users/200608.mbox/[EMAIL
> PROTECTED]
> I am trying to avoid binding as the user will be able to add and
> delete rows within my datatable, so I was hoping to keep things flexible.
>
> public class X {
>
> private String prop1;
> private String prop2;
> private String prop3;
>
> getters/setters...etc
> }
>
> ====================
>
> class BackingBean {
>
> Collection <X> collection = new ArrayList <X> ();
>
> etc
> }
>
> ====================
>
> <tr:message for="validateRows" />
>
> <tr:table
> id="tblx"
> value="#{bean.collection}"
> binding="#{bean.coreTable}"
> var="entry" >
>
> <tr:column>
> <tr:inputText value="#{entry.prop1} />
> </tr:column>
>
> <tr:column>
> <tr:inputText value="#{entry.prop2} />
> </tr:column>
> :
> :
> etc
> </tr:table>
>
> <tr:inputHidden id="validateRows" value="dummy"
> validator="#{bean.validateRows}" />
>
> =====================
>
> Will only catch the first invlaid instance in the table - the
> validation message appears at the table level rather than per row.
>
> public void validateEntriesComplete(FacesContext facesContext,
> UIComponent uIComponent,
> Object object) throws ValidatorException {
>
> UIXCollection uixCollection = (UIXCollection) coreTable;
> int oldRowIndex = uixCollection.getRowIndex();
> for (int rowNum = 0, numRows = uixCollection.getRowCount();
> rowNum < numRows; rowNum++) {
> uixCollection.setRowIndex(rowNum);
> X instancex = (X) uixCollection.getRowData();
>
> if (!instancex.isAllPropertiesSet()
> && instancex.isAnyPropertySet()) {
>
> FacesMessage message = Messages.getMessage(
> Constants.LOCALIZATION_RESOURCE,
> "IncompleteRecord", null);
> message.setSeverity(FacesMessage.SEVERITY_ERROR);
> throw new ValidatorException(message);
>
> }
> }
> uixCollection.setRowIndex(oldRowIndex);
>
> }
--
http://www.noooxml.org/