OpenSlides/client/src/app/site/base/base-view-model.ts

26 lines
701 B
TypeScript
Raw Normal View History

import { Displayable } from '../../shared/models/base/displayable';
import { Identifiable } from '../../shared/models/base/identifiable';
2018-11-12 13:47:02 +01:00
import { Deserializable } from 'app/shared/models/base/deserializable';
2018-09-10 15:53:11 +02:00
/**
* Base class for view models. alls view models should have titles.
*/
export abstract class BaseViewModel implements Displayable, Identifiable {
/**
* Force children to have an id.
*/
public abstract id: number;
2018-11-12 13:47:02 +01:00
public abstract updateValues(update: Deserializable): void;
2018-09-10 15:53:11 +02:00
public abstract getTitle(): string;
2018-09-10 15:53:11 +02:00
public getListTitle(): string {
return this.getTitle();
2018-09-10 15:53:11 +02:00
}
public toString(): string {
return this.getTitle();
2018-09-10 15:53:11 +02:00
}
}