use of kutch.biff.marvin.widget.SteelSimpleGaugeWidget in project Board-Instrumentation-Framework by intel.
the class SteelSimpleGaugeBuilder method Build.
public static SteelSimpleGaugeWidget Build(FrameworkNode masterNode, String widgetDefFilename) {
SteelSimpleGaugeWidget sg = new SteelSimpleGaugeWidget();
for (FrameworkNode node : masterNode.getChildNodes()) {
if (BaseWidget.HandleCommonDefinitionFileConfig(sg, node)) {
continue;
} else if (node.getNodeName().equalsIgnoreCase("MinValue")) {
String str = node.getTextContent();
try {
sg.setMinValue(Double.parseDouble(str));
} catch (Exception ex) {
LOGGER.severe("Invalid MinValue in Widget Definition File");
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("MaxValue")) {
String str = node.getTextContent();
try {
sg.setMaxValue(Double.parseDouble(str));
} catch (Exception ex) {
LOGGER.severe("Invalid MaxValue in SteelSimpleGauge Widget Definition File");
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("Decimals")) {
String str = node.getTextContent();
try {
sg.setDecimalPlaces(Integer.parseInt(str));
} catch (Exception ex) {
LOGGER.severe("Invalid Decimals in SteelSimpleGauge Widget Definition File");
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("UnitText")) {
String str = node.getTextContent();
sg.setUnitText(str);
} else if (node.getNodeName().equalsIgnoreCase("Sections")) {
List<Pair<Double, Double>> percentSections = ProcessPercentageSections(node);
if (null != percentSections) {
sg.setPercentageSections(percentSections);
} else {
List<Section> sectList = ProcessSections(node);
if (null != sectList) {
sg.setSections(sectList);
} else {
return null;
}
}
} else {
LOGGER.severe("Invalid SteelSimpleGauge Widget Definition File. Unknown Tag: " + node.getNodeName());
return null;
}
}
return sg;
}
Aggregations