Node description = this.getXmlChildNode(itemXmlNode,"description");
if(description==itemXmlNode)return null;
String categoryDescription = description.getTextContent();
//we may now create the asociated panel
ParametersPanel panel = new ParametersPanel(categoryDescription);
//then add parameters to this panel
Node parametersNode = this.getXmlChildNode(itemXmlNode,"parameters");
if(parametersNode==itemXmlNode)return null;
Node parameter = parametersNode.getFirstChild();
if(parameter != null)
{
//enumerate the parameters if there is some
do
{
if(parameter.getLocalName() == "parameter")
{
String parameterType = null;
String parameterDescription= null;
String parameterName= null;
NamedNodeMap attributes = parameter.getAttributes();
if(attributes != null)
{
Node typeNode = null;
if((typeNode=attributes.getNamedItem("type")) != null)
{
parameterType=typeNode.getTextContent();
}
Node nameNode = null;
if((nameNode=attributes.getNamedItem("name")) != null)
{
parameterName=nameNode.getTextContent();
}
}
parameterDescription = parameter.getTextContent();
panel.addParameter(parameterType,parameterName,parameterDescription);
}
}while((parameter = parameter.getNextSibling()) != null);
}
//still need to add the pattern to the panel
Node patternNode = this.getXmlChildNode(itemXmlNode,"pattern");
if(patternNode==itemXmlNode)return null;
Node patternItem = patternNode.getFirstChild();
if(patternItem != null)
{
//enumerate the parameters if there is some
do
{
if(patternItem.getLocalName() == null) // it's a part of the pattern text
{
panel.addPatternItem(PatternItem.Type.LITTERAL,patternItem.getTextContent());
}
if(patternItem.getLocalName() == "var") //it's a reference in the pattern
{
panel.addPatternItem(PatternItem.Type.REFERENCE,patternItem.getTextContent());
}
}while((patternItem = patternItem.getNextSibling()) != null);
}
CreationTreeNode itemTreeNode = new CreationTreeNode(itemName,categoryDescription,panel);