projects/wms-framework/src/lib/models/controls/BindableItemCollection.ts
BindableItemCollection class
ICollectionBase
INotifyCollectionChanged
Properties |
|
Methods |
Accessors |
constructor(owner: IProvideDataItems<T>)
|
||||||
Creates an instance of BindableItemCollection.
Parameters :
|
Protected _owner |
Type : IProvideDataItems<T>
|
Owner of the data that the collection manipulates. |
CollectionChanged |
Type : SubscriptionEvent<void>
|
Default value : new SubscriptionEvent()
|
Event that handles the change of the collection |
internalArray |
Type : T[]
|
Internal array used in case the used needs a array instead of the current class |
PropertyChanged |
Type : SubscriptionEvent<void>
|
Event that gets fired when a property changes. |
add | ||||||
add(item: any)
|
||||||
Add an item in the owner of the data
Parameters :
Returns :
void
|
addItemSilently | |||||||||
addItemSilently(index: number, value: T)
|
|||||||||
To Implement
Parameters :
Returns :
void
|
clear |
clear()
|
To implement
Returns :
void
|
contains | ||||||
contains(value: T)
|
||||||
To implement
Parameters :
Returns :
boolean
{boolean} |
copyTo | |||||||||
copyTo(target: T[], index: number)
|
|||||||||
To implement
Parameters :
Returns :
void
|
getItem | ||||||
getItem(index: number)
|
||||||
Get an item from the owner of the data
Parameters :
Returns :
any
{*} |
indexOf | ||||||
indexOf(value: T)
|
||||||
To implement
Parameters :
Returns :
number
{number} |
insert | |||||||||
insert(index: number, value: T)
|
|||||||||
Insert an element in the data owner in a specific index.
Parameters :
Returns :
void
|
remove | ||||||
remove(value: T)
|
||||||
Remove an element in the data owner.
Parameters :
Returns :
boolean
{boolean} |
removeAt | ||||||
removeAt(index: number)
|
||||||
To implement
Parameters :
Returns :
void
|
removeItemSilently | ||||||
removeItemSilently(index: number)
|
||||||
To implement
Parameters :
Returns :
void
|
resetItemsSilently | ||||||
resetItemsSilently(index: number)
|
||||||
To implement
Parameters :
Returns :
void
|
setItem | |||||||||
setItem(index: number, value: T)
|
|||||||||
To implement
Parameters :
Returns :
void
|
sort |
sort()
|
To implement
Returns :
any
|
sort | ||||||
sort(comparer: IComparer<T>)
|
||||||
Parameters :
Returns :
any
|
sort | ||||||
sort(comparer?: any)
|
||||||
Parameters :
Returns :
any
|
()
|
Iterator of the iterable class
Returns :
Iterator<T, any, undefined>
{Iterator<T, any, undefined>} |
count |
getcount()
|
Gets the count of the datasets from the datacount
Returns :
number
|
import {
CollectionChangeInfo,
IComparer,
INotifyCollectionChanged,
} from '../../baseframework/collections';
import { SubscriptionEvent } from '../../utils/SubscriptionEvent';
import { ICollectionBase } from './ICollectionBase';
import { IProvideDataItems } from './IProvideDataItems';
/**
* BindableItemCollection class
*
* @export
* @class BindableItemCollection
* @implements {ICollectionBase<T>}
* @implements {INotifyCollectionChanged}
* @template T
* @wType Infragistics.Collections.BindableItemCollection`1
*/
export class BindableItemCollection<T>
implements ICollectionBase<T>, INotifyCollectionChanged
{
/**
* Owner of the data that the collection manipulates.
*
* @protected
* @type {IProvideDataItems<T>}
* @memberof BindableItemCollection
*/
protected _owner: IProvideDataItems<T>;
/**
* Creates an instance of BindableItemCollection.
* @param {IProvideDataItems<T>} owner
* @memberof BindableItemCollection
*/
constructor(owner: IProvideDataItems<T>) {
this._owner = owner;
}
/**
* Event that gets fired when a property changes.
*
* @memberof BindableItemCollection
* @wIgnore
*/
PropertyChanged: SubscriptionEvent<
(o: any, args: { PropertyName: string }) => void
>;
/**
* To Implement
*
* @param {number} index
* @param {T} value
* @memberof BindableItemCollection
* @wMethod AddItemSilently
* @wNoMap
*/
addItemSilently(index: number, value: T): void {
throw new Error('Method not implemented.');
}
/**
* To implement
*
* @param {number} index
* @memberof BindableItemCollection
* @wMethod removeItemSilently
* @wNoMap
*/
removeItemSilently(index: number): void {
throw new Error('Method not implemented.');
}
/**
* To implement
*
* @param {number} index
* @memberof BindableItemCollection
* @wMethod ResetItemsSilently
* @wNoMap
*/
resetItemsSilently(index: number): void {
throw new Error('Method not implemented.');
}
/**
* To implement
*
* @param {number} index
* @param {T} value
* @memberof BindableItemCollection
*/
setItem(index: number, value: T) {
throw new Error('Method not implemented.');
}
/**
* To implement
*
* @param {T} value
* @return {*} {number}
* @memberof BindableItemCollection
* @wMethod IndexOf
* @wNoMap
*/
indexOf(value: T): number {
throw new Error('Method not implemented.');
}
/**
* Insert an element in the data owner in a specific index.
*
* @param {number} index
* @param {T} value
* @memberof BindableItemCollection
* @wMethod Insert
*/
insert(index: number, value: T) {
this._owner.InsertItem(index, value);
}
/**
* To implement
*
* @param {number} index
* @memberof BindableItemCollection
* @wMethod RemoveAt
* @wNoMap
*/
removeAt(index: number) {
throw new Error('Method not implemented.');
}
/**
* To implement
*
* @memberof BindableItemCollection
*/
sort();
sort(comparer: IComparer<T>);
sort(comparer?: any): any {
throw new Error('Method not implemented.');
}
/**
* To implement
*
* @memberof BindableItemCollection
* @wMethod Clear
* @wNoMap
*/
clear(): void {
// we need to implement this method to make the collection work
}
/**
* To implement
*
* @param {T} value
* @return {*} {boolean}
* @memberof BindableItemCollection
* @wMethod Contains
* @wNoMap
*/
contains(value: T): boolean {
throw new Error('Method not implemented.');
}
/**
* Remove an element in the data owner.
*
* @param {T} value
* @return {*} {boolean}
* @memberof BindableItemCollection
* @wMethod Remove
*/
remove(value: T): boolean {
return this._owner.RemoveItem(value);
}
/**
* To implement
*
* @param {T[]} target
* @param {number} index
* @memberof BindableItemCollection
* @wMethod CopyTo
* @wNoMap
*/
copyTo(target: T[], index: number): void {
throw new Error('Method not implemented.');
}
/**
* Iterator of the iterable class
*
* @return {*} {Iterator<T, any, undefined>}
* @memberof BindableItemCollection
*/
[Symbol.iterator](): Iterator<T, any, undefined> {
return this._owner.toArray()[Symbol.iterator]();
}
/**
* Internal array used in case the used needs a array instead of the current class
*
* @type {T[]}
* @memberof BindableItemCollection
*/
internalArray: T[];
/**
* Event that handles the change of the collection
*
* @memberof BindableItemCollection
*/
CollectionChanged: SubscriptionEvent<
(e: any, args: CollectionChangeInfo) => void
> = new SubscriptionEvent();
/**
* Add an item in the owner of the data
*
* @param {*} item
* @memberof BindableItemCollection
* @wMethod Add
*/
add(item: any) {
this._owner.add(item);
}
/**
* Get an item from the owner of the data
*
* @param {number} index
* @return {*} {*}
* @memberof BindableItemCollection
* @wMethod GetItem
*/
getItem(index: number): any {
return this._owner.GetDataItem(index);
}
/**
* Gets the count of the datasets from the datacount
*
* @readonly
* @type {number}
* @memberof BindableItemCollection
* @wProperty Count
*/
get count(): number {
let result = 0;
if (this._owner != null) {
result = this._owner.DataCount;
}
return result;
}
}