The CLOSED_LIST PARAMETER is used to present a hardcoded list of values to the user when configuring a component for Talend Open Studio. This is specified in the FIELD=CLOSED_LIST attribute of the PARAMETER element in the component's XML descriptor
XML Descriptor
For example, the following XML descriptor presents a drop down list of values to the user: None, Required, Max Length, Date.
XML Descriptor with a CLOSED_LIST PARAMETER |
Component View
This descriptor will produce the following CLOSED_LIST.
CLOSED_LIST Diplayed in Component View |
Properties
The XML descriptor is supported by the following message.properties entries. The NAME attribute of the ITEM maps to a property. These properties format the item names using a mixed-case
LIST_OF_RULE_TYPES.NAME=Rule Types
LIST_OF_RULE_TYPES.ITEM.NONE_NM=None
LIST_OF_RULE_TYPES.ITEM.REQUIRED_NM=Required
LIST_OF_RULE_TYPES.ITEM.MAXLEN_NM=Max Length
LIST_OF_RULE_TYPES.ITEM.DATE_NM=Date Format
Code
The VALUE set by the user is available using the ElementParameterParser.getValue() call.
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String ruleType = ElementParameterParser.getValue(node, "__LIST_OF_RULE_TYPES__");
%>
System.out.println("selected ruleType=<%= ruleType %>");
A CLOSED_LIST is used to prompt the user to select from a list of values. The list is formed within a PARAMETER using list of ITEMS. A default is specified by including an ITEM NAME in the ITEMS definition.
Thank you for the good blog post Bekwam!
ReplyDeleteTalend Community Manager.