List of usage examples for javafx.scene Node toString
@Override
public String toString()
From source file:view.EditorView.java
@FXML // This method is called by the FXMLLoader when initialization is complete void initialize() { assert insertRoom != null : "fx:id=\"insertRoom\" was not injected: check your FXML file 'EditorMain.fxml'."; assert drawing != null : "fx:id=\"drawing\" was not injected: check your FXML file 'EditorMain.fxml'."; assert insertPath != null : "fx:id=\"insertPath\" was not injected: check your FXML file 'EditorMain.fxml'."; currentEditorInstance = this; // modify the default exception handler to show the ReportingDialog on every uncaught exception final Thread.UncaughtExceptionHandler currentUncaughtExceptionHandler = Thread .getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> { if (currentUncaughtExceptionHandler != null) { // execute current handler as we only want to append it currentUncaughtExceptionHandler.uncaughtException(thread, exception); }// w w w . jav a2 s . c o m Platform.runLater(() -> { new ExceptionAlert(exception).showAndWait(); new ReportingDialog(stage.getScene()).show(AppConfig.gitHubUserName, AppConfig.gitHubRepoName, exception); }); }); currentGame.addListener((observable, oldValue, newValue) -> { if (newValue != null) { newValue.modifiedProperty().addListener((observable1, oldValue1, newValue1) -> { this.menuItemSave.setDisable(!newValue1); setWindowTitle(newValue); }); } setWindowTitle(newValue); }); initGame(); scrollPane.hvalueProperty().addListener((observable, oldValue, newValue) -> unselectingDisabled = true); scrollPane.vvalueProperty().addListener((observable, oldValue, newValue) -> unselectingDisabled = true); // add button icons insertRoom.setGraphic(new ImageView(new Image(EditorView.class.getResourceAsStream("add-room.png")))); moveButton.setGraphic(new ImageView(new Image(EditorView.class.getResourceAsStream("move-arrows.png")))); insertPath.setGraphic( new ImageView(new Image(EditorView.class.getResourceAsStream("connecting-points.png")))); autoLayoutButton .setGraphic(new ImageView(new Image(EditorView.class.getResourceAsStream("autoLayout.png")))); refreshViewButton .setGraphic(new ImageView(new Image(EditorView.class.getResourceAsStream("refreshView.png")))); // add tooltips insertRoom.setTooltip(new Tooltip("Insert a new room")); moveButton.setTooltip(new Tooltip("Move rooms")); insertPath.setTooltip(new Tooltip("Connect rooms to create walk paths")); autoLayoutButton.setTooltip(new Tooltip("Automatically rearrange the rooms in the view below")); refreshViewButton.setTooltip(new Tooltip("Refresh the current view")); // forward events to all selected items // drawing.setOnMouseClicked(forwardEventsToSelectableNodesHandler); // drawing.setOnMousePressed(forwardEventsToSelectableNodesHandler); // drawing.setOnMouseReleased(forwardEventsToSelectableNodesHandler); // drawing.setOnDragDetected(forwardEventsToSelectableNodesHandler); // drawing.setOnMouseDragged(forwardEventsToSelectableNodesHandler); scrollPane.setOnKeyPressed(event -> { if (event.getCode().equals(KeyCode.DELETE)) { for (Node child : new ArrayList<>(drawing.getChildren())) { if (child instanceof Disposable) { if (((Disposable) child).isSelected() && event.getTarget() != child) { FOKLogger.fine(EditorView.class.getName(), "Sending disposal command to child, Child is: " + child.toString() + "\ntarget is: " + event.getTarget().toString()); try { ((Disposable) child).dispose(); } catch (IllegalStateException e) { FOKLogger.log(EditorView.class.getName(), Level.INFO, "User tried to remove the current room (not allowed)", e); new Alert(Alert.AlertType.ERROR, "Could not perform delete operation: \n\n" + ExceptionUtils.getRootCauseMessage(e)).show(); } } } } } else if (event.getCode().equals(KeyCode.A) && event.isControlDown()) { // select everything for (Node child : new ArrayList<>(drawing.getChildren())) { if (child instanceof Selectable) { ((Selectable) child).setSelected(true); } } } }); }