Search in sources :

Example 1 with SkillFacade

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) SkillFacade(pcgen.facade.core.SkillFacade) Dimension(java.awt.Dimension) SpinnerRenderer(pcgen.gui2.util.table.TableCellUtilities.SpinnerRenderer) CharacterFacade(pcgen.facade.core.CharacterFacade) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) TableCellUtilities(pcgen.gui2.util.table.TableCellUtilities) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) JSpinner(javax.swing.JSpinner) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel)

Example 2 with SkillFacade

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.");
}
Also used : ArrayList(java.util.ArrayList) SkillFacade(pcgen.facade.core.SkillFacade) Date(java.util.Date) LanguageFacade(pcgen.facade.core.LanguageFacade) CNAbility(pcgen.cdom.content.CNAbility) Skill(pcgen.core.Skill) Language(pcgen.core.Language)

Example 3 with SkillFacade

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();
}
Also used : DomainFacade(pcgen.facade.core.DomainFacade) EquipmentFacade(pcgen.facade.core.EquipmentFacade) ClassFacade(pcgen.facade.core.ClassFacade) KitFacade(pcgen.facade.core.KitFacade) TempBonusFacade(pcgen.facade.core.TempBonusFacade) AbilityFacade(pcgen.facade.core.AbilityFacade) SkillFacade(pcgen.facade.core.SkillFacade) DeityFacade(pcgen.facade.core.DeityFacade) HtmlInfoBuilder(pcgen.gui2.util.HtmlInfoBuilder) RaceFacade(pcgen.facade.core.RaceFacade) SpellFacade(pcgen.facade.core.SpellFacade) TemplateFacade(pcgen.facade.core.TemplateFacade)

Example 4 with SkillFacade

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());
    }
}
Also used : BonusChangeFacet(pcgen.cdom.facet.BonusChangeFacet) SkillFacade(pcgen.facade.core.SkillFacade) SkillFacet(pcgen.cdom.facet.model.SkillFacet)

Example 5 with SkillFacade

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;
}
Also used : CNAbility(pcgen.cdom.content.CNAbility) LanguageChooserFacade(pcgen.facade.core.LanguageChooserFacade) Skill(pcgen.core.Skill) SkillFacade(pcgen.facade.core.SkillFacade) DefaultListFacade(pcgen.facade.util.DefaultListFacade)

Aggregations

SkillFacade (pcgen.facade.core.SkillFacade)7 CNAbility (pcgen.cdom.content.CNAbility)2 BonusChangeFacet (pcgen.cdom.facet.BonusChangeFacet)2 SkillFacet (pcgen.cdom.facet.model.SkillFacet)2 Skill (pcgen.core.Skill)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 DefaultListCellRenderer (javax.swing.DefaultListCellRenderer)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JSpinner (javax.swing.JSpinner)1 Language (pcgen.core.Language)1 AbilityFacade (pcgen.facade.core.AbilityFacade)1 CharacterFacade (pcgen.facade.core.CharacterFacade)1 ClassFacade (pcgen.facade.core.ClassFacade)1 DeityFacade (pcgen.facade.core.DeityFacade)1