use of org.openremote.model.asset.AssetMeta in project openremote by openremote.
the class MetaEditor method onMetaItemTypeChanged.
protected void onMetaItemTypeChanged(MetaItemEditor itemEditor, boolean updateItem) {
if (updateItem) {
itemEditor.item.clearValue();
// TODO Should use meta item descriptors from server
Value initialValue = Arrays.stream(AssetMeta.values()).filter(assetMeta -> assetMeta.getUrn().equals(itemEditor.nameList.getSelectedValue())).map(MetaItemDescriptor::getInitialValue).findFirst().orElse(null);
ValueType valueType = EnumUtil.enumFromString(ValueType.class, itemEditor.typeList.getSelectedValue()).orElse(null);
if (valueType == ValueType.BOOLEAN && initialValue == null) {
initialValue = Values.create(false);
}
itemEditor.onModified(initialValue);
}
itemEditor.updateValueEditor();
}
Aggregations