CE-604 Let a customizer set a record label

This commit is contained in:
2023-11-02 14:32:53 -05:00
parent 9e3054381a
commit c58d8fd7de
2 changed files with 14 additions and 0 deletions

View File

@ -274,6 +274,14 @@ public class QValueFormatter
*******************************************************************************/
private static String formatRecordLabelExceptionalCases(QTableMetaData table, QRecord record)
{
//////////////////////////////////////////////////////////////////////////////////////
// if the record already has a label (say, from a query-customizer), then return it //
//////////////////////////////////////////////////////////////////////////////////////
if(record.getRecordLabel() != null)
{
return (record.getRecordLabel());
}
///////////////////////////////////////////////////////////////////////////////////////
// if there's no record label format, then just return the primary key display value //
///////////////////////////////////////////////////////////////////////////////////////

View File

@ -121,6 +121,12 @@ class QValueFormatterTest extends BaseTest
table = new QTableMetaData().withPrimaryKeyField("id");
assertEquals("42", QValueFormatter.formatRecordLabel(table, new QRecord().withValue("id", 42)));
///////////////////////////////////////////////////////////////////////////////////////
// exceptional flow: no recordLabelFormat specified, and record already had a label //
///////////////////////////////////////////////////////////////////////////////////////
table = new QTableMetaData().withPrimaryKeyField("id");
assertEquals("my label", QValueFormatter.formatRecordLabel(table, new QRecord().withRecordLabel("my label").withValue("id", 42)));
/////////////////////////////////////////////////
// exceptional flow: no fields for the format //
/////////////////////////////////////////////////