!--a11y-->
Creating Dynamic User Interface
Elements
To demonstrate the creation of arbitrary user interface elements, the SomeBackEnd.java class is provided with the project template. There are two inner classes contained in this: FieldDescriptor and OperationDescriptor.

With the help of the FieldDescriptor class, the corresponding metadata – such as labels and context properties – is defined for the required form fields.
· uiType: Type of the form input field
· name: Name of the corresponding context attribute
· type: Type of the context attribute that is mapped to the input field (uiType)
· label: Text of label belonging to the input field
· tooltip: Quick info of the input field
· init: Value that is to be displayed first in the form field
In the SomeBackEnd.java class, there are already predefined form fields that are created dynamically during the tutorial.
private Object[] fields = { new FieldDescriptor("InputField","firstName", "com.sap.dictionary.string", "First Name", "Enter first name here",""),
new FieldDescriptor("InputField","lastName", "com.sap.dictionary.string","Last Name", "Enter last name here",""),
new FieldDescriptor("InputField","birthday", "com.sap.dictionary.date","Date of Birth", "Enter date here", null),
new FieldDescriptor("DropDownByKey","country","com.sap.workshop .dynamicprogramming.simpletypes.Country", "Country","Choose your country here",""),
new FieldDescriptor("RadioButtonGroupByKey","sex","com.sap. workshop.dynamicprogramming.simpletypes .Sex","Sex","Choose your sex here",""),
new FieldDescriptor("CheckBox","isManager", "com.sap.dictionary.boolean", "Is a Manager", "Checked if person is a manager", new Boolean(false)) }; |

In the fields array, there are certain FieldDescriptors that specify a Simple type as the type for the context attribute. These simple types are already contained in the Web Dynpro project – see also: TutWD_Dynamic_Init à Dictionaries à Local Dictionary à Data Types à Simple Types.
Using the OperationDescriptor class, the information required for actions and pushbuttons is provided.
· name: ID of the pushbutton
· displayText: Label for pushbutton (mapped to an action)
· tooltip: Quick info of the pushbutton
In the SomeBackEnd.java class, there are already predefined pushbuttons that are created dynamically during the tutorial.
private Object[] operations = { new OperationDescriptor ("delete","Delete", "Delete your input."),
new OperationDescriptor ("save", "Save", "Save current record."), }; |
Next step:
Dynamically Building the Appropriate Context
