use of org.broadleafcommerce.openadmin.dto.GroupMetadata in project BroadleafCommerce by BroadleafCommerce.
the class BasicEntityMetadataProvider method buildGroupFromMetadataOverride.
private void buildGroupFromMetadataOverride(String groupName, String tabName, GroupMetadataOverride override, Map<String, TabMetadata> metadata) {
TabMetadata constructedTab = getTabFromMetadata(tabName, metadata);
groupName = override.getName() == null || override.getName().isEmpty() ? groupName : override.getName();
GroupMetadata group = new GroupMetadata();
group.setGroupName(groupName);
group.setGroupOrder(override.getOrder());
group.setColumn(override.getColumn());
group.setUntitled(override.getUntitled());
group.setTooltip(override.getTooltip());
group.setCollapsed(override.getCollapsed());
constructedTab.getGroupMetadata().put(groupName, group);
}
use of org.broadleafcommerce.openadmin.dto.GroupMetadata in project BroadleafCommerce by BroadleafCommerce.
the class BasicEntityMetadataProvider method buildTabFromMetadataOverride.
private void buildTabFromMetadataOverride(String tabName, MetadataOverride override, Map<String, TabMetadata> metadata) {
tabName = override.getName() == null || override.getName().isEmpty() ? tabName : override.getName();
TabMetadata tab = new TabMetadata();
tab.setTabName(tabName);
tab.setTabOrder(override.getOrder());
tab.setGroupMetadata(new HashMap<String, GroupMetadata>());
metadata.put(tabName, tab);
}
use of org.broadleafcommerce.openadmin.dto.GroupMetadata in project BroadleafCommerce by BroadleafCommerce.
the class BasicEntityMetadataProvider method buildGroupMetadata.
protected GroupMetadata buildGroupMetadata(AdminGroupPresentation groupPresentation, Class<?> owningClass, Map<String, TabMetadata> metadata) {
GroupMetadata group = new GroupMetadata();
group.setOwningClass(owningClass.getCanonicalName());
group.setGroupName(groupPresentation.name());
group.setGroupOrder(groupPresentation.order());
group.setColumn(groupPresentation.column());
group.setUntitled(groupPresentation.untitled());
group.setTooltip(groupPresentation.tooltip());
group.setCollapsed(groupPresentation.collapsed());
return group;
}
use of org.broadleafcommerce.openadmin.dto.GroupMetadata in project BroadleafCommerce by BroadleafCommerce.
the class BasicEntityMetadataProvider method addTabAndGroupMetadataFromCmdProperties.
@Override
public MetadataProviderResponse addTabAndGroupMetadataFromCmdProperties(ClassMetadata cmd, Map<String, TabMetadata> metadata) {
for (Property p : cmd.getProperties()) {
FieldMetadata fmd = p.getMetadata();
boolean isExcluded = fmd.getExcluded() != null && fmd.getExcluded() == true;
boolean isHidden = fmd instanceof BasicFieldMetadata && ((BasicFieldMetadata) fmd).getVisibility() != null && (((BasicFieldMetadata) fmd).getVisibility().equals(VisibilityEnum.HIDDEN_ALL) || ((BasicFieldMetadata) fmd).getVisibility().equals(VisibilityEnum.FORM_HIDDEN));
if (!(isExcluded || isHidden)) {
GroupMetadata groupMetadata = getGroupFromMetadata(fmd.getGroup(), metadata);
if (groupMetadata == null) {
TabMetadata tabMetadata = getTabFromMetadata(fmd.getTab(), metadata);
Map<String, GroupMetadata> groupMetadataMap = tabMetadata == null || tabMetadata.getGroupMetadata() == null ? new HashMap<String, GroupMetadata>() : tabMetadata.getGroupMetadata();
if (tabMetadata == null && !(fmd.getTab() == null || fmd.getTab().isEmpty())) {
tabMetadata = new TabMetadata();
tabMetadata.setTabName(fmd.getTab());
tabMetadata.setTabOrder(fmd.getTabOrder());
tabMetadata.setOwningClass(cmd.getPolymorphicEntities().getFullyQualifiedClassname());
tabMetadata.setGroupMetadata(groupMetadataMap);
metadata.put(fmd.getTab(), tabMetadata);
}
// is a collection being added to only the specified tab, not a group as well.
if (!(fmd.getGroup() == null || fmd.getGroup().isEmpty())) {
groupMetadata = new GroupMetadata();
groupMetadata.setOwningClass(cmd.getPolymorphicEntities().getFullyQualifiedClassname());
groupMetadata.setGroupName(fmd.getGroup());
groupMetadata.setGroupOrder(fmd.getGroupOrder());
groupMetadata.setColumn(0);
groupMetadata.setUntitled(false);
groupMetadata.setCollapsed(false);
groupMetadataMap.put(fmd.getGroup(), groupMetadata);
}
}
}
}
return MetadataProviderResponse.HANDLED;
}
use of org.broadleafcommerce.openadmin.dto.GroupMetadata 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;
}
Aggregations