-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced search text field with new implementation. Some polishing.
- Loading branch information
1 parent
c10ff0a
commit 9f6b17e
Showing
19 changed files
with
146 additions
and
52 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
components/src/main/java/com/dlsc/jfxcentral2/components/MobileSearchTextField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.dlsc.jfxcentral2.components; | ||
|
||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
import javafx.geometry.Insets; | ||
import javafx.geometry.Pos; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.layout.Priority; | ||
import org.kordamp.ikonli.javafx.FontIcon; | ||
import org.kordamp.ikonli.materialdesign.MaterialDesign; | ||
|
||
public class MobileSearchTextField extends BorderPane { | ||
|
||
public MobileSearchTextField() { | ||
getStyleClass().add("text-input"); | ||
|
||
getStyleClass().add("mobile-search-text-field"); | ||
|
||
TextField textField = new TextField(); | ||
textField.textProperty().bindBidirectional(textProperty()); | ||
textField.promptTextProperty().bind(promptText); | ||
|
||
HBox.setHgrow(textField, Priority.ALWAYS); | ||
|
||
FontIcon icon = new FontIcon(MaterialDesign.MDI_MAGNIFY); | ||
BorderPane.setAlignment(icon, Pos.CENTER); | ||
BorderPane.setMargin(textField, new Insets(0, 10, 0, 10)); | ||
|
||
setLeft(icon); | ||
setCenter(textField); | ||
} | ||
|
||
private final StringProperty text = new SimpleStringProperty(); | ||
|
||
public String getText() { | ||
return text.get(); | ||
} | ||
|
||
public StringProperty textProperty() { | ||
return text; | ||
} | ||
|
||
public void setText(String text) { | ||
this.text.set(text); | ||
} | ||
|
||
public final void clear() { | ||
text.set(""); | ||
} | ||
|
||
private final StringProperty promptText = new SimpleStringProperty(); | ||
|
||
public String getPromptText() { | ||
return promptText.get(); | ||
} | ||
|
||
public StringProperty promptTextProperty() { | ||
return promptText; | ||
} | ||
|
||
public void setPromptText(String promptText) { | ||
this.promptText.set(promptText); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.