Update to set QFieldSection label from name; try to avoid backend-module-not-defined errors

This commit is contained in:
2022-09-09 15:13:28 -05:00
parent a1f5e90106
commit 2f787036d0
3 changed files with 34 additions and 2 deletions

View File

@ -130,6 +130,10 @@ public class QInstanceEnricher
{ {
generateTableFieldSections(table); generateTableFieldSections(table);
} }
else
{
table.getSections().forEach(this::enrich);
}
if(CollectionUtils.nullSafeHasContents(table.getRecordLabelFields()) && !StringUtils.hasContent(table.getRecordLabelFormat())) if(CollectionUtils.nullSafeHasContents(table.getRecordLabelFields()) && !StringUtils.hasContent(table.getRecordLabelFormat()))
{ {
@ -215,6 +219,19 @@ public class QInstanceEnricher
/*******************************************************************************
**
*******************************************************************************/
private void enrich(QFieldSection section)
{
if(!StringUtils.hasContent(section.getLabel()))
{
section.setLabel(nameToLabel(section.getName()));
}
}
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/

View File

@ -63,6 +63,19 @@ public class QFieldSection
/*******************************************************************************
**
*******************************************************************************/
public QFieldSection(String name, QIcon icon, Tier tier, List<String> fieldNames)
{
this.name = name;
this.icon = icon;
this.tier = tier;
this.fieldNames = fieldNames;
}
/******************************************************************************* /*******************************************************************************
** Getter for name ** Getter for name
** **

View File

@ -65,7 +65,7 @@ public class QBackendModuleDispatcher
return; return;
} }
backendTypeToModuleClassNameMap = new HashMap<>(); Map<String, String> newMap = new HashMap<>();
String[] moduleClassNames = new String[] String[] moduleClassNames = new String[]
{ {
@ -84,13 +84,15 @@ public class QBackendModuleDispatcher
{ {
Class<?> moduleClass = Class.forName(moduleClassName); Class<?> moduleClass = Class.forName(moduleClassName);
QBackendModuleInterface module = (QBackendModuleInterface) moduleClass.getConstructor().newInstance(); QBackendModuleInterface module = (QBackendModuleInterface) moduleClass.getConstructor().newInstance();
backendTypeToModuleClassNameMap.put(module.getBackendType(), moduleClassName); newMap.put(module.getBackendType(), moduleClassName);
} }
catch(Exception e) catch(Exception e)
{ {
LOG.debug("Backend module [{}] could not be loaded: {}", moduleClassName, e.getMessage()); LOG.debug("Backend module [{}] could not be loaded: {}", moduleClassName, e.getMessage());
} }
} }
backendTypeToModuleClassNameMap = newMap;
} }