import { SimpleLayoutView } from "../Views.Layout/Simple/SimpleLayout.js";
import { LayoutView } from "../Views.Layout/Generic/Layout.js";
export var FeatureBlendLayoutType;
(function (FeatureBlendLayoutType) {
    FeatureBlendLayoutType["Panels"] = "Panels";
    FeatureBlendLayoutType["Tabbed"] = "Tabbed";
    FeatureBlendLayoutType["Simple"] = "Simple";
})(FeatureBlendLayoutType || (FeatureBlendLayoutType = {}));
export class FeatureBlendView extends Jade.UI.Control {
    constructor(options) {
        super(options);
    }
    get autoFocusOnLoad() {
        return this.state.get("autoFocusOnLoad", true);
    }
    get layout() {
        this.ensureLayout();
        return this.m_layout;
    }
    set layout(value) {
        this.m_layout = value;
    }
    get layoutType() {
        return this.state.get("layout");
    }
    get source() {
        return this.m_source;
    }
    set source(value) {
        this.m_source = value;
    }
    loadModel(model) {
        this.source = model;
        this.layout.loadModel(model);
    }
    commit() {
        this.layout.commit();
    }
    loadErrors(errors) {
        this.layout.loadErrors(errors);
    }
    layout_init() {
        switch (this.layoutType) {
            case FeatureBlendLayoutType.Panels:
                this.m_layout = new LayoutView({
                    cssClass: "-fb-layout-panels",
                    source: this.source.context,
                    autoFocusOnLoad: this.autoFocusOnLoad
                });
                break;
            case FeatureBlendLayoutType.Tabbed:
                this.m_layout = new LayoutView({
                    cssClass: "-fb-layout-tabbed",
                    source: this.source.context,
                    autoFocusOnLoad: this.autoFocusOnLoad
                });
                break;
            case FeatureBlendLayoutType.Simple:
                this.m_layout = new SimpleLayoutView({
                    source: this.source.context,
                    autoFocusOnLoad: this.autoFocusOnLoad
                });
                break;
        }
        this.controls.add(this.m_layout);
    }
    ensureLayout() {
        if (this.m_layout == null) {
            this.layout_init();
        }
    }
}
