Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,24 @@ 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());
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to add break; statements in order to prevent fall-through in case more cases are added in the future.

break;
}
}

/** Scan, i.e. add 'current' value to live samples */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Loading