Академический Документы
Профессиональный Документы
Культура Документы
7b52540d9d8c4e00b9723151622bbb64
view on: demo kit nightly build | demo kit latest release
A property has a name and an associated data type. It has a well-defined default value
expressed as a literal of that data type. Properties are accessible to application code
via the element’s API as getters and setters, but are also used by a control’s renderer in
a read-only way. The following list gives an overview of the most important settings
for a property:
– type: Data type of the control property; OpenUI5 provides an automatic type
validation. Valid types are, for example, string (default) for a string property,
int or float for number properties, int[], etc. for arrays and
sap.ui.core.CSSSize for a custom-defined type.
– defaultValue: Default value that is set if the application does not set a value; if
no default value is defined, the property value is undefined.
These control-specific settings are only available when inheriting from a control or
one of the base classes sap.ui.core.Control, sap.ui.core.Element,
sap.ui.base.ManagedObject, see Object Metadata and Implementation. For a
complete list of the possible settings, see API Reference:
sap.ui.base.ManagedObject.extend.
• Events
An event has a name as well as any number of parameters. The element’s API offers
support to manage event subscriptions.
events: {
"logout": {}
}
For each event, methods for registering, de-registering and firing the event are
created. For the logout event, for example, the attachLogout, detachLogout,
fireLogout methods are created.
A control can enable events to be interrupted by the application. A tab control, for
example, can enable the application to cancel a close event by setting the
allowPreventDefault property of the event to true and checking the return value
after firing the event:
events: {
"close": {allowPreventDefault : true}
}
Aggregations and associations are defined by their name and a configuration object
with the following information:
– type: The type should be a subclass of the element or the control; the default is
sap.ui.core.control
If only the type needs to be set, you can just give it as a string instead of the
configuration object.
One example:
aggregations: {
"acceptButton" : "sap.m.Button", // if only type is given, no object
is required
"content" : {singularName: "content"}, // default type is
"sap.ui.core.Control",
// which is appropriate for
generic containers
"toolbarItems" : {type : "sap.m.Button", multiple : true, singularName
: "toolbarItem"}
// a fully specified
aggregation
}
If you want to mark one aggregation as default aggregation in order to be able to omit
the aggregation tag in XML views, you can do this by setting the defaultAggregation
property to the name of the aggregation as shown in the following code snippet:
aggregations: {
"content": {singularName: "content"} // default type is
"sap.ui.core.Control", multiple is "true"
},
defaultAggregation: "content"
For a brief explanation of the differences between an aggregation and an association, see
the Control Metadata section under Working with Controls. For a complete list of the
possible settings, see API Reference: sap.ui.base.ManagedObject.extend.