From b9605fc9dbf581e7c11c4c386edc84549c61ae4f Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Mon, 19 Oct 2026 13:53:34 +0200 Subject: [PATCH 1/4] CSSTUDIO-3793 Implement reading the description using the DescriptionProvider interface instead of the DisplayProvider interface in PV Table. --- .../pvtable/model/PVTableItem.java | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java b/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java index d9f8f4b009..32088daac9 100644 --- a/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java +++ b/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java @@ -20,6 +20,7 @@ import org.epics.vtype.AlarmStatus; import org.epics.vtype.Display; import org.epics.vtype.DisplayProvider; +import org.epics.vtype.DescriptionProvider; import org.epics.vtype.EnumDisplay; import org.epics.vtype.Time; import org.epics.vtype.VBoolean; @@ -202,29 +203,13 @@ private void createPVs(final String name) } private void updateDescription() { - if(desc_value == null) { - //update description from value or pv - VType currentValue = getValue(); - if(currentValue != null) { - String description = null; - // DisplayProvider is an optional interface for VType values, - // not PVs, but the custum datasource as Muscade happens to implement - // DisplayProvider for enum and bool PVs, so check for that here - Display display = currentValue instanceof DisplayProvider ? ((DisplayProvider) currentValue).getDisplay(): null; - if(display == null && currentValue instanceof VEnum){ - EnumDisplay enumdisplay = ((VEnum) currentValue).getDisplay(); - if(enumdisplay instanceof DisplayProvider){ - display = ((DisplayProvider)enumdisplay).getDisplay(); - } - } - if (display != null) { - description = display.getDescription(); - } - desc_value = description != null ? description : null; - desc_name = desc_value != null ? "Description of " + name + " PV" : "no description"; - desc_flow = value_flow; - } - } + desc_value = switch (getValue()) { + case VEnum vEnum when vEnum.getDisplay() instanceof DescriptionProvider descriptionProvider -> descriptionProvider.getDescription().orElse(""); + case DescriptionProvider descriptionProvider -> descriptionProvider.getDescription().orElse(""); + default -> ""; + }; + desc_name = desc_value != null ? "Description of " + name + " PV" : "no description"; + desc_flow = value_flow; } /** @return true if item is selected to be restored */ From 8dbb614d668a0117090c9b988b8566e4ad3f87fe Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Thu, 15 Oct 2026 10:26:31 +0200 Subject: [PATCH 2/4] CSSTUDIO-3793 Decode the description when decoding Boolean, Enum, and String PVA values. --- .../java/org/phoebus/pv/pva/Decoders.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java b/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java index e5a4a559bf..b8a3b3593e 100644 --- a/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java +++ b/core/pv-pva/src/main/java/org/phoebus/pv/pva/Decoders.java @@ -13,6 +13,7 @@ import java.time.Instant; import java.util.Arrays; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import org.epics.pva.data.PVAArray; @@ -33,6 +34,7 @@ import org.epics.pva.data.PVAString; import org.epics.pva.data.PVAStringArray; import org.epics.pva.data.PVAStructure; +import org.epics.pvdata.pv.PVStructure; import org.epics.util.array.ArrayByte; import org.epics.util.array.ArrayDouble; import org.epics.util.array.ArrayFloat; @@ -243,6 +245,20 @@ public Number parse(String source, ParsePosition parsePosition) } } + private static Optional decodeDescription(final PVAStructure struct) { + if (struct.get("display") instanceof PVAStructure display) { + if (display.get("description") instanceof PVAString pvaString) { + return Optional.ofNullable(pvaString.get()); + } + else { + return Optional.empty(); + } + } + else { + return Optional.empty(); + } + } + private static Display decodeDisplay(final PVAStructure struct) { String units; @@ -341,7 +357,7 @@ private static Display decodeDisplay(final PVAStructure struct) */ public static VType decodeBool(PVAStructure struct, PVABool field) { - return VBoolean.of(field.get(), decodeAlarm(struct), decodeTime(struct)); + return VBoolean.of(field.get(), decodeAlarm(struct), decodeTime(struct), decodeDescription(struct)); } /** @param struct Structure @@ -350,7 +366,7 @@ public static VType decodeBool(PVAStructure struct, PVABool field) */ public static VType decodeString(PVAStructure struct, PVAString field) { - return VString.of(field.get(), decodeAlarm(struct), decodeTime(struct)); + return VString.of(field.get(), decodeAlarm(struct), decodeTime(struct), decodeDescription(struct)); } /** @param struct Structure for enum @@ -366,7 +382,7 @@ public static VEnum decodeEnum(final PVAStructure struct) throws Exception final int value = ((PVAInt)section.get("index")).get(); final PVAStringArray choices = section.get("choices"); - return VEnum.of(value, EnumDisplay.of(choices.get()), alarm, time); + return VEnum.of(value, EnumDisplay.of(choices.get()), alarm, time, decodeDescription(struct)); } /** @param struct Structure From 8d869c7b506d5243d87c4b2c5a4e799b7ade5514 Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Mon, 19 Oct 2026 13:52:59 +0200 Subject: [PATCH 3/4] CSSTUDIO-3793 Set epics-vtype version to 1.0.9-SNAPSHOT for development. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 060b046f3d..b9b89f019b 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 2026-10-06T19:17:33Z 7.0.11 1.0.8 - 1.0.8 + 1.0.9-SNAPSHOT 25.0.4 From 0d84f2c905341999934a973c3452152482769552 Mon Sep 17 00:00:00 2001 From: Abraham Wolk Date: Mon, 19 Oct 2026 14:31:35 +0200 Subject: [PATCH 4/4] Remove whitespace. --- .../applications/pvtable/model/PVTableItem.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java b/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java index 32088daac9..f099be879c 100644 --- a/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java +++ b/app/pvtable/src/main/java/org/phoebus/applications/pvtable/model/PVTableItem.java @@ -84,9 +84,9 @@ public class PVTableItem /** Listener to description PV */ private volatile Disposable desc_flow; - + private volatile String[] valueOptions = null; - + private static final String DESC_FIELD = "DESC"; private static final String DOT = "."; @@ -179,7 +179,7 @@ private void createPVs(final String name) // Determine DESC field include dot in case of variable name such as variableEGUName desc_name = name.replace(DOT + fieldVal, DOT + DESC_FIELD); } - + try { final PV new_desc_pv = PVPool.getPV(desc_name); @@ -201,7 +201,7 @@ private void createPVs(final String name) } } } - + private void updateDescription() { desc_value = switch (getValue()) { case VEnum vEnum when vEnum.getDisplay() instanceof DescriptionProvider descriptionProvider -> descriptionProvider.getDescription().orElse(""); @@ -280,7 +280,7 @@ public String getDescription() { updateDescription(); return desc_value == null ? "" : desc_value; } - + /** @return description pv name **/ public String getDescriptionName() { return desc_name; @@ -305,7 +305,7 @@ else if(copy instanceof VBoolean) { } return valueOptions; } - + /** @return index in case of Enum value */ public int getIndex() { int index = - 1;