Creating a Template for a Custom Object
Create a template if you want to customize a user interface object for your mobile project.
To create a template
2. In the Model section of the Outline Editor, expand the outline so that you view the UserInterface > Templates node.
3. Right-click the Templates node and select New Child > Template.
Mobile Development adds a Template child node.
4. Select the new Template node.
5. In the Properties section of the Outline Editor, specify a Java class name in the Class Name property.
For example, if you want to customize the Button user interface object, you might specify MyButtonTemplate.
Mobile Development renames the Template node to the name you specified in the Class Name property.
6. Right-click the template node you just added and select New Child > object, where object is the type of object you want to customize.
For example, if you want to customize the Button object, select New Child > Button.
7. Select the new node you added and in the Properties section of the Outline Editor, fill in the properties. For more information about properties, see
Template Properties. Mobile Development generates the following Java classes for the template:
Abstracttemplate_name.java in the gen/src folder in the
package_name.ui.templates package
This class contains the standard logic to handle the user interface object you are customizing with the template.
Important:
Do not update this Java class. Mobile Development regenerates it each time you generate sources and any changes you make will be overwritten.
template_name.java in the src folder in the
package_name.ui.templates package
You update the templat_name.java class to customize the user interface object.
For the generated Java classes:
template_name is the Java class name you specified for the
Class Name property of the template node.
package_name is the package name you specified for your mobile project.
9. Add the logic to customize the user interface object to thetemplate_name.java class.
Related Topics