Search in sources :

Example 1 with SteelGaugeRadialSteelWidget

use of kutch.biff.marvin.widget.SteelGaugeRadialSteelWidget in project Board-Instrumentation-Framework by intel.

the class SteelGaugeRadialSteelBuilder method Build.

@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public static SteelGaugeRadialSteelWidget Build(FrameworkNode masterNode, String widgetDefFilename) {
    SteelGaugeRadialSteelWidget objWidget = new SteelGaugeRadialSteelWidget();
    for (FrameworkNode node : masterNode.getChildNodes()) {
        if (BaseWidget.HandleCommonDefinitionFileConfig(objWidget, node)) {
            continue;
        } else if (node.getNodeName().equalsIgnoreCase("MinValue")) {
            String str = node.getTextContent();
            try {
                objWidget.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 {
                objWidget.setMaxValue(Double.parseDouble(str));
            } catch (Exception ex) {
                LOGGER.severe("Invalid MaxValue in SteelGauge Widget Definition File");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("Decimals")) {
            String str = node.getTextContent();
            try {
                objWidget.setDecimalPlaces(Integer.parseInt(str));
            } catch (Exception ex) {
                LOGGER.severe("Invalid Decimals in SteelGauge Widget Definition File");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("DialStartAngle")) {
            String str = node.getTextContent();
            try {
                objWidget.setDialStartAngle(Integer.parseInt(str));
            } catch (Exception ex) {
                LOGGER.severe("Invalid DialStartAngle in SteelGauge Widget Definition File");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("DialRangeAngle")) {
            String str = node.getTextContent();
            try {
                objWidget.setRangeAngle(Integer.parseInt(str));
            } catch (Exception ex) {
                LOGGER.severe("Invalid DialRangeAngle in SteelGauge Widget Definition File");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("MajorTicksSpace")) {
            String str = node.getTextContent();
            try {
                objWidget.setMajorTick(Integer.parseInt(str));
            } catch (Exception ex) {
                LOGGER.severe("Invalid MajorTicksSpace in SteelGauge Widget Definition File");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("MinorTicksSpace")) {
            String str = node.getTextContent();
            try {
                objWidget.setMinorTick(Integer.parseInt(str));
            } catch (Exception ex) {
                LOGGER.severe("Invalid MinorTicksSpace in SteelGauge Widget Definition File");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("TickLableOrientation")) {
            String str = node.getTextContent();
            if (0 == str.compareToIgnoreCase("Horizontal")) {
                objWidget.setOrientation(TickLabelOrientation.HORIZONTAL);
            } else if (0 == str.compareToIgnoreCase("Orthogonal")) {
                objWidget.setOrientation(TickLabelOrientation.ORTHOGONAL);
            } else if (0 == str.compareToIgnoreCase("Tangent")) {
                objWidget.setOrientation(TickLabelOrientation.TANGENT);
            } else {
                LOGGER.severe("Invalid TickLableOrientation in SteelGauge Widget Definition File. Should be Horizontal, Orthogonal or Tangent");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("EnhancedRateText")) {
            String str = node.getTextContent();
            if (0 == str.compareToIgnoreCase("True")) {
                objWidget.setEnhancedRateText(true);
            } else if (0 == str.compareToIgnoreCase("False")) {
                objWidget.setEnhancedRateText(false);
            } else {
                LOGGER.severe("Invalid EnhancedRateText in SteelGauge Widget Definition File.  Should be true or false");
                return null;
            }
        } else if (node.getNodeName().equalsIgnoreCase("UnitText")) {
            String str = node.getTextContent();
            objWidget.setUnitText(str);
        } else {
            LOGGER.severe("Invalid SteelGauge Widget Definition File.  Unknown Tag: " + node.getNodeName());
            return null;
        }
    }
    return objWidget;
}
Also used : FrameworkNode(kutch.biff.marvin.utility.FrameworkNode) SteelGaugeRadialSteelWidget(kutch.biff.marvin.widget.SteelGaugeRadialSteelWidget)

Aggregations

FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)1 SteelGaugeRadialSteelWidget (kutch.biff.marvin.widget.SteelGaugeRadialSteelWidget)1