File

projects/wms-framework/src/lib/infra/CommandBase.ts

Description

Basic implementation of CommandBase class.

Implements

ICommand

Index

Properties
Methods
Accessors

Properties

CanExecuteChanged
Type : SubscriptionEvent<any>
Default value : new SubscriptionEvent()

Event trigerred when CanExecute changes its value.

Private commandSource
Type : any
Default value : null

Stores the CommandSource value.

Methods

CanExecute
CanExecute(parameter?: any)

Query if the command can be executed.

Parameters :
Name Type Optional
parameter any Yes
Returns : boolean

{boolean}

Execute
Execute(parameter?: any)

Executes the command if it can be executed.

Parameters :
Name Type Optional
parameter any Yes
Returns : void

Accessors

CommandSource
getCommandSource()

Gets or sets the command source.

Returns : any
setCommandSource(value: any)
Parameters :
Name Type Optional
value any No
Returns : void
import { ICommand } from '../baseframework/ICommand';
import { Debugger } from '../diagnostics/Debugger';
import { SubscriptionEvent } from '../utils/SubscriptionEvent';

/**
 * Basic implementation of CommandBase class.
 *
 * @export
 * @class CommandBase
 * @implements {ICommand}
 * @wType Infragistics.CommandBase
 */
export class CommandBase implements ICommand {
  /**
   * Event trigerred when `CanExecute` changes its value.
   *
   * @type {SubscriptionEvent<any>}
   * @memberof CommandBase
   */
  CanExecuteChanged: SubscriptionEvent<any> = new SubscriptionEvent();

  /**
   * Stores the `CommandSource` value.
   *
   * @private
   * @type {*}
   * @memberof CommandBase
   */
  private commandSource: any = null;

  /**
   * Query if the command can be executed.
   *
   * @param {*} [parameter]
   * @return {*}  {boolean}
   * @memberof CommandBase
   * @wNoMap
   */
  CanExecute(parameter?: any): boolean {
    Debugger.RegisterUse('Infragistics_CommandBase.CanExecute');
    return true;
  }

  /**
   * Executes the command if it can be executed.
   *
   * @param {*} [parameter]
   * @memberof CommandBase
   * @wNoMap
   */
  Execute(parameter?: any): void {
    Debugger.RegisterUse('Infragistics_CommandBase.Execute');
  }

  /**
   * Gets or sets the command source.
   *
   * @type {*}
   * @memberof CommandBase
   */
  get CommandSource(): any {
    return this.commandSource;
  }

  set CommandSource(value: any) {
    this.commandSource = value;
  }
}

result-matching ""

    No results matching ""