Search in sources :

Example 6 with ListChooser

use of main.swing.generic.components.editors.lists.ListChooser in project Eidolons by IDemiurge.

the class ListEditor method launch.

@Override
public String launch(String value, String name) {
    if (listData == null && !listDataSet) {
        if (res_name != null) {
            listData = ResourceManager.getFilesInFolder(res_name);
            // StringMaster.formatResList(listData);
            Collections.sort(listData);
        } else if (ENUM) {
            // TODO get enum class by name (constants)
            if (enumClass != null) {
                listData = EnumMaster.getEnumConstantNames(enumClass);
            } else {
                Class<?> ENUM_CLASS = EnumMaster.getEnumClass(name);
                if (// TODO find
                ENUM_CLASS == null) {
                    ENUM_CLASS = EnumMaster.getEnumClass(name, MACRO_CONTENT_CONSTS.class);
                }
                listData = EnumMaster.getEnumConstantNames(ENUM_CLASS);
                StringMaster.formatList(listData);
            }
        } else {
            if (TYPE == null) {
                TYPE = DC_TYPE.ABILS;
                subgroup = name;
                if (!XML_Reader.getSubGroups(TYPE.toString()).contains(subgroup)) {
                    Err.info("No subgroup found! - " + subgroup);
                }
                if (getBASE_TYPE() instanceof DC_TYPE) {
                    switch((DC_TYPE) getBASE_TYPE()) {
                        case BF_OBJ:
                            TYPE = DC_TYPE.ACTIONS;
                            subgroup = null;
                            break;
                        case CHARS:
                            TYPE = DC_TYPE.ACTIONS;
                            subgroup = null;
                            break;
                        case UNITS:
                            TYPE = DC_TYPE.ACTIONS;
                            subgroup = null;
                            break;
                    }
                }
            }
            listData = DataManager.getTypeNamesGroup(TYPE, subgroup);
            if (filterGroup != null) {
                listData = DataManager.getTypeNamesGroup(TYPE, filterGroup);
            } else if (filterSubgroup != null) {
                listData = DataManager.getTypesSubGroupNames(TYPE, filterSubgroup);
            }
            if (getConditions() != null) {
                Ref ref = new Ref(Game.game, getEntity().getId());
                listData = DataManager.toStringList(new Filter<ObjType>(ref, getConditions()).filter(DataManager.toTypeList(listData, TYPE)));
            }
        }
    }
    ListChooser listChooser;
    if (mode == SELECTION_MODE.SINGLE) {
        listChooser = new ListChooser(listData, ENUM, TYPE);
    } else {
        secondListData = new ArrayList<>();
        if (value != null) {
            if (!value.equals(ContentManager.getDefaultEmptyValue())) {
                secondListData = ListMaster.toList(value.toString(), ENUM);
            }
        }
        listChooser = new ListChooser(listData, secondListData, ENUM, TYPE);
    }
    if (ENUM || TYPE == DC_TYPE.UNITS || TYPE == DC_TYPE.CHARS || TYPE == DC_TYPE.DEITIES) {
        columns = 1;
    }
    listChooser.setColumns(columns);
    listChooser.setVarTypes(getVarTypes());
    listChooser.setVarClass(getVarTypesClass());
    String newValue = listChooser.getString();
    return newValue;
}
Also used : Ref(main.entity.Ref) DC_TYPE(main.content.DC_TYPE) Filter(main.elements.Filter) ListChooser(main.swing.generic.components.editors.lists.ListChooser)

Example 7 with ListChooser

use of main.swing.generic.components.editors.lists.ListChooser in project Eidolons by IDemiurge.

the class NameMaster method pickName.

public static String pickName(Entity hero) {
    List<String> nameGroups = StringMaster.openContainer(getNamesGroups(getBg(hero)), " ");
    List<String> list = new ArrayList<>();
    for (String nameGroup : nameGroups) {
        list.addAll(StringMaster.openContainer(getNamesForGroup(nameGroup, EntityCheckMaster.getGender(hero) == HeroEnums.GENDER.FEMALE), " "));
    }
    String name = new ListChooser(SELECTION_MODE.MULTIPLE, list, false).choose();
    if (name != null) {
        return StringMaster.joinStringList(StringMaster.openContainer(name), " ", true);
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) ListChooser(main.swing.generic.components.editors.lists.ListChooser)

Example 8 with ListChooser

use of main.swing.generic.components.editors.lists.ListChooser in project Eidolons by IDemiurge.

the class LE_Palette method deletePalettes.

protected void deletePalettes(boolean removeFile) {
    // int i = DialogMaster.optionChoice(paletteTabs.getTabs().toArray(),
    // "choose palette to remove");
    // paletteTabs.removeTab(i);
    List<String> list = new ArrayList<>();
    for (HC_Tab tab : paletteTabs.getTabs()) {
        list.add(tab.getName());
    }
    String string = new ListChooser(SELECTION_MODE.MULTIPLE, list, false).choose();
    for (String ws : StringMaster.open(string)) {
        int i = list.indexOf(ws);
        paletteTabs.removeTab(i);
        if (removeFile) {
            FileManager.getFile(getWorkspaceFolder() + ws + ".xml").delete();
        }
    }
    // if (!removeFile) {
    // if (DialogMaster.confirm("Remove File?"))
    // FileManager.getFile(getWorkspaceFolder()).delete();
    // } else
    refresh();
}
Also used : ArrayList(java.util.ArrayList) HC_Tab(eidolons.client.cc.gui.neo.tabs.HC_Tab) ListChooser(main.swing.generic.components.editors.lists.ListChooser)

Example 9 with ListChooser

use of main.swing.generic.components.editors.lists.ListChooser in project Eidolons by IDemiurge.

the class PresetLauncher method choosePreset.

public static Preset choosePreset(List<Preset> presets) {
    List<String> list = new ArrayList<>();
    for (Preset s : presets) {
        list.add(s.toString());
    }
    String result = new ListChooser(SELECTION_MODE.SINGLE, list, false).choose();
    if (result == null) {
        return null;
    }
    Preset preset = PresetMaster.findPreset(result);
    if (preset != null) {
        PresetMaster.setPreset(preset);
    }
    return preset;
}
Also used : Preset(eidolons.test.Preset) ArrayList(java.util.ArrayList) ListChooser(main.swing.generic.components.editors.lists.ListChooser)

Example 10 with ListChooser

use of main.swing.generic.components.editors.lists.ListChooser in project Eidolons by IDemiurge.

the class TestLauncher method choose.

public String choose(DC_TYPE type) {
    String filterGroup = getFilterGroup(type);
    List<String> data = DataManager.getTypeNames(type);
    if (!filterGroup.isEmpty()) {
        data = DataManager.getTypesSubGroupNames(type, filterGroup);
    }
    String objects = new ListChooser(SELECTION_MODE.MULTIPLE, data, type).choose();
    return objects;
}
Also used : ListChooser(main.swing.generic.components.editors.lists.ListChooser)

Aggregations

ListChooser (main.swing.generic.components.editors.lists.ListChooser)17 ObjType (main.entity.type.ObjType)6 ArrayList (java.util.ArrayList)5 EnumMaster (main.system.auxiliary.EnumMaster)3 LINK_VARIANT (eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)2 File (java.io.File)2 DC_TYPE (main.content.DC_TYPE)2 PROPERTY (main.content.values.properties.PROPERTY)2 Ref (main.entity.Ref)2 ImageChooser (main.swing.generic.components.editors.ImageChooser)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 HC_Tab (eidolons.client.cc.gui.neo.tabs.HC_Tab)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 DC_Cell (eidolons.entity.obj.DC_Cell)1 Unit (eidolons.entity.obj.unit.Unit)1 ArenaBattleMaster (eidolons.game.battlecraft.logic.battle.arena.ArenaBattleMaster)1 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)1 Preset (eidolons.test.Preset)1