UNPKG

@kieler/klighd-core

Version:

Core KLighD diagram visualization with Sprotty

65 lines 2.61 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SynthesesRegistry = void 0; /* * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient * * http://rtsys.informatik.uni-kiel.de/kieler * * Copyright 2019, 2021 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 */ const inversify_1 = require("inversify"); const registry_1 = require("../base/registry"); const actions_1 = require("./actions"); /** * A simple {@link Registry} that holds a list of all available syntheses * as well as the currently selected synthesis. * * Handles SetSyntheses and SetSynthesis actions to keep the state in sync which * new events. */ let SynthesesRegistry = class SynthesesRegistry extends registry_1.Registry { constructor() { super(...arguments); this._currentSynthesisID = ''; this._syntheses = []; } handle(action) { var _a, _b; if (actions_1.SetSynthesesAction.isThisAction(action)) { this._syntheses = action.syntheses; this._currentSynthesisID = (_b = (_a = action.syntheses[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ''; this.notifyListeners(); } else if (actions_1.SetSynthesisAction.isThisAction(action)) { this._currentSynthesisID = action.id; this.notifyListeners(); } } get syntheses() { return this._syntheses; } get currentSynthesisID() { return this._currentSynthesisID; } }; exports.SynthesesRegistry = SynthesesRegistry; exports.SynthesesRegistry = SynthesesRegistry = __decorate([ (0, inversify_1.injectable)() ], SynthesesRegistry); //# sourceMappingURL=syntheses-registry.js.map