From 47d67d6311a992c34d56e255d4a63e0bbdb5d8f4 Mon Sep 17 00:00:00 2001 From: Bane Stojkovic Date: Tue, 10 Nov 2026 11:18:08 +0100 Subject: [PATCH] Update ValueNotationBinder.java --- .../org/diylc/presenter/ValueNotationBinder.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/diylc/diylc-core/src/main/java/org/diylc/presenter/ValueNotationBinder.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/ValueNotationBinder.java index 99514f9bb..8aa85fe4c 100644 --- a/diylc/diylc-core/src/main/java/org/diylc/presenter/ValueNotationBinder.java +++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/ValueNotationBinder.java @@ -37,8 +37,17 @@ import org.diylc.core.measures.ValueNotation; public class ValueNotationBinder { public static void bind(IConfigurationManager configManager, Runnable refresh) { - apply(configManager.readString(IPlugInPort.VALUE_NOTATION_KEY, - IPlugInPort.VALUE_NOTATION_DEFAULT)); + String stored = configManager.readString(IPlugInPort.VALUE_NOTATION_KEY, + IPlugInPort.VALUE_NOTATION_DEFAULT); + // a value that matches neither menu item, e.g. a label saved by an earlier build, would leave + // the Value Notation menu with nothing checked; this runs before the listener is added, so + // only the menu items hear about it + if (!IPlugInPort.VALUE_NOTATION_DECIMAL.equalsIgnoreCase(stored) + && !IPlugInPort.VALUE_NOTATION_RKM.equalsIgnoreCase(stored)) { + stored = IPlugInPort.VALUE_NOTATION_DEFAULT; + configManager.writeValue(IPlugInPort.VALUE_NOTATION_KEY, stored); + } + apply(stored); configManager.addConfigListener(IPlugInPort.VALUE_NOTATION_KEY, (key, value) -> { apply(value == null ? null : value.toString()); // cached component images still carry the labels drawn in the previous notation