James Williams
LinkedInMastodonGithub

Gratuitous use of ExpandoMetaClass

Things have been quietly and smoothly chugging along since the move to Groovy 1.1-BETA. I added support for a couple of the new SwingLabs Layout Managers. StackLayout, HorizontalLayout, and VerticalLayout being a couple of them. The latter two are great because they address the one sticking point I had with BoxLayout, the axis parameter. StackLayout, as its name implies, functions like CardLayout with one big difference. In CardLayout, each card obscures all the others. So I was wondering, what if you want to declare your components and have them added from front to back? Or vice versa? Could you do that with just one variable or function? Though you can set constraints, technically you can't set one variable and change the direction. So I was thinking of using ExpandoMetaClass to add a direction property to the class. Is it unneeded? Kinda. Is it gratuitous complexity just to use a new feature? Probably.

Qu'en pensez-vous? [What do you think?]

StackLayout defaults to Back to Front if you don't specify a constraint.