|
Sylvain Wallez wrote: Yep, I'm just afraid to perform calculations more than once in a single update. Since i already have a _javascript_ algorithm, I'm afraid of the possible overhead. The trigger widgets currently set a "recalculate" flag, and in readFromRequest() i actually perform this : - Call super.readFromRequest(). - If super.readFromRequest() parses a typed value, then the field goes in "user typed" mode and does not perform any calculation. - Else checks if the recalculate flag is set. - In that case call the algorithm. Obviusly this poses the following problem : "What if the readFromRequest() is called for the calculate field before the readFromRequest() has been called on triggers?". In that case the following could occurr : - The algorithm would either fail due to a null value or similar. - The algorithm would return a non update value. I tried a fallback for the first situation, when the algorithm cannot compute a value. In that case the algorithm is again called when a trigger notifies a value changed event, but this is untidy and also have no way to handle the second situation. Maybe it would be easier to install a ProcessingPhaseListener, using it this way : - I receive value changed notifications from triggers, and set the flag. - In readFromRequest i only check if the user typed something or not. - When the form notifies it has finished parsing values (and validating them) : ... check if the recalculate flag is set ... in that case call the algorithm ... clear the recalculate flag - Also, since an algorithm may also need values from other calculated fields ... in getValue(), if the recalculate flag is set, call the algorithm. ... also use a calcualting flag, to report an error if a circular calculation is detected. Using the ProcessingPhaseListener is a better solution? WDYT? FS? Fun Stuff? Free Style? Fiancial Service? :) -1 for client side. As i wrote, it brings A LOT of complexity, for formatting, double implementation of everything (algorithm must be wrote both for server side and for client side, both for us and for the user), a lot of untidy stuff needed to do it, and it's relatively useless with current great AJAX support. I think it was written in the Jira issue because at that time Ajax was still far. Simone -- Simone Gianni |
- Re: Calculated fields Simone Gianni
- Re: Calculated fields Sylvain Wallez
- Re: Calculated fields Simone Gianni
- Re: Calculated fields Joerg Heinicke
- Re: Calculated fields Sylvain Wallez
- Re: Calculated fields Antonio Gallardo
- Re: Calculated fields Simone Gianni
- Calculated fields Simone Gianni
- Re: Calculated fields Antonio Gallardo
- Re: Calculated fields Simone Gianni
- Re: Calculated fields Antonio Gallardo
