Search in sources :

Example 6 with SourceSelectionFacade

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

the class FacadeFactory method setDisplayedSources.

public static void setDisplayedSources(SourceSelectionFacade[] sources) {
    displayedSources.setContents(Arrays.asList(sources));
    ArrayList<String> hiddenElements = new ArrayList<>();
    for (SourceSelectionFacade selection : quickSources) {
        if (!ArrayUtils.contains(sources, selection)) {
            hiddenElements.add(selection.toString());
        }
    }
    PCGenSettings.getInstance().setStringArray("hiddenSources", hiddenElements);
}
Also used : SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade) ArrayList(java.util.ArrayList)

Example 7 with SourceSelectionFacade

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

the class FacadeFactory method createCustomSourceSelection.

public static SourceSelectionFacade createCustomSourceSelection(String name) {
    SourceSelectionFacade selection = new CustomSourceSelectionFacade(name);
    customSources.addElement(selection);
    quickSources.addElement(selection);
    displayedSources.addElement(selection);
    setCustomSourceSelectionArray();
    return selection;
}
Also used : SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade)

Example 8 with SourceSelectionFacade

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

the class FacadeFactory method setCustomSourceSelectionArray.

private static void setCustomSourceSelectionArray() {
    List<String> sources = new ArrayList<>();
    for (SourceSelectionFacade csel : customSources) {
        sources.add(csel.toString());
    }
    sourcesContext.setStringArray("selectionNames", sources);
}
Also used : SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade) ArrayList(java.util.ArrayList)

Example 9 with SourceSelectionFacade

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

the class DataLoadTest method data.

/**
	 * Build the list of sources to be checked. Also initialises the plugins and 
	 * loads the game mode and campaign files.
	 */
@Parameters(name = "{1}")
public static Collection<Object[]> data() {
    // Set things up
    loadGameModes();
    SettingsHandler.setOutputDeprecationMessages(false);
    SettingsHandler.setInputUnconstructedMessages(false);
    PCGenSettings.OPTIONS_CONTEXT.setBoolean(PCGenSettings.OPTION_ALLOW_OVERRIDE_DUPLICATES, true);
    List<String> exclusions = Arrays.asList(excludedSources);
    List<SourceSelectionFacade> basicSources = getBasicSources();
    assertFalse("No sources found", basicSources.isEmpty());
    List<Object[]> params = new ArrayList<>();
    for (SourceSelectionFacade ssf : basicSources) {
        String testName = ssf.toString().replaceAll("[\\(\\)]", "_");
        if (!exclusions.contains(testName)) {
            params.add(new Object[] { ssf, testName });
        }
    }
    return params;
}
Also used : SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade) ArrayList(java.util.ArrayList) Parameters(org.junit.runners.Parameterized.Parameters)

Example 10 with SourceSelectionFacade

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

the class DataLoadTest method getBasicSources.

private static List<SourceSelectionFacade> getBasicSources() {
    List<SourceSelectionFacade> basicSources = new ArrayList<>();
    for (Campaign campaign : Globals.getCampaignList()) {
        if (campaign.showInMenu()) {
            SourceSelectionFacade sourceSelection = FacadeFactory.createSourceSelection(campaign.getGameModes().getElementAt(0), Collections.singletonList(campaign), campaign.getName());
            basicSources.add(sourceSelection);
        }
    }
    for (GameMode mode : SystemCollections.getUnmodifiableGameModeList()) {
        String title = mode.getDefaultSourceTitle();
        if (title == null && !mode.getDefaultDataSetList().isEmpty()) {
            title = mode.getName();
        }
        if (!mode.getDefaultDataSetList().isEmpty()) {
            List<CampaignFacade> qcamps = new ArrayList<>();
            List<String> sources = mode.getDefaultDataSetList();
            for (String string : sources) {
                Campaign camp = Globals.getCampaignKeyed(string);
                assertNotNull("Cannot find source " + string + " for game mode " + mode, camp);
                qcamps.add(camp);
            }
            basicSources.add(FacadeFactory.createSourceSelection(mode, qcamps, mode.getDefaultSourceTitle()));
        }
    }
    return basicSources;
}
Also used : GameMode(pcgen.core.GameMode) SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade) Campaign(pcgen.core.Campaign) ArrayList(java.util.ArrayList) CampaignFacade(pcgen.facade.core.CampaignFacade)

Aggregations

SourceSelectionFacade (pcgen.facade.core.SourceSelectionFacade)14 File (java.io.File)4 ArrayList (java.util.ArrayList)4 CampaignFacade (pcgen.facade.core.CampaignFacade)4 PCGFile (pcgen.io.PCGFile)4 SourceFileLoader (pcgen.persistence.SourceFileLoader)3 CharacterFacade (pcgen.facade.core.CharacterFacade)2 GameModeFacade (pcgen.facade.core.GameModeFacade)2 PCGIOHandler (pcgen.io.PCGIOHandler)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 Point (java.awt.Point)1 HashSet (java.util.HashSet)1 BoxLayout (javax.swing.BoxLayout)1 JList (javax.swing.JList)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JTable (javax.swing.JTable)1 JTextField (javax.swing.JTextField)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1