use of pcgen.core.Campaign in project pcgen by PCGen.
the class AbstractGlobalTokenTestCase method classSetUp.
@BeforeClass
public static void classSetUp() throws URISyntaxException {
Locale.setDefault(Locale.US);
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class AbstractTokenTestCase method classSetUp.
@BeforeClass
public static void classSetUp() throws URISyntaxException {
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class AbstractPCClassLevelTokenTestCase method classSetUp.
@BeforeClass
public static final void classSetUp() throws URISyntaxException {
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class Gui2CampaignInfoFactory method appendCampaignInfo.
private void appendCampaignInfo(Campaign aCamp, final HtmlInfoBuilder infoText) {
infoText.appendLineBreak();
if (aCamp.getSizeOfListFor(ListKey.FILE_COVER) > 0) {
CampaignSourceEntry image = aCamp.getSafeListFor(ListKey.FILE_COVER).get(0);
infoText.appendIconElement(image.getURI().toString());
}
if (aCamp.getSizeOfListFor(ListKey.FILE_LOGO) > 0) {
CampaignSourceEntry image = aCamp.getSafeListFor(ListKey.FILE_LOGO).get(0);
infoText.appendIconElement(image.getURI().toString());
}
if (aCamp.getSizeOfListFor(ListKey.FILE_COVER) > 0 || aCamp.getSizeOfListFor(ListKey.FILE_LOGO) > 0) {
infoText.appendLineBreak();
}
String bString = SourceFormat.getFormattedString(aCamp, SourceFormat.MEDIUM, true);
if (StringUtils.isEmpty(bString)) {
bString = SourceFormat.getFormattedString(aCamp, SourceFormat.LONG, true);
}
//$NON-NLS-1$
infoText.appendI18nElement("in_sumSource", bString);
//$NON-NLS-1$
infoText.appendI18nFormattedElement(//$NON-NLS-1$
"in_infByPub", aCamp.getSafe(StringKey.PUB_NAME_LONG));
infoText.appendLineBreak();
// Add the data set release status
Status status = aCamp.getSafe(ObjectKey.STATUS);
//$NON-NLS-1$
infoText.appendI18nElement(//$NON-NLS-1$
"in_infStatus", //$NON-NLS-1$ //$NON-NLS-2$
"<font color=\"#" + Integer.toHexString(status.getColor()) + "\">" + status + //$NON-NLS-1$
"</font>");
infoText.appendLineBreak();
String descr = aCamp.get(StringKey.DESCRIPTION);
if (descr != null) {
//$NON-NLS-1$
infoText.appendI18nElement("in_infDesc", descr);
infoText.appendLineBreak();
}
// Add the website URLs
List<CampaignURL> webURLs = getUrlListForKind(aCamp, URLKind.WEBSITE);
if (!webURLs.isEmpty()) {
//$NON-NLS-1$
infoText.appendI18nElement("in_infWebsite", buildURLListString(webURLs));
infoText.appendLineBreak();
}
if (!aCamp.getType().isEmpty()) {
//$NON-NLS-1$
infoText.appendI18nElement("in_infType", aCamp.getType());
infoText.appendSpacer();
}
infoText.appendI18nElement("in_infRank", String.valueOf(//$NON-NLS-1$
aCamp.getSafe(IntegerKey.CAMPAIGN_RANK)));
if (!StringUtil.join(aCamp.getSafeListFor(ListKey.GAME_MODE), ", ").isEmpty()) {
infoText.appendSpacer();
//$NON-NLS-1$
infoText.appendI18nElement(//$NON-NLS-1$
"in_infGame", StringUtil.join(aCamp.getSafeListFor(ListKey.GAME_MODE), ", "));
}
infoText.appendLineBreak();
// Add the purchase URLs
List<CampaignURL> purchaseURLs = getUrlListForKind(aCamp, URLKind.PURCHASE);
if (!purchaseURLs.isEmpty()) {
//$NON-NLS-1$
infoText.appendI18nElement("in_infPurchase", buildURLListString(purchaseURLs));
infoText.appendLineBreak();
}
// Add the survey URLs
List<CampaignURL> surveyURLs = getUrlListForKind(aCamp, URLKind.SURVEY);
if (!surveyURLs.isEmpty()) {
//$NON-NLS-1$
infoText.appendI18nElement("in_infSurvey", buildURLListString(surveyURLs));
infoText.appendLineBreak();
}
String preString = PrerequisiteUtilities.preReqHTMLStringsForList(null, null, aCamp.getPrerequisiteList(), false);
if (!preString.isEmpty()) {
//$NON-NLS-1$
infoText.appendI18nFormattedElement("in_InfoRequirements", preString);
}
boolean infoDisplayed = false;
List<String> info = aCamp.getListFor(ListKey.INFO_TEXT);
if (info != null) {
if (!infoDisplayed) {
infoText.appendLineBreak();
}
//$NON-NLS-1$
infoText.appendSmallTitleElement(LanguageBundle.getString("in_infInf"));
infoText.appendLineBreak();
for (String infotext : info) {
infoText.append(infotext);
infoText.appendLineBreak();
}
infoDisplayed = true;
}
List<String> copyright = aCamp.getListFor(ListKey.SECTION_15);
if (copyright != null) {
if (!infoDisplayed) {
infoText.appendLineBreak();
}
//$NON-NLS-1$
infoText.appendSmallTitleElement(LanguageBundle.getString("in_infCopyright"));
infoText.appendLineBreak();
for (String license : copyright) {
infoText.append(license);
infoText.appendLineBreak();
}
}
List<Campaign> subCampaigns = aCamp.getSubCampaigns();
List<CampaignSourceEntry> notFoundSubCampaigns = aCamp.getNotFoundSubCampaigns();
if (subCampaigns != null && notFoundSubCampaigns != null && (!subCampaigns.isEmpty() || !notFoundSubCampaigns.isEmpty())) {
infoText.appendLineBreak();
infoText.appendSmallTitleElement(LanguageBundle.getString(//$NON-NLS-1$
"in_infIncludedCampaigns"));
infoText.appendLineBreak();
for (Campaign subCamp : subCampaigns) {
infoText.append(subCamp.getDisplayName());
infoText.appendLineBreak();
}
for (CampaignSourceEntry subCse : notFoundSubCampaigns) {
infoText.append(LanguageBundle.getFormattedString("in_infMissingCampaign", subCse.getURI()));
infoText.appendLineBreak();
}
}
infoText.appendLineBreak();
infoText.appendI18nElement("in_infPccPath", aCamp.getSourceURI().getPath());
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class FacadeFactory method initGameModes.
private static void initGameModes(List<GameMode> modes) {
for (GameMode mode : modes) {
String title = mode.getDefaultSourceTitle();
if (SettingsHandler.getGame().equals(mode) && title == null && !mode.getDefaultDataSetList().isEmpty()) {
title = mode.getName();
}
if (title != null && !"".equals(title)) {
DefaultListFacade<CampaignFacade> qcamps = new DefaultListFacade<>();
List<String> sources = mode.getDefaultDataSetList();
for (String string : sources) {
Campaign camp = Globals.getCampaignKeyed(string);
if (camp != null) {
qcamps.addElement(camp);
} else {
Logging.log(Logging.WARNING, "Unable to find source " + string + " used in default source " + title + " for game mode " + mode + ". " + title + " might not work correctly.");
}
}
if (qcamps.isEmpty()) {
Logging.log(Logging.WARNING, "Unable to load default source '" + title + "'. All of its sources are missing.");
continue;
}
quickSources.addElement(new BasicSourceSelectionFacade(mode.getDefaultSourceTitle(), qcamps, mode));
}
}
}
Aggregations