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);
}
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();
}
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");
}
}
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);
}
}
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);
}
}
Aggregations