API addition to Region & change to SkinBase method signatures

Richard Bair richard.bair at oracle.com
Tue Apr 16 17:29:41 PDT 2013


> So I am suggesting adding some helper methods to Region and passing in values to the compute methods so that its much easier for developers to have the correctly snapped values at hand. 
> 
> Region Additions
> 
> public class Region {
>     …..
>     public int snappedTopInset()
>     public int snappedBottomInset()
>     public int snappedRightInset()
>     public int snappedBottomInset()
>     …..
> }

Of course you meant snappedLeftInset() for one of those snappedBottomInset() methods :-)

I think this makes sense for the following reasons:
	1) The snappedFooInset methods will show up in javadoc & code complete next to snapSize etc, so people will see these when they're inspecting other layout-related methods.
	2) Passing the values into the computeFoo methods is helpful because:
		a) people will see the insets and think "Ya, I should take insets into account when defining the min/pref/max"
		b) people will use the right insets instead of having to manually snap them
	3) SkinBase is new in 8 so no problem making the incompatible change

I'm quite happy with this, I think it is good all the way around.

Richard


More information about the openjfx-dev mailing list