Add defaultValuesForNewChildRecordsFromParentFields to ChildRecordListData

This commit is contained in:
2025-02-03 08:53:30 -06:00
parent 1cec2505c9
commit 036b02bb6c
2 changed files with 41 additions and 1 deletions

View File

@ -165,6 +165,7 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
*******************************************************************************/ *******************************************************************************/
public Builder withManageAssociationName(String manageAssociationName) public Builder withManageAssociationName(String manageAssociationName)
{ {
// todo - validate association name exists (on the table?)
widgetMetaData.withDefaultValue("manageAssociationName", manageAssociationName); widgetMetaData.withDefaultValue("manageAssociationName", manageAssociationName);
return (this); return (this);
} }
@ -194,7 +195,7 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
} }
else if(input.getWidgetMetaData().getDefaultValues().containsKey("maxRows")) else if(input.getWidgetMetaData().getDefaultValues().containsKey("maxRows"))
{ {
maxRows = ValueUtils.getValueAsInteger(input.getWidgetMetaData().getDefaultValues().containsKey("maxRows")); maxRows = ValueUtils.getValueAsInteger(input.getWidgetMetaData().getDefaultValues().get("maxRows"));
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -299,6 +300,13 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
} }
} }
} }
if(widgetValues.containsKey("defaultValuesForNewChildRecordsFromParentFields"))
{
@SuppressWarnings("unchecked")
Map<String, String> defaultValuesForNewChildRecordsFromParentFields = (Map<String, String>) widgetValues.get("defaultValuesForNewChildRecordsFromParentFields");
widgetData.setDefaultValuesForNewChildRecordsFromParentFields(defaultValuesForNewChildRecordsFromParentFields);
}
} }
widgetData.setAllowRecordEdit(BooleanUtils.isTrue(ValueUtils.getValueAsBoolean(input.getQueryParams().get("allowRecordEdit")))); widgetData.setAllowRecordEdit(BooleanUtils.isTrue(ValueUtils.getValueAsBoolean(input.getQueryParams().get("allowRecordEdit"))));

View File

@ -51,6 +51,7 @@ public class ChildRecordListData extends QWidgetData
private boolean canAddChildRecord = false; private boolean canAddChildRecord = false;
private Map<String, Serializable> defaultValuesForNewChildRecords; private Map<String, Serializable> defaultValuesForNewChildRecords;
private Set<String> disabledFieldsForNewChildRecords; private Set<String> disabledFieldsForNewChildRecords;
private Map<String, String> defaultValuesForNewChildRecordsFromParentFields;
@ -523,6 +524,37 @@ public class ChildRecordListData extends QWidgetData
return (this); return (this);
} }
/*******************************************************************************
** Getter for defaultValuesForNewChildRecordsFromParentFields
*******************************************************************************/
public Map<String, String> getDefaultValuesForNewChildRecordsFromParentFields()
{
return (this.defaultValuesForNewChildRecordsFromParentFields);
}
/*******************************************************************************
** Setter for defaultValuesForNewChildRecordsFromParentFields
*******************************************************************************/
public void setDefaultValuesForNewChildRecordsFromParentFields(Map<String, String> defaultValuesForNewChildRecordsFromParentFields)
{
this.defaultValuesForNewChildRecordsFromParentFields = defaultValuesForNewChildRecordsFromParentFields;
}
/*******************************************************************************
** Fluent setter for defaultValuesForNewChildRecordsFromParentFields
*******************************************************************************/
public ChildRecordListData withDefaultValuesForNewChildRecordsFromParentFields(Map<String, String> defaultValuesForNewChildRecordsFromParentFields)
{
this.defaultValuesForNewChildRecordsFromParentFields = defaultValuesForNewChildRecordsFromParentFields;
return (this);
}
} }