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