2019-04-23 16:57:35 +02:00
|
|
|
import { BaseProjectableViewModel } from './base-projectable-view-model';
|
|
|
|
import { isDetailNavigable, DetailNavigable } from 'app/shared/models/base/detail-navigable';
|
|
|
|
import { BaseModelWithListOfSpeakers } from 'app/shared/models/base/base-model-with-list-of-speakers';
|
|
|
|
import { BaseViewModel } from './base-view-model';
|
|
|
|
import { ListOfSpeakers } from 'app/shared/models/agenda/list-of-speakers';
|
|
|
|
|
|
|
|
export function isBaseViewModelWithListOfSpeakers(obj: any): obj is BaseViewModelWithListOfSpeakers {
|
|
|
|
const model = <BaseViewModelWithListOfSpeakers>obj;
|
|
|
|
return (
|
|
|
|
!!obj &&
|
|
|
|
isDetailNavigable(model) &&
|
|
|
|
model.getListOfSpeakersTitle !== undefined &&
|
|
|
|
model.listOfSpeakers !== undefined &&
|
|
|
|
model.list_of_speakers_id !== undefined
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes a base view model with a list of speakers.
|
|
|
|
*/
|
|
|
|
export interface IBaseViewModelWithListOfSpeakers<M extends BaseModelWithListOfSpeakers = any>
|
|
|
|
extends BaseProjectableViewModel<M>,
|
|
|
|
DetailNavigable {
|
2019-07-01 11:23:33 +02:00
|
|
|
listOfSpeakers: any | null;
|
2019-04-23 16:57:35 +02:00
|
|
|
|
|
|
|
list_of_speakers_id: number;
|
|
|
|
|
|
|
|
getListOfSpeakersTitle: () => string;
|
|
|
|
|
|
|
|
getListOfSpeakersSlideTitle: () => string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base view model class for models with a list of speakers.
|
2019-07-01 11:23:33 +02:00
|
|
|
*
|
|
|
|
* TODO: Resolve circular dependencies with `ViewListOfSpeakers` to avoid `any`.
|
2019-04-23 16:57:35 +02:00
|
|
|
*/
|
|
|
|
export abstract class BaseViewModelWithListOfSpeakers<M extends BaseModelWithListOfSpeakers = any>
|
|
|
|
extends BaseProjectableViewModel<M>
|
|
|
|
implements IBaseViewModelWithListOfSpeakers<M> {
|
2019-07-01 11:23:33 +02:00
|
|
|
protected _listOfSpeakers?: any;
|
2019-04-23 16:57:35 +02:00
|
|
|
|
2019-07-01 11:23:33 +02:00
|
|
|
public get listOfSpeakers(): any | null {
|
2019-04-23 16:57:35 +02:00
|
|
|
return this._listOfSpeakers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get list_of_speakers_id(): number {
|
|
|
|
return this._model.list_of_speakers_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public getListOfSpeakersTitle: () => string;
|
|
|
|
public getListOfSpeakersSlideTitle: () => string;
|
|
|
|
|
2019-07-01 11:23:33 +02:00
|
|
|
public constructor(collectionString: string, model: M, listOfSpeakers?: any) {
|
2019-04-23 16:57:35 +02:00
|
|
|
super(collectionString, model);
|
|
|
|
this._listOfSpeakers = listOfSpeakers || null; // Explicit set to null instead of undefined, if not given
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract getDetailStateURL(): string;
|
|
|
|
|
|
|
|
public updateDependencies(update: BaseViewModel): void {
|
|
|
|
// We cannot check with instanceof, becuase this givec circular dependency issues...
|
|
|
|
if (update.collectionString === ListOfSpeakers.COLLECTIONSTRING && update.id === this.list_of_speakers_id) {
|
2019-07-01 11:23:33 +02:00
|
|
|
this._listOfSpeakers = update;
|
2019-04-23 16:57:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|