import { BaseView } from "../Views/BaseView.js";
export class LayoutViewBase extends BaseView {
    constructor(options) {
        super(options);
    }
    get autoFocusOnLoad() {
        return this.state.get("autoFocusOnLoad", true);
    }
    get source() {
        return super.source;
    }
    set source(value) {
        super.source = value;
    }
    get cssClass() {
        return this.state.get("cssClass", "-fb-layout-tabbed");
    }
    get controller() {
        return this.source?.featureSet?.controller;
    }
    onLoadModel() {
    }
    loadModel(model) {
        this.source = model.context;
        this.source.featureSet.valueChangesAreSilent = true;
        this.onLoadModel();
        this.source.featureSet.valueChangesAreSilent = false;
        this.controller.activate();
    }
    commit() {
        if (this.source != null && this.controller != null) {
            this.controller.commit();
        }
    }
    loadErrors(errors) {
        if (this.source == null) {
            return;
        }
        this.source.root.errors.clear();
        if (errors != null) {
            this.source.root.errors.load(errors);
        }
    }
}
