jcryptool / core

JCrypTool Core Plug-ins
https://www.cryptool.org
Eclipse Public License 1.0
161 stars 42 forks source link

NOISSUE: Add a helper class to create GridData layouts. #247

Closed tassadarius closed 3 years ago

tassadarius commented 3 years ago

Add a convenience builder for GridData

From the commit message:

This newly added class works basically like a builder and helps in creating GridData objects which need properties such as widthHint, minimumWidth, or verticalIndent set.

Before you would had to create an own variable like so:

GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.verticalIndent = 100;
gd.heightHint = 60;
myLabel.setLayoutData(gd);

But now it doesn't require a variable and looks IMHO nicer:

myLabel.setLayoutData(GridDataBuilder.with(SWT.FILL, SWT.FILL, true, true)
        .verticalIndent(100).heightHint(60).get());
grthor commented 3 years ago

Looks nice 👍🏻 Like the unit service, really well documented.