[ 
https://issues.apache.org/jira/browse/TRINIDAD-1489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12712312#action_12712312
 ] 

Gabrielle Crawford commented on TRINIDAD-1489:
----------------------------------------------

Currently there's this code in UIXEditableValue


  protected boolean compareValues(Object previous, Object value)
  {
    if (isEmpty(previous)) 
      return !isEmpty(value);

    return !previous.equals(value);
  }

The fix being proposed is that if the .equals fails we'll check if the two 
values are 
  1. the same type
  2. implement comparable

and if 1 and 2 are true we'll use compareTo

> get a valueChangeEvent for bigDecimal even though user didn't make a change.
> ----------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1489
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1489
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>            Reporter: Gabrielle Crawford
>
> When attribute data type is BigDecimal and <af:convertNumber> is used Trin 
> treats the attribute as if the attribute value is changed even though the 
> attribute value has not been changed.
> Under the covers the numberConverter is using the java decimalFormat class, 
> and things can get a little funny when you use bigdecimal, because bigdecimal 
> remembers formatting information like scale. So 2.0 is not equal to 2.00 in 
> bigdecimal.
> We can add logic to UIXEditableValueHolder that if .equals fails and if the 
> values are the same type and implement comparable we should then check 
> compareTo.
> There are 2 workarounds for now.
> 1] apply the pattern to the bigdecimal in the getter, so in the salary
> example code above return newSal instead of sal.
> 2] check compareTo in the setter, and don't set if you get 0.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to