use of org.diirt.vtype.VType in project org.csstudio.display.builder by kasemir.
the class CSVSampleImporterUnitTest method testCSVImport.
@Test
public void testCSVImport() throws Exception {
final InputStream input = getClass().getResourceAsStream("Lakeshore_A_9_2011.xml");
final SampleImporter importer = new CSVSampleImporter();
final List<VType> values = importer.importValues(input);
assertTrue(values.size() > 0);
for (VType value : values) System.out.println(VTypeHelper.toString(value));
final String text = VTypeHelper.toString(values.get(values.size() - 1));
assertThat(text, containsString("2011-09-13"));
assertThat(text, containsString("08:57:44.968"));
assertThat(text, containsString("84.912"));
}
use of org.diirt.vtype.VType in project org.csstudio.display.builder by kasemir.
the class PVSamplesUnitTest method testUndefinedLiveData.
/**
* When 'monitoring' a PV, IOCs will send data with zero time stamps
* for records that have never been processed.
* Check that time stamps are patched to host time.
*/
@Test
public void testUndefinedLiveData() {
final AtomicInteger waveform_index = new AtomicInteger(0);
// Start w/ empty samples
final PVSamples samples = new PVSamples(waveform_index);
assertEquals(0, samples.size());
// Add sample w/ null time stamp, INVALID/UDF
final Instant null_time = Instant.ofEpochMilli(0);
VType value = new ArchiveVNumber(null_time, AlarmSeverity.NONE, "", null, 0.0);
assertThat(ValueUtil.timeOf(value).isTimeValid(), equalTo(false));
samples.addLiveSample(value);
System.out.println("Original: " + value);
// Should have that sample, plus copy that's extrapolated to 'now'
assertEquals(2, samples.size());
value = samples.get(0).getVType();
System.out.println("Sampled : " + value);
assertThat(ValueUtil.timeOf(value).isTimeValid(), equalTo(true));
}
use of org.diirt.vtype.VType in project org.csstudio.display.builder by kasemir.
the class BaseLEDRepresentation method contentChanged.
private void contentChanged(final WidgetProperty<VType> property, final VType old_value, final VType new_value) {
final VType value = model_widget.runtimePropValue().getValue();
if (value == null) {
value_color = alarm_colors[AlarmSeverity.UNDEFINED.ordinal()];
value_label = "";
} else {
int value_index = computeColorIndex(new_value);
final Color[] save_colors = colors;
if (value_index < 0)
value_index = 0;
if (value_index >= save_colors.length)
value_index = save_colors.length - 1;
value_color = save_colors[value_index];
value_label = computeLabel(value_index);
}
dirty_content.mark();
toolkit.scheduleUpdate(this);
}
use of org.diirt.vtype.VType in project org.csstudio.display.builder by kasemir.
the class ComboRepresentation method contentChanged.
private void contentChanged(final WidgetProperty<?> property, final Object old_value, final Object new_value) {
VType value = model_widget.runtimePropValue().getValue();
boolean fromPV = model_widget.propItemsFromPV().getValue() && value instanceof VEnum;
// also sets index
items = computeItems(value, fromPV);
dirty_content.mark();
toolkit.scheduleUpdate(this);
}
Aggregations