use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class SteelLCDWidgetBuilder method Build.
public static SteelLCDWidget Build(FrameworkNode masterNode, String widgetDefFilename) {
SteelLCDWidget lcd = new SteelLCDWidget();
for (FrameworkNode node : masterNode.getChildNodes()) {
if (BaseWidget.HandleCommonDefinitionFileConfig(lcd, node)) {
continue;
} else if (node.getNodeName().equalsIgnoreCase("MinValue")) {
String str = node.getTextContent();
try {
lcd.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 {
lcd.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 {
lcd.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();
lcd.setUnitText(str);
} else if (node.getNodeName().equalsIgnoreCase("UnitText")) {
String str = node.getTextContent();
lcd.setUnitText(str);
} else if (node.getNodeName().equalsIgnoreCase("KeepAspectRatio")) {
String str = node.getTextContent();
if (0 == str.compareToIgnoreCase("False")) {
lcd.setKeepAspectRatio(false);
} else if (0 == str.compareToIgnoreCase("True")) {
lcd.setKeepAspectRatio(true);
} else {
LOGGER.severe("Invalid LCD Widget Definition File. KeepAspectRation should be True or False, not:" + str);
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("ShowMaxMeasuredValue")) {
String str = node.getTextContent();
if (0 == str.compareToIgnoreCase("True")) {
lcd.setShowMeasuredMax(true);
} else if (0 == str.compareToIgnoreCase("False")) {
lcd.setShowMeasuredMax(false);
} else {
LOGGER.severe("Invalid LCD Widget Definition File. ShowMaxMeasuredValue should be True or False, not:" + str);
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("ShowMinMeasuredValue")) {
String str = node.getTextContent();
if (0 == str.compareToIgnoreCase("True")) {
lcd.setShowMeasuredMin(true);
} else if (0 == str.compareToIgnoreCase("False")) {
lcd.setShowMeasuredMin(false);
} else {
LOGGER.severe("Invalid LCD Widget Definition File. ShowMaxMeasuredValue should be True or False, not:" + str);
return null;
}
} else {
LOGGER.severe("Invalid LCD Widget Definition File. Unknown Tag: " + node.getNodeName());
return null;
}
}
return lcd;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class LineChartWidget_MS method HandleWidgetSpecificSettings.
@Override
public boolean HandleWidgetSpecificSettings(FrameworkNode node) {
if (true == HandleChartSpecificAppSettings(node)) {
return true;
}
if (node.getNodeName().equalsIgnoreCase("Series")) {
String ID, Namespace, Label;
if (node.hasAttribute("Label")) {
Label = node.getAttribute("Label");
} else {
Label = "";
}
for (FrameworkNode newNode : node.getChildNodes()) {
if (newNode.getNodeName().equalsIgnoreCase("MinionSrc")) {
Utility.ValidateAttributes(new String[] { "ID", "Namespace" }, newNode);
if (newNode.hasAttribute("ID")) {
ID = newNode.getAttribute("ID");
} else {
LOGGER.severe("Series defined with invalid MinionSrc - no ID");
return false;
}
if (newNode.hasAttribute("Namespace")) {
Namespace = newNode.getAttribute("Namespace");
} else {
LOGGER.severe("Series defined with invalid MinionSrc - no Namespace");
return false;
}
SeriesDataSet objDS = new SeriesDataSet(Label, ID, Namespace);
getSeries().add(objDS);
}
}
return true;
}
return false;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class DynamicTransition method ReadTransitionInformation.
public static DynamicTransition ReadTransitionInformation(FrameworkNode baseNode) {
DynamicTransition.Transition _TransitionType = DynamicTransition.Transition.NONE;
int _Transition_xGridCount = 10;
int _Transition_yGridCount = 10;
int _Transition_Delay = 100;
Color _Transition_Snapshot_Color_bg = Color.TRANSPARENT;
Duration _Transition_Duration = Duration.millis(1500);
for (FrameworkNode node : baseNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("#Text") || node.getNodeName().equalsIgnoreCase("#Comment")) {
continue;
}
if (node.getNodeName().equalsIgnoreCase("Transition")) {
String strTransition = node.getTextContent();
_TransitionType = DynamicTransition.VerifyTransitionType(strTransition);
if (_TransitionType == DynamicTransition.Transition.INVALID) {
LOGGER.severe("Invalid Transition [" + strTransition + "] specified. Valid values are: " + DynamicTransition.names());
return null;
}
if (node.hasAttribute("xGrids")) {
_Transition_xGridCount = node.getIntegerAttribute("xGrids", 0);
if (_Transition_xGridCount <= 0) {
LOGGER.severe("Invlid xGrids value for Transition: " + node.getAttribute("xGrids"));
return null;
}
}
if (node.hasAttribute("yGrids")) {
_Transition_yGridCount = node.getIntegerAttribute("yGrids", 0);
if (_Transition_yGridCount <= 0) {
LOGGER.severe("Invlid yGrids value for Transition: " + node.getAttribute("yGrids"));
return null;
}
}
if (node.hasAttribute("Duration")) {
int Transition_Duration = node.getIntegerAttribute("Duration", 0);
if (Transition_Duration <= 0) {
LOGGER.severe("Invlid Duration value for Transition: " + node.getAttribute("Duration"));
return null;
}
_Transition_Duration = Duration.millis(Transition_Duration);
}
if (node.hasAttribute("Delay")) {
_Transition_Delay = node.getIntegerAttribute("Delay", 0);
if (_Transition_Delay <= 0) {
LOGGER.severe("Invlid Delay value for Transition: " + node.getAttribute("Delay"));
return null;
}
}
// nuking this, s not really needed anymore
// if (node.hasAttribute("Background"))
// {
// String strColor = node.getAttribute("Background");
// try
// {
// _Transition_Snapshot_Color_bg = Color.web(strColor);
// }
// catch (Exception e)
// {
// LOGGER.severe("Invalid Background value for getTransition: " + strColor);
// return false;
// }
// }
}
}
DynamicTransition objTransition = new DynamicTransition(_TransitionType);
objTransition.setDelay(_Transition_Delay);
objTransition.setDuration(_Transition_Duration);
objTransition.setNoOfTilesX(_Transition_xGridCount);
objTransition.setNoOfTilesY(_Transition_yGridCount);
objTransition.setSnapshotColor(_Transition_Snapshot_Color_bg);
// _objTransition = objTransition;
return objTransition;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class BarGaugeWidgetBuilder method Build.
public static BarGaugeWidget Build(FrameworkNode masterNode, String widgetDefFilename) {
BarGaugeWidget gauge = new BarGaugeWidget();
for (FrameworkNode node : masterNode.getChildNodes()) {
if (BaseWidget.HandleCommonDefinitionFileConfig(gauge, node)) {
continue;
} else if (node.getNodeName().equalsIgnoreCase("MinValue")) {
String str = node.getTextContent();
try {
gauge.setMinValue(Double.parseDouble(str));
} catch (NumberFormatException ex) {
LOGGER.severe("Invalid MinValue in BarGauge Widget Definition File");
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("MaxValue")) {
String str = node.getTextContent();
try {
gauge.setMaxValue(Double.parseDouble(str));
} catch (NumberFormatException ex) {
LOGGER.severe("Invalid MaxValue in BarGauge Widget Definition File");
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("Decimals")) {
String str = node.getTextContent();
try {
gauge.setDecimalPlaces(Integer.parseInt(str));
} catch (NumberFormatException ex) {
LOGGER.severe("Invalid Decimals in Bareauge Widget Definition File");
return null;
}
} else if (node.getNodeName().equalsIgnoreCase("UnitText")) {
String str = node.getTextContent();
gauge.setUnitText(str);
} else {
LOGGER.severe("Invalid BarGauge Widget Definition File. Unknown Tag: " + node.getNodeName());
return null;
}
}
return gauge;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class TaskManager method BuildDesktopTaskItem.
private DesktopTask BuildDesktopTaskItem(String taskID, FrameworkNode taskNode) {
/**
* <TaskList ID="TestDesktop">
* <TaskItem Type="Desktop">
* <Document Action="Open">foo.html</Document>
* </TaskItem>
* </TaskList>
*/
DesktopTask objDesktopTask = new DesktopTask();
for (FrameworkNode node : taskNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("Document")) {
Utility.ValidateAttributes(new String[] { "Action" }, node);
if (!objDesktopTask.SetDocument(node.getTextContent())) {
LOGGER.severe("Desktop task has invalid document: " + node.getTextContent());
return null;
}
if (node.hasAttribute("Action")) {
if (!objDesktopTask.SetAction(node.getAttribute("Action"))) {
LOGGER.severe("Desktop task has invalid Actiont: " + node.getAttribute("Action"));
}
} else {
objDesktopTask.SetAction("Open");
}
}
}
if (!objDesktopTask.isValid()) {
objDesktopTask = null;
LOGGER.severe("Task with ID: " + taskID + " contains an invalid Desktop Task.");
}
return objDesktopTask;
}
Aggregations