use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method parseNonEmptyToken.
@Override
protected ParseResult parseNonEmptyToken(LoadContext context, Ability ability, String value) {
Visibility vis;
if (value.equals("YES")) {
vis = Visibility.DEFAULT;
} else if (value.equals("DISPLAY")) {
vis = Visibility.DISPLAY_ONLY;
} else if (value.equals("EXPORT")) {
vis = Visibility.OUTPUT_ONLY;
} else if (value.equals("NO")) {
vis = Visibility.HIDDEN;
} else {
return new ParseResult.Fail("Unable to understand " + getTokenName() + " tag: " + value, context);
}
context.getObjectContext().put(ability, ObjectKey.VISIBILITY, vis);
return ParseResult.SUCCESS;
}
use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method parseNonEmptyToken.
@Override
public ParseResult parseNonEmptyToken(LoadContext context, AbilityCategory ac, String value) {
Visibility vis;
if (value.equals("YES")) {
vis = Visibility.DEFAULT;
} else if (value.equals("QUALIFY")) {
vis = Visibility.QUALIFY;
} else if (value.equals("NO")) {
vis = Visibility.HIDDEN;
} else {
return new ParseResult.Fail("Unable to understand " + getTokenName() + " tag: " + value, context);
}
ac.setVisible(vis);
return ParseResult.SUCCESS;
}
use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method unparse.
@Override
public String[] unparse(LoadContext context, PCTemplate template) {
Visibility vis = context.getObjectContext().getObject(template, ObjectKey.VISIBILITY);
if (vis == null) {
return null;
}
String visString;
if (vis.equals(Visibility.DEFAULT)) {
visString = "YES";
} else if (vis.equals(Visibility.DISPLAY_ONLY)) {
visString = "DISPLAY";
} else if (vis.equals(Visibility.OUTPUT_ONLY)) {
visString = "EXPORT";
} else if (vis.equals(Visibility.HIDDEN)) {
visString = "NO";
} else {
context.addWriteMessage("Visibility " + vis + " is not a valid Visibility for a PCTemplate");
return null;
}
return new String[] { visString };
}
use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method parseNonEmptyToken.
@Override
protected ParseResult parseNonEmptyToken(LoadContext context, ContentDefinition factDef, String value) {
Visibility vis;
if (value.equals("YES")) {
vis = Visibility.DEFAULT;
} else if (value.equals("DISPLAY")) {
vis = Visibility.DISPLAY_ONLY;
} else if (value.equals("EXPORT")) {
vis = Visibility.OUTPUT_ONLY;
} else if (value.equals("NO")) {
vis = Visibility.HIDDEN;
} else {
return new ParseResult.Fail("Unable to understand " + getTokenName() + " tag: " + value, context);
}
factDef.setVisibility(vis);
return ParseResult.SUCCESS;
}
use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method parseNonEmptyToken.
@Override
protected ParseResult parseNonEmptyToken(LoadContext context, Equipment eq, String value) {
Visibility vis;
if (value.equals("YES")) {
vis = Visibility.DEFAULT;
} else if (value.equals("DISPLAY")) {
vis = Visibility.DISPLAY_ONLY;
} else if (value.equals("EXPORT")) {
vis = Visibility.OUTPUT_ONLY;
} else if (value.equals("NO")) {
vis = Visibility.HIDDEN;
} else {
ComplexParseResult cpr = new ComplexParseResult();
cpr.addErrorMessage("Unexpected value used in " + getTokenName() + " in Equipment");
cpr.addErrorMessage(" " + value + " is not a valid value for " + getTokenName());
cpr.addErrorMessage(" Valid values in Equipment are YES, NO, DISPLAY, EXPORT");
return cpr;
}
context.getObjectContext().put(eq, ObjectKey.VISIBILITY, vis);
return ParseResult.SUCCESS;
}
Aggregations