mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Add withValues(Pair...) and iconAndColorValues
This commit is contained in:
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.model.metadata.fields;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum;
|
||||||
import com.kingsrook.qqq.backend.core.utils.Pair;
|
import com.kingsrook.qqq.backend.core.utils.Pair;
|
||||||
|
|
||||||
|
|
||||||
@ -81,6 +82,20 @@ public enum AdornmentType
|
|||||||
{
|
{
|
||||||
return (new Pair<>("icon." + value, iconName));
|
return (new Pair<>("icon." + value, iconName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
static Pair<String, Serializable>[] iconAndColorValues(Serializable value, String iconName, String colorName)
|
||||||
|
{
|
||||||
|
if(value instanceof PossibleValueEnum<?> possibleValueEnum)
|
||||||
|
{
|
||||||
|
value = (Serializable) possibleValueEnum.getPossibleValueId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (new Pair[] { iconValue(value, iconName), colorValue(value, colorName) });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,4 +164,20 @@ public class FieldAdornment
|
|||||||
return (withValue(value.getA(), value.getB()));
|
return (withValue(value.getA(), value.getB()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Fluent setter for values
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public FieldAdornment withValues(Pair<String, Serializable>... values)
|
||||||
|
{
|
||||||
|
for(Pair<String, Serializable> value : values)
|
||||||
|
{
|
||||||
|
withValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user