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