Search in sources :

Example 11 with Visibility

use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.

the class VisibleToken method unparse.

@Override
public String[] unparse(LoadContext context, Equipment eq) {
    Visibility vis = context.getObjectContext().getObject(eq, 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 an Equipment");
        return null;
    }
    return new String[] { visString };
}
Also used : Visibility(pcgen.util.enumeration.Visibility)

Example 12 with Visibility

use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.

the class VisibleToken method unparse.

@Override
public String[] unparse(LoadContext context, EquipmentModifier eqm) {
    Visibility vis = context.getObjectContext().getObject(eqm, ObjectKey.VISIBILITY);
    if (vis == null) {
        return null;
    }
    String visString;
    if (vis.equals(Visibility.DEFAULT)) {
        visString = "YES";
    } else if (vis.equals(Visibility.QUALIFY)) {
        visString = "QUALIFY";
    } else if (vis.equals(Visibility.HIDDEN)) {
        visString = "NO";
    } else {
        context.addWriteMessage("Visibility " + vis + " is not a valid Visibility for a EqMod");
        return null;
    }
    return new String[] { visString };
}
Also used : Visibility(pcgen.util.enumeration.Visibility)

Example 13 with Visibility

use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.

the class VisibleToken method unparse.

@Override
public String[] unparse(LoadContext context, PCClass pcc) {
    Visibility vis = context.getObjectContext().getObject(pcc, ObjectKey.VISIBILITY);
    if (vis == null) {
        return null;
    }
    String visString;
    if (vis.equals(Visibility.DEFAULT)) {
        visString = "YES";
    } else if (vis.equals(Visibility.HIDDEN)) {
        visString = "NO";
    } else {
        context.addWriteMessage("Visibility " + vis + " is not a valid Visibility for a PCClass");
        return null;
    }
    return new String[] { visString };
}
Also used : Visibility(pcgen.util.enumeration.Visibility)

Example 14 with Visibility

use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.

the class VisibleToken method unparse.

@Override
public String[] unparse(LoadContext context, Kit kit) {
    Visibility vis = kit.get(ObjectKey.VISIBILITY);
    if (vis == null) {
        return null;
    }
    String visString;
    if (vis.equals(Visibility.DEFAULT)) {
        visString = "YES";
    } else if (vis.equals(Visibility.QUALIFY)) {
        visString = "QUALIFY";
    } else if (vis.equals(Visibility.HIDDEN)) {
        visString = "NO";
    } else {
        context.addWriteMessage("Visibility " + vis + " is not a valid Visibility for a Kit");
        return null;
    }
    return new String[] { visString };
}
Also used : Visibility(pcgen.util.enumeration.Visibility)

Example 15 with Visibility

use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.

the class VisibleToken method parseNonEmptyToken.

@Override
protected ParseResult parseNonEmptyToken(LoadContext context, Kit kit, String value) {
    Visibility vis;
    if (value.equals("QUALIFY")) {
        vis = Visibility.QUALIFY;
    } else if (value.equals("NO")) {
        vis = Visibility.HIDDEN;
    } else if (value.equals("YES")) {
        vis = Visibility.DEFAULT;
    } else {
        return new ParseResult.Fail("Can't understand Visibility: " + value, context);
    }
    kit.put(ObjectKey.VISIBILITY, vis);
    return ParseResult.SUCCESS;
}
Also used : Visibility(pcgen.util.enumeration.Visibility)

Aggregations

Visibility (pcgen.util.enumeration.Visibility)23 ParseResult (pcgen.rules.persistence.token.ParseResult)4 Skill (pcgen.core.Skill)2 ComplexParseResult (pcgen.rules.persistence.token.ComplexParseResult)2 FactDefinition (pcgen.cdom.content.fact.FactDefinition)1 FactSetDefinition (pcgen.cdom.content.factset.FactSetDefinition)1 LoadContext (pcgen.rules.context.LoadContext)1