File

projects/wms-framework/src/lib/models/controls/GridPanelModel.ts

Description

Class that represents the model of a ColumnDefinitionCollection.

Extends

PresentationFrameworkCollectionModel

Index

Properties
Methods

Constructor

constructor(grid: GridModel)
Parameters :
Name Type Optional
grid GridModel No

Properties

Private innerCollection
Default value : new SimpleList<T>()
Protected bindingExpressions
Default value : new SimpleDictionary< string, BindingExpression >()
Inherited from DependencyObject
Public BindingValidationError
Default value : new SubscriptionEvent< (sender: any, e: BindingValidationErrorEventArgs) => void >()
Inherited from DependencyObject

Event for validation errors

Public change
Type : SubscriptionEvent<void>
Default value : new SubscriptionEvent()
Inherited from DependencyObject

Infrastructure event for notifying event changes

Public Dispatcher
Type : Dispatcher
Default value : Dispatcher.GetDispatcher()
Inherited from DependencyObject
isEnableSetPropertiesRegistry
Type : boolean
Default value : true
Inherited from DependencyObject

Flag which indicates if the dependency property set mechanism is enable

Public IsInitializingBindings
Type : boolean
Default value : false
Inherited from DependencyObject

Property to determine if bindings are being initialized

previousValidationMessage
Type : string
Default value : ''
Inherited from DependencyObject
Protected properties
Type : object
Default value : {}
Inherited from DependencyObject
Private setPropertiesRegistry
Type : Map<string | boolean>
Default value : new Map()
Inherited from DependencyObject

Registry with dependencies properties which has been set

validationerr
Default value : false
Inherited from DependencyObject
validationMessagesStack
Type : Array<>
Default value : []
Inherited from DependencyObject

Keeps a queue of validation messages registered on the current Dependency Object

Methods

add
add(value: T)
Parameters :
Name Type Optional
value T No
Returns : void
clear
clear()
Returns : void
contains
contains(value: T)
Parameters :
Name Type Optional
value T No
Returns : boolean
copyTo
copyTo(target: T[], index: number)
Parameters :
Name Type Optional
target T[] No
index number No
Returns : void
getItem
getItem(index: number)
Parameters :
Name Type Optional
index number No
Returns : T
indexOf
indexOf(value: T)
Parameters :
Name Type Optional
value T No
Returns : number
insert
insert(index: number, value: T)
Parameters :
Name Type Optional
index number No
value T No
Returns : void
internalAdd
internalAdd(value: T)

Add used for internal processing of added elements to collection without trigger change

Parameters :
Name Type Optional
value T No
Returns : void
remove
remove(value: T)
Parameters :
Name Type Optional
value T No
Returns : boolean
removeAt
removeAt(index: number)
Parameters :
Name Type Optional
index number No
Returns : void
setItem
setItem(index: number, value: T)
Parameters :
Name Type Optional
index number No
value T No
Returns : void
sort
sort()
Returns : any
()
Returns : Iterator<T, any, undefined>
Private addRelatedSubscriptionIfRequired
addRelatedSubscriptionIfRequired(event: SubscriptionEvent<any>, theHandler: any, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
event SubscriptionEvent<any> No
theHandler any No
bindingExpression BindingExpression No
Returns : void
Private addSubscriptionForTwoWayBindings
addSubscriptionForTwoWayBindings(dependencyProperty: DependencyProperty, binding: Binding, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
dependencyProperty DependencyProperty No
binding Binding No
bindingExpression BindingExpression No
Returns : void
addsValidationMessage
addsValidationMessage(propKey: Binding | string, message: string)
Inherited from DependencyObject

Adds a new validation message associated to a binding or a property name

Parameters :
Name Type Optional
propKey Binding | string No
message string No
Returns : void
Private beginSubscribeToMultiPropertyPathChanges
beginSubscribeToMultiPropertyPathChanges(context: any, binding: Binding, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
context any No
binding Binding No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
Returns : void
Private checkForSubscriptoinToDataErrorInfo
checkForSubscriptoinToDataErrorInfo(currentContext: any, binding: Binding, propertyToSubscribe: string, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
currentContext any No
binding Binding No
propertyToSubscribe string No
bindingExpression BindingExpression No
Returns : void
Public clearValue
clearValue(property: DependencyProperty)
Inherited from DependencyObject

Clears the dependency property value

Parameters :
Name Type Optional
property DependencyProperty No
Returns : void
Equals
Equals(obj: any)
Inherited from DependencyObject

Compares this dependency object agains another object.

Parameters :
Name Type Optional
obj any No
Returns : boolean

{boolean}

GetChild
GetChild(idx: number)
Inherited from DependencyObject

Gets the child element at the index position

Parameters :
Name Type Optional
idx number No
Returns : DependencyObject

{DependencyObject}

GetChildrenCount
GetChildrenCount()
Inherited from DependencyObject

Method o know the amount of children the parent has

Returns : number

{number}

GetHashCode
GetHashCode()
Inherited from DependencyObject

Gets a hash code for this dependency object.

Returns : number

{number}

Public getValue
getValue(property: DependencyProperty)
Inherited from DependencyObject

Gets the value of a dependency property

Parameters :
Name Type Optional
property DependencyProperty No
Returns : any
Private handleErrorsOnContext
handleErrorsOnContext(errorCtxt: INotifyDataErrorInfo, args: DataErrorsChangedEventArgs)
Inherited from DependencyObject

Check and register possible errors in an error context

Parameters :
Name Type Optional
errorCtxt INotifyDataErrorInfo No
args DataErrorsChangedEventArgs No
Returns : void
Public IsPropertySet
IsPropertySet(propertyName: string)
Inherited from DependencyObject

Indicates if the property has been already set.

Parameters :
Name Type Optional
propertyName string No
Returns : any
Private performDataErrorValidationIfRequired
performDataErrorValidationIfRequired(binding: Binding, theBindingContext: any)
Inherited from DependencyObject

Performs validation on model if the model implementes IDataErrorINfo

Parameters :
Name Type Optional
binding Binding No
theBindingContext any No
Returns : void
Private performRemoveValidationIfInValidationError
performRemoveValidationIfInValidationError(binding: Binding)
Inherited from DependencyObject

Performs the remove validation if the InValidationError is true

Parameters :
Name Type Optional
binding Binding No
Returns : void
Public performTargetObjectBindingUpdate
performTargetObjectBindingUpdate(dependencyProperty: DependencyProperty, binding: Binding)
Inherited from DependencyObject

Updates the target object value associated to the binding.

Parameters :
Name Type Optional
dependencyProperty DependencyProperty No
binding Binding No
Returns : void
Private preprocessValue
preprocessValue(property: DependencyProperty, value: any)
Inherited from DependencyObject

Preprocess value to be set to dependency property

Parameters :
Name Type Optional
property DependencyProperty No
value any No
Returns : any
Private recreateSubscriptionsForMultiPropertyBindingPath
recreateSubscriptionsForMultiPropertyBindingPath(currentContext: any, outerContext: any, properties: string[], propertyIndex: number, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression, subscriptionsForCurrentBindingPath: Array<>)
Inherited from DependencyObject
Parameters :
Name Type Optional
currentContext any No
outerContext any No
properties string[] No
propertyIndex number No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
subscriptionsForCurrentBindingPath Array<> No
Returns : void
Private registerSetPropertyIfRequired
registerSetPropertyIfRequired(name: string)
Inherited from DependencyObject

Register set property if required

Parameters :
Name Type Optional
name string No
Returns : void
Private removeSubscriptionsForMultiPropertyBindingPath
removeSubscriptionsForMultiPropertyBindingPath(subscriptionsForCurrentBindingPath: [], propertyIndex: number)
Inherited from DependencyObject
Parameters :
Name Type Optional
subscriptionsForCurrentBindingPath [] No
propertyIndex number No
Returns : void
removeValidationMessage
removeValidationMessage(propKey: Binding | string)
Inherited from DependencyObject

Removes a validation message associated to a binding or a property name

Parameters :
Name Type Optional
propKey Binding | string No
Returns : void
SetBinding
SetBinding(dependencyProperty: DependencyProperty, binding: Binding)
Inherited from DependencyObject

Sets a binding to the specified property at runtime

Parameters :
Name Type Optional Description
dependencyProperty DependencyProperty No

property to bind

binding Binding No

binding object

Returns : void
Public setValue
setValue(property: DependencyProperty, value: any)
Inherited from DependencyObject

Sets the value for a dependency property

Parameters :
Name Type Optional
property DependencyProperty No
value any No
Returns : void
Public setValueForScopedRegion
setValueForScopedRegion(property: DependencyProperty, value: any, scopedRegionManager: IRegionManager)
Inherited from DependencyObject

Sets the value for a dependency property. This is a workaround to support Scoped Region Managers. A research is required to find out the way to get the application region Manager when scoped region managers are used (when creating the DelayedRegionBehavior, the correct scoped region manager must be passed as an argument).

Parameters :
Name Type Optional
property DependencyProperty No
value any No
scopedRegionManager IRegionManager No
Returns : void
Protected shouldPreventDefaultSourceUpdate
shouldPreventDefaultSourceUpdate(dependencyProperty: DependencyProperty, binding: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
dependencyProperty DependencyProperty No
binding BindingExpression No
Returns : boolean
Private subscribeToBindingPathChanges
subscribeToBindingPathChanges(context: any, binding: Binding, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
context any No
binding Binding No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
Returns : void
Private subscribeToErrorsChangedInModel
subscribeToErrorsChangedInModel(errorCtxt: INotifyDataErrorInfo, propertyToSubscribe: string, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
errorCtxt INotifyDataErrorInfo No
propertyToSubscribe string No
bindingExpression BindingExpression No
Returns : void
Private subscribeToPropertyChanges
subscribeToPropertyChanges(currentContext: any, outerContext: any, properties: string[], propertyIndex: number, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression, subscriptionsForCurrentBindingPath: Array<>)
Inherited from DependencyObject
Parameters :
Name Type Optional
currentContext any No
outerContext any No
properties string[] No
propertyIndex number No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
subscriptionsForCurrentBindingPath Array<> No
Returns : void
Private updateSourceOfBinding
updateSourceOfBinding(binding: Binding, outerContext: any, dependencyProperty: DependencyProperty)
Inherited from DependencyObject

Updates the source of a binding

Parameters :
Name Type Optional
binding Binding No
outerContext any No
dependencyProperty DependencyProperty No
Returns : void
import { FrameworkElement } from '../../basecomponentmodel/FrameworkElement';
import { DependencyObject } from '../../basecomponentmodel/DependencyObject';
import { PresentationFrameworkCollectionModel } from './ItemsControlModel';
import { DependencyProperty } from '../../basecomponentmodel/DependencyProperty';
import { UIElementCollectionModel } from '../../basecomponentmodel/UIElementCollectionModel';
import { PanelModel } from './PanelModel';
import { AngularComponentId } from '../../helpers';
import { GridUnitType } from '../enums';

/**
 * Class that represents the model of a RowDefinition.
 *
 * @export
 * @class GridRowDefinition
 * @wType System.Windows.Controls.RowDefinition
 */
export class GridRowDefinition extends DependencyObject {
  /**
   * Internal height property
   *
   * @private
   * @type {GridLength}
   * @memberof GridRowDefinition
   */
  private _height: GridLength = new GridLength(1, GridUnitType.Star);

  /**
   * MinHeight property.
   *
   * @type {*}
   * @memberof GridRowDefinition
   */
  public MinHeight: any = null;

  /**
   * MaxHeight property.
   *
   * @type {*}
   * @memberof GridRowDefinition
   */
  public MaxHeight: any = null;

  /**
   * Gets the current value of Height
   *
   * @type {GridLength}
   * @memberof GridRowDefinition
   */
  public get Height(): GridLength {
    return this._height;
  }

  /**
   * Sets a new value for Height
   *
   * @memberof GridRowDefinition
   */
  public set Height(value: GridLength) {
    if (value != this._height) {
      this._height = value;
      this.change.fire(['RowDefinitionHeight']);
    }
  }
}

/**
 * Class that represents the model of a ColumnDefinition.
 *
 * @export
 * @class GridColumnDefinition
 * @extends {DependencyObject}
 * @wType System.Windows.Controls.ColumnDefinition
 */
export class GridColumnDefinition extends DependencyObject {
  /**
   * Width property.
   *
   * @private
   * @type {GridLength}
   * @memberof GridColumnDefinition
   */
  private _width: GridLength = new GridLength(1, GridUnitType.Star);

  /**
   * MinWidth property.
   *
   * @type {*}
   * @memberof GridColumnDefinition
   */
  public MinWidth: any = null;

  /**
   * MaxWidth property.
   *
   * @type {*}
   * @memberof GridColumnDefinition
   */
  public MaxWidth: any = null;

  /**
   * Gets or sets the width.
   *
   * @type {GridLength}
   * @memberof GridColumnDefinition
   */
  public get Width(): GridLength {
    return this._width;
  }
  public set Width(value: GridLength) {
    if (value !== this._width) {
      this._width = value;
      this.change.fire(['ColumnDefinitionWidth']);
    }
  }
}

/**
 * Class that represents the model of a ColumnDefinitionCollection.
 *
 * @export
 * @class GridColumnDefinitions
 * @extends {PresentationFrameworkCollectionModel<GridColumnDefinition>}
 * @wType System.Windows.Controls.ColumnDefinitionCollection
 */
export class GridColumnDefinitions extends PresentationFrameworkCollectionModel<GridColumnDefinition> {
  constructor(private grid: GridModel) {
    super();
  }
}

/**
 * Class that represents the model of a RowDefinitionCollection.
 *
 * @export
 * @class GridRowDefinitions
 * @extends {PresentationFrameworkCollectionModel<GridRowDefinition>}
 * @wType System.Windows.Controls.RowDefinitionCollection
 */
export class GridRowDefinitions extends PresentationFrameworkCollectionModel<GridRowDefinition> {
  public MinWidth: number = 0;
  constructor(private grid: GridModel) {
    super();
  }
}

/**
 * Class that represents the model of a GridLength.
 *
 * @export
 * @class GridLength
 * @wType System.Windows.GridLength
 */
export class GridLength {
  public static Auto: any = new GridLength(0, GridUnitType.Auto);
  public get Value(): number {
    return this.length;
  }
  constructor(
    public length: number,
    public unitType: GridUnitType = GridUnitType.Pixel
  ) {}

  /**
   * Gets a value indicating if the grid lenght unit is a absolute value
   *
   * @readonly
   * @type {boolean}
   * @memberof GridLength
   */
  public get IsAbsolute(): boolean {
    return this.unitType === GridUnitType.Pixel;
  }

  /**
   * Gets a value indicating if the grid lenght unit is an auto value
   *
   * @readonly
   * @type {boolean}
   * @memberof GridLength
   */
  public get IsAuto(): boolean {
    return this.unitType === GridUnitType.Auto;
  }

  /**
   * Gets a value indicating if the grid lenght unit is a star value
   *
   * @readonly
   * @type {boolean}
   * @memberof GridLength
   */
  public get IsStar(): boolean {
    return this.unitType === GridUnitType.Star;
  }
}

/**
 * Class that represents the model of a Grid.
 *
 * @export
 * @class GridModel
 * @extends {PanelModel}
 * @wType System.Windows.Controls.Grid
 */
export class GridModel extends PanelModel {
  public AngularComponentId = AngularComponentId.gridPanel;
  public attachedComponentInstance;
  public ColumnDefinitions: GridColumnDefinitions;
  public RowDefinitions: GridRowDefinitions;

  /**
   * ColumnProperty dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof GridPanelModel
   */
  static ColumnProperty: DependencyProperty = new DependencyProperty(
    'Grid_Column',
    null,
    null
  );

  /**
   * ColumnSpanProperty dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof GridPanelModel
   */
  static ColumnSpanProperty: DependencyProperty = new DependencyProperty(
    'Grid_ColumnSpan',
    null,
    null
  );

  /**
   * RowProperty dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof GridPanelModel
   */
  static RowProperty: DependencyProperty = new DependencyProperty(
    'Grid_Row',
    null,
    null
  );

  /**
   * RowSpanProperty dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof GridPanelModel
   */
  static RowSpanProperty: DependencyProperty = new DependencyProperty(
    'Grid_RowSpan',
    null,
    null
  );

  /**
   * ShowGridLinesProperty dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof GridPanelModel
   */
  static ShowGridLinesProperty: DependencyProperty = new DependencyProperty(
    'Grid_ShowGridLines',
    false,
    null
  );

  constructor() {
    super();
    this.ColumnDefinitions = new GridColumnDefinitions(this);
    this.RowDefinitions = new GridRowDefinitions(this);
    this.Children = new UIElementCollectionModel(this);
  }

  public static getColumnInformation(cell: any): number {
    return cell.getValue(GridModel.ColumnProperty);
  }
  public static getRowInformation(cell: any): number {
    return cell.getValue(GridModel.RowProperty);
  }
  public static setRowInformation(cell: DependencyObject, row: number) {
    cell.setValue(GridModel.RowProperty, row);
  }
  public static setColumnInformation(cell: DependencyObject, column: number) {
    cell.setValue(GridModel.ColumnProperty, column);
  }

  public static SetRow(element: FrameworkElement, row: number) {
    element.setValue(GridModel.RowProperty, row);
  }
  public static GetRow(element: FrameworkElement) {
    return element.getValue(GridModel.RowProperty);
  }
  public static SetColumn(element: FrameworkElement, column: number) {
    element.setValue(GridModel.ColumnProperty, column);
  }
  public static GetColumn(element: FrameworkElement) {
    return element.getValue(GridModel.ColumnProperty);
  }
  public static SetRowSpan(element: FrameworkElement, rowSpan: number) {
    element.setValue(GridModel.RowSpanProperty, rowSpan);
  }
  public static GetRowSpan(element: FrameworkElement): any {
    return element.getValue(GridModel.RowSpanProperty);
  }
  public static SetColumnSpan(element: FrameworkElement, columnSpan: number) {
    element.setValue(GridModel.ColumnSpanProperty, columnSpan);
  }
  public static GetColumnSpan(element: FrameworkElement): any {
    return element.getValue(GridModel.ColumnSpanProperty);
  }
}

result-matching ""

    No results matching ""