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


Java ComponentFactory.getCheckboxControl方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.uif.util.ComponentFactory.getCheckboxControl方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentFactory.getCheckboxControl方法的具体用法?Java ComponentFactory.getCheckboxControl怎么用?Java ComponentFactory.getCheckboxControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.uif.util.ComponentFactory的用法示例。


在下文中一共展示了ComponentFactory.getCheckboxControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getControlInstance

import org.kuali.rice.krad.uif.util.ComponentFactory; //导入方法依赖的package包/类
protected Control getControlInstance( AttributeDefinition attrDef, DataObjectAttribute dataObjectAttribute ) {
    Control c = null;
    // Check for the hidden hint - if present - then use that control type
    if ( dataObjectAttribute != null && hasHintOfType(dataObjectAttribute, UifDisplayHintType.HIDDEN) ) {
        c = ComponentFactory.getHiddenControl();
    } else if ( attrDef.getOptionsFinder() != null ) {
        // if a values finder has been established, use a radio button group or drop-down list
        if ( dataObjectAttribute != null && hasHintOfType(dataObjectAttribute, UifDisplayHintType.RADIO) ) {
            c = ComponentFactory.getRadioGroupControl();
        } else {
            c = ComponentFactory.getSelectControl();
        }
    } else if ( attrDef.getName().endsWith( ".principalName" ) && dataObjectAttribute != null ) {
        // FIXME: JHK: Yes, I know this is a *HORRIBLE* hack - but the alternative
        // would look even more "hacky" and error-prone
        c = ComponentFactory.getUserControl();
        // Need to find the relationship information
        // get the relationship ID by removing .principalName from the attribute name
        String relationshipName = StringUtils.removeEnd(attrDef.getName(), ".principalName");
        DataObjectMetadata metadata = dataObjectService.getMetadataRepository().getMetadata(
                dataObjectAttribute.getOwningType());
        if ( metadata != null ) {
            DataObjectRelationship relationship = metadata.getRelationship(relationshipName);
            if ( relationship != null && CollectionUtils.isNotEmpty(relationship.getAttributeRelationships())) {
                ((UserControl)c).setPrincipalIdPropertyName(relationship.getAttributeRelationships().get(0).getParentAttributeName());
                ((UserControl)c).setPersonNamePropertyName(relationshipName + "." + KimConstants.AttributeConstants.NAME);
                ((UserControl)c).setPersonObjectPropertyName(relationshipName);
            }
        } else {
            LOG.warn( "Attempt to pull relationship name: " + relationshipName + " resulted in missing metadata when looking for: " + dataObjectAttribute.getOwningType() );
        }
    } else {
        switch ( attrDef.getDataType() ) {
            case STRING :
                // TODO: Determine better way to store the "200" metric below
                if ( attrDef.getMaxLength() != null && attrDef.getMaxLength().intValue() > 200 ) {
                    c = ComponentFactory.getTextAreaControl();
                } else {
                    c = ComponentFactory.getTextControl();
                }
                break;
            case BOOLEAN:
                c = ComponentFactory.getCheckboxControl();
                break;
            case DATE:
            case DATETIME:
            case TRUNCATED_DATE:
                c = ComponentFactory.getDateControl();
                break;
            case CURRENCY:
            case DOUBLE:
            case FLOAT:
            case INTEGER:
            case LARGE_INTEGER:
            case LONG:
            case PRECISE_DECIMAL:
                c = ComponentFactory.getTextControl();
                break;
            case MARKUP:
                c = ComponentFactory.getTextAreaControl();
                break;
            default:
                c = ComponentFactory.getTextControl();
                break;
        }
    }
    return c;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:69,代码来源:UifDefaultingServiceImpl.java


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