當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。