Skip to content

Remove behavior from RangeSlider and SnapshotView control #1395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
ext.java9Args = [
// For various usages of TraversalEngine
"--add-exports=javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls",
"--add-exports=javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls",
// For various behaviors across controls
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls",
// For ReadOnlyUnbackedObservableList across files
"--add-exports=javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls",
// For InputMap used in behavior classes
"--add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls",
// For EventHandlerManager in AutoCompletionBinding
"--add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls",
// For MappingChange, NonIterableChange across files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013, 2014 ControlsFX
* Copyright (c) 2013, 2021, ControlsFX
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -26,8 +26,6 @@
*/
package org.controlsfx.samples;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Button;
Expand All @@ -36,7 +34,6 @@
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

import org.controlsfx.ControlsFXSample;
import org.controlsfx.control.NotificationPane;
import org.controlsfx.control.action.Action;
Expand Down Expand Up @@ -81,13 +78,11 @@ public String getControlStylesheetURL() {
}));

Button showBtn = new Button("Show / Hide");
showBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
if (notificationPane.isShowing()) {
notificationPane.hide();
} else {
notificationPane.show();
}
showBtn.setOnAction(e -> {
if (notificationPane.isShowing()) {
notificationPane.hide();
} else {
notificationPane.show();
}
});

Expand All @@ -97,27 +92,15 @@ public String getControlStylesheetURL() {

cbUseDarkTheme = new CheckBox("Use dark theme");
cbUseDarkTheme.setSelected(false);
cbUseDarkTheme.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
updateBar();
}
});
cbUseDarkTheme.setOnAction(e -> updateBar());

cbHideCloseBtn = new CheckBox("Hide close button");
cbHideCloseBtn.setSelected(false);
cbHideCloseBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
notificationPane.setCloseButtonVisible(!cbHideCloseBtn.isSelected());
}
});
cbHideCloseBtn.setOnAction(e -> notificationPane.setCloseButtonVisible(!cbHideCloseBtn.isSelected()));

textField = new TextField();
textField.setPromptText("Type text to display and press Enter");
textField.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
notificationPane.show(textField.getText());
}
});
textField.setOnAction(e -> notificationPane.show(textField.getText()));

VBox root = new VBox(10);
root.setPadding(new Insets(50, 0, 0, 10));
Expand Down
3 changes: 0 additions & 3 deletions controlsfx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ javadoc {
"javafx.base/com.sun.javafx.event=org.controlsfx.controls",
"javafx.web/com.sun.webkit=org.controlsfx.controls",
"javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls",
"javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls",
"javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls",
"javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls",
"javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls"
]
)
Expand Down
28 changes: 24 additions & 4 deletions controlsfx/src/main/java/impl/org/controlsfx/ImplUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
*/
package impl.org.controlsfx;

import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Group;
Expand All @@ -42,6 +38,10 @@
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;

import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

public class ImplUtils {

private ImplUtils() {
Expand Down Expand Up @@ -157,4 +157,24 @@ public static ObservableList<Node> getChildrenReflectively(Parent p) {

return children;
}

public static void focusPreviousSibling(Node node) {
final ObservableList<Node> children = node.getParent().getChildrenUnmodifiable();
final int index = children.indexOf(node);
if (index > 0) {
children.get(index - 1).requestFocus();
} else {
node.getParent().requestFocus();
}
}

public static void focusNextSibling(Node node) {
final ObservableList<Node> children = node.getParent().getChildrenUnmodifiable();
final int index = children.indexOf(node);
if (index < children.size() - 1) {
children.get(index + 1).requestFocus();
} else {
focusNextSibling(node.getParent());
}
}
}
19 changes: 0 additions & 19 deletions controlsfx/src/main/java/impl/org/controlsfx/ReflectionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
*/
package impl.org.controlsfx;

import javafx.scene.Parent;
import javafx.scene.control.Control;
import javafx.scene.control.TableColumnBase;
import javafx.scene.control.skin.NestedTableColumnHeader;
import javafx.scene.control.skin.TableHeaderRow;
Expand Down Expand Up @@ -133,23 +131,6 @@ public static Integer onScroll(TableViewSkinBase tableViewSkinBase, String metho
return -1;
}

/****************************************************************************************************
*
* TraversalEngine
*
****************************************************************************************************/

public static void setTraversalEngine(Control control, Object engine) {
try {
Class<?> parentHelper = Class.forName("com.sun.javafx.scene.ParentHelper");
Method method = parentHelper.getMethod("setTraversalEngine", Parent.class, engine.getClass());
method.setAccessible(true);
method.invoke(parentHelper, control, engine);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
throw new RuntimeException("Cannot set Traversal Engine");
}
}

/****************************************************************************************************
*
* Miscellaneous
Expand Down
Loading