import { Component, OnInit, ElementRef } from '@angular/core'; import { CfCoreComponent } from '../core/core.component'; import { CfButtonComponent } from '../button/button.component'; import { CfWeatherComponent } from '../weather/weather.component'; import { CfNewsComponent } from '../news/news.component'; import { CfWorldClockComponent } from '../world-clock/world-clock.component'; import { CfBpmListComponent } from '../bpm-list/bpm-list.component'; import { ClockComponentModel } from '../../models/clock/clock-component.model'; import { PageService } from '../../services/page-service/page.service'; /** * This component refers to a Weather app. */ @Component({ selector: 'cf-page-2', template: "
", styles: [".cf-page-content-styles { background: grey URL(\"/assets/images/page_background.jpg\") no-repeat 0 0; background-size: 100% 100%; position: fixed; left: 0; top: 0; bottom: 0; right: 0; } .cf-page-content { left: 0; top: 75px; bottom: 75px; right: 0; position: absolute; } .cf-page-header { background: #03A9F4; color: #fff; position: fixed; left: 0; right: 0; top: 0; min-height: 50px; } .cf-page-header img { width: 113px; height: 34px; } .cf-page-footer { background: #03A9F4; color: #fff; position: fixed; left: 0; right: 0; bottom: 0; min-height: 50px; } .cf-page-footer span { padding-top: 14px; padding-left: 20px; padding-bottom: 15px; } .cf-page-header .cf-page-header-spacer { flex: 1 1 auto; } .cf-page-header a { color: #ffffff; } .buttonTreeBar { margin-right: 30px; background: #1E90FF; } .buttonSendMessage { background: #1E90FF; } .buttonAddComp { background: #1E90FF; } .buttonRemoveComp { background: #1E90FF; } "], entryComponents: [ CfButtonComponent, CfWeatherComponent, CfNewsComponent, CfWorldClockComponent, CfBpmListComponent ] }) export class CfPage2 extends CfCoreComponent implements OnInit { // data for components to be used in page body clock : ClockComponentModel = { id: "Clock1", city: "Paris" }; constructor(public elementRef: ElementRef, public pageService: PageService) { super(elementRef); this.id = 'page2';// have to set explicitly to get components form the storage } /** *

This method is called when initializing the component.

*/ ngOnInit() { super.ngOnInit(); this.pageService.loadComponents(this.id, this.dynamicallyAddedComponents); } // Page Footer Functionality dynamicallyAddedComponents: any[] = []; addComponent(compName: string): void { this.pageService.addComponent(compName, this.dynamicallyAddedComponents, this.id); } removeComponent(): void { this.pageService.removeComponent(this.dynamicallyAddedComponents, this.id); } }