From 58127b145c65a23ff476be7ffd1b8920f57f407c Mon Sep 17 00:00:00 2001 From: georgweiss Date: Wed, 13 Nov 2024 13:33:35 +0100 Subject: [PATCH 1/2] Make DESC field use in databrowser non-default --- .../trends/databrowser3/model/PVItem.java | 18 +++++++++++++++--- .../databrowser3/preferences/Preferences.java | 4 ++++ .../databrowser_preferences.properties | 7 ++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java index bf2ba9a595..1eddf8cf72 100644 --- a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java +++ b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java @@ -398,11 +398,23 @@ private void updateUnits(final VType value) setUnits(display.getUnit()); } + /** + * Updates the value axis label based on the {@link Preferences#value_axis_label_policy} property. + * If the property is set to pv-desc, then DESC field is used if defined and non-empty (works with pva only). + * @param value Value of PV update. + */ public void updateDescription(final VType value) { - final Display display = Display.displayOf(value); - if (display.getDescription() != null) - setDisplayName(display.getDescription()); + switch(Preferences.value_axis_label_policy){ + case "pv-name": + default: + return; + case "pv-desc": + final Display display = Display.displayOf(value); + if (display.getDescription() != null && !display.getDescription().isEmpty()){ + setDisplayName(display.getDescription()); + } + } } /** Scan, i.e. add 'current' value to live samples */ diff --git a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java index 18780336ba..b1f236b4be 100644 --- a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java +++ b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java @@ -101,6 +101,10 @@ public static class TimePreset /** Setting */ @Preference public static boolean config_dialog_supported; + @Preference + public static String value_axis_label_policy; + + static { final PreferencesReader prefs = AnnotatedPreferences.initialize(Activator.class, Preferences.class, "/databrowser_preferences.properties"); diff --git a/app/databrowser/src/main/resources/databrowser_preferences.properties b/app/databrowser/src/main/resources/databrowser_preferences.properties index 3c266af990..23162d4bb0 100644 --- a/app/databrowser/src/main/resources/databrowser_preferences.properties +++ b/app/databrowser/src/main/resources/databrowser_preferences.properties @@ -150,4 +150,9 @@ time_span_shortcuts=30 Minutes,-30 min|1 Hour,-1 hour|12 Hours,-12 hour|1 Day,-1 # Determines if the plot runtime config dialog is supported. Defaults to false as the Data Browser # offers the same functionality through its configuration tabs. -config_dialog_supported=false \ No newline at end of file +config_dialog_supported=false + +# Determines default value axis label policy. Supported options: +# pv-name: classic policy. Default if this property is not set or set to an unsupported value. +# pv-desc: use DESC field, if available from PV and non-empty. Works only with pva. +value_axis_label_policy=pv-name \ No newline at end of file From 31fe92d4d137105d98ad380ef2a31963113097af Mon Sep 17 00:00:00 2001 From: georgweiss Date: Wed, 13 Nov 2024 16:02:24 +0100 Subject: [PATCH 2/2] Change based on feed-back --- .../main/java/org/csstudio/trends/databrowser3/model/PVItem.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java index 1eddf8cf72..14172808da 100644 --- a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java +++ b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java @@ -414,6 +414,7 @@ public void updateDescription(final VType value) if (display.getDescription() != null && !display.getDescription().isEmpty()){ setDisplayName(display.getDescription()); } + break; } }