Application of Flex framework Riawave and thinking of Ajax development framework

Source: Internet
Author: User
Tags event listener

Jbpmside to use Flex development process designer and manager, just one of the company's internal projects also applied to flex, probably spent a week to familiarize and understand flex. It found that flex development and Ajax development of many similarities, here to flex some of their learning experience summed up. It is divided into three parts, the introduction to the Riawave framework, the reference to Riawave, the introduction of the AJAX development framework that you used earlier, and some of your own views on the Ajax future.

The custom application of Flex framework Riawave

Flex has many development frameworks, the most famous of which is Cairngorm. But Cairngorm is too complicated, and the fine-grained separation of responsibilities leads to too much class and code, which is less suitable for small and medium projects. Here we use the Riawave, which is precisely riawave is not a framework, it is just a simple code example of Address Book management, it contains a lot of best practices. The point here is that most of the time it takes a technology to decide whether the technology itself is advanced, but whether the technology is a lot of users.

Riawave split the application into three parts, views, Modellocator, and DAO.

Views refer to the page components in the application, such as tables, forms, menus, and so on. Its responsibilities: 1, the composition of the entire application of the interface; 2. Handling native events within the component, such as mouse events and keyboard events that occur in the component, 3, publishing custom events when other components are required to collaborate, 4, and manipulating the data associated with them; 5, Monitor the customization events issued by other components and make a formal change.

Modellocator is the core of the whole application.

It's responsibilities:

1, centralized storage application of all data;

2, to the page components to provide a unified custom event listener interface, that all the page components to other components of the custom event monitoring must be through the modellocator to subscribe;

3, the only custom event publishing interface, that is, any page components to publish their own custom events must be published through the Modellocator;

4, centralized maintenance of all types of custom events. Modellocator is a single state, and through Modellocator, all custom events for the application are managed uniformly.

DAO is responsible for manipulating the applied data.

It's responsibilities:

1, change the application of data, provide the application of data modification of the unified interface, that is, User Action page components change data, in fact, from the page component to DAO processing;

2, remote Access Service side, Flex is usually as the front-end application of the display, and Ajax, the operation of the data and server-side interaction;

3, the server side returns the correct operation result, changes the data in the Modellocator, publishes the custom event, triggers the corresponding page component change.

As you can see, the entire flex application is driven entirely by events.

Other parts to understand:

1, Flex Data binding mechanism, this mechanism is also implemented by the event publishing/subscription mechanism, it can save itself to write a duplicate custom event publishing/subscription code, to achieve component display data and modellocator data synchronization;

2, VO, local data modeling, use: When a custom event is released, carry component data through Vo, Vo is included in the event, and the data is passed to the DAO.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.