@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
49 lines • 1.78 kB
JavaScript
import { RcsbFv } from "@rcsb/rcsb-saguaro/lib/RcsbFv/RcsbFv";
import { RcsbFvTooltip } from "../RcsbFvTooltip/RcsbFvTooltip";
class RcsbFvContextManager {
constructor() {
this.rcsbFvManager = new Map();
this.rcsbButtonManager = new Map();
}
getFv(elementFvId, boardConfig) {
const o = this.rcsbFvManager.get(elementFvId);
if (o) {
return o;
}
else {
const rcsbFvSingleViewer = buildRcsbFvSingleViewer(elementFvId, boardConfig);
this.setFv(elementFvId, rcsbFvSingleViewer);
return rcsbFvSingleViewer;
}
}
hasFv(elementFvId) {
return this.rcsbFvManager.has(elementFvId);
}
setFv(elementFvId, rcsbFv) {
this.rcsbFvManager.set(elementFvId, rcsbFv);
}
getButtonList(elementFvId) {
return this.rcsbButtonManager.get(elementFvId);
}
setButton(elementFvId, buttonId) {
var _a;
if (this.rcsbButtonManager.get(elementFvId) == null)
this.rcsbButtonManager.set(elementFvId, new Set());
(_a = this.rcsbButtonManager.get(elementFvId)) === null || _a === void 0 ? void 0 : _a.add(buttonId);
}
removeFv(elementFvId) {
this.rcsbFvManager.delete(elementFvId);
if (this.rcsbButtonManager.has(elementFvId))
this.rcsbButtonManager.delete(elementFvId);
}
}
function buildRcsbFvSingleViewer(elementId, boardConfig) {
const config = Object.assign({ rowTitleWidth: 190, tooltipGenerator: new RcsbFvTooltip() }, boardConfig);
return new RcsbFv({
rowConfigData: [],
boardConfigData: config,
elementId: elementId
});
}
export const rcsbFvCtxManager = new RcsbFvContextManager();
//# sourceMappingURL=RcsbFvContextManager.js.map