use of pcgen.facade.core.CampaignFacade in project pcgen by PCGen.
the class Gui2CampaignInfoFactory method getHTMLInfo.
public String getHTMLInfo(SourceSelectionFacade selection) {
if (selection.getCampaigns().getSize() == 1) {
return getHTMLInfo(selection.getCampaigns().getElementAt(0));
}
final HtmlInfoBuilder infoText = new HtmlInfoBuilder(selection.toString());
for (CampaignFacade campaign : selection.getCampaigns()) {
if (campaign == null || !(campaign instanceof Campaign)) {
continue;
}
Campaign aCamp = (Campaign) campaign;
infoText.appendLineBreak();
infoText.appendLineBreak();
infoText.appendTitleElement(aCamp.getDisplayName());
appendCampaignInfo(aCamp, infoText);
}
return infoText.toString();
}
use of pcgen.facade.core.CampaignFacade in project pcgen by PCGen.
the class PCGenFrame method getFormattedCampaigns.
private String getFormattedCampaigns(SourceSelectionFacade sources) {
StringBuilder campList = new StringBuilder(100);
campList.append("<UL>");
int count = 1;
final int maxListLen = 6;
for (CampaignFacade facade : sources.getCampaigns()) {
campList.append("<li>");
if (count >= maxListLen && sources.getCampaigns().getSize() > maxListLen) {
int numExtra = sources.getCampaigns().getSize() - maxListLen + 1;
campList.append(LanguageBundle.getFormattedString("in_loadPcDiffSourcesExcessSources", String.valueOf(numExtra)));
break;
}
campList.append(facade.toString());
campList.append("</li>");
count++;
}
campList.append("</UL>");
return campList.toString();
}
use of pcgen.facade.core.CampaignFacade in project pcgen by PCGen.
the class PCGenFrame method checkSourceEquality.
private boolean checkSourceEquality(SourceSelectionFacade source1, SourceSelectionFacade source2) {
if (source1 == source2) {
return true;
}
if (source1 == null ^ source2 == null) {
return false;
}
//we use reference equality since GameModeFacades come from a fixed database
if (source1.getGameMode().get() != source2.getGameMode().get()) {
return false;
}
ListFacade<CampaignFacade> campaigns1 = source1.getCampaigns();
ListFacade<CampaignFacade> campaigns2 = source2.getCampaigns();
if (campaigns1.getSize() != campaigns2.getSize()) {
return false;
}
for (CampaignFacade campaignFacade : campaigns1) {
if (!campaigns2.containsElement(campaignFacade)) {
return false;
}
}
return true;
}
use of pcgen.facade.core.CampaignFacade in project pcgen by PCGen.
the class InfoGuidePane method refreshDisplayedSources.
private void refreshDisplayedSources(SourceSelectionFacade sources) {
if (sources == null) {
gameModeLabel.setText(Constants.WRAPPED_NONE_SELECTED);
} else {
gameModeLabel.setText(sources.getGameMode().get().getDisplayName());
}
if (sources == null || sources.getCampaigns().isEmpty()) {
campaignList.setText(LanguageBundle.getString("in_si_nosources"));
} else {
HtmlInfoBuilder builder = new HtmlInfoBuilder();
for (CampaignFacade campaign : sources.getCampaigns()) {
builder.append(campaign.getName()).appendLineBreak();
}
campaignList.setText(builder.toString());
}
}
use of pcgen.facade.core.CampaignFacade in project pcgen by PCGen.
the class SourceSelectionDialog method fireSourceLoad.
private void fireSourceLoad() {
SourceSelectionFacade selection;
if (tabs.getSelectedComponent() == basicPanel) {
selection = basicPanel.getSourceSelection();
} else {
selection = FacadeFactory.createSourceSelection(advancedPanel.getSelectedGameMode(), advancedPanel.getSelectedCampaigns());
}
if (selection == null) {
return;
}
List<CampaignFacade> campaigns = ListFacades.wrap(selection.getCampaigns());
if (FacadeFactory.passesPrereqs(campaigns)) {
setVisible(false);
frame.loadSourceSelection(selection);
} else {
JOptionPane.showMessageDialog(this, "Some sources have unfulfilled prereqs", "Cannot Load Selected Sources", JOptionPane.INFORMATION_MESSAGE);
}
}
Aggregations