Search in sources :

Example 1 with CampaignFacade

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();
}
Also used : Campaign(pcgen.core.Campaign) HtmlInfoBuilder(pcgen.gui2.util.HtmlInfoBuilder) CampaignFacade(pcgen.facade.core.CampaignFacade)

Example 2 with CampaignFacade

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

Example 3 with CampaignFacade

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

Example 4 with CampaignFacade

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

Example 5 with CampaignFacade

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

Aggregations

CampaignFacade (pcgen.facade.core.CampaignFacade)20 ArrayList (java.util.ArrayList)6 Campaign (pcgen.core.Campaign)5 GameMode (pcgen.core.GameMode)4 GameModeFacade (pcgen.facade.core.GameModeFacade)4 SourceSelectionFacade (pcgen.facade.core.SourceSelectionFacade)4 DefaultListFacade (pcgen.facade.util.DefaultListFacade)4 URI (java.net.URI)3 BorderLayout (java.awt.BorderLayout)2 Dimension (java.awt.Dimension)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 DataSet (pcgen.core.DataSet)2 GameModeDisplayFacade (pcgen.facade.core.GameModeDisplayFacade)2 HtmlInfoBuilder (pcgen.gui2.util.HtmlInfoBuilder)2 PCGIOHandler (pcgen.io.PCGIOHandler)2 Point (java.awt.Point)1 File (java.io.File)1 HashSet (java.util.HashSet)1 Box (javax.swing.Box)1