I want to provide users with the ability to search in the database. They should be able to search by text on one column and by dates on another column. But I don't want to make two separate fields in the UI, I want to combine them in one TextField. LocalDateTextField in JFXtras is useful for this, as it allows to pick dates with convenient picker, but also allows to enter text. However, it automatically parses the input, and if it can't be parsed into LocalDate, the field clears (as it should by definition).
My question is: can I make it keep the text, so that I get LocalDate if there is one, or if the LocalDate field is null, then I get just the text? I've tried experimenting with setParseErrorCallback (tried to set the text property there), but it seems that deletion happens somewhere down the line. I could just put a button next to the regular TextField that calls the PopOver with LocalDatePicker, but I'm not sure how to replicate the way it looks. How do I style it so that the popover is colored with gradient just like Button? I've tried doing picker.getStyleClass().add("button")
but that carries over on-hover glow and padding.
Here's how LocalDateTextField picker looks:
Note the padding, the gradient and how it's directly below the text field. And here's LocalDatePicker in the PopOver that is called when Button is pressed:
In summary: can I change the behaviour of LocalDateTextField, if yes then how, if not then how do I style my own implementation to look the same? I've tried looking at the source files, but I can't understand where the magic is happening there for the life of me.