StablexUI icon indicating copy to clipboard operation
StablexUI copied to clipboard

Suggestion: Make Layout Classes chainable

Open curly-brace opened this issue 9 years ago • 0 comments

make all properties return class instance instead of assigned value.

so instead of having this code:

UIBuilder.create(Widget, {
    defaults: 'Header',
    layout: {
        var l = new Column();
        l.cols = [24, -1, 24, 24, 24];
        l.cellPadding = 4;
        l.paddingTop = 4;
        l.paddingBottom = 4;
        l.paddingLeft = 4;
        l.paddingRight = 12;
        l;
    }
}

we can have just:

UIBuilder.create(Widget, {
    defaults: 'Header',
    layout: new Column()
        .cols([24, -1, 24, 24, 24])
        .cellPadding(4)
        .paddingTop(4)
        .paddingBottom(4)
        .paddingLeft(4)
        .paddingRight(12)
}

May be it would be helpful also in other classes, like skins (creating on the fly)

curly-brace avatar Jul 13 '15 05:07 curly-brace