Search in sources :

Example 1 with SteelSimpleGaugeWidget

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;
}
Also used : SteelSimpleGaugeWidget(kutch.biff.marvin.widget.SteelSimpleGaugeWidget) List(java.util.List) ArrayList(java.util.ArrayList) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)1 SteelSimpleGaugeWidget (kutch.biff.marvin.widget.SteelSimpleGaugeWidget)1