Search in sources :

Example 1 with EditViewPanel

use of main.gui.builders.EditViewPanel in project Eidolons by IDemiurge.

the class AV_ButtonPanel method handleButtonClick.

public void handleButtonClick(boolean alt, String command) {
    switch(command) {
        case DEFAULTS:
            ModelManager.addDefaultValues(alt);
            break;
        case "Test":
            if (alt)
                DC_SoundMaster.preconstructEffectSounds();
            else
                AnimationConstructor.preconstructAllForAV();
            break;
        case "Test1":
            ItemGenerator.setGenerationOn(true);
            String playerParty = null;
            ObjType type = null;
            if (ArcaneVault.getSelectedOBJ_TYPE() == DC_TYPE.PARTY) {
                type = ArcaneVault.getSelectedType();
                playerParty = type.getProperty(PROPS.MEMBERS);
            } else if (ArcaneVault.getWorkspaceManager().getActiveWorkspace() != null) {
                type = DataManager.getType(ArcaneVault.getWorkspaceManager().getActiveWorkspace().getName(), DC_TYPE.PARTY);
                playerParty = type.getProperty(PROPS.MEMBERS);
            // default
            // for selected type(s)
            // for workspace
            }
            String enemyParty = UnitGroupMaster.getRandomReadyGroup(type.getLevel());
            // FAST_DC.main(args);
            break;
        case "Add WS":
            ArcaneVault.getWorkspaceManager().newWorkspaceForParty();
            break;
        case "Add Tab":
            {
                // boolean micro = true;
                // List<OBJ_TYPE> types = new ArrayList<>();
                // if (micro){
                // types = new ArrayList<>(Arrays.asList( OBJ_TYPES.values()));
                // }
                // types.removeAll( XML_Reader.getXmlMap().keySet());
                Class<?> ENUM_CLASS = DC_TYPE.class;
                String toAdd = ListChooser.chooseEnum(ENUM_CLASS, SELECTION_MODE.MULTIPLE);
                for (String sub : StringMaster.open(toAdd)) {
                    ArcaneVault.getMainBuilder().getTabBuilder().addTab(ENUM_CLASS, sub);
                }
                break;
            }
        case "Group":
            {
                UnitGroupMaster.createUnitGroup(null);
                break;
            }
        case "Edit":
            {
                // if (ArcaneVault.getSelectedType() != null)
                MapEditor.launch();
                // WorldEditor.editDefaultCampaign(); // ?
                break;
            }
        case "Clone":
            {
                final boolean alt_ = alt;
                new Thread(new Runnable() {

                    public void run() {
                        if (alt_) {
                            ArcaneVault.getSelectedType().copyValues(ArcaneVault.getPreviousSelectedType(), getCopyVals());
                        } else {
                            ArcaneVault.getSelectedType().cloneMapsWithExceptions(ArcaneVault.getPreviousSelectedType(), G_PROPS.NAME, G_PROPS.DISPLAYED_NAME, G_PROPS.IMAGE, G_PROPS.GROUP, ArcaneVault.getSelectedType().getOBJ_TYPE_ENUM().getGroupingKey(), ArcaneVault.getSelectedType().getOBJ_TYPE_ENUM().getSubGroupingKey());
                        }
                        refresh();
                    }
                }, "Clone thread").start();
                break;
            }
        case NEW_TREE:
            {
                OBJ_TYPE TYPE = ArcaneVault.getSelectedType().getOBJ_TYPE_ENUM();
                if (TYPE == DC_TYPE.SKILLS || (TYPE == DC_TYPE.CLASSES)) {
                    if (!alt) {
                        HC_Master.initTreeArg(ArcaneVault.getSelectedType());
                        HC_Master.initTreeView();
                        EditViewPanel panel = ArcaneVault.getMainBuilder().getEditViewPanel();
                        if (TYPE == DC_TYPE.SKILLS) {
                            panel.setSkillTreeViewComp(HC_Master.getAvTreeView());
                        } else {
                            panel.setClassTreeViewComp(HC_Master.getAvTreeView());
                        }
                        panel.setTreeView(true);
                        panel.refresh();
                        launchSelectionListeningThread(TYPE, null);
                    } else {
                        JFrame window = AV_T3View.showInNewWindow(true, TYPE == DC_TYPE.SKILLS);
                        // HC_Master.showHeroTreeInWindow(ArcaneVault
                        // .getSelectedType());
                        launchSelectionListeningThread(TYPE, window);
                    }
                    if (TYPE == DC_TYPE.SKILLS) {
                        if (skillSelectionListeningThreadRunning) {
                            return;
                        }
                    } else {
                        if (classSelectionListeningThreadRunning) {
                            return;
                        }
                    }
                    return;
                }
                if (!alt) {
                    ArcaneVault.getMainBuilder().getEditViewPanel().setTreeView(false);
                    ArcaneVault.getMainBuilder().getEditViewPanel().refresh();
                    return;
                }
                TabBuilder tabBuilder = new TabBuilder(null);
                JComponent comp = tabBuilder.build();
                ArcaneVault.addTree(tabBuilder);
                JFrame window = GuiManager.inNewWindow(comp, "Arcane Vault", new Dimension(ArcaneVault.TREE_WIDTH, ArcaneVault.TREE_HEIGHT));
                // window.isActive()
                break;
            }
        case "WS Add":
            {
                ModelManager.addToWorkspace(alt);
                break;
            }
        case "Toggle":
            {
                if (alt) {
                    int result = DialogMaster.optionChoice("What do I toggle?", "Inversion");
                    if (result == 0) {
                        ArcaneVault.setColorsInverted(!ArcaneVault.isColorsInverted());
                    }
                    break;
                }
                EditViewPanel panel = ArcaneVault.getMainBuilder().getEditViewPanel();
                if (panel.getTreeViewComp() != null) {
                    panel.setTreeView(!panel.isTreeView());
                    panel.refresh();
                }
                ModelManager.toggle();
                break;
            }
        case "Backup":
            {
                XML_Writer.createBackUpReserve();
                break;
            }
        case RENAME_SELECTED_TYPE:
            {
                renameType(ArcaneVault.getSelectedType());
                break;
            }
        case RENAME_TYPE:
            {
                type = DataManager.getType(JOptionPane.showInputDialog("Enter type name"));
                renameType(type);
                break;
            }
        case CLEAN_UP:
            {
                // cleanUp();
                break;
            }
        case RENAME_VALUE:
            {
                break;
            }
        case REMOVE_VALUE:
            {
                String values = JOptionPane.showInputDialog("Enter value names");
                if (values == null) {
                    values = (ListChooser.chooseEnum(PARAMETER.class, PROPERTY.class));
                }
                if (values == null) {
                    break;
                }
                String input = ListChooser.chooseEnum(DC_TYPE.class);
                if (input == null) {
                    break;
                }
                for (String typeName : StringMaster.open(input)) {
                    DC_TYPE TYPE = DC_TYPE.getType(typeName);
                    for (String valName : StringMaster.open(values)) {
                        VALUE val = ContentManager.getValue(valName);
                        boolean emptyOnly = JOptionPane.showConfirmDialog(null, "Empty only?") == JOptionPane.YES_OPTION;
                        XML_Transformer.removeValue(val, XML_Reader.getFile(TYPE), true, emptyOnly);
                    }
                }
                break;
            }
        case "Transform":
            {
                if (xmlTransformMenu == null) {
                    xmlTransformMenu = new XmlTransformMenu();
                } else {
                    xmlTransformMenu.setVisible(xmlTransformMenu.isVisible());
                }
            }
        case "Undo":
            {
                if (alt) {
                // while()
                }
                ModelManager.undo();
                break;
            }
        case "Upgrade":
            {
                if (alt) {
                    ModelManager.addParent();
                } else {
                    ModelManager.addUpgrade();
                }
                break;
            }
        case "New Hero":
            {
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        CharacterCreator.addNewHero();
                    }
                });
                break;
            }
        case "Remove":
            {
                ModelManager.remove();
                break;
            }
        case "Reload":
            {
                Weaver.inNewThread(new Runnable() {

                    public void run() {
                        ModelManager.saveAll();
                        ModelManager.reload();
                        TableMouseListener.configureEditors();
                    }
                });
            }
        case "Add":
            {
                ModelManager.add();
                break;
            }
        case "Save":
            {
                ModelManager.save();
                break;
            }
        case "Save all":
            {
                ModelManager.saveAll();
                return;
            }
    }
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) EditViewPanel(main.gui.builders.EditViewPanel) TabBuilder(main.gui.builders.TabBuilder) ObjType(main.entity.type.ObjType) PARAMETER(main.content.values.parameters.PARAMETER)

Example 2 with EditViewPanel

use of main.gui.builders.EditViewPanel in project Eidolons by IDemiurge.

the class AV_T3View method toggleEditTable.

public static void toggleEditTable(Boolean left_right_center) {
    // TODO for currently active tree...
    // alt click - let choose, otherwise active...
    String pos = comp.getCenterTreePos();
    if (left_right_center != null) {
        pos = left_right_center ? comp.getLeftTreePos() : comp.getRightTreePos();
    }
    HT_View tree = comp.getCenterTree();
    if (left_right_center != null) {
        tree = left_right_center ? comp.getLeftTree() : comp.getRightTree();
    }
    if (comp.getRemovedTree() != null) {
        comp.remove(table.getPanel());
        comp.add(comp.getRemovedTree(), pos);
        if (left_right_center != null) {
            if (left_right_center) {
                comp.add(comp.getInfoPanel(), comp.getInfoPanelPos());
            } else {
                comp.add(comp.getInfoPanel2(), comp.getInfoPanel2Pos());
            }
        }
        comp.setRemovedTree(null);
    } else {
        if (table == null) {
            table = new EditViewPanel() {

                // no second table! sync selection!
                public boolean isTwoTableModeEnabled() {
                    return false;
                }

                @Override
                public void selectType(ObjType type) {
                    resetData(type);
                    setTableView();
                }

                protected int getHeight() {
                    return comp.getTreeSize().height;
                }

                public boolean isMenuHidden() {
                    return true;
                }

                protected int getWidth() {
                    return comp.getTreeSize().width;
                }

                protected void initTable(boolean second) {
                    super.initTable(second);
                    table.setTableHeader(null);
                // scrollPane
                // .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
                }
            };
        }
        if (HC_Master.getSelectedTreeNode() != null) {
            table.selectType(HC_Master.getSelectedTreeNode().getType());
        }
        if (left_right_center != null) {
            if (left_right_center) {
                comp.remove(comp.getInfoPanel());
            } else {
                comp.remove(comp.getInfoPanel2());
            }
        }
        comp.remove(tree);
        comp.setRemovedTree(tree);
        comp.add(table.getPanel(), pos);
    }
    comp.revalidate();
    comp.repaint();
}
Also used : HT_View(eidolons.client.cc.gui.neo.tree.view.HT_View) ObjType(main.entity.type.ObjType) EditViewPanel(main.gui.builders.EditViewPanel)

Aggregations

ObjType (main.entity.type.ObjType)2 EditViewPanel (main.gui.builders.EditViewPanel)2 HT_View (eidolons.client.cc.gui.neo.tree.view.HT_View)1 PARAMETER (main.content.values.parameters.PARAMETER)1 PROPERTY (main.content.values.properties.PROPERTY)1 TabBuilder (main.gui.builders.TabBuilder)1