When you define properties that a custom Java control will expose, you specify characteristics for those properties in an XML file. The particular elements and attributes you use are diagrammed in the following figure. You can click each box to see a topic about a particular element and its attributes.
For step-by-step instructions on creating an annotation XML file and connecting it to your control, see How Do I: Define Properties for a Java Control.
The following example defines a department-description property with two attributes, abbreviation and id. The abbreviation attribute takes a text value that can not be more than four characters long. The id attribute is an integer. Both attributes are defined as not "required," meaning that a developer need not explicitly set them before running an app that uses the control. As a result, default values are provided.
<control-tags> <control-tag name="department-description"> <description>Specifies information about the department.</description> <attribute name="abbreviation" required="false"> <description>Specifies the department's four-letter abbreviation.</description> <type> <text max-length="4"/> </type> <default-value>ACCT</default-value> </attribute> <attribute name="id" required="false"> <description>Specifies the department's ID number.</description> <type> <integer/> </type> <default-value>1036</default-value> </attribute> </control-tag> </control-tags>
A developer could add the control that exposes this property to a component in WebLogic Workshop such as a JWS file. Setting these attributes on its control in a JWS would add an annotation in the JWS source code, immediately preceding the control's variable declaration. If the developer changed the default attribute values to ENGN and 2345, that annotation would look something like this:
@jc:department-description abbreviation="ENGN" id="2345"