Extending Builders with custom code

Dr. Michael Paus mp at jugs.org
Wed Jun 27 10:31:29 PDT 2012


I thought I was quite explicit in RT-16569 but anyway - here is an example.

The whole purpose of the Builders is to be able to define a whole scene 
graph fluently in one statement but with the current Builders this is 
not directly possible because we cannot use convenience methods like these.

(Example from the documentation of GridPane)
Applications may also use convenience methods which combine the steps of 
setting the constraints and adding the children:

      GridPane gridpane = new GridPane();
      gridpane.add(new Button(), 2, 1); // column=2 row=1
      gridpane.add(new Label(), 3, 1);  // column=3 row=1

Just try to do the same using the GridPaneBuilder. You can't because the 
GridPaneBuilder does not have this special 'add' method which GridPane 

There are more classes where such a situation occurs. Someone would have 
to go over all classes for which there is a Builder and look whether
it has any convenience methods which are relevant for the building process.

LG, Michael

Am 27.06.2012 17:50, schrieb Eva Krejcirova:
> Hi All,
> I am currently working on a system for extending our automatically 
> generated Builder classes with custom code and I would like to ask for 
> your help. Are you missing some convenience methods in existing 
> builders? I would be happy to hear it! (preferably in a form of Jira 
> issue ;-))
> Currently we have these Jira issues:
> * RT-19266 which talks about PathBuilder (adding moveTo(), lineTo() 
> methods to PathBuilder)
> * RT-16569 mentions the need for convenience methods in builders of 
> layout classes (but doesn't specify it more)
> Thanks,
> Eva

Dr. Michael Paus, Chairman of the Java User Group Stuttgart e.V. (JUGS).
For more information visit www.jugs.de.

More information about the openjfx-dev mailing list