Search in sources :

Example 1 with HT_Node

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

the class TreeMap method addNode.

public void addNode(Point point, HT_Node node, int size) {
    HT_Node replaced = getNodeMap().put(new PointX(point.x, point.y), node);
    if (replaced != null) {
        LogMaster.log(1, " !!! " + node + " replaces " + replaced + " !!! ");
    }
    getMouseMap().put(new Rectangle(point.x, point.y, size, size), node);
}
Also used : HT_Node(eidolons.client.cc.gui.neo.tree.HT_Node) PointX(main.swing.PointX)

Example 2 with HT_Node

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

the class HT_MapBuilder method addAltBaseLinks.

private void addAltBaseLinks() {
    for (HT_Node c : map.getNodeMap().values()) {
        String prop = c.getType().getProperty(PROPS.ALT_BASE_LINKS);
        if (prop.isEmpty()) {
            continue;
        }
        for (String s : StringMaster.open(prop)) {
            String typeName = VariableManager.removeVarPart(s);
            String vars = VariableManager.getVar(s);
            LINK_VARIANT variant = new EnumMaster<LINK_VARIANT>().retrieveEnumConst(LINK_VARIANT.class, vars.split("=")[0]);
            ObjType targetType = DataManager.getType(typeName, getTYPE());
            Point point = map.getPointForType(c.getType());
            // getPoint(variant, parent, type, parentX, i, sublingCount)
            // point = getNodePointFromLink(point2.x, targetType, 0, 0,
            // c.getType(), variant);
            /*
                 * use the variant.getOffset()
				 *
				 * what point is base?
				 *
				 * c.
				 *
				 */
            int offsetX = StringMaster.getInteger(vars.split("=")[1].split(",")[0]);
            int offsetY = StringMaster.getInteger(vars.split("=")[1].split(",")[1]);
            point = new PointX(point.x + offsetX, point.y + offsetY);
            StaticTreeLink link = new StaticTreeLink(variant, point, targetType, c.getType());
            // link.setAlt(true); // what will it do?
            map.getAltLinks().put(link, targetType);
        }
    }
}
Also used : HT_Node(eidolons.client.cc.gui.neo.tree.HT_Node) ObjType(main.entity.type.ObjType) LINK_VARIANT(eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT) PointX(main.swing.PointX)

Example 3 with HT_Node

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

the class EditViewPanel method selectType.

public void selectType(boolean fromHT, ObjType type) {
    toggleAE_VIEW();
    if (ArcaneVault.getSelectedType() != null) {
        if (type.getOBJ_TYPE_ENUM().isHeroTreeType()) {
            if (type.getOBJ_TYPE_ENUM() != ArcaneVault.getSelectedType().getOBJ_TYPE_ENUM()) {
                if (getSkillTreeViewComp() == null || getClassTreeViewComp() == null) {
                    setTreeView(false);
                } else {
                    setDirty(true);
                }
            }
        }
    }
    ArcaneVault.setSelectedType(type);
    if (fromHT) {
        try {
            ModelManager.adjustTreeTabSelection(type, false);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    } else {
        if (isTreeView()) {
            if (getTreeViewComp() != null) {
                HT_Node node = null;
                try {
                    node = getTreeViewComp().getTree().getMap().getNodeForType(type);
                } catch (Exception e) {
                    main.system.ExceptionMaster.printStackTrace(e);
                    setTreeView(false);
                    selectType(fromHT, type);
                }
                if (node != null) {
                    HC_Master.setSelectedTreeNode(node);
                    getTreeViewComp().getTree().getPanel().repaint();
                }
            }
        }
    }
    if (isTreeView()) {
        HT_View viewComp = type.getOBJ_TYPE_ENUM() == DC_TYPE.SKILLS ? getSkillTreeViewComp() : getClassTreeViewComp();
        if (viewComp != null) {
            String key = type.getSubGroupingKey();
            if (!key.equalsIgnoreCase(viewComp.getDisplayedTabPanel().getSelectedTabName())) {
                if (!key.equalsIgnoreCase("Multiclass")) {
                    try {
                        viewComp.tabSelected(key);
                        viewComp.repaint();
                        setDirty(true);
                    } catch (Exception e) {
                        main.system.ExceptionMaster.printStackTrace(e);
                    }
                }
            }
        }
    }
    try {
        resetData(type);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    if (type.getOBJ_TYPE_ENUM().isTreeEditType()) {
        setAE_View(type.getName());
    } else {
        setTableView();
    }
}
Also used : HT_Node(eidolons.client.cc.gui.neo.tree.HT_Node) HT_View(eidolons.client.cc.gui.neo.tree.view.HT_View)

Example 4 with HT_Node

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

the class HT_View method mouseClicked.

@Override
public void mouseClicked(MouseEvent e) {
    tree = treeCache.get(arg);
    getTree().setDisplayRequirements(false);
    if (e.getSource() instanceof CustomButton) {
        CustomButton customButton = (CustomButton) e.getSource();
        if (e.isAltDown()) {
            customButton.handleAltClick();
        } else {
            customButton.handleClick();
        }
        return;
    }
    if (e.getClickCount() > 1) {
        // else
        if (SwingUtilities.isRightMouseButton(e)) {
            // toggleViewMode();
            cycleViewMode();
            return;
        }
    }
    Point point = e.getPoint();
    HT_Node node = null;
    for (Rectangle rect : tree.getMap().getMouseMap().keySet()) {
        if (rect.contains(point)) {
            node = tree.getMap().getMouseMap().get(rect);
            break;
        }
    }
    if (node == null) {
        handleSpecialClick(e);
        return;
    }
    ObjType type = node.getValue();
    if (CoreEngine.isArcaneVault()) {
        // ARCANE VAULT ARCANE VAULT ARCANE VAULT
        if (e.isControlDown()) {
            Boolean vertical_horizontal_manual = null;
            // if (e.isShiftDown())
            // vertical_horizontal_manual =
            // SwingUtilities.isRightMouseButton(e);
            adjustLink(vertical_horizontal_manual, node);
            return;
        } else {
            if (e.isAltDown()) {
                editDefaultProp(type);
            } else if (e.isShiftDown()) {
                if (TreeControlPanel.setProp(e.isAltDown(), type)) {
                    rebuildAndSetTree();
                }
                return;
            }
        }
        if (e.getClickCount() > 1) {
            if (!SwingUtilities.isRightMouseButton(e)) {
                editImage(type);
            }
            // if (e.isAltDown()) {
            // editDefaultProp(type);
            // } else {
            // editImage(type);
            // return;
            // }
            ID_OPERATION operation = null;
            if (SwingUtilities.isRightMouseButton(e)) {
                operation = ID_OPERATION.SWAP;
            } else {
            // TODO
            }
            if (operation != null) {
                adjustIds(operation, DataManager.getSublings(type, tree.getTypes()));
                return;
            }
        }
    // NON-AV
    } else if (e.isAltDown() || e.getClickCount() > 1) {
        boolean result = CharacterCreator.getHeroManager().addItem(hero, type, getTYPE(), getPROP());
        if (result) {
            added(type);
        } else {
            DC_SoundMaster.playStandardSound(STD_SOUNDS.CLICK_BLOCKED);
            getTree().setDisplayRequirements(true);
        }
    }
    select(node, type);
// node.refresh();
}
Also used : HT_Node(eidolons.client.cc.gui.neo.tree.HT_Node) ObjType(main.entity.type.ObjType) CustomButton(eidolons.swing.components.buttons.CustomButton)

Example 5 with HT_Node

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

the class HT_View method select.

protected void select(HT_Node node, ObjType type) {
    for (HT_Node n : tree.getMap().getNodeMap().values()) {
        n.setSelected(false);
    }
    node.setSelected(true);
    if (!CoreEngine.isArcaneVault()) {
        CharacterCreator.typeSelected(type);
    } else {
        WaitMaster.receiveInput(type.getOBJ_TYPE_ENUM() == DC_TYPE.SKILLS ? WAIT_OPERATIONS.SELECTION : WAIT_OPERATIONS.CUSTOM_SELECT, type.getName(), false);
    }
    DC_SoundMaster.playStandardSound(STD_SOUNDS.SLOT);
    // if (node.getParentType() != null)
    // DC_SoundMaster.playStandardSound(STD_SOUNDS.MOVE);
    HC_Master.setSelectedTreeNode(node);
    tree.refresh();
    tree.getPanel().repaint();
}
Also used : HT_Node(eidolons.client.cc.gui.neo.tree.HT_Node)

Aggregations

HT_Node (eidolons.client.cc.gui.neo.tree.HT_Node)6 PointX (main.swing.PointX)3 ObjType (main.entity.type.ObjType)2 LINK_VARIANT (eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)1 HT_View (eidolons.client.cc.gui.neo.tree.view.HT_View)1 CustomButton (eidolons.swing.components.buttons.CustomButton)1