From: Glen Mazza <[EMAIL PROTECTED]>

Are we sure it should return 0?  Shouldn't there be a
difference between "no value" given, and a value of
"0" given, esp. in cases when you need to calculate
inheritance? I think so...

this is a good point. I didnt consider the wider effect on non-padding properties.


<snip/>


OTOH, if you notice in the Area.RegionViewport class I recently put some helper classes in such as getPaddingAndSpacingBefore(), for finding the values of *specific* properties, where we can make such "return a 0 if it's NULL"-type determinations.

looks like what I was after.



These helper functions (1) simplify the renderer code (esp. as the business logic would otherwise be duplicated in each renderer class), (2) allows code sharing between the renderers and layout (which also sometimes needs to calculate these values), and (3) provides a central point to store property-specific business logic (e.g., how do we handle a NULL for this *specific* property system-wide? Raise exception or a warning, return 0, return 2 as the default?, etc., etc.) This may be a more accurate route for us--note for memory concerns, though, I just provided methods in the RegionViewport to calculate the values, and did not duplicate the values themselves in RegionViewport.


I agree. We dont want to have to replicate this business logic in all the renderers. On a related note, wouldnt it be better to move the helper functions getPaddingAndSpacingBefore() to the Area class, which is the container for Traits anyway. Wouldnt want to have to replicate these functions on every sub-class of Area. OTOH not every class that derives from Area will have Padding and spacing attributes.


What do you think? I can supply patches if necessary.

Chris

_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today! http://www.msn.co.uk/messenger




Reply via email to