Search in sources :

Example 16 with CharacterFacade

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;
}
Also used : ConsoleUIDelegate(pcgen.system.ConsoleUIDelegate) SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade) SourceFileLoader(pcgen.persistence.SourceFileLoader) PCGFile(pcgen.io.PCGFile) File(java.io.File) CharacterFacade(pcgen.facade.core.CharacterFacade) ConsoleUIDelegate(pcgen.system.ConsoleUIDelegate) UIDelegate(pcgen.facade.core.UIDelegate)

Example 17 with CharacterFacade

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;
}
Also used : CharacterFacade(pcgen.facade.core.CharacterFacade) CharacterFacadeImpl(pcgen.gui2.facade.CharacterFacadeImpl)

Example 18 with CharacterFacade

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);
}
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) EmptyBorder(javax.swing.border.EmptyBorder) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) CharacterFacade(pcgen.facade.core.CharacterFacade) TemplateFacade(pcgen.facade.core.TemplateFacade)

Example 19 with CharacterFacade

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();
    }
}
Also used : CharacterFacade(pcgen.facade.core.CharacterFacade)

Example 20 with CharacterFacade

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();
}
Also used : ListFacade(pcgen.facade.util.ListFacade) CharacterFacade(pcgen.facade.core.CharacterFacade)

Aggregations

CharacterFacade (pcgen.facade.core.CharacterFacade)31 File (java.io.File)11 JPanel (javax.swing.JPanel)9 JScrollPane (javax.swing.JScrollPane)9 FilterBar (pcgen.gui2.filter.FilterBar)9 SearchFilterPanel (pcgen.gui2.filter.SearchFilterPanel)9 FlippingSplitPane (pcgen.gui2.tools.FlippingSplitPane)9 Box (javax.swing.Box)8 BorderLayout (java.awt.BorderLayout)6 ArrayList (java.util.ArrayList)5 PCGFile (pcgen.io.PCGFile)5 EmptyBorder (javax.swing.border.EmptyBorder)4 JCheckBox (javax.swing.JCheckBox)3 JLabel (javax.swing.JLabel)3 PlayerCharacter (pcgen.core.PlayerCharacter)3 SuperNode (pcgen.facade.core.SpellSupportFacade.SuperNode)3 SortableTableModel (pcgen.gui2.util.table.SortableTableModel)3 SortableTableRowSorter (pcgen.gui2.util.table.SortableTableRowSorter)3 IOException (java.io.IOException)2 URI (java.net.URI)2