Search in sources :

Example 1 with DataValue

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

the class NameGenPanel method setPronounciationText.

private void setPronounciationText(Iterable<DataValue> data) {
    StringBuilder proBuffer = new StringBuilder();
    for (DataValue val : data) {
        String aPronounciation = val.getSubValue("pronounciation");
        if (aPronounciation == null) {
            aPronounciation = val.getValue();
        }
        proBuffer.append(aPronounciation);
    }
    setPronounciationText(proBuffer.toString());
}
Also used : WeightedDataValue(pcgen.core.doomsdaybook.WeightedDataValue) DataValue(pcgen.core.doomsdaybook.DataValue)

Example 2 with DataValue

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

the class NameGenPanel method setNameText.

private void setNameText(Iterable<DataValue> data) {
    StringBuilder nameBuffer = new StringBuilder();
    for (DataValue val : data) {
        nameBuffer.append(val.getValue());
    }
    setNameText(nameBuffer.toString());
}
Also used : WeightedDataValue(pcgen.core.doomsdaybook.WeightedDataValue) DataValue(pcgen.core.doomsdaybook.DataValue)

Example 3 with DataValue

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

the class NameGenPanel method generate.

/**
	 * Generate a Rule
	 * @return new Rule
	 */
public Rule generate() {
    try {
        Rule rule;
        if (chkStructure.isSelected()) {
            RuleSet rs = (RuleSet) cbCatalog.getSelectedItem();
            rule = rs.getRule();
        } else {
            rule = (Rule) cbStructure.getSelectedItem();
        }
        ArrayList<DataValue> aName = rule.getData();
        setNameText(aName);
        setMeaningText(aName);
        setPronounciationText(aName);
        return rule;
    } catch (Exception e) {
        Logging.errorPrint(e.getMessage(), e);
        return null;
    }
}
Also used : RuleSet(pcgen.core.doomsdaybook.RuleSet) WeightedDataValue(pcgen.core.doomsdaybook.WeightedDataValue) DataValue(pcgen.core.doomsdaybook.DataValue) CRRule(pcgen.core.doomsdaybook.CRRule) HyphenRule(pcgen.core.doomsdaybook.HyphenRule) Rule(pcgen.core.doomsdaybook.Rule) SpaceRule(pcgen.core.doomsdaybook.SpaceRule) FileNotFoundException(java.io.FileNotFoundException) DataConversionException(org.jdom2.DataConversionException)

Example 4 with DataValue

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

the class NameGenPanel method NameButtonActionPerformed.

private void NameButtonActionPerformed(ActionEvent evt) {
    try {
        NameButton nb = (NameButton) evt.getSource();
        DataElement element = nb.getDataElement();
        element.getData();
        Rule rule = this.lastRule;
        if (rule == null) {
            if (chkStructure.isSelected()) {
                RuleSet rs = (RuleSet) cbCatalog.getSelectedItem();
                rule = rs.getLastRule();
            } else {
                rule = (Rule) cbStructure.getSelectedItem();
            }
            this.lastRule = rule;
        }
        ArrayList<DataValue> aName = rule.getLastData();
        setNameText(aName);
        setMeaningText(aName);
        setPronounciationText(aName);
    } catch (Exception e) {
        Logging.errorPrint(e.getMessage(), e);
    }
}
Also used : DataElement(pcgen.core.doomsdaybook.DataElement) RuleSet(pcgen.core.doomsdaybook.RuleSet) WeightedDataValue(pcgen.core.doomsdaybook.WeightedDataValue) DataValue(pcgen.core.doomsdaybook.DataValue) CRRule(pcgen.core.doomsdaybook.CRRule) HyphenRule(pcgen.core.doomsdaybook.HyphenRule) Rule(pcgen.core.doomsdaybook.Rule) SpaceRule(pcgen.core.doomsdaybook.SpaceRule) FileNotFoundException(java.io.FileNotFoundException) DataConversionException(org.jdom2.DataConversionException)

Example 5 with DataValue

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

the class NameGenPanel method setMeaningText.

private void setMeaningText(Iterable<DataValue> data) {
    StringBuilder meaningBuffer = new StringBuilder();
    for (DataValue val : data) {
        //$NON-NLS-1$ // XML attribute no translation
        String aMeaning = val.getSubValue("meaning");
        if (aMeaning == null) {
            aMeaning = val.getValue();
        }
        meaningBuffer.append(aMeaning);
    }
    setMeaningText(meaningBuffer.toString());
}
Also used : WeightedDataValue(pcgen.core.doomsdaybook.WeightedDataValue) DataValue(pcgen.core.doomsdaybook.DataValue)

Aggregations

DataValue (pcgen.core.doomsdaybook.DataValue)5 WeightedDataValue (pcgen.core.doomsdaybook.WeightedDataValue)5 FileNotFoundException (java.io.FileNotFoundException)2 DataConversionException (org.jdom2.DataConversionException)2 CRRule (pcgen.core.doomsdaybook.CRRule)2 HyphenRule (pcgen.core.doomsdaybook.HyphenRule)2 Rule (pcgen.core.doomsdaybook.Rule)2 RuleSet (pcgen.core.doomsdaybook.RuleSet)2 SpaceRule (pcgen.core.doomsdaybook.SpaceRule)2 DataElement (pcgen.core.doomsdaybook.DataElement)1