use of org.csstudio.trends.databrowser3.model.PlotSamples in project org.csstudio.display.builder by kasemir.
the class WaveformView method showSelectedSample.
/**
* Show the current sample of the current model item.
*/
private void showSelectedSample() {
// Get selected sample (= one waveform)
final PlotSamples samples = model_item.getSamples();
final int idx = sample_index.getSelection();
final PlotSample sample;
samples.getLock().lock();
try {
sample_index.setMaximum(samples.size());
sample = samples.get(idx);
} finally {
samples.getLock().unlock();
}
// Setting the value can be delayed while the plot is being updated
final VType value = sample.getVType();
Activator.getThreadPool().execute(() -> waveform.setValue(value));
if (value == null)
clearInfo();
else {
updateAnnotation(sample.getPosition(), sample.getValue());
int size = value instanceof VNumberArray ? ((VNumberArray) value).getData().size() : 1;
plot.getXAxis().setValueRange(0.0, (double) size);
timestamp.setText(TimestampHelper.format(VTypeHelper.getTimestamp(value)));
status.setText(NLS.bind(Messages.SeverityStatusFmt, VTypeHelper.getSeverity(value).toString(), VTypeHelper.getMessage(value)));
}
plot.requestUpdate();
}
Aggregations