Implementing Parameter Mapping
Use
You can implement parameter mapping dynamically.
Procedure
Set Constant Values to Action Parameters
-
Insert the following code into the wdDoModifyView method:
if(firstTime){
IWDCheckBox theCheckBox =(IWDCheckbox)view.getElement("<UI element Id>");
theCheckBox.mappingOfOnToggle().setBoolean("<action parameter name>", true);
}
The methods addParameter of IWDParameterMapping are deprecated, use the following methods instead, depending on the parameter type:
-
setBoolean(String name, boolean value)
-
setByte(String name, byte value)
-
setChar(String name, char value)
-
setDouble(String name, double value)
-
setFloat(String name, float value)
-
setInt(String name, int value)
-
setLong(String name, long value)
-
setShort(String name, short value)
-
setString(String name, String value)
The parameter name refers to the action parameter name.
-
Map Existing Event Parameters to Existing Action Parameters
-
Insert the following code into the wdDoModifyView method:
if(firstTime){
IWDCheckBox theCheckBox =(IWDCheckBox)view.getElement("<UI element Id>");
theCheckBox.mappingOfOnToggle().addSourceMapping(IWDCheckBox.IWDOnToggle.CHECKED,
"<action parameter name>");
}
Example
Suppose you have a Button with ID GenderSelector and an action with parameter female of type boolean , the code will look like this:
|
if (firstTime) { IWDButton genderSelector = (IWD Button ) view.getElement("GenderSelector"); genderSelector.mappingOfOnAction ().setBoolean("female", true); } |