mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
CE-604 Let a customizer set a record label
This commit is contained in:
@ -274,6 +274,14 @@ public class QValueFormatter
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
private static String formatRecordLabelExceptionalCases(QTableMetaData table, QRecord record)
|
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 //
|
// if there's no record label format, then just return the primary key display value //
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -121,6 +121,12 @@ class QValueFormatterTest extends BaseTest
|
|||||||
table = new QTableMetaData().withPrimaryKeyField("id");
|
table = new QTableMetaData().withPrimaryKeyField("id");
|
||||||
assertEquals("42", QValueFormatter.formatRecordLabel(table, new QRecord().withValue("id", 42)));
|
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 //
|
// exceptional flow: no fields for the format //
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
|
Reference in New Issue
Block a user