import { RevClientObject, RevSchemaField } from '../../common'; import { RevCanvas } from '../components/canvas/canvas'; import { RevColumnsManager } from '../components/column/columns-manager'; import { RevFocus } from '../components/focus/focus'; import { RevMouse } from '../components/mouse/mouse'; import { RevRenderer } from '../components/renderer/renderer'; import { RevScroller } from '../components/scroller'; import { RevSelection } from '../components/selection/selection'; import { RevSubgridsManager } from '../components/subgrid/subgrids-manager'; import { RevViewLayout } from '../components/view/view-layout'; import { RevBehavioredColumnSettings, RevBehavioredGridSettings } from '../settings'; import { RevCellPropertiesBehavior } from './cell-properties-behavior'; import { RevDataExtractBehavior } from './data-extract-behavior'; import { RevEventBehavior } from './event-behavior'; import { RevFocusScrollBehavior } from './focus-scroll-behavior'; import { RevFocusSelectBehavior } from './focus-select-behavior'; import { RevReindexBehavior } from './reindex-behavior'; import { RevRowPropertiesBehavior } from './row-properties-behavior'; import { RevServerNotificationBehavior } from './server-notification-behavior'; /** @internal */ export class RevBehaviorManager implements RevClientObject { readonly focusScrollBehavior: RevFocusScrollBehavior; readonly focusSelectBehavior: RevFocusSelectBehavior; readonly eventBehavior: RevEventBehavior; readonly reindexBehavior: RevReindexBehavior; readonly rowPropertiesBehavior: RevRowPropertiesBehavior; readonly cellPropertiesBehavior: RevCellPropertiesBehavior; readonly dataExtractBehavior: RevDataExtractBehavior; private readonly _serverNotificationBehavior: RevServerNotificationBehavior; constructor( readonly clientId: string, readonly internalParent: RevClientObject, gridSettings: BGS, canvas: RevCanvas, columnsManager: RevColumnsManager, subgridsManager: RevSubgridsManager, viewLayout: RevViewLayout, focus: RevFocus, selection: RevSelection, mouse: RevMouse, renderer: RevRenderer, horizontalScroller: RevScroller, verticalScroller: RevScroller, descendantEventer: RevEventBehavior.DescendantEventer, ) { this.eventBehavior = new RevEventBehavior( this.clientId, this, gridSettings.eventDispatchEnabled, canvas, columnsManager, viewLayout, focus, selection, mouse, renderer, horizontalScroller, verticalScroller, descendantEventer, (event) => canvas.dispatchEvent(event), ); this.reindexBehavior = new RevReindexBehavior( this.clientId, this, focus, selection ); this._serverNotificationBehavior = new RevServerNotificationBehavior( this.clientId, this, columnsManager, subgridsManager, viewLayout, focus, selection, renderer, this.eventBehavior, this.reindexBehavior, ); this.focusScrollBehavior = new RevFocusScrollBehavior( this.clientId, this, gridSettings, columnsManager, subgridsManager, viewLayout, focus, ); this.focusSelectBehavior = new RevFocusSelectBehavior( this.clientId, this, gridSettings, columnsManager, selection, focus, viewLayout, ); this.rowPropertiesBehavior = new RevRowPropertiesBehavior( this.clientId, this, viewLayout, ); this.cellPropertiesBehavior = new RevCellPropertiesBehavior( this.clientId, this, columnsManager, subgridsManager, viewLayout, ); this.dataExtractBehavior = new RevDataExtractBehavior( this.clientId, this, selection, subgridsManager, columnsManager ); } get active() { return this._serverNotificationBehavior.notificationsEnabled; } set active(value: boolean){ if (value){ this._serverNotificationBehavior.enableNotifications(); } else { this._serverNotificationBehavior.disableNotifications(); } } destroy() { this._serverNotificationBehavior.destroy(); this.eventBehavior.destroy(); } }