Search in sources :

Example 16 with G_Panel

use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.

the class MusicListPanel method initCustomViews.

protected void initCustomViews() {
    List<File> topList = new ArrayList<>();
    Map<String, List<String>> customMap = new XLinkedMap<>();
    for (File file : FileManager.getFilesFromDirectory(AHK_Master.CUSTOM_LISTS_FOLDER, true)) {
        if (file.isDirectory()) {
            String name = file.getName();
            G_Panel view = initView(getCustomMap(name, FileManager.getFilesFromDirectory(file.getPath(), false), customMap), isLetterShown());
        // viewsPanel.addView(file.getName(), view);
        } else {
            topList.add(file);
        }
    }
    // add root to the subpanel map
    Map<String, List<String>> map = getCustomMap(topList, customMap);
    MusicListPanel panel = new MusicListPanel(key, map);
    panel.setView(panel.initView(map, isLetterShown()));
    viewsPanel.addView("Custom", panel);
}
Also used : XLinkedMap(main.data.XLinkedMap) G_Panel(main.swing.generic.components.G_Panel) List(java.util.List) File(java.io.File)

Example 17 with G_Panel

use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.

the class MusicListPanel method initView.

public G_Panel initView(final Map<String, List<String>> map, Boolean letterShown, final int customWrap, final List<String> musicConsts) {
    lastMap = map;
    final G_Panel view = new ListButtonPanel(map, this, customWrap, musicConsts);
    view.refresh();
    return view;
}
Also used : G_Panel(main.swing.generic.components.G_Panel)

Example 18 with G_Panel

use of main.swing.generic.components.G_Panel 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 19 with G_Panel

use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.

the class UnitGroupMaster method chooseUnit.

private static ObjType chooseUnit(ObjType factionType, int power, int max_power) {
    Map<ObjType, Integer> pool = initPool(factionType);
    List<ObjType> available = new ArrayList<>();
    for (ObjType l : pool.keySet()) {
        if (getUnitCost(l, factionType) > power) {
            continue;
        }
        if (l.getIntParam(PARAMS.POWER) > max_power) {
            continue;
        }
        available.add(l);
    }
    if (available.isEmpty()) {
        return null;
    }
    // chooseUnit();
    Map<String, String> map = new HashMap<>();
    for (ObjType type : pool.keySet()) {
        map.put(type.getName(), "Cost: " + pool.get(type) + "; Power: " + type.getIntParam(PARAMS.POWER));
    }
    ListChooser.setDecorator(new Decorator() {

        @Override
        public void addComponents(G_Panel panel) {
            G_ListPanel<ObjType> list = // new CustomList<>(getUnitList());
            new G_ListPanel<ObjType>(getUnitList()) {

                @Override
                public void setInts() {
                    wrap = 1;
                    minItems = max;
                    rowsVisible = 1;
                    layoutOrientation = JList.HORIZONTAL_WRAP;
                }

                @Override
                public boolean isVertical() {
                    return false;
                }
            };
            list.setPanelSize(new Dimension(300, 120));
            panel.add(list, "pos tp.x decor_info.y2");
            WrappedTextComp textComp = new WrappedTextComp(null) {

                @Override
                protected Color getColor() {
                    return Color.black;
                }

                @Override
                public synchronized List<String> getTextLines() {
                    List<String> list = new ArrayList<>();
                    list.add(UnitGroupMaster.getRemainingPower() + " points remaining");
                    list.add("Size contraints: between " + min + " and " + max);
                    return list;
                }
            };
            textComp.setDefaultSize(new Dimension(300, 120));
            panel.add(textComp, "id decor_info, pos tp.x tp.y2");
        }
    });
    ListChooser.setTooltipMapForComponent(map);
    ListChooser.setSortingDisabled(true);
    return ListChooser.chooseType_(available, DC_TYPE.UNITS);
// gui - a list per ally
}
Also used : G_ListPanel(main.swing.generic.components.panels.G_ListPanel) HashMap(java.util.HashMap) G_Panel(main.swing.generic.components.G_Panel) ArrayList(java.util.ArrayList) Decorator(main.swing.generic.Decorator) ObjType(main.entity.type.ObjType) WrappedTextComp(eidolons.swing.components.panels.page.log.WrappedTextComp) List(java.util.List) ArrayList(java.util.ArrayList)

Example 20 with G_Panel

use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.

the class Launcher method initTopGUI.

private static void initTopGUI() {
    frame = new G_Frame(MAIN_TITLE, true);
    // setCustomCursor()
    setCustomIcon();
    if (!GuiManager.isWide()) {
        frame.setLayout(new GridLayout());
        viewPanel = new G_Panel();
        viewPanel.setLayout(new GridLayout());
        viewPanel.setSize(// TODO
        GuiManager.getScreenSize());
        frame.add(viewPanel, "pos 0 0");
    } else {
        DEV_MODE = false;
        initBackground();
        frame.add(background, "pos 0 0");
        viewPanel = new G_Panel();
        // otherwise there is this
        viewPanel.setLayout(new GridLayout());
        // size calc issue? viewPanel.setSize(VIEW_PANEL_SIZE);
        double X = (GuiManager.getScreenWidth() - VIEW_PANEL_SIZE.getWidth()) / 2;
        double Y = (GuiManager.getScreenHeight() - VIEW_PANEL_SIZE.getHeight()) / 2;
        frame.setLayout(new MigLayout());
        G_Panel panel = new G_Panel();
        panel.setPanelSize(GuiManager.getScreenSize());
        panel.setSize(GuiManager.getScreenSize());
        panel.add(viewPanel, "pos " + X + " " + Y);
        panel.setOpaque(true);
        panel.setBackground(ColorManager.BACKGROUND);
        frame.add(panel, "pos 0 0");
        frame.setComponentZOrder(panel, 0);
        frame.setComponentZOrder(background, 1);
    }
    if (fullscreen) {
        GuiManager.setFullscreen(true);
        GuiManager.setWindowToFullscreen(frame);
    } else {
        frame.setSize(GuiManager.getScreenSize());
    // frame.setBackground(Color.black);
    }
    frame.setUndecorated(true);
    frame.setVisible(true);
}
Also used : G_Frame(main.swing.generic.windows.G_Frame) G_Panel(main.swing.generic.components.G_Panel) MigLayout(net.miginfocom.swing.MigLayout)

Aggregations

G_Panel (main.swing.generic.components.G_Panel)59 CustomButton (eidolons.swing.components.buttons.CustomButton)6 List (java.util.List)4 PARAMETER (main.content.values.parameters.PARAMETER)4 ObjType (main.entity.type.ObjType)4 TextComp (main.swing.components.TextComp)4 ArrayList (java.util.ArrayList)3 XLinkedMap (main.data.XLinkedMap)3 MigLayout (net.miginfocom.swing.MigLayout)3 PoolComp (eidolons.client.cc.gui.misc.PoolComp)2 HC_Tab (eidolons.client.cc.gui.neo.tabs.HC_Tab)2 HC_TabPanel (eidolons.client.cc.gui.neo.tabs.HC_TabPanel)2 WrappedTextComp (eidolons.swing.components.panels.page.log.WrappedTextComp)2 MusicList (main.music.entity.MusicList)2 MusicListPanel (main.music.gui.MusicListPanel)2 G_Component (main.swing.generic.components.G_Component)2 GraphicComponent (main.swing.generic.components.misc.GraphicComponent)2 PortraitComp (eidolons.client.cc.gui.neo.header.PortraitComp)1 HC_PagedListPanel (eidolons.client.cc.gui.pages.HC_PagedListPanel)1 PartyComp (eidolons.game.module.adventure.gui.map.obj.PartyComp)1