use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class FtlMigrationTest method loadCharacter.
/**
* @param characterFile
* @return
*/
private CharacterFacade loadCharacter(String characterFilename) {
File file = new File(characterFilename);
if (!PCGFile.isPCGenCharacterFile(file)) {
Logging.errorPrint("Invalid character file specified: " + file.getAbsolutePath());
return null;
}
// Load data
UIDelegate uiDelegate = new ConsoleUIDelegate();
SourceSelectionFacade sourcesForCharacter = CharacterManager.getRequiredSourcesForCharacter(file, uiDelegate);
Logging.log(Logging.INFO, "Loading sources " + sourcesForCharacter.getCampaigns() + " using game mode " + sourcesForCharacter.getGameMode());
SourceFileLoader loader = new SourceFileLoader(sourcesForCharacter, uiDelegate);
loader.execute();
// Load character
CharacterFacade character = CharacterManager.openCharacter(file, uiDelegate, loader.getDataSetFacade());
return character;
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class CharacterManager method createChracterFacade.
private static CharacterFacade createChracterFacade(UIDelegate delegate, DataSetFacade dataset, final PlayerCharacter newPC) {
CharacterFacade character = new CharacterFacadeImpl(newPC, delegate, dataset);
characters.addElement(character);
return character;
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class TemplateInfoTab method initComponents.
private void initComponents() {
FlippingSplitPane topPane = new FlippingSplitPane("TemplateTop");
setTopComponent(topPane);
setOrientation(VERTICAL_SPLIT);
JPanel availPanel = new JPanel(new BorderLayout());
FilterBar<CharacterFacade, TemplateFacade> bar = new FilterBar<>();
bar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
bar.addDisplayableFilter(qFilterButton);
availPanel.add(bar, BorderLayout.NORTH);
availableTable.setDisplayableFilter(bar);
availableTable.setTreeCellRenderer(qualifiedRenderer);
availPanel.add(new JScrollPane(availableTable), BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
addButton.setHorizontalTextPosition(SwingConstants.LEADING);
box.add(addButton);
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<CharacterFacade, TemplateFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
selectedTable.setDisplayableFilter(filterBar);
selectedTable.setTreeCellRenderer(qualifiedRenderer);
selPanel.add(new JScrollPane(selectedTable), BorderLayout.CENTER);
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);
setBottomComponent(infoPane);
setResizeWeight(0.75);
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class CharacterTabs method stateChanged.
@Override
public void stateChanged(ChangeEvent e) {
int index = getSelectedIndex();
CharacterFacade character = index != -1 ? characters.get(index) : null;
frame.setSelectedCharacter(character);
if (character != null) {
infoTabbedPane.setCharacter(character);
} else {
infoTabbedPane.clearStateMap();
}
}
use of pcgen.facade.core.CharacterFacade in project pcgen by PCGen.
the class CharacterTabs method elementsChanged.
@Override
public void elementsChanged(ListEvent<CharacterFacade> e) {
removeAll();
for (CharacterFacade character : characters) {
listenerMap.remove(character).removeListeners();
}
characters.clear();
for (CharacterFacade character : (ListFacade<CharacterFacade>) e.getSource()) {
addCharacter(character);
}
infoTabbedPane.clearStateMap();
}
Aggregations