Search in sources :

Example 1 with WeightedDataValue

use of pcgen.core.doomsdaybook.WeightedDataValue in project pcgen by PCGen.

the class NameGenPanel method loadList.

private String loadList(Element list) throws DataConversionException {
    pcgen.core.doomsdaybook.DDList dataList = new pcgen.core.doomsdaybook.DDList(allVars, list.getAttributeValue("title"), list.getAttributeValue("id"));
    java.util.List<?> elements = list.getChildren();
    for (final Object element : elements) {
        Element child = (Element) element;
        String elementName = child.getName();
        if (elementName.equals("VALUE")) {
            WeightedDataValue dv = new WeightedDataValue(child.getText(), child.getAttribute("weight").getIntValue());
            List<?> subElements = child.getChildren("SUBVALUE");
            for (final Object subElement1 : subElements) {
                Element subElement = (Element) subElement1;
                dv.addSubValue(subElement.getAttributeValue("type"), subElement.getText());
            }
            dataList.add(dv);
        }
    }
    allVars.addDataElement(dataList);
    return dataList.getId();
}
Also used : DataElement(pcgen.core.doomsdaybook.DataElement) Element(org.jdom2.Element) WeightedDataValue(pcgen.core.doomsdaybook.WeightedDataValue)

Aggregations

Element (org.jdom2.Element)1 DataElement (pcgen.core.doomsdaybook.DataElement)1 WeightedDataValue (pcgen.core.doomsdaybook.WeightedDataValue)1