import { BaseView } from "../Views/BaseView.js";
export default class LayoutViewBase extends BaseView {
    constructor(options) {
        super(options);
    }
    get source() {
        return super.source;
    }
    set source(value) {
        super.source = value;
    }
    get cssClass() {
        return this.state.get("cssClass", "-feature-blend-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;
        }
        if (errors != null) {
            this.source.root.clearErrors();
            this.source.root.loadErrors(errors);
        }
        this.globals.events.errorsLoadPublish();
    }
    clearErrors(errors) {
        if (this.source == null) {
            return;
        }
        if (errors != null) {
            this.source.root.clearErrors();
            this.source.root.loadErrors(errors);
        }
        this.globals.events.errorsLoadPublish();
    }
}
