use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class SteelGaugeRadialWidget method HandleValueRange.
/**
* Sets range for widget - not valid for all widgets
* @param rangeNode
* @return
*/
@Override
public boolean HandleValueRange(FrameworkNode rangeNode) {
double Min = -1234.5678;
double Max = -1234.5678;
if (rangeNode.hasAttribute("Min")) {
Min = rangeNode.getDoubleAttribute("Min", Min);
if (Min == -1234.5678) {
return false;
}
this.MinValue = Min;
}
if (rangeNode.hasAttribute("Max")) {
Max = rangeNode.getDoubleAttribute("Max", Max);
if (Max == -1234.5678) {
return false;
}
this.MaxValue = Max;
}
for (FrameworkNode node : rangeNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("#Text") || node.getNodeName().equalsIgnoreCase("#comment")) {
continue;
}
if (node.getNodeName().equalsIgnoreCase("TickCount")) {
double MajorTickVal = -1234;
double MinorTickVal = -1234;
if (node.hasAttribute("Major")) {
MajorTickVal = node.getDoubleAttribute("Major", MajorTickVal);
if (MajorTickVal != -1234) {
setMajorTick((this.MaxValue - this.MinValue) / MajorTickVal);
} else {
LOGGER.severe("Invalid TickCount:Major ->" + node.getAttribute("Major"));
return false;
}
}
if (node.hasAttribute("Minor")) {
MinorTickVal = node.getDoubleAttribute("Minor", MinorTickVal);
if (MinorTickVal != -1234) {
setMinorTick((this.MaxValue - this.MinValue) / MinorTickVal);
} else {
LOGGER.severe("Invalid TickCount:Minor ->" + node.getAttribute("Minor"));
return false;
}
}
}
}
return true;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class SteelGaugeWidget method HandleValueRange.
/**
* Sets range for widget - not valid for all widgets
* @param rangeNode
* @return
*/
@Override
public boolean HandleValueRange(FrameworkNode rangeNode) {
double Min = -1234.5678;
double Max = -1234.5678;
if (rangeNode.hasAttribute("Min")) {
Min = rangeNode.getDoubleAttribute("Min", Min);
if (Min == -1234.5678) {
return false;
}
this.MinValue = Min;
}
if (rangeNode.hasAttribute("Max")) {
Max = rangeNode.getDoubleAttribute("Max", Max);
if (Max == -1234.5678) {
return false;
}
this.MaxValue = Max;
}
for (FrameworkNode node : rangeNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("#Text") || node.getNodeName().equalsIgnoreCase("#comment")) {
continue;
}
if (node.getNodeName().equalsIgnoreCase("TickCount")) {
double MajorTickVal = -1234;
double MinorTickVal = -1234;
if (node.hasAttribute("Major")) {
MajorTickVal = node.getDoubleAttribute("Major", MajorTickVal);
if (MajorTickVal != -1234) {
setMajorTick((this.MaxValue - this.MinValue) / MajorTickVal);
} else {
LOGGER.severe("Invalid TickCount:Major ->" + node.getAttribute("Major"));
return false;
}
}
if (node.hasAttribute("Minor")) {
MinorTickVal = node.getDoubleAttribute("Minor", MinorTickVal);
if (MinorTickVal != -1234) {
setMinorTick((this.MaxValue - this.MinValue) / MinorTickVal);
} else {
LOGGER.severe("Invalid TickCount:Minor ->" + node.getAttribute("Minor"));
return false;
}
}
} else {
return false;
}
}
return true;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class TabWidget method LoadConfiguration.
public boolean LoadConfiguration(FrameworkNode doc) {
if (doc.getChildNodes().isEmpty()) {
LOGGER.severe("No Widgets Defined for Tab: " + getTitle());
return false;
}
for (FrameworkNode node : doc.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("#Text") || node.getNodeName().equalsIgnoreCase("#Comment")) {
continue;
}
if (node.getNodeName().equalsIgnoreCase("Title")) {
setTitle(node.getTextContent());
} else if (node.getNodeName().equalsIgnoreCase("Peekaboo")) {
if (!HandlePeekaboo(this, node)) {
return false;
}
} else if (node.getNodeName().equalsIgnoreCase("StyleOverride")) {
if (false == WidgetBuilder.HandleStyleOverride(this, node)) {
return false;
}
} else if (node.getNodeName().equalsIgnoreCase("ClickThroughTransparent")) {
SetClickThroughTransparentRegion(node.getBooleanValue());
if (node.hasAttribute("Propagate") && node.getBooleanAttribute("Propagate")) {
setExplicitPropagate(true);
}
} else if (node.getNodeName().equalsIgnoreCase("Widget") || node.getNodeName().equalsIgnoreCase("Grid") || node.getNodeName().equalsIgnoreCase("DynamicGrid")) {
Widget widget = WidgetBuilder.Build(node);
if (null != widget) {
_Widgets.add(widget);
} else {
return false;
}
} else if (node.getNodeName().equalsIgnoreCase("GridMacro") || node.getNodeName().equalsIgnoreCase("MacroGrid")) {
if (!WidgetBuilder.ReadGridMacro(node)) {
return false;
}
} else if (node.getNodeName().equalsIgnoreCase("For")) {
List<Widget> repeatList = WidgetBuilder.BuildRepeatList(node);
if (null == repeatList) {
return false;
}
_Widgets.addAll(repeatList);
} else if (node.getNodeName().equalsIgnoreCase("TaskList")) {
ConfigurationReader.ReadTaskList(node);
} else if (node.getNodeName().equalsIgnoreCase("Prompt")) {
ConfigurationReader.ReadPrompt(node);
} else if (node.getNodeName().equalsIgnoreCase("AliasList")) {
// already deal with someplace else
} else if (false == HandleWidgetSpecificSettings(node)) {
LOGGER.warning("Unknown Entry: " + node.getNodeName() + " in Tab ID= " + getMinionID());
}
}
return true;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class WidgetBuilder method ReadGridInfo.
public static DynamicGridWidget ReadGridInfo(FrameworkNode gridNode, DynamicGridWidget retWidget) {
if (gridNode.getChildNodes().isEmpty()) {
return retWidget;
}
for (FrameworkNode node : gridNode.getChildNodes(true)) {
if (node.getNodeName().equalsIgnoreCase("#Text") || node.getNodeName().equalsIgnoreCase("#comment")) {
continue;
}
if (node.getNodeName().equalsIgnoreCase("PaddingOverride") || node.getNodeName().equalsIgnoreCase("Padding")) {
retWidget.HandleWidgetSpecificSettings(node);
} else if (node.getNodeName().equalsIgnoreCase("Widget") || node.getNodeName().equalsIgnoreCase("Grid")) {
Widget subWidget = WidgetBuilder.Build(node);
if (null != subWidget) {
retWidget.AddWidget(subWidget);
} else {
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("GridMacro") || node.getNodeName().equalsIgnoreCase("MacroGrid")) {
if (!ReadGridMacro(node)) {
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("For")) {
List<Widget> repeatList = WidgetBuilder.BuildRepeatList(node);
if (null == repeatList) {
return null;
}
for (Widget objWidget : repeatList) {
retWidget.AddWidget(objWidget);
}
} else if (node.getNodeName().equalsIgnoreCase("MinionSrc")) {
if (node.hasAttributes()) {
Utility.ValidateAttributes(new String[] { "Namespace", "ID" }, node);
if (node.hasAttribute("ID") && node.hasAttribute("Namespace")) {
retWidget.setMinionID(node.getAttribute("ID"));
retWidget.setNamespace(node.getAttribute("Namespace"));
continue;
}
}
LOGGER.severe("Malformed DynamicGrid Widget MinionSrc Definition in Application.XML");
return null;
} else if (node.getNodeName().equalsIgnoreCase("StyleOverride")) {
HandleStyleOverride(retWidget, node);
} else if (// for external grid files
node.getNodeName().equalsIgnoreCase("Peekaboo")) {
if (!HandlePeekaboo(retWidget, node)) {
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("ClickThroughTransparent")) {
retWidget.SetClickThroughTransparentRegion(node.getBooleanValue());
if (node.hasAttribute("Propagate") && node.getBooleanAttribute("Propagate")) {
retWidget.setExplicitPropagate(true);
}
} else if (!retWidget.HandleWidgetSpecificSettings(node)) {
LOGGER.severe("Unknown DynamicGrid Item in Config file: " + node.getNodeName());
return null;
}
}
return retWidget;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class WidgetBuilder method OpenDefinitionFile.
public static FrameworkNode OpenDefinitionFile(String inputFilename, String DesiredNode) {
LOGGER.config("Opening [" + DesiredNode + "] file: " + inputFilename);
Document doc = ConfigurationReader.OpenXMLFile(inputFilename);
if (null == doc) {
return null;
}
boolean foundRequiredRoot = false;
NodeList nodes = doc.getChildNodes();
for (int iLoop = 0; iLoop < nodes.getLength(); iLoop++) {
if (nodes.item(iLoop).getNodeName().equalsIgnoreCase("MarvinExternalFile")) {
nodes = nodes.item(iLoop).getChildNodes();
foundRequiredRoot = true;
break;
}
}
if (false == foundRequiredRoot) {
LOGGER.severe("External defintion file [" + inputFilename + "] did not have root of <MarvinExternalFile>");
return null;
}
for (int iLoop = 0; iLoop < nodes.getLength(); iLoop++) {
Node node = nodes.item(iLoop);
if (null != DesiredNode) {
if (node.getNodeName().equalsIgnoreCase(DesiredNode)) {
return new FrameworkNode(node);
}
} else if (// only root should have children, so should be good
node.hasChildNodes()) {
return new FrameworkNode(node);
}
}
return null;
}
Aggregations