TangoKey attributeKey;
ImageViewerBox imageBox = new ImageViewerBox();
StringScalarBox stringBox = new StringScalarBox();
NumberScalarBox numberBox = new NumberScalarBox();
ChartViewerBox chartBox = new ChartViewerBox();
BooleanScalarBox booleanBox = new BooleanScalarBox();
TangoKey tangoKey = generateCommandKey("Start");
setWidgetModel(startButton, booleanBox, tangoKey);
startButton.setText("Start");
tangoKey = generateCommandKey("Stop");
setWidgetModel(stopButton, booleanBox, tangoKey);
stopButton.setText("Stop");
attributeKey = generateAttributeKey("data");
setWidgetModel(dataImage, imageBox, attributeKey);
dataImage.setAlwaysFitMaxSize(true);
attributeKey = generateReadOnlyAttributeKey("energyStep");
setWidgetModel(energyStepRead, stringBox, attributeKey);
stringBox.setUnitEnabled(energyStepRead, true);
attributeKey = generateWriteAttributeKey("energyStep");
setWidgetModel(energyStepWrite, numberBox, attributeKey);
attributeKey = generateAttributeKey("state");
setWidgetModel(stateLabel, stringBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("status");
setWidgetModel(statusArea, stringBox, attributeKey);
stringBox.setColorEnabled(statusArea, false);
attributeKey = generateAttributeKey("mode");
setWidgetModel(acquisitionModeCombo, stringBox, attributeKey);
ITextTarget acquisitionModeTarget = new ITextTarget() {
@Override
public void setText(String text) {
setEnergyLabelVisible(text);
}
@Override
public void removeMediator(Mediator<?> mediator) {
}
@Override
public void addMediator(Mediator<?> mediator) {
}
@Override
public String getText() {
return null;
}
};
setWidgetModel(acquisitionModeTarget, stringBox, attributeKey);
attributeKey = generateAttributeKey("energyScale");
setWidgetModel(energyScaleCombo, stringBox, attributeKey);
attributeKey = generateAttributeKey("passEnergy");
setWidgetModel(passEnergyCombo, stringBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("excitationEnergy");
setWidgetModel(excitationEnergyRead, stringBox, attributeKey);
stringBox.setUnitEnabled(excitationEnergyRead, true);
attributeKey = generateWriteAttributeKey("excitationEnergy");
setWidgetModel(excitationEnergyWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("stepTime");
setWidgetModel(stepTimeRead, stringBox, attributeKey);
stringBox.setUnitEnabled(stepTimeRead, true);
attributeKey = generateWriteAttributeKey("stepTime");
setWidgetModel(stepTimeWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("lowEnergy");
setWidgetModel(lowEnergyRead, stringBox, attributeKey);
stringBox.setUnitEnabled(lowEnergyRead, true);
attributeKey = generateWriteAttributeKey("lowEnergy");
setWidgetModel(lowEnergyWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("highEnergy");
setWidgetModel(highEnergyRead, stringBox, attributeKey);
stringBox.setUnitEnabled(highEnergyRead, true);
attributeKey = generateWriteAttributeKey("highEnergy");
setWidgetModel(highEnergyWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("fixEnergy");
setWidgetModel(fixEnergyRead, stringBox, attributeKey);
attributeKey = generateWriteAttributeKey("fixEnergy");
setWidgetModel(fixEnergyWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("detectorFirstXChannel");
setWidgetModel(xminRead, stringBox, attributeKey);
attributeKey = generateWriteAttributeKey("detectorFirstXChannel");
setWidgetModel(xminWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("detectorLastXChannel");
setWidgetModel(xmaxRead, stringBox, attributeKey);
attributeKey = generateWriteAttributeKey("detectorLastXChannel");
setWidgetModel(xmaxWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("detectorFirstYChannel");
setWidgetModel(yminRead, stringBox, attributeKey);
attributeKey = generateWriteAttributeKey("detectorFirstYChannel");
setWidgetModel(yminWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("detectorLastYChannel");
setWidgetModel(ymaxRead, stringBox, attributeKey);
attributeKey = generateWriteAttributeKey("detectorLastYChannel");
setWidgetModel(ymaxWrite, numberBox, attributeKey);
attributeKey = generateReadOnlyAttributeKey("detectorSlices");
setWidgetModel(slicesRead, stringBox, attributeKey);
attributeKey = generateWriteAttributeKey("detectorSlices");
setWidgetModel(slicesWrite, numberBox, attributeKey);
String[] lensModeList = { "lens1", "lens2", "lens3" };
DeviceProxy tmpDeviceProxy = null;
try {
tmpDeviceProxy = new DeviceProxy(model);
DeviceData dd = tmpDeviceProxy.command_inout("GetLensModeList");
lensModeList = dd.extractStringArray();
}
catch (DevFailed e) {
e.printStackTrace();
}
lensModeCombo.setValueList((Object[]) lensModeList);
attributeKey = generateAttributeKey("lensMode");
setWidgetModel(lensModeCombo, stringBox, attributeKey);
String[] passModeList = { "pass1", "pass2", "pass3" };
if (tmpDeviceProxy != null) {
try {
DeviceData dd = tmpDeviceProxy.command_inout("GetpassModeList");
passModeList = dd.extractStringArray();
}
catch (DevFailed e) {
e.printStackTrace();
}
}
passModeCombo.setValueList((Object[]) passModeList);
attributeKey = generateAttributeKey("passMode");
setWidgetModel(passModeCombo, stringBox, attributeKey);
attributeKey = generateAttributeKey("channelScale");
TangoKey attributeKey2 = generateAttributeKey("sumData");
chartBox.connectWidgetDual(sumDataSpectrum, attributeKey, attributeKey2);
sumDataSpectrum.setAxisName("Energy (eV)", IChartViewer.X);
sumDataSpectrum.setAxisName("Counts", IChartViewer.Y1);
setEnergyLabelVisible((String) acquisitionModeCombo.getSelectedItem());