Skip to content

Suggestion: Make Layout Classes chainable #212

@curly-brace

Description

@curly-brace

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions