Search in sources :

Example 1 with StaticTreeLink

use of eidolons.client.cc.gui.neo.tree.logic.StaticTreeLink in project Eidolons by IDemiurge.

the class HC_Tree method updateLinks.

private void updateLinks() {
    if (HC_Master.getPreviousSelectedTreeNode() == HC_Master.getSelectedTreeNode()) {
        return;
    }
    HT_Node node = HC_Master.getSelectedTreeNode();
    linksToHighlight = new ArrayList<>();
    selectionPathNodes.clear();
    if (node != null) {
        ObjType type = node.getType();
        // could cache per type too
        while (true) {
            node = map.getNodeForType(node.getParentType());
            if (node == null) {
                break;
            }
            selectionPathNodes.add(node);
            StaticTreeLink link = map.getLinkForChildType(node.getType());
            if (link == null) {
            }
            if (link == null) {
                continue;
            }
            linksToHighlight.add(link);
        }
        linksToHighlight.add(map.getLinkForChildType(type));
    }
    dynamicLinks = new ArrayList<>();
    // add req links
    for (ObjType t : HC_Master.getRequiredSkills(getSelectedType(), false)) {
        XLine line = getLine(getSelectedType(), t);
        TreeLink link = new TreeLink(LINK_TYPE.REQUIRED, line);
        dynamicLinks.add(link);
    }
    // add node from another
    // special requirements (e.g. Mastery, deity, class...)
    DataManager.getChildren(getSelectedType(), getTypes());
}
Also used : XLine(main.swing.XLine) StaticTreeLink(eidolons.client.cc.gui.neo.tree.logic.StaticTreeLink) ObjType(main.entity.type.ObjType) TreeLink(eidolons.client.cc.gui.neo.tree.logic.TreeLink) StaticTreeLink(eidolons.client.cc.gui.neo.tree.logic.StaticTreeLink)

Example 2 with StaticTreeLink

use of eidolons.client.cc.gui.neo.tree.logic.StaticTreeLink in project Eidolons by IDemiurge.

the class HC_Tree method sortLinksForZ.

private void sortLinksForZ(Map<StaticTreeLink, Point> staticLinkMap) {
    List<StaticTreeLink> list = new ArrayList<>(staticLinkMap.keySet());
    Collections.sort(list, new Comparator<StaticTreeLink>() {

        @Override
        public int compare(StaticTreeLink o1, StaticTreeLink o2) {
            for (ObjType c : o1.getChildren()) {
                if (map.getNodeForType(c).isSelected()) {
                    break;
                }
            }
            return 0;
        }
    });
    List<Point> values = new ArrayList<>();
    for (StaticTreeLink l : list) {
        values.add(staticLinkMap.get(l));
    }
    staticLinkMap = new MapMaster<StaticTreeLink, Point>().constructMap(list, values);
    map.setStaticLinkMap(staticLinkMap);
}
Also used : StaticTreeLink(eidolons.client.cc.gui.neo.tree.logic.StaticTreeLink) ObjType(main.entity.type.ObjType) MapMaster(main.system.auxiliary.data.MapMaster)

Aggregations

StaticTreeLink (eidolons.client.cc.gui.neo.tree.logic.StaticTreeLink)2 ObjType (main.entity.type.ObjType)2 TreeLink (eidolons.client.cc.gui.neo.tree.logic.TreeLink)1 XLine (main.swing.XLine)1 MapMaster (main.system.auxiliary.data.MapMaster)1