use of pcgen.facade.core.SkillFacade in project pcgen by PCGen.
the class SkillInfoTab method initComponents.
private void initComponents() {
setOrientation(VERTICAL_SPLIT);
setResizeWeight(0.70);
JSpinner spinner = new JSpinner();
//$NON-NLS-1$
spinner.setEditor(new JSpinner.NumberEditor(spinner, "#0.#"));
skillTable.setDefaultRenderer(Float.class, new SpinnerRenderer(spinner));
skillTable.setDefaultRenderer(Integer.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
skillTable.setDefaultRenderer(String.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
skillTable.setRowHeight(26);
FilterBar<CharacterFacade, SkillFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
cFilterButton.setText(LanguageBundle.getString("in_classString"));
cFilterButton.setEnabled(false);
filterBar.addDisplayableFilter(cFilterButton);
//$NON-NLS-1$
trainedFilterButton.setText(LanguageBundle.getString("in_trained"));
trainedFilterButton.setEnabled(false);
filterBar.addDisplayableFilter(trainedFilterButton);
JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(skillTable, filterBar);
availPanel.setPreferredSize(new Dimension(650, 300));
JScrollPane tableScrollPane;
JPanel tablePanel = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
constraints.fill = java.awt.GridBagConstraints.BOTH;
constraints.weightx = 1.0;
constraints.ipady = 0;
constraints.weighty = 1.0;
SkillPointTableModel.initializeTable(skillpointTable);
tableScrollPane = new JScrollPane(skillpointTable);
tablePanel.add(tableScrollPane, constraints);
htmlPane.setOpaque(false);
htmlPane.setEditable(false);
htmlPane.setFocusable(false);
//$NON-NLS-1$
htmlPane.setContentType("text/html");
skillFilterBox.setRenderer(new DefaultListCellRenderer());
JScrollPane selScrollPane = new JScrollPane(htmlPane);
JPanel skillPanel = new JPanel(new BorderLayout());
skillPanel.add(skillFilterBox, BorderLayout.NORTH);
skillPanel.add(selScrollPane, BorderLayout.CENTER);
selScrollPane.setPreferredSize(new Dimension(530, 300));
FlippingSplitPane topPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, skillPanel, "SkillTop");
setTopComponent(topPane);
FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, "SkillBottom");
bottomPane.setLeftComponent(tablePanel);
tablePanel.setPreferredSize(new Dimension(650, 100));
bottomPane.setRightComponent(infoPane);
infoPane.setPreferredSize(new Dimension(530, 100));
setBottomComponent(bottomPane);
}
use of pcgen.facade.core.SkillFacade in project pcgen by PCGen.
the class CharacterFacadeImpl method refreshLanguageList.
/**
* Regenerate the character's list of languages.
*/
void refreshLanguageList() {
long startTime = new Date().getTime();
List<Language> sortedLanguages = new ArrayList<>(charDisplay.getLanguageSet());
Collections.sort(sortedLanguages);
languages.updateContents(sortedLanguages);
autoLanguagesCache = null;
boolean allowBonusLangAfterFirst = Globals.checkRule(RuleConstants.INTBONUSLANG);
boolean atFirstLvl = theCharacter.getTotalLevels() <= 1;
int bonusLangMax = theCharacter.getBonusLanguageCount();
currBonusLangs = new ArrayList<>();
CNAbility a = theCharacter.getBonusLanguageAbility();
List<String> currBonusLangNameList = theCharacter.getAssociationList(a);
for (LanguageFacade langFacade : languages) {
Language lang = (Language) langFacade;
if (currBonusLangNameList.contains(lang.getKeyName())) {
currBonusLangs.add(lang);
}
}
int bonusLangRemain = bonusLangMax - currBonusLangs.size();
if (!allowBonusLangAfterFirst && !atFirstLvl) {
bonusLangRemain = 0;
}
numBonusLang.set(bonusLangRemain);
if (bonusLangRemain > 0) {
if (allowBonusLangAfterFirst) {
todoManager.addTodo(new TodoFacadeImpl(Tab.SUMMARY, "Languages", "in_sumTodoBonusLanguage", 110));
todoManager.removeTodo("in_sumTodoBonusLanguageFirstOnly");
} else {
todoManager.addTodo(new TodoFacadeImpl(Tab.SUMMARY, "Languages", "in_sumTodoBonusLanguageFirstOnly", 110));
todoManager.removeTodo("in_sumTodoBonusLanguage");
}
} else {
todoManager.removeTodo("in_sumTodoBonusLanguage");
todoManager.removeTodo("in_sumTodoBonusLanguageFirstOnly");
}
int numSkillLangSelected = 0;
int skillLangMax = 0;
//TODO: Need to cope with multiple skill languages
SkillFacade speakLangSkill = dataSet.getSpeakLanguageSkill();
if (speakLangSkill != null) {
Skill skill = (Skill) speakLangSkill;
List<String> langList = theCharacter.getAssociationList(skill);
numSkillLangSelected = langList.size();
skillLangMax = SkillRankControl.getTotalRank(theCharacter, skill).intValue();
}
int skillLangRemain = skillLangMax - numSkillLangSelected;
numSkillLang.set(skillLangRemain);
if (skillLangRemain > 0) {
todoManager.addTodo(new TodoFacadeImpl(Tab.SUMMARY, "Languages", "in_sumTodoSkillLanguage", 112));
} else {
todoManager.removeTodo("in_sumTodoSkillLanguage");
}
if (skillLangRemain < 0) {
todoManager.addTodo(new TodoFacadeImpl(Tab.SUMMARY, "Languages", "in_sumTodoSkillLanguageTooMany", 112));
} else {
todoManager.removeTodo("in_sumTodoSkillLanguageTooMany");
}
long endTime = new Date().getTime();
Logging.log(Logging.DEBUG, "refreshLanguageList took " + (endTime - startTime) + " ms.");
}
use of pcgen.facade.core.SkillFacade 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();
}
use of pcgen.facade.core.SkillFacade in project pcgen by PCGen.
the class CharacterLevelsFacadeImpl method initForCharacter.
/**
* Initialise the instance for the current character.
*/
private void initForCharacter() {
classLevels = new ArrayList<>();
charLevels = new ArrayList<>();
refreshClassList();
charID = theCharacter.getCharID();
SkillFacet skillFacet = FacetLibrary.getFacet(SkillFacet.class);
skillFacet.addDataFacetChangeListener(this);
BonusChangeFacet bcf = FacetLibrary.getFacet(BonusChangeFacet.class);
for (SkillFacade skillFacade : dataSetFacade.getSkills()) {
bcf.addBonusChangeListener(this, "SKILLRANK", skillFacade.getKeyName().toUpperCase());
}
}
use of pcgen.facade.core.SkillFacade in project pcgen by PCGen.
the class CharacterFacadeImpl method getLanguageChoosers.
@Override
public ListFacade<LanguageChooserFacade> getLanguageChoosers() {
CNAbility cna = theCharacter.getBonusLanguageAbility();
DefaultListFacade<LanguageChooserFacade> chooserList = new DefaultListFacade<>();
chooserList.addElement(new LanguageChooserFacadeImpl(this, LanguageBundle.getString("in_sumLangBonus"), //$NON-NLS-1$
cna));
SkillFacade speakLangSkill = dataSet.getSpeakLanguageSkill();
if (speakLangSkill != null) {
chooserList.addElement(new LanguageChooserFacadeImpl(this, //$NON-NLS-1$
LanguageBundle.getString("in_sumLangSkill"), (Skill) speakLangSkill));
}
return chooserList;
}
Aggregations