File

projects/wms-framework/src/lib/regionsframework/RegionBehaviorCollection.ts

Description

RegionBehaviorCollection class.

Extends

SimpleDictionary

Implements

IRegionBehaviorCollection

Index

Properties
Methods

Constructor

constructor(region: IRegion)
Parameters :
Name Type Optional
region IRegion No

Properties

behaviors
Type : SimpleDictionary<string | IRegionBehavior>
Default value : new SimpleDictionary< string, IRegionBehavior >()
region
Type : IRegion
Private internalMap
Type : Map<K | V>
Inherited from SimpleDictionary
Abstract count
Type : number
Inherited from Dictionary
Defined in Dictionary:61

Gets the count of elements in the dictionary

Abstract internalArray
Type : []
Inherited from Dictionary
Defined in Dictionary:62
Abstract keys
Type : ICollection<K>
Inherited from Dictionary
Defined in Dictionary:41

The keys collection

Abstract values
Type : ICollection<V>
Inherited from Dictionary
Defined in Dictionary:51

The values collection

Methods

Add
Add(key: string, behavior: IRegionBehavior)
Parameters :
Name Type Optional
key string No
behavior IRegionBehavior No
Returns : void
ContainsKey
ContainsKey(key: string)
Parameters :
Name Type Optional
key string No
Returns : boolean
add
add(value: [K, V])
Inherited from Dictionary
Defined in Dictionary:66
Parameters :
Name Type Optional
value [K, V] No
Returns : void
addEntry
addEntry(key: K, value: V)
Inherited from Dictionary
Defined in Dictionary:46
Parameters :
Name Type Optional
key K No
value V No
Returns : void
clear
clear()
Inherited from Dictionary
Defined in Dictionary:69
Returns : void
contains
contains(value: [K, V])
Inherited from Dictionary
Defined in Dictionary:72
Parameters :
Name Type Optional
value [K, V] No
Returns : boolean
containsKey
containsKey(key: K)
Inherited from Dictionary
Defined in Dictionary:76
Parameters :
Name Type Optional
key K No
Returns : boolean
copyTo
copyTo(target: [], index: number)
Inherited from Dictionary
Defined in Dictionary:83
Parameters :
Name Type Optional
target [] No
index number No
Returns : void
filter
filter(predicate: (item: [K, V]) => void)
Inherited from SimpleDictionary

Creates a new SimpleDictionary object with the elements that matched the given predicate

Parameters :
Name Type Optional Description
predicate function No

a function that filters this SimpleDictionary elements.

Returns : SimpleDictionary<K, V>

a new SimpleDictionary with filtered in elements.

getItem
getItem(key: K)
Inherited from Dictionary
Defined in Dictionary:30
Parameters :
Name Type Optional
key K No
Returns : V
hasKey
hasKey(key: K)
Inherited from Dictionary
Defined in Dictionary:49
Parameters :
Name Type Optional
key K No
Returns : any
remove
remove(value: [K, V])
Inherited from Dictionary
Defined in Dictionary:79
Parameters :
Name Type Optional
value [K, V] No
Returns : boolean
removeEntry
removeEntry(key: K)
Inherited from Dictionary
Defined in Dictionary:52
Parameters :
Name Type Optional
key K No
Returns : void
setItem
setItem(key: K, value: V)
Inherited from Dictionary
Defined in Dictionary:37
Parameters :
Name Type Optional
key K No
value V No
Returns : void
tryGetValue
tryGetValue(key: K, value: (v: V) => void)
Inherited from Dictionary
Defined in Dictionary:55
Parameters :
Name Type Optional
key K No
value function No
Returns : boolean
()
Inherited from Dictionary
Defined in Dictionary:86
Returns : Iterator<, any, undefined>
import {
  ArgumentException,
  ArgumentNullException,
} from '../baseframework/Exceptions';
import { SimpleDictionary } from '../baseframework/SimpleDictionary';
import { IRegion } from './IRegion';
import { IRegionBehavior } from './IRegionBehavior';
import { IRegionBehaviorCollection } from './IRegionBehaviorCollection';

/**
 * RegionBehaviorCollection class.
 *
 * @export
 * @class RegionBehaviorCollection
 * @extends {SimpleDictionary<string, IRegionBehavior>}
 * @implements {IRegionBehaviorCollection}
 * @wType Microsoft.Practices.Prism.Regions.RegionBehaviorCollection
 */
export class RegionBehaviorCollection
  extends SimpleDictionary<string, IRegionBehavior>
  implements IRegionBehaviorCollection
{
  region: IRegion;
  behaviors: SimpleDictionary<string, IRegionBehavior> = new SimpleDictionary<
    string,
    IRegionBehavior
  >();
  constructor(region: IRegion) {
    super();
    this.region = region;
  }
  Add(key: string, behavior: IRegionBehavior): void {
    if (key == null) {
      throw new ArgumentNullException('key');
    }
    if (behavior == null) {
      throw new ArgumentNullException('regionBehavior');
    }
    if (this.behaviors.containsKey(key)) {
      throw new ArgumentException(
        'Could not add duplicate behavior with same key.'
      );
    }
    this.behaviors.add([key, behavior]);
    behavior.Region = this.region;
    behavior.Attach();
  }
  ContainsKey(key: string): boolean {
    return this.behaviors.containsKey(key);
  }
}

result-matching ""

    No results matching ""