Extending Builders: Layout Builders

Eva Krejcirova eva.krejcirova at oracle.com
Wed Nov 21 02:03:21 PST 2012


On 20.11.2012 15:41, Richard Bair wrote:
>> *GridPaneBuilder*
>> addColumn(int columnIndex, Node... children)
>> addRow(int rowIndex, Node... children)
>> add(Node child, int columnIndex, int rowIndex)
>> add(Node child, int columnIndex, int rowIndex, int colspan, int rowspan)
> Do we  use columnIndex, rowIndex elsewhere? Usually I've seen "row, col", but "x, y", so it could go either way, but we should be consistent with elsewhere in the platform.
I took the names and order of the arguments from the corresponding 
methods in GridPane, so that its builder is consistent with it. Having 
the order different in GrindPane and GridPaneBuilder would be extremely 
confusing, I think.

>> *RegionBuilder*
>> maxSize(double width, double height)
>> minSize(double width, double height)
>> prefSize(double width, double height)
>> These will be inherited by all layout builders.
>>
>> A also propose to add following convenience methods which don't have direct counterpart in layout classes (the constraints can be specified only by static methods there)
>> Adding these would enable us to add child with constraint to  layout without having to hold a reference to it. e.g
>> Hbox h = HBoxBuilder.create().add(CircleBuilder.create...build(), margin).build();
>> instead of
>> Circle circle = CircleBuilder.create...build();
>> Hbox h = HBoxBuilder.create().children(circle).build();
>> Hbox.setMargin (circle, margin);
>>
>> The proposed methods are:
>> *AnchorPaneBuilder*
>> add(Node child, Double topAnchor, Double rightAnchor, Double bottomAnchor, Double leftAnchor)
> Can these be primitive doubles instead?
AnchorPane uses Doubles,  so I used them in Builder too, but I can 
surely change them to primitives.

Eva


More information about the openjfx-dev mailing list