util
Clone or download
Modified Files
package com.StreamPi.Util.XMLConfigHelper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class XMLConfigHelper {
public XMLConfigHelper()
{
}
public String getStringProperty(Element parentElement, String propertyName) throws Exception
{
return getProperty(parentElement, propertyName);
}
public int getIntProperty(Element parentElement, String propertyName) throws Exception
{
return Integer.parseInt(getProperty(parentElement, propertyName));
}
public boolean getBooleanProperty(Element parentElement, String propertyName) throws Exception
{
return getProperty(parentElement, propertyName).equals("true");
}
public String getProperty(Element parentElement, String propertyName) throws Exception
{
return parentElement.getElementsByTagName(propertyName).item(0).getTextContent();
}
public String getStringProperty(Element parentElement, String propertyName, String ifNotPresent, boolean printStackTrace)
{
String tbr = ifNotPresent;
try
{
tbr = getProperty(parentElement, propertyName);
}
catch(Exception e)
{
if(printStackTrace)
e.printStackTrace();
}
return tbr;
}
public String getStringProperty(Element parentElement, String propertyName, String ifNotPresent)
{
return getStringProperty(parentElement, propertyName, ifNotPresent, true);
}
public int getIntProperty(Element parentElement, String propertyName, int ifNotPresent)
{
int tbr = ifNotPresent;
try
{
tbr = Integer.parseInt(getProperty(parentElement, propertyName));
}
catch(Exception e)
{
e.printStackTrace();
}
return tbr;
}
public boolean getBooleanProperty(Element parentElement, String propertyName, boolean ifNotPresent)
{
boolean tbr = ifNotPresent;
try
{
tbr = getProperty(parentElement, propertyName).equals("true");
}
catch(Exception e)
{
e.printStackTrace();
}
return tbr;
}
public boolean doesElementExist(Element parent, String nameOfElement)
{
return parent.getElementsByTagName(nameOfElement).getLength() > 0;
}
public boolean doesElementExist(Document document, String nameOfElement)
{
return document.getElementsByTagName(nameOfElement).getLength() > 0;
}
}
module com.StreamPi.Util {
module com.StreamPi.Util {
requires transitive org.kordamp.ikonli.javafx;
requires transitive org.kordamp.ikonli.javafx;
requires transitive org.kordamp.ikonli.fontawesome5;
requires transitive org.kordamp.ikonli.fontawesome5;
requires transitive javafx.base;
requires transitive javafx.base;
requires transitive javafx.controls;
requires transitive javafx.controls;
requires transitive java.xml;
exports com.StreamPi.Util.Version;
exports com.StreamPi.Util.Version;
exports com.StreamPi.Util.Exception;
exports com.StreamPi.Util.Exception;
exports com.StreamPi.Util.Platform;
exports com.StreamPi.Util.Platform;
exports com.StreamPi.Util.FormHelper;
exports com.StreamPi.Util.FormHelper;
exports com.StreamPi.Util.StartAtBoot;
exports com.StreamPi.Util.StartAtBoot;
exports com.StreamPi.Util.Alert;
exports com.StreamPi.Util.Alert;
exports com.StreamPi.Util.ComboBox;
exports com.StreamPi.Util.ComboBox;
exports com.StreamPi.Util.XMLConfigHelper;
}
}