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;
}
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);
}
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());
}
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;
}
Aggregations