Search in sources :

Example 1 with TableDialog

use of de.neemann.digital.gui.components.table.TableDialog in project Digital by hneemann.

the class Main method createAnalyseMenu.

/**
 * Creates the analyse menu
 *
 * @param menuBar the menu bar
 */
private void createAnalyseMenu(JMenuBar menuBar) {
    JMenu analyse = new JMenu(Lang.get("menu_analyse"));
    menuBar.add(analyse);
    analyse.add(new ToolTipAction(Lang.get("menu_analyse")) {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                Model model = new ModelCreator(circuitComponent.getCircuit(), library).createModel(false);
                try {
                    if (model.isInvalidSignal())
                        new ErrorMessage(Lang.get("msg_invalidSignalsAnalysed")).show(Main.this);
                    else
                        new TableDialog(Main.this, new ModelAnalyser(model).analyse(), library, shapeFactory, getBaseFileName()).setVisible(true);
                    ensureModelIsStopped();
                } finally {
                    model.close();
                }
            } catch (PinException | NodeException | AnalyseException | ElementNotFoundException | BacktrackException | RuntimeException e1) {
                showErrorWithoutARunningModel(Lang.get("msg_analyseErr"), e1);
            }
        }
    }.setToolTip(Lang.get("menu_analyse_tt")).setAccelerator("F9").createJMenuItem());
    analyse.add(new ToolTipAction(Lang.get("menu_synthesise")) {

        @Override
        public void actionPerformed(ActionEvent e) {
            TruthTable tt = new TruthTable(3).addResult();
            new TableDialog(Main.this, tt, library, shapeFactory, getBaseFileName()).setVisible(true);
            ensureModelIsStopped();
        }
    }.setToolTip(Lang.get("menu_synthesise_tt")).createJMenuItem());
    analyse.add(new ToolTipAction(Lang.get("menu_expression")) {

        @Override
        public void actionPerformed(ActionEvent e) {
            new ExpressionDialog(Main.this, library, shapeFactory, getBaseFileName()).setVisible(true);
        }
    }.setToolTip(Lang.get("menu_expression_tt")).createJMenuItem());
}
Also used : ModelAnalyser(de.neemann.digital.analyse.ModelAnalyser) ElementNotFoundException(de.neemann.digital.draw.library.ElementNotFoundException) AnalyseException(de.neemann.digital.analyse.AnalyseException) ModelCreator(de.neemann.digital.draw.model.ModelCreator) TableDialog(de.neemann.digital.gui.components.table.TableDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) TruthTable(de.neemann.digital.analyse.TruthTable) LibraryTreeModel(de.neemann.digital.gui.components.tree.LibraryTreeModel) ExpressionDialog(de.neemann.digital.gui.components.expression.ExpressionDialog)

Aggregations

AnalyseException (de.neemann.digital.analyse.AnalyseException)1 ModelAnalyser (de.neemann.digital.analyse.ModelAnalyser)1 TruthTable (de.neemann.digital.analyse.TruthTable)1 ElementNotFoundException (de.neemann.digital.draw.library.ElementNotFoundException)1 ModelCreator (de.neemann.digital.draw.model.ModelCreator)1 ExpressionDialog (de.neemann.digital.gui.components.expression.ExpressionDialog)1 TableDialog (de.neemann.digital.gui.components.table.TableDialog)1 ValueTableDialog (de.neemann.digital.gui.components.testing.ValueTableDialog)1 LibraryTreeModel (de.neemann.digital.gui.components.tree.LibraryTreeModel)1