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