Chapter 1 PRADO programming now gives us a deeper understanding of the PRADO framework. In this chapter, we will first introduce some basic concepts of the framework and how to apply existing PRADO components to develop a PRADO application. 2.1 components according to ClemensSzyperski, 'Chapter 2 uses PRADO programming
Now let's take a deeper look at the PRADO framework. In this chapter, we will first introduce some basic concepts of the framework and how to apply existing PRADO components to develop a PRADO application.
2.1Components
According to Clemens Szyperski, the ''software component is a combination unit with a specific interface, which can exist independently and participate in other components. ''
In PRADO, the component isTComponentOr its subclass instance. The PRADO framework already containsTComponent
Class, which implements the attributes and event mechanisms of components.
- Attributes can be considered as common variables describing a feature of a component, such as background color and font size. Properties are of type, suchString,IntegerAnd so on. The attribute can be read-only or read/write.
- The event enables the proxy function to respond to certain movements in the component, such as mouse clicks and text changes.
A component will continue the attributes and methods of all its parent class components, because the component itself is actually a class.
A complete component class definition contains two files:
- A class file that defines the logic of the component class. This file is important to the PHP code. The file name must be the same as the class name, and. PhpAs the file suffix.
- A specification file that defines the attributes and methods of component classes. This file is in XML format. If this component class does not define new attributes and events outside the parent class, this file can be omitted. By default, this file is in the same directory as the class file of the component, and the name is the same. The only difference is that their file name suffix (the class file suffix is. PhpThe specification file is. Spec). It is worth noting that PRADO also promised you to use different file names to name the specification file and template file, but the class file name must still follow the same name as the class, and the suffix is. Php. At this time, you needSPECIFICATION_FILESpecifies the file name containing the path of the specification file. you can apply the correct or relative path (relative class file location ).
Note: PRADO is case sensitive, including component type, attribute name, event name, and file name.
2.1.1Widget
A control is a PRADO component that defines the user interface. Each control has a parent control and some child controls (note that the parent and child relations here are completely different from the parent class subclass concepts in object-oriented systems. A control is the parent control of another control. it only clarifies that the former has the latter. this ownership relationship can be understood as a directory containing a sub-directory; rather than the concept that the latter is a sub-class of the former, and the concept that the former continues ). The page is the highest level control, and it does not have a parent control (of course, you can also think that Application is its parent control ). The use of a PRADO is a collection of pages, each page represents a hierarchical tree structure of the control set, the relationship between the control and the control is linked together through the parent-child relationship.