zoukankan      html  css  js  c++  java
  • Ext js 2.0 Overview(2) 组件模型概况

    Component Overview

    One of the goals with 2.0 was to provide even more basic building blocks than ever before. The Component class was originally introduced in 1.x, but was not fully integrated throughout the framework. In 2.0, Component's capabilities have been further expanded and improved upon, making it one of the most fundamental classes in the overall architecture. Component now provides a unified model for component creation, rendering, event handling, state management and destruction, and every component in Ext that requires these features now extends Component. Here are the key features of Component in 2.0:

    2.0的一个目标是希望能提供更加简单的方式来创建应用模块。Component类,在1.x中已经存在了,但是它并没有被完整的集成贯穿于整个框架。在2.0中,Component的功能被进一步扩展和改进,它现在已经是整个架构中最基础的一个类。Component提供了统一的组件创建,呈现,事件处理,状态管理和销毁,所有的需要这些功能的组件都是从Component类扩展而来的。下面是Component的一个核心功能:

    • Explicit constructor chaining and overriding(明确的构造器链条和重写覆盖)
      Component itself provides a base constructor that will apply any config passed into any subclass, and the initComponent function can be used all the way through the inheritance chain to provide custom constructor logic at each step in the hierarchy.

    Component本身提供了一个可以应用通过子类传递过来的配置参数的基本构造器,同时它提供的initComponent函数,可以在继承链条上的每一个层次的构造器上执行自定义的构造逻辑。

    • Managed rendering(呈现管理)
      In 2.0, every component automatically supports lazy (on-demand) rendering, and the rendering pipeline is managed for you automatically. Even so, you still have ultimate flexibility to customize the rendering process via before and after render events.

    在2.0中,所有的组件都是自动的延迟(按需)呈现,它们的呈现通道是为你自动管理的。当然,你仍然可以在最终呈现前通过定制呈现前后事件来灵活控制最终的呈现结果。

    • Managed destruction(释放管理)
      Each component also contains a destroy function, and Ext manages clean up by automatically garbage collecting and destroying components when they are no longer needed. Of course, destruction also provides before and after events and can be customized when needed.

    每个组件都包含有一个销毁(释放)函数,Ext通过自动垃圾收集器来清除和销毁不再需要的组件实例。当然,我们也可以定制销毁前后的事件。

    • Automatic state management(自动的状态管理)
      Components now have built-in functionality for setting and retrieving state, and many components in Ext support automatic state management as long as the global StateManager has been initialized with a state Provider.

    组件有设置和读取状态的内置功能,大多数组件都支持通过使用在StateManager中初始化的状态提供者来进行自动的状态管理。

    • Consistent interface for basic component behavior(基本行为的统一接口)
      The most fundamental behaviors that can apply to any component such as hiding, showing, enabling and disabling are provided via Component, and these can all be overridden or customized by any subclass as needed.

    大多数基本行为,比如:隐藏/显示,可用/不可用等都可以通过Component来应用于所有的组件上,同时这些行为都可以被子类所隐藏和定制。

    • Availability via ComponentMgr(ComponentMgr的功能)
      Every component in Ext gets registered with the ComponentMgr on creation, so you can retrieve any component at any time simply by calling Ext.getCmp('id').

    所有的组件在被创建的时候都会在ComponentMgr中注册,所以你可以通过Ext.getCmp('id')的方式来简单的取出任意的组件实例。

    • Plugin support(插件的支持)
      Any component can now be extended through the use of plugins. A plugin is any class with an init method that accepts a single parameter of type Ext.Component. Plugins can be added into any Component via the plugins config option. When a component is created, if any plugins are available, the component will call the init method on each plugin, passing a reference to itself. Each plugin can then call methods or respond to events on the Component as needed to provide its functionality.

    所有组件都可以通过使用插件来扩展。插件是一个带有一个Ext.Component 参数的名为init方法的任意类。插件可以通过组件的plugins可选配置来添加。当组件被创建时,如果有插件存在,组件会调用所有插件的init方法,传递他们自身的实例引用给插件。之后插件会调用自身的方法,或者给组件挂上一些事件代理来提供自身的功能。

    阿不 http://hjf1223.cnblogs.com
  • 相关阅读:
    Python3安装和虚拟环境配置
    CentOS中nginx安装部署
    CRM项目的整理---第一篇
    软件代码的发布
    ansible的roles使用
    ansible中的playbook脚本的介绍与使用
    ansible模块的介绍与使用
    Ansible的参数介绍
    ansible的介绍与安装
    linux网络配置,查看IP地址
  • 原文地址:https://www.cnblogs.com/hjf1223/p/964690.html
Copyright © 2011-2022 走看看