    protected void onOK() {
        final boolean checkInvalids = (Boolean) _paramWarnOnErrors.getValue();
        final boolean noDataValueUsed = (Boolean) _paramNoDataValueUsed.getValue();
        final float noDataValue = (Float) _paramNoDataValue.getValue();
        _targetBand.setImageInfo(null);
        _targetBand.setGeophysicalNoDataValue(noDataValue);
        _targetBand.setNoDataValueUsed(noDataValueUsed);
        if (getCreateVirtualBand()) {
            final VirtualBand virtualBand = (VirtualBand) _targetBand;
            virtualBand.setExpression(_paramExpression.getValueAsText());
            virtualBand.setCheckInvalids(checkInvalids);
        } else {
            if (!_targetBand.hasRasterData()) {
                final int rasterSize = _targetBand.getRasterWidth() * _targetBand.getRasterHeight();
                final int type = _targetBand.getDataType();
                final int requiredMemory = rasterSize * ProductData.getElemSize(type);
                final long freeMemory = Runtime.getRuntime().freeMemory();
                final float megabyte = 1024.0f * 1024.0f;
                if (freeMemory <= requiredMemory) {
                    String message = "Can not create the new band.\n" +
                                     String.format("\tFree memory    : %f.1 MB\n", freeMemory / megabyte) +
                                     String.format("\tRequired memory: %f.1 MB\n\n", requiredMemory / megabyte) +
                                     "The amount of required memory is equal or greater than the available memory.";
                    _visatApp.showErrorDialog(message); 
                    BandArithmetikDialog.super.onOK();
                    return;
                } else if (requiredMemory * 2 > freeMemory) {
                    String message = "Creating the new band will cause the system to reach the memory limit.\n" +
                                     "Ths can cause the system to slow down.\n" +
                                     String.format("\tFree memory    : %f MB\n", freeMemory / megabyte) +
                                     String.format("\tRequired memory: %f MB\n\n", requiredMemory / megabyte) +
                                     "Do you want to create the image anyhow?";
                    final int answer = _visatApp.showQuestionDialog(message, null);
                    if (answer != JOptionPane.YES_OPTION) {
                        BandArithmetikDialog.super.onOK();
                        return;
                    }
                }
            }
        }
        if (!_targetProduct.containsBand(_targetBand.getName())) {
            _targetProduct.addBand(_targetBand);
        }
        final String expression = _paramExpression.getValueAsText();
        _targetBand.setSynthetic(true);
        SwingWorker swingWorker = new SwingWorker() {
            final ProgressMonitor pm = new DialogProgressMonitor(getJDialog(), "Band Arithmetic",
                                                                 Dialog.ModalityType.APPLICATION_MODAL);
            String _errorMessage;
            int _numInvalids;
            @Override
            protected Object doInBackground() throws Exception {
                _errorMessage = null;
                try {
                    if (!getCreateVirtualBand()) {
                        _numInvalids = _targetBand.computeBand(expression,
                                                               getCompatibleProducts(),
                                                               checkInvalids,
                                                               noDataValueUsed,
                                                               noDataValue,
                                                               pm);
                        _targetBand.fireProductNodeDataChanged();
                    }
                } catch (IOException e) {
                    Debug.trace(e);
                    _errorMessage = "The band could not be created.\nAn I/O error occurred:\n" + e.getMessage();  
                } catch (ParseException e) {
                    Debug.trace(e);
                    _errorMessage = "The band could not be created.\nAn expression parse error occurred:\n" + e.getMessage(); 
                } catch (EvalException e) {
                    Debug.trace(e);
                    _errorMessage = "The band could not be created.\nAn expression evaluation error occured:\n" + e.getMessage();
                } finally {
                }
                return null;
            }
            @Override
            public void done() {
                boolean ok = true;
                if (_errorMessage != null) {
                    showErrorDialog(_errorMessage);
                    ok = false;
                } else if (pm.isCanceled()) {
                    showErrorDialog("Band arithmetic has been canceled.");
                    ok = false;
                } else if (_numInvalids > 0 && checkInvalids) {
                    int numPixelsTotal = _targetBand.getRasterWidth() * _targetBand.getRasterHeight();
                    int percentage = MathUtils.floorInt(100.0 * _numInvalids / numPixelsTotal);
                    if (percentage == 0) {
                        percentage = 1;
                    }
                    String message = _numInvalids + " of " + numPixelsTotal + " pixels (< " + percentage + "%) are invalid due to arithmetic exceptions.\n"; 
                    if (noDataValueUsed) {
                        message += "These pixels have been set to " + noDataValue + ".\n\n";  
                    } else {
                        message += "These pixels have been set to NaN (IEEE 754).\n\n";  
                    }
                    message += "Do you still want to use the suspicious computed data?\n"      
                            + "If you select \"No\", all computed data will be lost.";  
                    int status = showQuestionDialog("Invalid Pixel Warning", message);
                    if (status != JOptionPane.YES_OPTION) {
                        ok = false;
                    }
                }
                finalOnOk(ok);
            }
        };
        swingWorker.execute();
    }

    protected void onOK() {
        final boolean checkInvalids = (Boolean) _paramWarnOnErrors.getValue();
        final boolean noDataValueUsed = (Boolean) _paramNoDataValueUsed.getValue();
        final float noDataValue = (Float) _paramNoDataValue.getValue();
        _targetBand.setImageInfo(null);
        _targetBand.setGeophysicalNoDataValue(noDataValue);
        _targetBand.setNoDataValueUsed(noDataValueUsed);
        if (getCreateVirtualBand()) {
            final VirtualBand virtualBand = (VirtualBand) _targetBand;
            virtualBand.setExpression(_paramExpression.getValueAsText());
            virtualBand.setCheckInvalids(checkInvalids);
        } else {
            if (!_targetBand.hasRasterData()) {
                final int rasterSize = _targetBand.getRasterWidth() * _targetBand.getRasterHeight();
                final int type = _targetBand.getDataType();
                final int requiredMemory = rasterSize * ProductData.getElemSize(type);
                final long freeMemory = Runtime.getRuntime().freeMemory();
                final float megabyte = 1024.0f * 1024.0f;
                if (freeMemory <= requiredMemory) {
                    String message = "Can not create the new band.\n" +
                                     "The amount of required memory is equal or greater than the available memory.\n\n" +
                                     String.format("\tFree memory    : %f.1 MB\n", freeMemory / megabyte) +
                                     String.format("\tRequired memory: %f.1 MB", requiredMemory / megabyte);
                    _visatApp.showErrorDialog(message); 
                    BandArithmetikDialog.super.onOK();
                    return;
                } else if (requiredMemory * 2 > freeMemory) {
                    String message = "Creating the new band will cause the system to reach its memory limit.\n" +
                                     "This can cause the system to slow down.\n" +
                                     String.format("\tFree memory    : %f MB\n", freeMemory / megabyte) +
                                     String.format("\tRequired memory: %f MB\n\n", requiredMemory / megabyte) +
                                     "Do you really want to create the image?";
                    final int answer = _visatApp.showQuestionDialog(message, null);
                    if (answer != JOptionPane.YES_OPTION) {
                        BandArithmetikDialog.super.onOK();
                        return;
                    }
                }
            }
        }
        if (!_targetProduct.containsBand(_targetBand.getName())) {
            _targetProduct.addBand(_targetBand);
        }
        final String expression = _paramExpression.getValueAsText();
        _targetBand.setSynthetic(true);
        SwingWorker swingWorker = new SwingWorker() {
            final ProgressMonitor pm = new DialogProgressMonitor(getJDialog(), "Band Arithmetic",
                                                                 Dialog.ModalityType.APPLICATION_MODAL);
            String _errorMessage;
            int _numInvalids;
            @Override
            protected Object doInBackground() throws Exception {
                _errorMessage = null;
                try {
                    if (!getCreateVirtualBand()) {
                        _numInvalids = _targetBand.computeBand(expression,
                                                               getCompatibleProducts(),
                                                               checkInvalids,
                                                               noDataValueUsed,
                                                               noDataValue,
                                                               pm);
                        _targetBand.fireProductNodeDataChanged();
                    }
                } catch (IOException e) {
                    Debug.trace(e);
                    _errorMessage = "The band could not be created.\nAn I/O error occurred:\n" + e.getMessage();  
                } catch (ParseException e) {
                    Debug.trace(e);
                    _errorMessage = "The band could not be created.\nAn expression parse error occurred:\n" + e.getMessage(); 
                } catch (EvalException e) {
                    Debug.trace(e);
                    _errorMessage = "The band could not be created.\nAn expression evaluation error occured:\n" + e.getMessage();
                } finally {
                }
                return null;
            }
            @Override
            public void done() {
                boolean ok = true;
                if (_errorMessage != null) {
                    showErrorDialog(_errorMessage);
                    ok = false;
                } else if (pm.isCanceled()) {
                    showErrorDialog("Band arithmetic has been canceled.");
                    ok = false;
                } else if (_numInvalids > 0 && checkInvalids) {
                    int numPixelsTotal = _targetBand.getRasterWidth() * _targetBand.getRasterHeight();
                    int percentage = MathUtils.floorInt(100.0 * _numInvalids / numPixelsTotal);
                    if (percentage == 0) {
                        percentage = 1;
                    }
                    String message = _numInvalids + " of " + numPixelsTotal + " pixels (< " + percentage + "%) are invalid due to arithmetic exceptions.\n"; 
                    if (noDataValueUsed) {
                        message += "These pixels have been set to " + noDataValue + ".\n\n";  
                    } else {
                        message += "These pixels have been set to NaN (IEEE 754).\n\n";  
                    }
                    message += "Do you still want to use the suspicious computed data?\n"      
                            + "If you select \"No\", all computed data will be lost.";  
                    int status = showQuestionDialog("Invalid Pixel Warning", message);
                    if (status != JOptionPane.YES_OPTION) {
                        ok = false;
                    }
                }
                finalOnOk(ok);
            }
        };
        swingWorker.execute();
    }
