Search in sources :

Example 1 with MusicListPanel

use of main.music.gui.MusicListPanel in project Eidolons by IDemiurge.

the class MusicCore method getFilterView.

public static MusicListPanel getFilterView(String filterVal, PROPERTY filterProp) {
    Map<String, List<String>> map = new XLinkedMap<>();
    String name = filterProp.getName() + " by " + filterVal;
    MusicListPanel panel = new MusicListPanel(name, map);
    int maxSize = 0;
    int i = 0;
    for (String substring : StringMaster.open(filterVal)) {
        List<String> list = new ArrayList<>();
        for (ObjType type : DataManager.getTypes(AT_OBJ_TYPE.MUSIC_LIST)) {
            if (type.checkProperty(filterProp, substring)) {
                list.add(type.getProperty(G_PROPS.HOTKEY) + "::" + type.getProperty(AT_PROPS.PATH));
            }
        }
        if (maxSize < list.size()) {
            maxSize = list.size();
        }
        map.put(i + "", list);
        i++;
    }
    List<String> musicConsts = StringMaster.openContainer(filterVal);
    int customWrap = 2 + maxSize / 14;
    if (customWrap < 0) {
        customWrap = 0;
    }
    G_Panel v = panel.initView(map, false, customWrap, musicConsts);
    panel.setView(v);
    panel.setName(name);
    v.setName(name);
    return panel;
}
Also used : ObjType(main.entity.type.ObjType) XLinkedMap(main.data.XLinkedMap) G_Panel(main.swing.generic.components.G_Panel) MusicListPanel(main.music.gui.MusicListPanel) MusicList(main.music.entity.MusicList) List(java.util.List)

Example 2 with MusicListPanel

use of main.music.gui.MusicListPanel in project Eidolons by IDemiurge.

the class AHK_Master method showMusicListPanel.

public static void showMusicListPanel(String fileName) {
    setPanel(new MusicListPanel(fileName, getScriptViewMap(fileName)));
    panel.init();
    JFrame window = GuiManager.inNewWindow(getPanel(), "Music Core", GuiManager.getScreenSize());
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Image image = ImageManager.getImage(UI_ARCANE_TOWER_KEY_PNG);
    window.setIconImage(image);
}
Also used : MusicListPanel(main.music.gui.MusicListPanel)

Example 3 with MusicListPanel

use of main.music.gui.MusicListPanel in project Eidolons by IDemiurge.

the class MusicCore method newFilteredView.

public static void newFilteredView(int option, Class<?> c) {
    MusicListPanel view = getGroupedView(option, c);
    if (view == null) {
        return;
    }
    AHK_Master.getPanel().getViewsPanel().addView(view.getView().getName(), view);
    AHK_Master.getPanel().getViewsPanel().viewClicked(view.getView().getName());
}
Also used : MusicListPanel(main.music.gui.MusicListPanel)

Example 4 with MusicListPanel

use of main.music.gui.MusicListPanel in project Eidolons by IDemiurge.

the class MusicCore method getGroupedView.

public static MusicListPanel getGroupedView(int option, Class<?> constClass) {
    if (option == -1) {
        return null;
    }
    PROPERTY filterProp = ContentManager.getPROP(constClass.getSimpleName());
    // String[] array = (AHK_Master.qwerty + " " +
    // AHK_Master.qwerty.substring(1).toUpperCase() + " 123")
    // .split(" ");
    String viewName = "All " + StringMaster.getWellFormattedString(constClass.getSimpleName());
    Map<String, List<String>> map = new XLinkedMap<>();
    List<String> musicConsts = EnumMaster.getEnumConstantNames(constClass);
    if (option != 0) {
        musicConsts = getMusicConsts(constClass, option);
        viewName = getViewName(constClass, option);
    }
    Map<ObjType, String> multiPropMap = new HashMap<>();
    loop: for (String g : musicConsts) {
        // map.
        List<String> list = new ArrayList<>();
        // for (MusicList musList : listTypeMap.values()) {
        typeLoop: for (ObjType type : DataManager.getTypes(AT_OBJ_TYPE.MUSIC_LIST)) {
            if (type.checkProperty(filterProp, g)) {
                if (filterProp.isContainer()) {
                    containerLoop: for (String sub : StringMaster.open(type.getProperty(filterProp))) {
                        for (String c : musicConsts) {
                            if (StringMaster.compare(c, sub)) {
                                if (c.equalsIgnoreCase(g)) {
                                    break containerLoop;
                                } else {
                                    multiPropMap.put(type, c);
                                    continue typeLoop;
                                }
                            }
                        }
                    }
                }
                list.add(AHK_Master.getScriptLineForList(type));
            }
        }
        map.put(g, list);
    }
    for (ObjType sub : multiPropMap.keySet()) {
        for (String c : map.keySet()) {
            if (multiPropMap.get(sub).equals(c)) {
                map.get(c).add(AHK_Master.getScriptLineForList(sub));
            }
        }
    }
    for (String sub : map.keySet()) {
        map.put(sub, new ArrayList<>(new LinkedHashSet<>(map.get(sub))));
    }
    // TODO adapt to max list size also
    int wrap = 5 - map.size() / 2;
    MusicListPanel musicListPanel = new MusicListPanel("", null);
    G_Panel view = // AHK_Master.getPanel()
    musicListPanel.initView(map, false, wrap, musicConsts);
    musicListPanel.setView(view);
    view.setName(viewName);
    return musicListPanel;
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) XLinkedMap(main.data.XLinkedMap) G_Panel(main.swing.generic.components.G_Panel) ObjType(main.entity.type.ObjType) MusicListPanel(main.music.gui.MusicListPanel) MusicList(main.music.entity.MusicList) List(java.util.List)

Aggregations

MusicListPanel (main.music.gui.MusicListPanel)4 List (java.util.List)2 XLinkedMap (main.data.XLinkedMap)2 ObjType (main.entity.type.ObjType)2 MusicList (main.music.entity.MusicList)2 G_Panel (main.swing.generic.components.G_Panel)2 PROPERTY (main.content.values.properties.PROPERTY)1