Search in sources :

Example 6 with HtmlInfoBuilder

use of pcgen.gui2.util.HtmlInfoBuilder in project pcgen by PCGen.

the class Gui2CampaignInfoFactory method getHTMLInfo.

/**
	 * @see pcgen.core.facade.CampaignInfoFactory#getHTMLInfo(pcgen.core.facade.CampaignFacade)
	 */
@Override
public String getHTMLInfo(CampaignFacade campaign) {
    if (campaign == null || !(campaign instanceof Campaign)) {
        return "";
    }
    Campaign aCamp = (Campaign) campaign;
    final HtmlInfoBuilder infoText = new HtmlInfoBuilder(aCamp.getDisplayName());
    appendCampaignInfo(aCamp, infoText);
    return infoText.toString();
}
Also used : Campaign(pcgen.core.Campaign) HtmlInfoBuilder(pcgen.gui2.util.HtmlInfoBuilder)

Example 7 with HtmlInfoBuilder

use of pcgen.gui2.util.HtmlInfoBuilder in project pcgen by PCGen.

the class Gui2InfoFactory method getHTMLInfo.

@Override
public String getHTMLInfo(InfoFacade facade) {
    if (facade == null) {
        return EMPTY_STRING;
    }
    // Use a more detailed info if we can
    if (facade instanceof AbilityFacade) {
        return getHTMLInfo((AbilityFacade) facade);
    }
    if (facade instanceof ClassFacade) {
        return getHTMLInfo((ClassFacade) facade, null);
    }
    if (facade instanceof DeityFacade) {
        return getHTMLInfo((DeityFacade) facade);
    }
    if (facade instanceof DomainFacade) {
        return getHTMLInfo((DomainFacade) facade);
    }
    if (facade instanceof EquipmentFacade) {
        return getHTMLInfo((EquipmentFacade) facade);
    }
    if (facade instanceof KitFacade) {
        return getHTMLInfo((KitFacade) facade);
    }
    if (facade instanceof RaceFacade) {
        return getHTMLInfo((RaceFacade) facade);
    }
    if (facade instanceof SkillFacade) {
        return getHTMLInfo((SkillFacade) facade);
    }
    if (facade instanceof SpellFacade) {
        return getHTMLInfo((SpellFacade) facade);
    }
    if (facade instanceof TempBonusFacade) {
        return getHTMLInfo((TempBonusFacade) facade);
    }
    if (facade instanceof TemplateFacade) {
        return getHTMLInfo((TemplateFacade) facade);
    }
    final HtmlInfoBuilder infoText = new HtmlInfoBuilder();
    infoText.appendTitleElement(facade.toString());
    infoText.appendLineBreak();
    if (!facade.getType().isEmpty()) {
        //$NON-NLS-1$
        infoText.appendI18nElement("in_irInfoType", facade.getType());
        infoText.appendLineBreak();
    }
    infoText.appendI18nElement(//$NON-NLS-1$
    "in_itmInfoLabelTextSource", facade.getSource());
    return infoText.toString();
}
Also used : DomainFacade(pcgen.facade.core.DomainFacade) EquipmentFacade(pcgen.facade.core.EquipmentFacade) ClassFacade(pcgen.facade.core.ClassFacade) KitFacade(pcgen.facade.core.KitFacade) TempBonusFacade(pcgen.facade.core.TempBonusFacade) AbilityFacade(pcgen.facade.core.AbilityFacade) SkillFacade(pcgen.facade.core.SkillFacade) DeityFacade(pcgen.facade.core.DeityFacade) HtmlInfoBuilder(pcgen.gui2.util.HtmlInfoBuilder) RaceFacade(pcgen.facade.core.RaceFacade) SpellFacade(pcgen.facade.core.SpellFacade) TemplateFacade(pcgen.facade.core.TemplateFacade)

Example 8 with HtmlInfoBuilder

use of pcgen.gui2.util.HtmlInfoBuilder in project pcgen by PCGen.

the class CharacterFacadeImpl method showKitWarnings.

/**
	 * Show the user any warnings from thekit application and get 
	 * their approval to continue.
	 * 
	 * @param kit The kit being applied.
	 * @param warnings The warnigns generated in the test application.
	 * @return true if the kit should be applied, false if not.
	 */
private boolean showKitWarnings(Kit kit, List<String> warnings) {
    if (warnings.isEmpty()) {
        return true;
    }
    HtmlInfoBuilder warningMsg = new HtmlInfoBuilder();
    //$NON-NLS-1$
    warningMsg.append(LanguageBundle.getString("in_kitWarnStart"));
    warningMsg.appendLineBreak();
    //$NON-NLS-1$
    warningMsg.append("<UL>");
    for (String string : warnings) {
        warningMsg.appendLineBreak();
        //$NON-NLS-1$
        warningMsg.append("<li>");
        warningMsg.append(string);
        //$NON-NLS-1$
        warningMsg.append("</li>");
    }
    //$NON-NLS-1$
    warningMsg.append("</UL>");
    warningMsg.appendLineBreak();
    //$NON-NLS-1$
    warningMsg.append(LanguageBundle.getString("in_kitWarnEnd"));
    return delegate.showWarningConfirm(kit.getDisplayName(), warningMsg.toString());
}
Also used : HtmlInfoBuilder(pcgen.gui2.util.HtmlInfoBuilder)

Example 9 with HtmlInfoBuilder

use of pcgen.gui2.util.HtmlInfoBuilder 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 10 with HtmlInfoBuilder

use of pcgen.gui2.util.HtmlInfoBuilder in project pcgen by PCGen.

the class CharacterManager method showLoadNotices.

/**
	 * Show the user any warnings or errors from the character load and get 
	 * their approval to continue.
	 * 
	 * @param errors Is this a list of errors?  
	 * @param warnings The warnings generated on load.
	 * @param fileName The name of the file being loaded.
	 * @param delegate The UIDelegate to use for notifications.
	 * @return true if the character should be loaded, false if not.
	 */
private static boolean showLoadNotices(boolean errors, List<String> warnings, String fileName, UIDelegate delegate) {
    if (warnings.isEmpty()) {
        return true;
    }
    HtmlInfoBuilder warningMsg = new HtmlInfoBuilder();
    Level lvl;
    if (errors) {
        //$NON-NLS-1$
        warningMsg.append(LanguageBundle.getString("in_cmErrorStart"));
        Logging.errorPrint("The following errors were encountered while loading " + fileName);
        lvl = Logging.ERROR;
    } else {
        //$NON-NLS-1$
        warningMsg.append(LanguageBundle.getString("in_cmWarnStart"));
        Logging.log(Logging.WARNING, "The following warnings were encountered while loading " + fileName);
        lvl = Logging.WARNING;
    }
    warningMsg.appendLineBreak();
    //$NON-NLS-1$
    warningMsg.append("<UL>");
    for (final String string : warnings) {
        warningMsg.appendLineBreak();
        //$NON-NLS-1$
        warningMsg.append("<li>");
        warningMsg.append(string);
        //$NON-NLS-1$
        warningMsg.append("</li>");
        //$NON-NLS-1$
        Logging.log(lvl, "* " + string);
    }
    //$NON-NLS-1$
    warningMsg.append("</UL>");
    warningMsg.appendLineBreak();
    if (errors) {
        //$NON-NLS-1$
        warningMsg.append(LanguageBundle.getString("in_cmErrorEnd"));
        delegate.showErrorMessage(fileName, warningMsg.toString());
        return false;
    }
    //$NON-NLS-1$
    warningMsg.append(LanguageBundle.getString("in_cmWarnEnd"));
    return delegate.showWarningConfirm(fileName, warningMsg.toString());
}
Also used : Level(java.util.logging.Level) HtmlInfoBuilder(pcgen.gui2.util.HtmlInfoBuilder)

Aggregations

HtmlInfoBuilder (pcgen.gui2.util.HtmlInfoBuilder)22 BigDecimal (java.math.BigDecimal)3 ArrayList (java.util.ArrayList)3 Equipment (pcgen.core.Equipment)3 PCClass (pcgen.core.PCClass)3 CharacterSpell (pcgen.core.character.CharacterSpell)3 TreeMap (java.util.TreeMap)2 TreeSet (java.util.TreeSet)2 CDOMObject (pcgen.cdom.base.CDOMObject)2 CNAbility (pcgen.cdom.content.CNAbility)2 RaceType (pcgen.cdom.enumeration.RaceType)2 Ability (pcgen.core.Ability)2 Campaign (pcgen.core.Campaign)2 Domain (pcgen.core.Domain)2 SpellInfo (pcgen.core.character.SpellInfo)2 Spell (pcgen.core.spell.Spell)2 CampaignFacade (pcgen.facade.core.CampaignFacade)2 File (java.io.File)1 List (java.util.List)1 Map (java.util.Map)1