Handle array value string representation

This commit is contained in:
Bane Stojkovic
2022-12-12 01:17:53 +01:00
parent e9414613a4
commit c7d5fe3cf4
6 changed files with 14 additions and 4 deletions
@@ -30,6 +30,7 @@ import java.lang.reflect.Array;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors;
import org.diylc.core.IDIYComponent; import org.diylc.core.IDIYComponent;
import org.diylc.core.Project; import org.diylc.core.Project;
import org.diylc.core.annotations.EditableProperty; import org.diylc.core.annotations.EditableProperty;
@@ -87,8 +88,15 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
} }
@Override @Override
public String getValueForDisplay() { public String getValueForDisplay() {
return getValue() == null ? "" : getValue().toString(); if (getValue() == null)
return "";
Object val = getValue();
if (val.getClass().isArray()) {
return String.join(" / ", Arrays.stream((Object[])val).map(x -> x == null ? "" : x.toString()).collect(Collectors.toList()));
}
return val.toString();
} }
/** /**
@@ -4241,6 +4241,10 @@
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType> <changeType>NEW_FEATURE</changeType>
<description>Added 'PCB Terminal Block' component</description> <description>Added 'PCB Terminal Block' component</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>Show component values in the project explorer</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
Binary file not shown.
-2
View File
@@ -49,7 +49,6 @@ AWG
Alternate Alternate
And And
Angle Offset Angle Offset
Apply Model
B-C-E BJT B-C-E BJT
Background Background
Box Box
@@ -148,7 +147,6 @@ Source Style
Source Type Source Type
Srpski Srpski
Stroke Stroke
TB2
Ten Ten
Terminal Terminal
Timing Timing
Binary file not shown.
Binary file not shown.