Search in sources :

Example 1 with RaceFacade

use of pcgen.facade.core.RaceFacade 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 2 with RaceFacade

use of pcgen.facade.core.RaceFacade in project pcgen by PCGen.

the class RaceInfoTab method initComponents.

private void initComponents() {
    FlippingSplitPane topPane = new FlippingSplitPane("RaceTop");
    setTopComponent(topPane);
    setOrientation(VERTICAL_SPLIT);
    JPanel availPanel = new JPanel(new BorderLayout());
    FilterBar<Object, RaceFacade> bar = new FilterBar<>();
    bar.addDisplayableFilter(new SearchFilterPanel());
    //$NON-NLS-1$
    noRacialHdFilterButton.setText(LanguageBundle.getString("in_irNoRacialHd"));
    //$NON-NLS-1$
    noRacialHdFilterButton.setToolTipText(LanguageBundle.getString("in_irNoRacialHdTip"));
    bar.addDisplayableFilter(noRacialHdFilterButton);
    //$NON-NLS-1$
    qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
    bar.addDisplayableFilter(qFilterButton);
    raceTable.setDisplayableFilter(bar);
    availPanel.add(bar, BorderLayout.NORTH);
    raceTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    raceTable.setTreeCellRenderer(qualifiedRenderer);
    availPanel.add(new JScrollPane(raceTable), BorderLayout.CENTER);
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    selectRaceButton.setHorizontalTextPosition(SwingConstants.LEADING);
    box.add(selectRaceButton);
    box.add(Box.createHorizontalStrut(5));
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    availPanel.add(box, BorderLayout.SOUTH);
    topPane.setLeftComponent(availPanel);
    JPanel selPanel = new JPanel(new BorderLayout());
    FilterBar<Object, RaceFacade> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    selectedTable.setDisplayableFilter(filterBar);
    selectedTable.setTreeCellRenderer(qualifiedRenderer);
    JScrollPane scrollPane = new JScrollPane(selectedTable);
    selPanel.add(scrollPane, BorderLayout.CENTER);
    scrollPane.setPreferredSize(new Dimension(0, 0));
    box = Box.createHorizontalBox();
    box.add(Box.createHorizontalStrut(5));
    box.add(removeButton);
    box.add(Box.createHorizontalGlue());
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    selPanel.add(box, BorderLayout.SOUTH);
    topPane.setRightComponent(selPanel);
    topPane.setResizeWeight(0.75);
    setBottomComponent(infoPane);
    setResizeWeight(0.75);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) Box(javax.swing.Box) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel) Dimension(java.awt.Dimension) EmptyBorder(javax.swing.border.EmptyBorder) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) RaceFacade(pcgen.facade.core.RaceFacade)

Example 3 with RaceFacade

use of pcgen.facade.core.RaceFacade in project pcgen by PCGen.

the class CompanionSupportFacadeImpl method linkCompanion.

/**
	 * Adds a newly opened character into the existing
	 * companion framework. This character will replace
	 * the dummy CompanionFacade that has the same
	 * file name. This should typically be called
	 * when a character is opened from one of the follower stubs
	 * @param character the character to link
	 */
private void linkCompanion(CharacterFacade character) {
    for (CompanionFacadeDelegate delegate : companionList) {
        File file = delegate.getFileRef().get();
        String name = delegate.getNameRef().get();
        RaceFacade race = delegate.getRaceRef().get();
        if (file.equals(character.getFileRef().get()) && name.equals(character.getNameRef().get()) && (race == null || race.equals(character.getRaceRef().get()))) {
            String companionType = delegate.getCompanionType();
            delegate.setCompanionFacade(character);
            // Note: When creating a companion we leave the linking to the create code.  
            if (character.getMaster() == null && character.getRaceRef().get() != null && !Constants.NONESELECTED.equals(character.getRaceRef().get().getKeyName())) {
                CompanionList compList = keyToCompanionListMap.get(companionType);
                final Follower newMaster = new Follower(charDisplay.getFileName(), charDisplay.getName(), compList);
                FollowerOption followerOpt = getFollowerOpt(compList, (Race) character.getRaceRef().get());
                if (followerOpt != null) {
                    newMaster.setAdjustment(followerOpt.getAdjustment());
                } else {
                    Logging.log(Logging.WARNING, "Failed to find FollowerOption for complist " + compList + " and race " + character.getRaceRef().get());
                }
                ((CharacterFacadeImpl) character).getTheCharacter().setMaster(newMaster);
            }
            return;
        }
    }
}
Also used : FollowerOption(pcgen.core.FollowerOption) CompanionList(pcgen.cdom.list.CompanionList) Follower(pcgen.core.character.Follower) File(java.io.File) RaceFacade(pcgen.facade.core.RaceFacade)

Aggregations

RaceFacade (pcgen.facade.core.RaceFacade)3 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 File (java.io.File)1 Box (javax.swing.Box)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 EmptyBorder (javax.swing.border.EmptyBorder)1 CompanionList (pcgen.cdom.list.CompanionList)1 FollowerOption (pcgen.core.FollowerOption)1 Follower (pcgen.core.character.Follower)1 AbilityFacade (pcgen.facade.core.AbilityFacade)1 ClassFacade (pcgen.facade.core.ClassFacade)1 DeityFacade (pcgen.facade.core.DeityFacade)1 DomainFacade (pcgen.facade.core.DomainFacade)1 EquipmentFacade (pcgen.facade.core.EquipmentFacade)1 KitFacade (pcgen.facade.core.KitFacade)1 SkillFacade (pcgen.facade.core.SkillFacade)1 SpellFacade (pcgen.facade.core.SpellFacade)1 TempBonusFacade (pcgen.facade.core.TempBonusFacade)1