XAF Application Development tutorial (4) application model and xaf Application Development

Source: Internet
Author: User

XAF Application Development tutorial (4) application model and xaf Application Development

XAF is a heavy-weight frame, which is indeed heavy enough and is well-behaved in all aspects.

If I read the first three sections, I may think where all N attributes come from? How many such attributes are there? What if it is not enough? Are you waiting for official development?

Well, I am not trying to solve these problems. Let's look at our application from another perspective!

Let's look back at the purpose of the project in the solution:


In the default project structure of XAF, XCRMDemo. Module writes code to generate both web and win projects.

That is to say, the module in is the inheritance relationship from top to bottom.

But actually, all the developers know that textbox displayed on the web and textbox displayed in win are completely different controls. One is supported by html and the other is the control in winform.

XAF only makes them a control with the same name, so that the type has a corresponding relationship with the control. However, in some cases, there may not be a control with the same function under the Web and Win, for example, I used a third-party control Excel editing control, but I only found the Win version, no Web version, then we can only write the control extension to XCRMDemo. win. module.

Let's take a look at the application Model, expand the XCRMDemo. Module Project, and double-click the Model. DesignedDiffs. xafml file. You can see:

If you download the source code from the previous chapter, compile ctrl + shift + B


As you can see, all the functions in the application can be controlled here.

Among them, ActionDesign, Is to set the button, such as the New button, Save, SaveAndClose used in the previous development, and so on.

If the system we want to develop only has Chinese characters, you can modify it here for Chinese.

To demonstrate the effect, I made a simple modification setting:


As shown in, I changed the title of Cancel, that is, the text displayed on the interface to "canceled"

Modify the buttons such as Delete, New, and Save in the same way.


We can see that there has been a change.

 

Views: This is a frequently used node. You can set most information about the view, layout, control availability, button hiding, and so on.

In XAF, there are four view types:

List View

Detailed View

Search View

DashboardView

In fact, we have all seen DashboardView in the past chapter. For example, the view is the list view. Click the new button to display the Details View.

In the customer class, click the select customer category pop-up window, which is the search view.

The view is derived from the business model. That is to say, the settings made in the BOModel will take effect in the BOModel view. For example:

We have already written the customer class, and the word "customer" is displayed anywhere on the interface. Next we will change the text to the customer information.


View the effect of the List View:


View the Details View:


It can be seen that the list and detailed view have been changed once. Here we only show the title, which looks very simple, but if you want to modify other information, this process is actually very useful. It does not need to be modified multiple times as frequently as in normal development.

Let's take a look at the modification of the View:


Open detailed view settings by path on the graph. You can see the attribute settings window on the right, which contains many settings, AllowDelete \ AllowEdit \ AllowNew, which can directly control the display of buttons on The View.

Modify the Caption to only affect the detailed view.

 

BOModel is used to set models. It refers to the classes, customers, business objects, and domainobjects that we create correspond to models, but they are called differently.

CreatableItems: a drop-down box is displayed on the model page. After you click it, the new feature is called directly to display the detailed view.

ImageSources: icon information is used in the navigation menu and various views. Related Information is listed here.

Localization: A part of the content to be localized is listed here.

NavigationItems: an Attribute like [NavigationItem ("basic information")] has been used in the Code. In fact, it indicates the creation of NavigationItems, which is a tree structure, you can operate and modify the desired structure more intuitively.

Validation: we can see all the verification rules used in the system. We haven't demonstrated them yet. We will give an example in the code later.

ViewItems: the correspondence between the existing editor and the type in the system. It is generally not modified here

QQ: 4603528 QQ group: 50185791



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.