use of pcgen.core.doomsdaybook.DataElement in project pcgen by PCGen.
the class NameGenPanel method loadStructureDD.
private void loadStructureDD() {
if (chkStructure.isSelected()) {
cbStructure.setModel(new DefaultComboBoxModel());
cbStructure.setEnabled(false);
} else {
Vector<DataElement> struct = new Vector<>();
for (String key : ((RuleSet) cbCatalog.getSelectedItem())) {
try {
struct.add(allVars.getDataElement(key));
} catch (Exception e) {
Logging.errorPrint(e.getMessage(), e);
}
}
DefaultComboBoxModel structModel = new DefaultComboBoxModel(struct);
cbStructure.setModel(structModel);
cbStructure.setEnabled(true);
}
}
use of pcgen.core.doomsdaybook.DataElement 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);
}
}
use of pcgen.core.doomsdaybook.DataElement in project pcgen by PCGen.
the class NameGenPanel method displayButtons.
private void displayButtons(Rule rule) {
clearButtons();
for (String key : rule) {
try {
DataElement ele = allVars.getDataElement(key);
if (ele.getTitle() != null) {
NameButton nb = new NameButton(ele);
nb.addActionListener(this::NameButtonActionPerformed);
buttonPanel.add(nb);
}
} catch (Exception e) {
Logging.errorPrint(e.getMessage(), e);
}
}
buttonPanel.repaint();
}
Aggregations