| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
ve.ce.AnnotationFactory = function VeCeAnnotationFactory() { |
| 15 |
|
| 16 |
OO.Factory.call( this ); |
| 17 |
}; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
OO.inheritClass( ve.ce.AnnotationFactory, OO.Factory ); |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
ve.ce.AnnotationFactory.prototype.getDescription = function ( annotation ) { |
| 33 |
const type = annotation.constructor.static.name; |
| 34 |
if ( Object.prototype.hasOwnProperty.call( this.registry, type ) ) { |
| 35 |
return this.registry[ type ].static.getDescription( annotation ); |
| 36 |
} |
| 37 |
throw new Error( 'Unknown annotation type: ' + type ); |
| 38 |
}; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
ve.ce.AnnotationFactory.prototype.canAnnotationBeActive = function ( type ) { |
| 47 |
if ( Object.prototype.hasOwnProperty.call( this.registry, type ) ) { |
| 48 |
return this.registry[ type ].static.canBeActive; |
| 49 |
} |
| 50 |
throw new Error( 'Unknown annotation type: ' + type ); |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
ve.ce.annotationFactory = new ve.ce.AnnotationFactory(); |