Skip to content
Snippets Groups Projects
Commit 6db89832 authored by Alexander Rose's avatar Alexander Rose
Browse files

added .remove method to registries

parent 0b1209a7
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,6 @@ export const PDBeStructureQualityReport = PluginBehavior.create<{ autoAttach: bo
// TODO: support filtering of themes based on the input structure
// in this case, it would check structure.models[0].customProperties.has(StructureQualityReport.Descriptor)
// TODO: add remove functionality
this.ctx.structureRepresentation.themeCtx.colorThemeRegistry.add('pdbe-structure-quality-report', {
label: 'PDBe Structure Quality Report',
factory: StructureQualityReportColorTheme,
......@@ -54,9 +53,7 @@ export const PDBeStructureQualityReport = PluginBehavior.create<{ autoAttach: bo
unregister() {
this.ctx.customModelProperties.unregister(StructureQualityReport.Descriptor.name);
this.ctx.lociLabels.removeProvider(labelPDBeValidation);
// TODO: add remove functionality to registry
// this.ctx.structureRepresentation.themeCtx.colorThemeRegistry.remove('pdbe-structure-quality-report')
this.ctx.structureRepresentation.themeCtx.colorThemeRegistry.remove('pdbe-structure-quality-report')
}
},
params: () => ({
......
......@@ -70,6 +70,11 @@ export class RepresentationRegistry<D> {
this._map.set(name, provider)
}
remove(name: string) {
this._list.splice(this._list.findIndex(e => e.name === name))
this._map.delete(name)
}
get<P extends PD.Params>(name: string): RepresentationProvider<D, P> {
return this._map.get(name) || EmptyRepresentationProvider as unknown as RepresentationProvider<D, P>
}
......
......@@ -79,6 +79,11 @@ namespace ColorTheme {
this._map.set(name, provider)
}
remove(name: string) {
this._list.splice(this._list.findIndex(e => e.name === name))
this._map.delete(name)
}
get<P extends PD.Params>(name: string): Provider<P> {
return this._map.get(name) || EmptyProvider as unknown as Provider<P>
}
......
......@@ -57,6 +57,11 @@ namespace SizeTheme {
this._map.set(name, provider)
}
remove(name: string) {
this._list.splice(this._list.findIndex(e => e.name === name))
this._map.delete(name)
}
get<P extends PD.Params>(id: string) {
return this._map.get(id) || EmptyProvider as unknown as Provider<P>
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment