当前位置: 首页>>代码示例>>Java>>正文


Java UifKeyValuesFinder类代码示例

本文整理汇总了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;
                }
            }
        }
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:73,代码来源:InputField.java


注:本文中的org.kuali.rice.krad.uif.control.UifKeyValuesFinder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。