projects/wms-framework/src/lib/baseframework/test/ShapeModelsForTest.ts
Properties |
|
Methods |
|
Accessors |
Private shapes |
Default value : new SimpleList<Shape>()
|
Public doDefaultInitialization |
doDefaultInitialization()
|
Returns :
void
|
Shapes | ||||
getShapes()
|
||||
setShapes(value)
|
||||
Parameters :
Returns :
void
|
import { ClassInfo } from '../../decorators/ClassInfo';
import { ObservableCollection, SimpleList } from '../collections';
import { Guid } from '../Guid';
import {
defineClassCustomAttributeMetadata,
defineCustomAttributeMetadata,
propertyInfo,
} from '../ReflectionSupport';
import { XmlInclude } from '../XmlSerializer';
@defineClassCustomAttributeMetadata(new XmlInclude('oldNs.Rect'))
@defineClassCustomAttributeMetadata(new XmlInclude('oldNs.Circle'))
@ClassInfo({ classId: 'oldNs.Shape' })
export abstract class Shape {}
@ClassInfo({ classId: 'oldNs.Rect' })
export class Rect extends Shape {
private side = 0;
@propertyInfo()
public get Side(): number {
return this.side;
}
public set Side(value: number) {
this.side = value;
}
}
@ClassInfo({ classId: 'oldNs.Circle' })
export class Circle extends Shape {
private side = 0;
@propertyInfo()
public get Radio(): number {
return this.side;
}
public set Radio(value: number) {
this.side = value;
}
}
@ClassInfo({ classId: 'oldNs.Model' })
export class Model {
private shapes = new SimpleList<Shape>();
@propertyInfo({ genericParameterTypeIds: ['oldNs.Shape'] })
public get Shapes(): SimpleList<Shape> {
return this.shapes;
}
public set Shapes(value) {
this.shapes = value;
}
public doDefaultInitialization() {
this.shapes = new SimpleList<Shape>([
Object.assign(new Rect(), { Side: 10 }),
Object.assign(new Circle(), { Radio: 23 }),
Object.assign(new Rect(), { Side: 20 }),
]);
}
}
@ClassInfo({ classId: 'oldNs.ModelWithBasicTypeLists' })
export class ModelWithBasicTypeLists {
private someStrings = new SimpleList<string>();
@propertyInfo({ genericParameterTypeIds: [String] })
public get SomeStringsWithoutSetter(): SimpleList<string> {
return this.someStrings;
}
private _NumbersList: SimpleList<number>;
@propertyInfo({ genericParameterTypeIds: [Number] })
public get NumbersList(): SimpleList<number> {
return this._NumbersList;
}
public set NumbersList(v: SimpleList<number>) {
this._NumbersList = v;
}
public doDefaultInitialization() {
this.someStrings = new SimpleList<string>([
'first data',
'second data',
'last entry',
]);
}
}
@ClassInfo({ classId: 'oldNs.Person' })
export class Person {
private _firstName: string;
@propertyInfo()
public get FirstName(): string {
return this._firstName;
}
public set FirstName(v: string) {
this._firstName = v;
}
private _lastName: string;
@propertyInfo()
public get LastName(): string {
return this._lastName;
}
public set LastName(v: string) {
this._lastName = v;
}
}
@ClassInfo({ classId: 'oldNs.ModelWithNestedElements' })
export class ModelWithNestedElements {
private boss: Person;
@propertyInfo()
public get Boss(): Person {
return this.boss;
}
public set Boss(v: Person) {
this.boss = v;
}
private supervisor: Person;
@propertyInfo()
public get Supervisor(): Person {
return this.supervisor;
}
public set Supervisor(v: Person) {
this.supervisor = v;
}
private peopleList: SimpleList<Person>;
@propertyInfo({ genericParameterTypeIds: ['oldNs.Person'] })
public get People(): SimpleList<Person> {
return this.peopleList;
}
public set People(v: SimpleList<Person>) {
this.peopleList = v;
}
}
///
@ClassInfo({ classId: 'oldNs.ModelWithObservableProperty' })
export class ModelWithObservableProperty {
private peopleList: ObservableCollection<Person>;
@propertyInfo({ genericParameterTypeIds: ['oldNs.Person'] })
public get People(): ObservableCollection<Person> {
return this.peopleList;
}
public set People(v: ObservableCollection<Person>) {
this.peopleList = v;
}
}