@Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (newValue != null && newValue != oldValue) {
if (newValue.booleanValue()) {
if (searchIconPath == null) {
searchIconPath = new Region();
searchIconPath.getStyleClass().add("search-icon");
}
getChildren().add(searchIconPath);
} else if (oldValue != null && searchIconPath != null) {
getChildren().remove(searchIconPath);
}
getSkinnable().requestLayout();
}
}
});
showSearchIconProperty().addListener(new ChangeListener<Boolean>() {
@Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (newValue != null) {
if (newValue.booleanValue()) {
if (cancelSearchIconPath == null) {
cancelSearchIconPath = new Region();
cancelSearchIconPath.getStyleClass().add("cancel-search-icon");
cancelSearchIconPath.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent event) {
getSkinnable().setText("");