/** * Constructor * * @param editInputComponent * @param controller */ public VLInputPopOverInPlaceEditor(IEditInputComponent editInputComponent, AbstractViewController controller) { this.editInputComponent = editInputComponent; this.controller = controller; setAutoHide(true); setAutoFix(true); setHideOnEscape(true); setDetachable(false); setArrowLocation(ArrowLocation.TOP_CENTER); focusedProperty().addListener((pop, ov, nv) -> { if (!nv) { hide(); } }); content.getChildren().add(editInputComponent.getContent()); buildActions(); allOverContainer.getChildren().addAll(content, actions); NodeHelper.setHVGrow(allOverContainer); allOverContainer.setStyle("-fx-border-color:#8c9eff;" + "-fx-border-width: 0;" + "-fx-padding: 32;"); NodeHelper.setHgrow(editInputComponent.getContent(), content, actions); }
private void buildActions() { okButton.setFocusTraversable(false); okButton.setText(controller.getGLocalised("SAVE_LABEL").toUpperCase()); cancelButton.setText(controller.getGLocalised("CANCEL_LABEL").toUpperCase()); cancelButton.setFocusTraversable(false); actions.setStyle("-fx-padding: 32 0 0 32; -fx-alignment: CENTER_RIGHT;-fx-spacing:16;"); actions.getChildren().addAll(NodeHelper.horizontalSpacer(), okButton, cancelButton); cancelButton.setOnAction(e -> { hide(); }); okButton.setOnAction(e -> { hide(); editInputComponent.commitModification(); }); editInputComponent.getContent().addEventHandler(KeyEvent.KEY_PRESSED, e -> { if (e.getCode() == KeyCode.ENTER) { hide(); } }); }