Use the @MVCView property if you want to use the
widget as a controller view. For background information on controllers
and controller views, see “Rich UI validating and formatting.”
The
@MVCView property has the following fields:
- retrieveViewHelper
- Specifies a custom function that retrieves data directly from
the widget and converts that data into a string. The function you
specify for retrieveViewHelper is the default
value for the retrieveViewHelper property
of the controller.
The function has no parameters and returns a
string.
- retrieveValidStateHelper
- Specifies a custom validation function that is invoked by the isValid function
of the controller.
The function referenced by retrieveValidStateHelper has
no parameters and returns a string or null (STRING?). Ensure that
a valid outcome returns null or an empty string.
- publishHelper
- Specifies a function that transfers data to the widget from the
model, after other controller-specific publishing functions (if any)
format the data. Your specification is the default value for the publishHelper property
of the controller.
The function has a string parameter (STRING in)
and no return value.
- publishMessageHelper
- Specifies a function that runs when the widget gains focus. Your
specification is the default value for the publishMessageHelper property
of the controller.
The function has a string parameter (STRING
in) and no return value.
For example, here is the
@MVCView property in the definition
of DojoCheckBox:
@MVCView{
retrieveViewHelper = getValueAsText,
publishHelper = setValueAsText
}
Here are the two functions referenced by the property:
private function setValueAsText(value String in)
if("TRUE" == strlib.upperCase(value))
setSelected (true);
else
setSelected(false);
end
end
private function getValueAsText() returns(String)
if(getSelected())
return("TRUE");
else
return("FALSE");
end
end