Search in sources :

Example 1 with ImportError

use of net.parostroj.timetable.model.imports.Import.ImportError in project grafikon by jub77.

the class ImportModelAction method eventDispatchActionAfter.

@Override
protected void eventDispatchActionAfter() {
    if (context.isCancelled()) {
        return;
    }
    List<ImportError> errors = new LinkedList<>();
    for (ImportComponent comp : imports.getImportComponents()) {
        errors.addAll(imports.getErrors(comp));
    }
    // create string ...
    if (!errors.isEmpty()) {
        StringBuilder message = new StringBuilder();
        int lineLength = 70;
        int nextLimit = lineLength;
        for (ImportError error : errors) {
            if (message.length() != 0) {
                message.append(", ");
            }
            if (nextLimit < message.length()) {
                message.append('\n');
                nextLimit += lineLength;
            }
            message.append(getText(error));
        }
        JOptionPane.showConfirmDialog(getActionContext().getLocationComponent(), message, ResourceLoader.getString("import.warning.title"), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
    }
}
Also used : ImportComponent(net.parostroj.timetable.model.imports.ImportComponent) ImportError(net.parostroj.timetable.model.imports.Import.ImportError) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 ImportError (net.parostroj.timetable.model.imports.Import.ImportError)1 ImportComponent (net.parostroj.timetable.model.imports.ImportComponent)1