Search in sources :

Example 6 with ErrorMessage

use of de.neemann.gui.ErrorMessage in project Digital by hneemann.

the class External method init.

@Override
public void init(Model model) throws NodeException {
    try {
        Application app = Application.create(type);
        if (app == null)
            throw new NodeException(Lang.get("err_errorCreatingProcess"), this, -1, null);
        processInterface = app.start(label, code, ins, outs);
    } catch (IOException e) {
        throw new NodeException(Lang.get("err_errorCreatingProcess"), this, -1, null, e);
    }
    model.addObserver(event -> {
        if (event.equals(ModelEvent.STOPPED)) {
            try {
                processInterface.close();
            } catch (IOException e) {
                SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorClosingExternalProcess")).addCause(e));
            }
        }
    }, ModelEvent.STOPPED);
}
Also used : IOException(java.io.IOException) ErrorMessage(de.neemann.gui.ErrorMessage)

Example 7 with ErrorMessage

use of de.neemann.gui.ErrorMessage in project Digital by hneemann.

the class GifExporter method close.

private void close() {
    if (!closed) {
        try {
            writer.close();
            output.close();
            LOGGER.debug("closed GIF file");
            closed = true;
        } catch (IOException e) {
            SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorWritingGif")).addCause(e));
        }
    }
    dispose();
}
Also used : IOException(java.io.IOException) ErrorMessage(de.neemann.gui.ErrorMessage)

Example 8 with ErrorMessage

use of de.neemann.gui.ErrorMessage in project Digital by hneemann.

the class GifExporter method writeImage.

private void writeImage() {
    if (!closed) {
        try {
            writer.writeToSequence(createBufferedImage());
        } catch (IOException e) {
            SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorWritingGif")).addCause(e));
        }
        frames++;
        frameLabel.setText(Lang.get("msg_framesWritten_N", frames));
        LOGGER.debug("frame written to GIF file");
    }
}
Also used : IOException(java.io.IOException) ErrorMessage(de.neemann.gui.ErrorMessage)

Example 9 with ErrorMessage

use of de.neemann.gui.ErrorMessage in project Digital by hneemann.

the class TableDialog method createCircuit.

private void createCircuit(boolean useJKff, ExpressionModifier... modifier) {
    try {
        CircuitBuilder circuitBuilder = new CircuitBuilder(shapeFactory, useJKff, model.getTable().getVars()).setModelAnalyzerInfo(model.getTable().getModelAnalyzerInfo());
        new BuilderExpressionCreator(circuitBuilder, modifier).setUseJKOptimizer(useJKff).create(lastGeneratedExpressions);
        Circuit circuit = circuitBuilder.createCircuit();
        new Main.MainBuilder().setParent(TableDialog.this).setLibrary(library).setCircuit(circuit).setBaseFileName(filename).openLater();
    } catch (ExpressionException | FormatterException | RuntimeException e) {
        new ErrorMessage(Lang.get("msg_errorDuringCalculation")).addCause(e).show(this);
    }
}
Also used : FormatterException(de.neemann.digital.analyse.expression.format.FormatterException) Circuit(de.neemann.digital.draw.elements.Circuit) ErrorMessage(de.neemann.gui.ErrorMessage) Main(de.neemann.digital.gui.Main) ExpressionException(de.neemann.digital.analyse.expression.ExpressionException) CircuitBuilder(de.neemann.digital.builder.circuit.CircuitBuilder)

Example 10 with ErrorMessage

use of de.neemann.gui.ErrorMessage in project Digital by hneemann.

the class TableDialog method calculateExpressions.

private void calculateExpressions() {
    try {
        ExpressionListener expressionListener = new HTMLExpressionListener();
        if (createJK.isSelected())
            expressionListener = new ExpressionListenerJK(expressionListener);
        lastGeneratedExpressions = new ExpressionListenerStore(expressionListener);
        new ExpressionCreator(model.getTable()).create(lastGeneratedExpressions);
        kvMap.setResult(model.getTable(), lastGeneratedExpressions.getResults());
    } catch (ExpressionException | FormatterException | AnalyseException e1) {
        lastGeneratedExpressions = null;
        new ErrorMessage(Lang.get("msg_errorDuringCalculation")).addCause(e1).show(this);
    }
}
Also used : FormatterException(de.neemann.digital.analyse.expression.format.FormatterException) AnalyseException(de.neemann.digital.analyse.AnalyseException) ErrorMessage(de.neemann.gui.ErrorMessage) ExpressionException(de.neemann.digital.analyse.expression.ExpressionException)

Aggregations

ErrorMessage (de.neemann.gui.ErrorMessage)10 IOException (java.io.IOException)8 ExpressionException (de.neemann.digital.analyse.expression.ExpressionException)3 FormatterException (de.neemann.digital.analyse.expression.format.FormatterException)3 AnalyseException (de.neemann.digital.analyse.AnalyseException)2 CircuitBuilder (de.neemann.digital.builder.circuit.CircuitBuilder)2 Circuit (de.neemann.digital.draw.elements.Circuit)2 Main (de.neemann.digital.gui.Main)2 ToolTipAction (de.neemann.gui.ToolTipAction)2 ActionEvent (java.awt.event.ActionEvent)2 File (java.io.File)2 TruthTable (de.neemann.digital.analyse.TruthTable)1 TruthTableTableModel (de.neemann.digital.analyse.TruthTableTableModel)1 Expression (de.neemann.digital.analyse.expression.Expression)1 Variable (de.neemann.digital.analyse.expression.Variable)1 FormatToExpression (de.neemann.digital.analyse.expression.format.FormatToExpression)1 FormatToTableLatex (de.neemann.digital.analyse.expression.format.FormatToTableLatex)1 ExpressionModifier (de.neemann.digital.analyse.expression.modify.ExpressionModifier)1 NAnd (de.neemann.digital.analyse.expression.modify.NAnd)1 NOr (de.neemann.digital.analyse.expression.modify.NOr)1