use of pcgen.facade.core.ClassFacade in project pcgen by PCGen.
the class CharacterFacadeImpl method removeCharacterLevels.
/**
* @see pcgen.core.facade.CharacterFacade#removeCharacterLevels(int)
*/
@Override
public void removeCharacterLevels(int levels) {
for (int i = levels; i > 0 && !pcClassLevels.isEmpty(); i--) {
ClassFacade classFacade = charLevelsFacade.getClassTaken(pcClassLevels.getElementAt(pcClassLevels.getSize() - 1));
pcClassLevels.removeElement(pcClassLevels.getSize() - 1);
if (classFacade instanceof PCClass) {
Logging.log(Logging.INFO, charDisplay.getName() + ": Removing level " + //$NON-NLS-1$
(pcClassLevels.getSize() + 1) + " in class " + //$NON-NLS-1$
classFacade);
theCharacter.incrementClassLevel(-1, (PCClass) classFacade);
}
charLevelsFacade.removeLastLevel();
}
// Clean up the class list
for (Iterator<ClassFacade> iterator = pcClasses.iterator(); iterator.hasNext(); ) {
ClassFacade classFacade = iterator.next();
boolean stillPresent = false;
for (CharacterLevelFacade charLevel : pcClassLevels) {
if (charLevelsFacade.getClassTaken(charLevel) == classFacade) {
stillPresent = true;
break;
}
}
if (!stillPresent) {
iterator.remove();
}
}
postLevellingUpdates();
}
use of pcgen.facade.core.ClassFacade 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.ClassFacade in project pcgen by PCGen.
the class ClassLevelTableModel method getValueAt.
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (rowIndex == levels.getSize()) {
return null;
}
switch(columnIndex) {
case 0:
return rowIndex + 1;
case 1:
return levels.getHPGained(levels.getElementAt(rowIndex));
case 2:
ClassFacade c = levels.getClassTaken(levels.getElementAt(rowIndex));
String classKey = c.getKeyName();
if (finalLevelMap.get(classKey) == rowIndex) {
return c.toString() + " (" + character.getClassLevel(c) + ")";
}
return c.toString();
default:
return null;
}
}
use of pcgen.facade.core.ClassFacade in project pcgen by PCGen.
the class ClassInfoHandler method valueChanged.
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
TreePath path;
if (e.getSource() == availableTable.getSelectionModel()) {
path = availableTable.getTree().getSelectionPath();
} else {
path = selectedTable.getTree().getSelectionPath();
}
if (path == null) {
return;
}
ClassFacade c = null;
DefaultMutableTreeNode treenode = (DefaultMutableTreeNode) path.getLastPathComponent();
Object[] objs = treenode.getUserObjectPath();
for (Object object : objs) {
if (object instanceof ClassFacade) {
c = (ClassFacade) object;
break;
}
}
if (c != null) {
text = character.getSpellSupport().getClassInfo(c);
classPane.setText(text);
}
}
}
use of pcgen.facade.core.ClassFacade 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