use of pcgen.cdom.content.fact.FactDefinition in project pcgen by PCGen.
the class Gui2InfoFactory method appendFacts.
private void appendFacts(HtmlInfoBuilder infoText, CDOMObject cdo) {
Class<? extends CDOMObject> cl = cdo.getClass();
LoadContext context = Globals.getContext();
Collection<FactDefinition> defs = context.getReferenceContext().getConstructedCDOMObjects(FactDefinition.class);
for (FactDefinition<?, ?> def : defs) {
if (def.getUsableLocation().isAssignableFrom(cl)) {
Visibility visibility = def.getVisibility();
if (visibility != null && visibility.isVisibleTo(View.VISIBLE_DISPLAY)) {
FactKey<?> fk = def.getFactKey();
Indirect<?> fact = cdo.get(fk);
if (fact != null) {
infoText.appendSpacer();
infoText.append("<b>");
infoText.append(fk.toString());
infoText.append(":</b> ");
infoText.append(fact.getUnconverted());
}
}
}
}
Collection<FactSetDefinition> setdefs = context.getReferenceContext().getConstructedCDOMObjects(FactSetDefinition.class);
for (FactSetDefinition<?, ?> def : setdefs) {
if (def.getUsableLocation().isAssignableFrom(cl)) {
Visibility visibility = def.getVisibility();
if (visibility != null && visibility.isVisibleTo(View.VISIBLE_DISPLAY)) {
FactSetKey<?> fk = def.getFactSetKey();
String s = getSetString(cdo, fk);
if (s != null) {
infoText.appendSpacer();
infoText.append("<b>");
infoText.append(fk.toString());
infoText.append(":</b> ");
infoText.append(s);
}
}
}
}
}
use of pcgen.cdom.content.fact.FactDefinition in project pcgen by PCGen.
the class RequiredTokenTest method resetContext.
protected void resetContext() {
URI testURI = testCampaign.getURI();
context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
context.setSourceURI(testURI);
context.setExtractURI(testURI);
cd = new FactDefinition();
}
use of pcgen.cdom.content.fact.FactDefinition in project pcgen by PCGen.
the class SelectableTokenTest method resetContext.
protected void resetContext() {
URI testURI = testCampaign.getURI();
context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
context.setSourceURI(testURI);
context.setExtractURI(testURI);
cd = new FactDefinition();
}
use of pcgen.cdom.content.fact.FactDefinition in project pcgen by PCGen.
the class DisplayNameTokenTest method resetContext.
protected void resetContext() {
URI testURI = testCampaign.getURI();
context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
context.setSourceURI(testURI);
context.setExtractURI(testURI);
cd = new FactDefinition();
}
use of pcgen.cdom.content.fact.FactDefinition in project pcgen by PCGen.
the class SelectableTokenIntegrationTest method resetContext.
private void resetContext() {
URI testURI = testCampaign.getURI();
context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
context.setSourceURI(testURI);
context.setExtractURI(testURI);
cd = new FactDefinition();
cd.setDisplayName(PROP_1);
cd.setFormatManager(STRING_MGR);
cd.setName(PROP_1);
cd.setFactName(PROP_1);
cd.setUsableLocation(Domain.class);
cd.setVisibility(Visibility.DEFAULT);
}
Aggregations