Skip to content

Commit

Permalink
Moved the creation of the search text field used by the FilterViewSki…
Browse files Browse the repository at this point in the history
…n to the FilterView control class. Added accessor for the field.
  • Loading branch information
dlemmermann committed May 10, 2024
1 parent 5681833 commit 1e696f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions gemsfx/src/main/java/com/dlsc/gemsfx/FilterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
*/
public class FilterView<T> extends Control {

private final SearchTextField searchTextField = new SearchTextField();

public FilterView() {
getStyleClass().add("filter-view");

Expand Down Expand Up @@ -119,6 +121,15 @@ protected Skin<?> createDefaultSkin() {
return new FilterViewSkin<>(this);
}

/**
* Returns the search text field used for entering filter terms.
*
* @return the search text field
*/
public final SearchTextField getSearchTextField() {
return searchTextField;
}

private final IntegerProperty scrollThreshold = new SimpleIntegerProperty(this, "scrollThreshold", 100);

public int getScrollThreshold() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public class FilterViewSkin<T> extends SkinBase<FilterView<T>> {

private final SearchTextField searchTextField = new SearchTextField();
private final SearchTextField searchTextField;
private final HBox filterGroupsPane = new HBox();
private final FlowPane filtersPane = new FlowPane();
private final HBox headerBox = new HBox();
Expand All @@ -38,6 +38,8 @@ public class FilterViewSkin<T> extends SkinBase<FilterView<T>> {
public FilterViewSkin(FilterView<T> view) {
super(view);

searchTextField = view.getSearchTextField();

InvalidationListener updateHeaderListener = it -> updateHeaderBox();
view.titleLabelProperty().addListener(updateHeaderListener);
view.titlePostfixLabelProperty().addListener(updateHeaderListener);
Expand Down

0 comments on commit 1e696f8

Please sign in to comment.