Skip to content

Commit 3268683

Browse files
authored
Merge pull request #3190 from ControlSystemStudio/CSSTUDIO-2798
Make DESC field use in databrowser non-default
2 parents 052da8d + 31fe92d commit 3268683

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/PVItem.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,24 @@ private void updateUnits(final VType value)
398398
setUnits(display.getUnit());
399399
}
400400

401+
/**
402+
* Updates the value axis label based on the {@link Preferences#value_axis_label_policy} property.
403+
* If the property is set to pv-desc, then DESC field is used if defined and non-empty (works with pva only).
404+
* @param value Value of PV update.
405+
*/
401406
public void updateDescription(final VType value)
402407
{
403-
final Display display = Display.displayOf(value);
404-
if (display.getDescription() != null)
405-
setDisplayName(display.getDescription());
408+
switch(Preferences.value_axis_label_policy){
409+
case "pv-name":
410+
default:
411+
return;
412+
case "pv-desc":
413+
final Display display = Display.displayOf(value);
414+
if (display.getDescription() != null && !display.getDescription().isEmpty()){
415+
setDisplayName(display.getDescription());
416+
}
417+
break;
418+
}
406419
}
407420

408421
/** Scan, i.e. add 'current' value to live samples */

app/databrowser/src/main/java/org/csstudio/trends/databrowser3/preferences/Preferences.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ public static class TimePreset
101101
/** Setting */
102102
@Preference public static boolean config_dialog_supported;
103103

104+
@Preference
105+
public static String value_axis_label_policy;
106+
107+
104108
static
105109
{
106110
final PreferencesReader prefs = AnnotatedPreferences.initialize(Activator.class, Preferences.class, "/databrowser_preferences.properties");

app/databrowser/src/main/resources/databrowser_preferences.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,9 @@ time_span_shortcuts=30 Minutes,-30 min|1 Hour,-1 hour|12 Hours,-12 hour|1 Day,-1
150150

151151
# Determines if the plot runtime config dialog is supported. Defaults to false as the Data Browser
152152
# offers the same functionality through its configuration tabs.
153-
config_dialog_supported=false
153+
config_dialog_supported=false
154+
155+
# Determines default value axis label policy. Supported options:
156+
# pv-name: classic policy. Default if this property is not set or set to an unsupported value.
157+
# pv-desc: use DESC field, if available from PV and non-empty. Works only with pva.
158+
value_axis_label_policy=pv-name

0 commit comments

Comments
 (0)