File

src/lib/services/tabOrderService/webforms-main-tab-order.service.ts

Extends

MainTabOrderService

Index

Methods

Methods

isValidTabNode
isValidTabNode(tabNodeReference: TabNode, isTabNodeReferenceRadioButton: boolean, selectedRadioButton: any)

Determines whether a node instance is valid. Adds a new validation to know if the instance is valid

Parameters :
Name Type Optional Description
tabNodeReference TabNode No

The tabNode

isTabNodeReferenceRadioButton boolean No

Determines if the tabbed control is a radiobutton

selectedRadioButton any No

Contains the selected radioButton for the current container

Returns : boolean

true if valid tab node

registerInstance
registerInstance(componentInstance: any)

Register a component instance into the service component list this method overrides the method of the MainTabOrderService because dont need the containerParentInstance validation since WebForms does not allow to change the parent of a component dynamically.

Parameters :
Name Type Optional
componentInstance any No
Returns : void
import { Injectable } from '@angular/core';
import {
  ControlComponent,
  MainTabOrderService,
  TabNode
} from '@mobilize/winforms-components';

@Injectable({
  providedIn: 'root'
})
export class WebFormsMainTabOrderService extends MainTabOrderService {
  /**
   * Register a component instance into the service component list
   * this method overrides the method of the MainTabOrderService because dont need
   * the containerParentInstance validation since WebForms does not allow
   * to change the parent of a component dynamically.
   * @param componentInstance
   */
  registerInstance(componentInstance: any): void {
    const nodeInstance = new TabNode(componentInstance);
    if (
      componentInstance instanceof ControlComponent &&
      nodeInstance.tabOrder > -1
    ) {
      this.insertSort(nodeInstance);
      componentInstance.tabNodeReference = nodeInstance;
      this.nodesInstances.add(componentInstance.model.id, nodeInstance);
    }
  }

  /**
   * Determines whether a node instance is valid.
   * Adds a new validation to know if the instance is valid
   *
   * @param tabNodeReference The tabNode
   * @param isTabNodeReferenceRadioButton Determines if the tabbed control is a radiobutton
   * @param selectedRadioButton Contains the selected radioButton for the current container
   * @returns true if valid tab node
   * @memberof WebFormsMainTabOrderService
   */
  isValidTabNode(
    tabNodeReference: TabNode,
    isTabNodeReferenceRadioButton: boolean,
    selectedRadioButton: any
  ): boolean {
    return (
      super.isValidTabNode(
        tabNodeReference,
        isTabNodeReferenceRadioButton,
        selectedRadioButton
      ) && tabNodeReference.currentInstance.getStyleDisplay() != 'none'
    );
  }
}

results matching ""

    No results matching ""