Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Looking for additional reviewers - builder classes for SWT

Hi,

Am 23.10.2018 um 09:40 schrieb Eric Williams:
We have a patch in gerrit to add support for builder/factory classes into SWT: https://git.eclipse.org/r/#/c/131348/

Please take a look if you have a moment!

I think the setters should be named set*().

And perhaps it isn't as nice as it could be. There is no way to switch from one type of builder to another, and to express the layout of the UI in the code. Something like this would be nice:

void createUI(Composite parent) {
    WidgetBuilder.startVGroup(parent)
        .startHGroup()
            .addLabel()
                .setText("Text:")
                .end()
            .addText()
                .setLimit(10)
                .end()
            .end()
        .startHGroup()
            .addGlue()
            .addButton()
                .setText("OK")
                .end()
            .end()
        .end();
}

There are of course numerous alternative ways for the above, of which the pros and cons can be discussed. But if the end result is the possibility for such a construct, it would be nice.

Best regards,
-Stephan


Back to the top