How to use the esp-js-ui.viewFactory function in esp-js-ui

To help you get started, we’ve selected a few esp-js-ui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github esp / esp-js / examples / esp-js-ui-module-based-app / src / trading-module / cash-tile / cashTileViewFactory.ts View on Github external
import {CashTileModel, defaultModelFactory} from './model/cashTileModel';
import {CashTileView} from './views/cashTileView';
import {rootStateHandlerMap} from './model/root/rootState';
import {referenceDataStateHandlerMap} from './model/refData/referenceDataState';
import {rootStateObservable} from './model/root/rootEventStreams';
import {inputStateHandlerMap} from './model/inputs/inputsState';
import {RequestForQuoteStateHandlers} from './model/rfq/requestForQuoteState';
import {RequestForQuoteEventStreams} from './model/rfq/requestForQuoteEventStreams';
import {RfqService} from './services/rfqService';
import {RootEvents} from './events';
import {DateSelectorModel} from './model/dateSelector/dateSelectorModel';
import {TradingModuleContainerConst} from '../tradingModuleContainerConst';

const _log = Logger.create('CashTileViewFactory');

@viewFactory(TradingModuleContainerConst.cashTileViewFactory, 'Cash Tile')
export class CashTileViewFactory extends ViewFactoryBase> {
    private _router : Router;
    constructor(container, router:Router) {
        super(container);
        this._router = router;
    }
    _createView(childContainer, state: CashTileModel): PolimerModel {
        _log.verbose('Creating cash tile model');

        const modelId = IdFactory.createId('cashTileModel');

        const initialModel = state || defaultModelFactory(modelId, 'EURUSD');

        let model = this._router
            // ***************************
            // Create a model and setup some initial state
github esp / esp-js / examples / esp-js-ui-module-based-app / src / trading-module / blotter / blotterViewFactory.ts View on Github external
import {Router} from 'esp-js';
import {ViewFactoryBase, Logger, viewFactory } from 'esp-js-ui';
import {TradingModuleContainerConst} from '../tradingModuleContainerConst';
import {BlotterState} from './models/blotterState';
import {BlotterModel} from './models/blotterModel';

const _log = Logger.create('BlotterViewFactory');

@viewFactory(TradingModuleContainerConst.blotterViewFactory, 'Blotter')
export class BlotterViewFactory extends ViewFactoryBase {
    private _router : Router;
    constructor(container, router:Router) {
        super(container);
        this._router = router;
    }
    // override
    _createView(childContainer, state:BlotterState):BlotterModel {
        _log.verbose('Creating blotter model');
        state = state || BlotterState.create();
        let model:BlotterModel = childContainer.resolve(TradingModuleContainerConst.blotterModel, state);
        model.observeEvents();
        return model;
    }
}