本文整理汇总了Java中org.kuali.rice.krad.uif.util.ComponentFactory.getDataField方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentFactory.getDataField方法的具体用法?Java ComponentFactory.getDataField怎么用?Java ComponentFactory.getDataField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.uif.util.ComponentFactory
的用法示例。
在下文中一共展示了ComponentFactory.getDataField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performCustomInitialization
import org.kuali.rice.krad.uif.util.ComponentFactory; //导入方法依赖的package包/类
@Override
public void performCustomInitialization(LifecycleElement component) {
super.performCustomInitialization(component);
if (component instanceof InquiryView) {
InquiryView inquiryView = (InquiryView) component;
PageGroup pageGroup = inquiryView.getCurrentPage();
Group oldSection = (Group) pageGroup.getItems().get(0);
oldSection.setHeaderText(oldSection.getHeaderText() + " - Customized");
Group newSection = ComponentFactory.getGroupWithDisclosureGridLayout();
newSection.setHeaderText("Dynamically Added Section");
DataField newDataField = ComponentFactory.getDataField("newDataField", "Dynamically Added Field");
newDataField.setForcedValue("This is a dynamically set value.");
List<Component> fields = new ArrayList<Component>();
fields.add(newDataField);
newSection.setItems(fields);
List<Component> sections = new ArrayList<Component>();
sections.addAll(pageGroup.getItems());
sections.add(newSection);
pageGroup.setItems(sections);
}
}
示例2: addAttributeSectionsToInquiryView
import org.kuali.rice.krad.uif.util.ComponentFactory; //导入方法依赖的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);
}
}
示例3: addCollectionSectionsToInquiryView
import org.kuali.rice.krad.uif.util.ComponentFactory; //导入方法依赖的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);
}
}