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();
}
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);
}
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;
}
}
}
Aggregations