From f41a62919e128c4acec47f9d9123939280c93e19 Mon Sep 17 00:00:00 2001 From: Jurgen Date: Tue, 14 May 2019 11:58:27 +0200 Subject: [PATCH] Remove deprecated methods (#818) Removed deprecated methods from ViewActions and GenericStyledArea --- .../fxmisc/richtext/GenericStyledArea.java | 39 ++----------------- .../java/org/fxmisc/richtext/ViewActions.java | 21 ---------- 2 files changed, 3 insertions(+), 57 deletions(-) diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java index 8c6b7bc2f..7e6c5c7ac 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java @@ -442,14 +442,14 @@ public final boolean removeSelection(Selection selection) { @Override public final void setOnOutsideSelectionMousePressed(EventHandler handler) { onOutsideSelectionMousePressed.set( handler ); } @Override public final ObjectProperty> onOutsideSelectionMousePressedProperty() { return onOutsideSelectionMousePressed; } private final ObjectProperty> onOutsideSelectionMousePressed = new SimpleObjectProperty<>( e -> { - onOutsideSelectionMousePressProperty().get().accept(e); + moveTo( hit( e.getX(), e.getY() ).getInsertionIndex(), SelectionPolicy.CLEAR ); }); @Override public final EventHandler getOnInsideSelectionMousePressReleased() { return onInsideSelectionMousePressReleased.get(); } @Override public final void setOnInsideSelectionMousePressReleased(EventHandler handler) { onInsideSelectionMousePressReleased.set( handler ); } @Override public final ObjectProperty> onInsideSelectionMousePressReleasedProperty() { return onInsideSelectionMousePressReleased; } private final ObjectProperty> onInsideSelectionMousePressReleased = new SimpleObjectProperty<>( e -> { - onInsideSelectionMousePressReleaseProperty().get().accept(e); + moveTo( hit( e.getX(), e.getY() ).getInsertionIndex(), SelectionPolicy.CLEAR ); }); private final ObjectProperty> onNewSelectionDrag = new SimpleObjectProperty<>(p -> { @@ -476,7 +476,7 @@ public final boolean removeSelection(Selection selection) { @Override public final void setOnSelectionDropped(EventHandler handler) { onSelectionDropped.set( handler ); } @Override public final ObjectProperty> onSelectionDroppedProperty() { return onSelectionDropped; } private final ObjectProperty> onSelectionDropped = new SimpleObjectProperty<>( e -> { - onSelectionDropProperty().get().accept(e); + moveSelectedText( hit( e.getX(), e.getY() ).getInsertionIndex() ); }); // not a hook, but still plays a part in the default mouse behavior @@ -1581,37 +1581,4 @@ private void suspendVisibleParsWhile(Runnable runnable) { return CSS_META_DATA_LIST; } - - // Note: this code should be moved to `onOutsideSelectionMousePressed` property - // in the next major release before removing this deprecated field - @Deprecated private final ObjectProperty> onOutsideSelectionMousePress = new SimpleObjectProperty<>( e -> { - CharacterHit hit = hit(e.getX(), e.getY()); - moveTo(hit.getInsertionIndex(), SelectionPolicy.CLEAR); - }); - @Deprecated - @Override public final ObjectProperty> onOutsideSelectionMousePressProperty() { - return onOutsideSelectionMousePress; - } - - // Note: this code should be moved to `onInsideSelectionMouseReleased` property - // in the next major release before removing this deprecated field - @Deprecated private final ObjectProperty> onInsideSelectionMousePressRelease = new SimpleObjectProperty<>( e -> { - CharacterHit hit = hit(e.getX(), e.getY()); - moveTo(hit.getInsertionIndex(), SelectionPolicy.CLEAR); - }); - @Deprecated - @Override public final ObjectProperty> onInsideSelectionMousePressReleaseProperty() { - return onInsideSelectionMousePressRelease; - } - - // Note: this code should be moved to `onSelectionDropped` property - // in the next major release before removing this deprecated field - @Deprecated private final ObjectProperty> onSelectionDrop = new SimpleObjectProperty<>( e -> { - CharacterHit hit = hit(e.getX(), e.getY()); - moveSelectedText(hit.getInsertionIndex()); - }); - @Deprecated - @Override public final ObjectProperty> onSelectionDropProperty() { - return onSelectionDrop; - } } diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/ViewActions.java b/richtextfx/src/main/java/org/fxmisc/richtext/ViewActions.java index 801aa53e6..4c0e67097 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/ViewActions.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/ViewActions.java @@ -463,25 +463,4 @@ default void hideContextMenu() { } } - /** Use setOnOutsideSelectionMousePressed(EventHandler>MouseEvent<) instead, which is FXML compatible */ - @Deprecated default void setOnOutsideSelectionMousePress(Consumer consumer) { onOutsideSelectionMousePressProperty().set(consumer); } - /** Use getOnOutsideSelectionMousePressed() instead */ - @Deprecated default Consumer getOnOutsideSelectionMousePress() { return onOutsideSelectionMousePressProperty().get(); } - /** Use onOutsideSelectionMousePressedProperty() instead */ - @Deprecated ObjectProperty> onOutsideSelectionMousePressProperty(); - - /** Use getOnInsideSelectionMousePressReleased() instead */ - @Deprecated default Consumer getOnInsideSelectionMousePressRelease() { return onInsideSelectionMousePressReleaseProperty().get(); } - /** Use setOnInsideSelectionMousePressReleased(EventHandler>MouseEvent<) instead, which is FXML compatible */ - @Deprecated default void setOnInsideSelectionMousePressRelease(Consumer consumer) { onInsideSelectionMousePressReleaseProperty().set(consumer); } - /** Use onInsideSelectionMousePressReleasedProperty() instead */ - @Deprecated ObjectProperty> onInsideSelectionMousePressReleaseProperty(); - - /** Use getOnSelectionDropped() instead */ - @Deprecated default Consumer getOnSelectionDrop() { return onSelectionDropProperty().get(); } - /** Use setOnSelectionDropped(EventHandler>MouseEvent<) instead, which is FXML compatible */ - @Deprecated default void setOnSelectionDrop(Consumer consumer) { onSelectionDropProperty().set(consumer); } - /** Use onSelectionDroppedProperty() instead */ - @Deprecated ObjectProperty> onSelectionDropProperty(); - }