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


Java AttributeDefinition.getControlField方法代码示例

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


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

示例1: getValues

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
/**
 * Will first try to retrieve options configured on the control.  If that doesn't return any values then will
 * try to use the optionfinder on the AttributeDefinition.
 *
 * @param attr - AttributeDefinition
 * @return Map of key value pairs
 */
protected Map<String, String> getValues(AttributeDefinition attr) {
    Control control = attr.getControlField();

    if ((control instanceof MultiValueControl)
            && (((MultiValueControl) control).getOptions() != null)
            && !((MultiValueControl) control).getOptions().isEmpty()) {
        List<KeyValue> keyValues = ((MultiValueControl) control).getOptions();
                Map<String, String> options = new HashMap<String, String> ();
                for (KeyValue keyValue : keyValues) {
                    options.put(keyValue.getKey(), keyValue.getValue());
                }
                return options;
    } else if (attr.getOptionsFinder() != null) {
        return attr.getOptionsFinder().getKeyLabelMap();
    }

    return Collections.emptyMap();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:DataDictionaryRemoteFieldServiceImpl.java

示例2: addAttributeSectionsToInquiryView

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void addAttributeSectionsToInquiryView( InquiryView view, DataObjectEntry dataObjectEntry ) {
    // Set up data structures to manage the creation of sections
    Map<String,Group> inquirySectionsById = new HashMap<String,Group>();
    Group currentGroup = createInquirySection("default",dataObjectEntry.getObjectLabel());
    inquirySectionsById.put(currentGroup.getId(), currentGroup);
    ((List<Group>)view.getItems()).add(currentGroup);

    // Loop over the attributes on the data object, adding them into the inquiry
    // If we have an @Section notation, switch to the section, creating if the ID is unknown
    List<Component> items = (List<Component>) currentGroup.getItems(); // needed to deal with generics issue
    for ( AttributeDefinition attr : dataObjectEntry.getAttributes() ) {
        boolean dontDisplay = hasHintOfType(attr.getDataObjectAttribute(), UifDisplayHintType.NO_INQUIRY);
        dontDisplay |= (attr.getControlField() instanceof HiddenControl);
        // Check for a section hint
        // Create or retrieve existing section as determined by the ID on the annotation
        UifDisplayHint sectionHint = getHintOfType(attr.getDataObjectAttribute(), UifDisplayHintType.SECTION);
        if ( sectionHint != null ) {
            if ( StringUtils.isNotBlank( sectionHint.id() ) ) {
                currentGroup = inquirySectionsById.get( sectionHint.id() );
                if ( currentGroup == null ) {
                    String sectionLabel = sectionHint.label();
                    if ( StringUtils.isBlank(sectionLabel) ) {
                        sectionLabel = deriveHumanFriendlyNameFromPropertyName(sectionHint.id() );
                    }

                    currentGroup = createInquirySection(sectionHint.id(), sectionHint.label());
                    inquirySectionsById.put(currentGroup.getId(), currentGroup);
                    ((List<Group>)view.getItems()).add(currentGroup);
                }
            } else {
                LOG.warn( "SECTION UifDisplayHint given without an ID - assuming 'default'" );
                currentGroup = inquirySectionsById.get("default");
            }
            items = (List<Component>) currentGroup.getItems();
        }

        // This is checked after the section test, since the @Section annotation
        // would be on the FK field
        if ( dontDisplay ) {
            continue;
        }

        DataField dataField = ComponentFactory.getDataField();
        dataField.setPropertyName(attr.getName());
        dataField.setLabel(attr.getLabel());
        items.add(dataField);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:50,代码来源:UifDefaultingServiceImpl.java

示例3: addCollectionSectionsToInquiryView

import org.kuali.rice.krad.datadictionary.AttributeDefinition; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void addCollectionSectionsToInquiryView( InquiryView view, DataObjectEntry dataObjectEntry ) {
    for ( CollectionDefinition coll : dataObjectEntry.getCollections() ) {
        // Create a new section
        DataObjectEntry collectionEntry = dataDictionaryService.getDataDictionary().getDataObjectEntry(coll.getDataObjectClass());
        // Extract the key fields on the collection which are linked to the parent.
        // When auto-generating the Inquiry Collection table, we want to exclude those.
        Collection<String> collectionFieldsLinkedToParent = new HashSet<String>();

        if ( coll.getDataObjectCollection() != null ) {
            for ( DataObjectAttributeRelationship rel : coll.getDataObjectCollection().getAttributeRelationships() ) {
                collectionFieldsLinkedToParent.add(rel.getChildAttributeName());
            }
        }

        if ( collectionEntry == null ) {
            LOG.warn( "Unable to find DataObjectEntry for collection class: " + coll.getDataObjectClass());
            continue;
        }

        CollectionGroup section = createCollectionInquirySection(coll.getName(), coll.getLabel());
        try {
            section.setCollectionObjectClass(Class.forName(coll.getDataObjectClass()));
        } catch (ClassNotFoundException e) {
            LOG.warn( "Unable to set class on collection section - class not found: " + coll.getDataObjectClass());
        }

        section.setPropertyName(coll.getName());
        // summary title : collection object label
        // Summary fields : PK fields?
        // add the attributes to the section
        for ( AttributeDefinition attr : collectionEntry.getAttributes() ) {
            boolean dontDisplay = hasHintOfType(attr.getDataObjectAttribute(), UifDisplayHintType.NO_INQUIRY);
            dontDisplay |= (attr.getControlField() instanceof HiddenControl);
            // Auto-exclude fields linked to the parent object
            dontDisplay |= collectionFieldsLinkedToParent.contains( attr.getName() );

            if ( dontDisplay ) {
                continue;
            }

            DataField dataField = ComponentFactory.getDataField();
            dataField.setPropertyName(attr.getName());
            ((List<Component>)section.getItems()).add(dataField);
        }
        ((List<Group>)view.getItems()).add(section);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:49,代码来源:UifDefaultingServiceImpl.java


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