Search in sources :

Example 6 with HC_PagedListPanel

use of eidolons.client.cc.gui.pages.HC_PagedListPanel in project Eidolons by IDemiurge.

the class VendorListsPanel method initTab.

protected void initTab(String title) {
    Map<String, HC_PagedListPanel> map = listMaps.get(title);
    if (map == null) {
        Chronos.mark(title);
        map = initListMap(title);
        Chronos.logTimeElapsedForMark(title);
        G_Panel tab = tabMap.get(title);
        for (String listName : map.keySet()) {
            tab.add(map.get(listName), "wrap");
        }
        listMaps.put(title, map);
    } else {
        try {
            map.values().iterator().next().getCurrentList().getList().setSelectedIndex(0);
        } catch (Exception e) {
        // main.system.ExceptionMaster.printStackTrace(e);
        }
    }
}
Also used : G_Panel(main.swing.generic.components.G_Panel) HC_PagedListPanel(eidolons.client.cc.gui.pages.HC_PagedListPanel)

Example 7 with HC_PagedListPanel

use of eidolons.client.cc.gui.pages.HC_PagedListPanel in project Eidolons by IDemiurge.

the class VendorListsPanel method initListMap.

public Map<String, HC_PagedListPanel> initListMap(String tabName) {
    List<String> group = getListGroup(tabName);
    ArrayList<String> specialLists = new ArrayList<>();
    Map<String, HC_PagedListPanel> map = new XLinkedMap<>();
    for (String listName : group) {
        if (checkSpecial(listName)) {
            specialLists.add(listName);
            continue;
        }
        if (!responsive) {
            if (!checkList(listName, false)) {
                continue;
            }
        }
        if (!showAll) {
            if (!checkList(listName, true)) {
                continue;
            }
        }
        List<String> types = DataManager.getTypesSubGroupNames(TYPE, listName);
        if (Launcher.ILYA_MODE) {
            if (TYPE == DC_TYPE.SPELLS || TYPE == DC_TYPE.SKILLS) {
                FilterMaster.filterByProp(types, G_PROPS.WORKSPACE_GROUP.getName(), "" + MetaEnums.WORKSPACE_GROUP.DESIGN, TYPE, true);
                FilterMaster.filterByProp(types, G_PROPS.WORKSPACE_GROUP.getName(), "" + MetaEnums.WORKSPACE_GROUP.IMPLEMENT, TYPE, true);
                FilterMaster.filterByProp(types, PROPS.ITEM_SHOP_CATEGORY.getName(), "" + ItemEnums.ITEM_SHOP_CATEGORY.SPECIAL, TYPE, true);
            // so you see, it wouldn't be hard to filter the items for
            // each shop in macro
            }
        }
        if (types == null) {
            // shot in the leg!
            continue;
        }
        if (types.isEmpty()) {
            continue;
        }
        List<ObjType> data;
        // if (checkSpecial(listName))
        // data = getSpecialData();
        // else {
        OBJ_TYPE T = TYPE;
        if (T instanceof C_OBJ_TYPE) {
            if (tabName.equalsIgnoreCase(DC_TYPE.JEWELRY.getName())) {
                T = DC_TYPE.JEWELRY;
            }
            if (tabName.equalsIgnoreCase(ItemEnums.ITEM_TYPE.ALCHEMY.toString())) {
                T = DC_TYPE.ITEMS;
            }
            // if (TYPE != OBJ_TYPES.SPELLS)
            if (tabName.equalsIgnoreCase(ItemEnums.ARMOR_TYPE.LIGHT.toString()) || tabName.equalsIgnoreCase(ItemEnums.ARMOR_TYPE.HEAVY.toString())) {
                T = DC_TYPE.ARMOR;
            }
        }
        // TODO is there a
        data = DataManager.toTypeList(types, T);
        if (getFilter() != null) {
            data = getFilter().filter(data);
        }
        if (getSpecialFilter() != null) {
            data = getSpecialFilter().filter(data);
        }
        if (getSorter() != null) {
            try {
                Collections.sort(data, getSorter());
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            // main.system.ExceptionMaster.printStackTrace(e);
            }
        }
        putList(listName, data, map);
    }
    for (String listName : specialLists) {
        List<ObjType> data = getSpecialData();
        if (getSorter() != null) {
            Collections.sort(data, getSorter());
        }
        putList(listName, data, map);
    }
    return map;
}
Also used : C_OBJ_TYPE(main.content.C_OBJ_TYPE) C_OBJ_TYPE(main.content.C_OBJ_TYPE) OBJ_TYPE(main.content.OBJ_TYPE) ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap) HC_PagedListPanel(eidolons.client.cc.gui.pages.HC_PagedListPanel)

Aggregations

HC_PagedListPanel (eidolons.client.cc.gui.pages.HC_PagedListPanel)7 ObjType (main.entity.type.ObjType)4 XLinkedMap (main.data.XLinkedMap)2 Shop (eidolons.game.module.adventure.town.Shop)1 C_OBJ_TYPE (main.content.C_OBJ_TYPE)1 OBJ_TYPE (main.content.OBJ_TYPE)1 G_Panel (main.swing.generic.components.G_Panel)1