Search in sources :

Example 6 with TabMetadata

use of org.broadleafcommerce.openadmin.dto.TabMetadata in project BroadleafCommerce by BroadleafCommerce.

the class BasicEntityMetadataProvider method buildTabMetadata.

protected TabMetadata buildTabMetadata(AdminTabPresentation tabPresentation, Class<?> owningClass, Map<String, TabMetadata> metadata) {
    TabMetadata constructedTab = getTabFromMetadata(tabPresentation.name(), metadata);
    TabMetadata tab;
    Map<String, GroupMetadata> groupMetadataMap;
    if (constructedTab != null) {
        tab = constructedTab;
        groupMetadataMap = tab.getGroupMetadata();
    } else {
        tab = new TabMetadata();
        groupMetadataMap = new HashMap<>();
        tab.setTabName(tabPresentation.name());
        tab.setTabOrder(tabPresentation.order());
        tab.setOwningClass(owningClass.getCanonicalName());
    }
    for (AdminGroupPresentation groupPresentation : tabPresentation.groups()) {
        if (getGroupFromMetadata(groupPresentation.name(), metadata) == null) {
            groupMetadataMap.put(groupPresentation.name(), buildGroupMetadata(groupPresentation, owningClass, metadata));
        }
    }
    tab.setGroupMetadata(groupMetadataMap);
    return tab;
}
Also used : AdminGroupPresentation(org.broadleafcommerce.common.presentation.AdminGroupPresentation) GroupMetadata(org.broadleafcommerce.openadmin.dto.GroupMetadata) TabMetadata(org.broadleafcommerce.openadmin.dto.TabMetadata)

Aggregations

TabMetadata (org.broadleafcommerce.openadmin.dto.TabMetadata)6 GroupMetadata (org.broadleafcommerce.openadmin.dto.GroupMetadata)4 Property (org.broadleafcommerce.openadmin.dto.Property)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AdminMainEntity (org.broadleafcommerce.common.admin.domain.AdminMainEntity)1 AdminGroupPresentation (org.broadleafcommerce.common.presentation.AdminGroupPresentation)1 AdminGroupPresentationOverride (org.broadleafcommerce.common.presentation.override.AdminGroupPresentationOverride)1 AdminTabPresentationOverride (org.broadleafcommerce.common.presentation.override.AdminTabPresentationOverride)1 BLCSystemProperty (org.broadleafcommerce.common.util.BLCSystemProperty)1 AdornedTargetCollectionMetadata (org.broadleafcommerce.openadmin.dto.AdornedTargetCollectionMetadata)1 BasicCollectionMetadata (org.broadleafcommerce.openadmin.dto.BasicCollectionMetadata)1 BasicFieldMetadata (org.broadleafcommerce.openadmin.dto.BasicFieldMetadata)1 CollectionMetadata (org.broadleafcommerce.openadmin.dto.CollectionMetadata)1 DynamicResultSet (org.broadleafcommerce.openadmin.dto.DynamicResultSet)1 Entity (org.broadleafcommerce.openadmin.dto.Entity)1 FieldMetadata (org.broadleafcommerce.openadmin.dto.FieldMetadata)1 FieldMetadataOverride (org.broadleafcommerce.openadmin.dto.override.FieldMetadataOverride)1 GroupMetadataOverride (org.broadleafcommerce.openadmin.dto.override.GroupMetadataOverride)1 MetadataOverride (org.broadleafcommerce.openadmin.dto.override.MetadataOverride)1