Search in sources :

Example 1 with INPUT_REQ

use of main.content.VALUE.INPUT_REQ in project Eidolons by IDemiurge.

the class CreationHelper method getInput.

public static String getInput(VALUE val, Entity entity, String value, INPUT_REQ preferredInputMode) {
    Class<?> ENUM_CLASS = EnumMaster.getEnumClass(val.getName());
    OBJ_TYPE TYPE = ContentManager.getOBJ_TYPE(val.getName());
    ListChooser.setTooltip("Input for " + val.getName());
    INPUT_REQ inputReq = preferredInputMode;
    if (inputReq == null) {
        inputReq = val.getInputReq();
        if (inputReq == null) {
            if (ENUM_CLASS != null) {
                inputReq = INPUT_REQ.SINGLE_ENUM;
            }
        }
    }
    switch(inputReq) {
        case STRING:
            return DialogMaster.inputText("Set value for " + val.getName(), value);
        case INTEGER:
            return "" + DialogMaster.inputInt("Set value for " + val.getName(), StringMaster.getInteger(val.getDefaultValue()));
        case MULTI_ENUM:
            return ListChooser.chooseEnum(ENUM_CLASS, SELECTION_MODE.MULTIPLE);
        case MULTI_TYPE:
            return ListChooser.chooseType(TYPE, SELECTION_MODE.MULTIPLE);
        case SINGLE_ENUM:
            return ListChooser.chooseEnum(ENUM_CLASS, SELECTION_MODE.SINGLE);
        case SINGLE_TYPE:
            return ListChooser.chooseType(TYPE);
        case SINGLE_TYPE_VAR:
            return null;
        case MULTI_TYPE_VAR:
            return null;
        case MULTI_ENUM_VAR:
            return null;
        case SINGLE_ENUM_VAR:
            return null;
    }
    return null;
}
Also used : INPUT_REQ(main.content.VALUE.INPUT_REQ) OBJ_TYPE(main.content.OBJ_TYPE)

Aggregations

OBJ_TYPE (main.content.OBJ_TYPE)1 INPUT_REQ (main.content.VALUE.INPUT_REQ)1