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.Modifier;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.annotations.EditableProperty;
@@ -88,7 +89,14 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
@Override
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();
}
/**
@@ -4242,6 +4242,10 @@
<changeType>NEW_FEATURE</changeType>
<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>
<changeType>IMPROVEMENT</changeType>
<description>Use scroll buttons in 'Tabbed Toolbar' instead of arranging tabs into multiple lines when the screen is not large enough to show them all</description>
Binary file not shown.
-2
View File
@@ -49,7 +49,6 @@ AWG
Alternate
And
Angle Offset
Apply Model
B-C-E BJT
Background
Box
@@ -148,7 +147,6 @@ Source Style
Source Type
Srpski
Stroke
TB2
Ten
Terminal
Timing
Binary file not shown.
Binary file not shown.