use of pcgen.facade.core.SpellFacade in project pcgen by PCGen.
the class SpellSupportFacadeImpl method buildAvailableNodes.
/**
* Construct the list of available spells for the character.
*/
private void buildAvailableNodes() {
availableSpellNodes.clearContents();
// Scan character classes for spell classes
List<PCClass> classList = getCharactersSpellcastingClasses();
// Look at each spell on each spellcasting class
for (PCClass pcClass : classList) {
DoubleKeyMapToList<SpellFacade, String, SpellNode> existingSpells = buildExistingSpellMap(availableSpellNodes, pcClass);
for (Spell spell : pc.getAllSpellsInLists(charDisplay.getSpellLists(pcClass))) {
// Create SpellNodeImpl for each spell
CharacterSpell charSpell = new CharacterSpell(pcClass, spell);
SpellFacadeImplem spellImplem = new SpellFacadeImplem(pc, spell, charSpell, null);
HashMapToList<CDOMList<Spell>, Integer> levelInfo = pc.getSpellLevelInfo(spell);
for (CDOMList<Spell> spellList : charDisplay.getSpellLists(pcClass)) {
List<Integer> levels = levelInfo.getListFor(spellList);
if (levels != null) {
for (Integer level : levels) {
SpellNodeImpl node = new SpellNodeImpl(spellImplem, pcClass, String.valueOf(level), null);
if (!existingSpells.containsInList(spellImplem, node.getSpellLevel(), node)) {
// Add to list
availableSpellNodes.addElement(node);
}
}
}
}
}
}
}
use of pcgen.facade.core.SpellFacade in project pcgen by PCGen.
the class QualifiedSpellTreeCellRenderer method getTreeCellRendererComponent.
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean focus) {
Object obj = ((DefaultMutableTreeNode) value).getUserObject();
if (//$NON-NLS-1$
"".equals(obj)) {
//$NON-NLS-1$
obj = LanguageBundle.getString("in_none");
}
super.getTreeCellRendererComponent(tree, obj, sel, expanded, leaf, row, focus);
if (obj instanceof SpellNode) {
SpellNode spellNode = (SpellNode) obj;
SpellFacade spell = spellNode.getSpell();
ClassFacade pcClass = spellNode.getSpellcastingClass();
if (!character.isQualifiedFor(spell, pcClass)) {
setForeground(UIPropertyContext.getNotQualifiedColor());
}
}
if (obj instanceof InfoFacade && ((InfoFacade) obj).isNamePI()) {
setFont(FontManipulation.bold_italic(getFont()));
} else {
setFont(FontManipulation.plain(getFont()));
}
return this;
}
use of pcgen.facade.core.SpellFacade in project pcgen by PCGen.
the class Gui2InfoFactory method getHTMLInfo.
@Override
public String getHTMLInfo(InfoFacade facade) {
if (facade == null) {
return EMPTY_STRING;
}
// Use a more detailed info if we can
if (facade instanceof AbilityFacade) {
return getHTMLInfo((AbilityFacade) facade);
}
if (facade instanceof ClassFacade) {
return getHTMLInfo((ClassFacade) facade, null);
}
if (facade instanceof DeityFacade) {
return getHTMLInfo((DeityFacade) facade);
}
if (facade instanceof DomainFacade) {
return getHTMLInfo((DomainFacade) facade);
}
if (facade instanceof EquipmentFacade) {
return getHTMLInfo((EquipmentFacade) facade);
}
if (facade instanceof KitFacade) {
return getHTMLInfo((KitFacade) facade);
}
if (facade instanceof RaceFacade) {
return getHTMLInfo((RaceFacade) facade);
}
if (facade instanceof SkillFacade) {
return getHTMLInfo((SkillFacade) facade);
}
if (facade instanceof SpellFacade) {
return getHTMLInfo((SpellFacade) facade);
}
if (facade instanceof TempBonusFacade) {
return getHTMLInfo((TempBonusFacade) facade);
}
if (facade instanceof TemplateFacade) {
return getHTMLInfo((TemplateFacade) facade);
}
final HtmlInfoBuilder infoText = new HtmlInfoBuilder();
infoText.appendTitleElement(facade.toString());
infoText.appendLineBreak();
if (!facade.getType().isEmpty()) {
//$NON-NLS-1$
infoText.appendI18nElement("in_irInfoType", facade.getType());
infoText.appendLineBreak();
}
infoText.appendI18nElement(//$NON-NLS-1$
"in_itmInfoLabelTextSource", facade.getSource());
return infoText.toString();
}
Aggregations