Skip to content
Snippets Groups Projects
Commit 39311383 authored by Katy Saintin's avatar Katy Saintin
Browse files

DataBrowser : Add useful method to get DataFormat from tango constant used by TangoDeviceExplorer

parent 4e59d203
No related branches found
No related tags found
No related merge requests found
......@@ -429,12 +429,23 @@ public class TangoDataSourceBrowser extends AbstractDataSourceProducerBrowser {
public DataFormat getFormat(final IKey key) {
DataFormat format = DataFormat.VOID;
IKey currentKey = getAdaptedKey(key);
if (currentKey instanceof TangoKey) {
String deviceName = TangoKeyTool.getDeviceName(currentKey);
if (TangoKeyTool.isAnAttribute(currentKey)) {
String attributeName = TangoKeyTool.getAttributeName(currentKey);
if (TangoAttributeHelper.isAttributeRunning(deviceName, attributeName)) {
int tangoFormat = TangoAttributeHelper.getAttributeFormat(deviceName, attributeName);
format = getDataFormat(tangoFormat);
}
}
}
return format;
}
public static DataFormat getDataFormat(int tangoFormat) {
DataFormat format = DataFormat.VOID;
switch (tangoFormat) {
case TangoConstHelper.BOOLEAN_FORMAT:
format = DataFormat.BOOLEAN;
......@@ -448,9 +459,6 @@ public class TangoDataSourceBrowser extends AbstractDataSourceProducerBrowser {
format = DataFormat.NUMERICAL;
break;
}
}
}
}
return format;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment