public void undo() throws CannotUndoException { super.undo(); for (int i = 0; i < categories.size(); i++) { String file = files.get(i); try { catalogModel.addRoute(categories.get(i), descriptions.get(i), toFile(new URL(file)), urls.get(i), new AddRouteCallback(), false); } catch (MalformedURLException e) { throw new IllegalStateException(format("Cannot create URL for %s", file)); } } }
public void undo() throws CannotUndoException { super.undo(); catalogModel.deleteRoutes(singletonList(callback.getRoute()), false); }
public void run() throws IOException { Route route = file != null ? category.getCategory().createRoute(description, file) : category.getCategory().createRoute(description, url); final RouteModel routeModel = new RouteModel(category, route); callback.setRoute(routeModel); invokeLater(new Runnable() { public void run() { routesTableModel.addRoute(routeModel); } }); } });
private void addFile() { String description = textFieldDescription.getText(); if (trim(description) == null) { labelResult.setText(RouteConverter.getBundle().getString("add-route-no-description-error")); pack(); return; } catalogModel.addRoute(category, description, file, null, new AddRouteCallback()); labelResult.setText(RouteConverter.getBundle().getString("add-route-by-file-success")); pack(); dispose(); }
private void addUrl() { String url = textFieldUrl.getText(); if (trim(url) == null) { labelResult.setText(RouteConverter.getBundle().getString("add-route-no-url-error")); pack(); return; } String description = textFieldDescription.getText(); if (trim(description) == null) { labelResult.setText(RouteConverter.getBundle().getString("add-route-no-description-error")); pack(); return; } catalogModel.addRoute(category, description, null, url, new AddRouteCallback()); labelResult.setText(RouteConverter.getBundle().getString("add-route-by-url-success")); pack(); dispose(); }