private static void onUncaughtException(Thread thread, Throwable throwable) { if (!ExceptionHandler.isLogException()) { LOGGER.log(Level.SEVERE, "Uncaught throwable in " + thread.getName(), throwable); } ExceptionHandler.getDefaultInstance().setException(throwable); }
private void handleBackActionWithExceptionHandler() { try { navigateBack(); } catch (VetoException | FlowException e) { getExceptionHandler().setException(e); } } }
private void handleActionWithExceptionHandler(String id) { try { handle(id); } catch (VetoException | FlowException e) { getExceptionHandler().setException(e); } }
public <T> void observeWorker(Worker<T> worker) { worker.exceptionProperty().addListener((ob, ol, e) -> setException(e)); }
c.accept(event); } catch (Exception e) { exceptionHandler.setException(e); c.accept(event); } catch (Exception e) { exceptionHandler.setException(e); exceptionHandler.setException(e); } catch (ExecutionException e) { exceptionHandler.setException(e);
public void attachLinkEventHandler(MenuItem menuItem, Class<?> controllerClass) { handler.attachAction(menuItem, () -> { try { navigate(controllerClass); } catch (Exception e) { getExceptionHandler().setException(e); } }); }
public void attachLinkEventHandler(Node node, Class<?> controllerClass) { handler.attachAction(node, () -> { try { navigate(controllerClass); } catch (Exception e) { getExceptionHandler().setException(e); } }); }
public static <T> List<TableColumn<T, ?>> createColumns(Class<T> entityType, ExceptionHandler exceptionHandler) { List<TableColumn<T, ?>> columns = new ArrayList<>(); for (Field field : entityType.getDeclaredFields()) { ViewColumn columnAnnotation = field.getAnnotation(ViewColumn.class); if (columnAnnotation != null) { TableColumn<T, ?> column = new TableColumn<>(); column.setText(columnAnnotation.value()); column.setEditable(columnAnnotation.editable()); column.setSortable(columnAnnotation.sortable()); column.setResizable(columnAnnotation.resizeable()); column.setCellValueFactory(e -> { try { return new SimpleObjectProperty(DataFXUtils.getPrivileged(field, e.getValue())); } catch (Exception exception) { exceptionHandler.setException(exception); return null; } }); columns.add(column); } } return columns; } }
/** * This methods creates a tab that contains the given view. * By doing so the metadata of the view will be bound to the tab properties. * So the text and icon of the tab can be changed by the view. * * @param context the context of the view. This includes the view and its controller instance * so that all needed informations are part of the context * @param exceptionHandler the exception handle for the view. This handler will handle all exceptions that will be thrown in the DataFX container context */ public <T> Tab createTab(ViewContext<T> context, ExceptionHandler exceptionHandler) { Tab tab = new Tab(); tab.textProperty().bind(context.getMetadata().titleProperty()); tab.graphicProperty().bind(context.getMetadata().graphicsProperty()); tab.setOnClosed(e -> { try { context.destroy(); } catch (Exception exception) { exceptionHandler.setException(exception); } }); tab.setContent(context.getRootNode()); return tab; }
public <T extends Node> Tab startInTab(FlowContainer<T> container) throws FlowException { Tab tab = new Tab(); getCurrentViewMetadata().addListener((e) -> { tab.textProperty().unbind(); tab.graphicProperty().unbind(); tab.textProperty().bind(getCurrentViewMetadata().get().titleProperty()); tab.graphicProperty().bind(getCurrentViewMetadata().get().graphicsProperty()); }); tab.setOnClosed(e -> { try { destroy(); } catch (Exception exception) { exceptionHandler.setException(exception); } }); tab.setContent(start(container)); return tab; }