本文整理汇总了Java中org.kuali.rice.krad.uif.control.UifKeyValuesFinder类的典型用法代码示例。如果您正苦于以下问题:Java UifKeyValuesFinder类的具体用法?Java UifKeyValuesFinder怎么用?Java UifKeyValuesFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UifKeyValuesFinder类属于org.kuali.rice.krad.uif.control包,在下文中一共展示了UifKeyValuesFinder类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performApplyModel
import org.kuali.rice.krad.uif.control.UifKeyValuesFinder; //导入依赖的package包/类
/**
* @see Component#performApplyModel(org.kuali.rice.krad.uif.view.View, Object, org.kuali.rice.krad.uif.component.Component)
*/
@Override
public void performApplyModel(View view, Object model, Component parent) {
super.performApplyModel(view, model, parent);
// Done in apply model so we have the message text for additional rich message processing in Message
// Sets message
if (StringUtils.isNotBlank(instructionalText) && StringUtils.isBlank(instructionalMessage.getMessageText())) {
instructionalMessage.setMessageText(instructionalText);
}
// Sets constraints
if (StringUtils.isNotBlank(constraintText) && StringUtils.isBlank(constraintMessage.getMessageText())) {
constraintMessage.setMessageText(constraintText);
}
// invoke options finder if options not configured on the control
List<KeyValue> fieldOptions = new ArrayList<KeyValue>();
// use options directly configured on the control first
if ((control != null) && control instanceof MultiValueControlBase) {
MultiValueControlBase multiValueControl = (MultiValueControlBase) control;
if ((multiValueControl.getOptions() != null) && !multiValueControl.getOptions().isEmpty()) {
fieldOptions = multiValueControl.getOptions();
}
}
// set multiLineReadOnlyDisplay to true to preserve text formatting
if (control instanceof TextAreaControl) {
setMultiLineReadOnlyDisplay(true);
}
// if options not configured on the control, invoke configured options finder
if (fieldOptions.isEmpty() && (optionsFinder != null)) {
if (optionsFinder instanceof UifKeyValuesFinder) {
fieldOptions = ((UifKeyValuesFinder) optionsFinder).getKeyValues((ViewModel) model);
// check if blank option should be added
if (((UifKeyValuesFinder) optionsFinder).isAddBlankOption()) {
fieldOptions.add(0, new ConcreteKeyValue("", ""));
}
} else {
fieldOptions = optionsFinder.getKeyValues();
}
if ((control != null) && control instanceof MultiValueControlBase) {
((MultiValueControlBase) control).setOptions(fieldOptions);
}
}
// if read only do key/value translation if necessary (if alternative and additional properties not set)
if (isReadOnly()
&& !fieldOptions.isEmpty()
&& StringUtils.isBlank(getReadOnlyDisplayReplacement())
&& StringUtils.isBlank(getReadOnlyDisplaySuffix())
&& StringUtils.isBlank(getReadOnlyDisplayReplacementPropertyName())
&& StringUtils.isBlank(getReadOnlyDisplaySuffixPropertyName())) {
Object fieldValue = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath());
// TODO: can we translate Collections? (possibly combining output with delimiter
if ((fieldValue != null) && (TypeUtils.isSimpleType(fieldValue.getClass()))) {
for (KeyValue keyValue : fieldOptions) {
if (StringUtils.equals(fieldValue.toString(), keyValue.getKey())) {
setReadOnlyDisplayReplacement(keyValue.getValue());
break;
}
}
}
}
}