Skip to content
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

Replace JFXDatePicker with DatePicker #750

Merged
merged 5 commits into from
Jan 15, 2024
Merged

Conversation

preland
Copy link
Contributor

@preland preland commented Jan 13, 2024

This PR replaces JFXDatePicker with DatePicker in the Account Seed View. This is a temporary fix for the "growing DatePicker" issue in #527.

It should be noted that I was unable to use the Seed Recovery feature on the Account Seed View, nor was I able to see the date associated with the current wallet seed. This issue was present both before and after the PR, and is likely unrelated to the "growing DatePicker" issue.

@preland preland requested a review from woodser as a code owner January 13, 2024 01:12
@woodser
Copy link
Contributor

woodser commented Jan 13, 2024

Looks like we can fix this issue while keeping JFXDatePicker by following Bisq's upstream change:

DatePicker datePicker = new JFXDatePicker();
// fix display issue from github.com/bisq-network/bisq/issues/6216 and github.com/sshahine/JFoenix/issues/1245
datePicker.getEditor().setMinWidth(250);
datePicker.getEditor().setMaxWidth(Control.USE_PREF_SIZE);
datePicker.getEditor().setPrefWidth(Control.USE_PREF_SIZE);
Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, columnIndex, title, datePicker, top);
return new Tuple2<>(topLabelWithVBox.first, datePicker);

https://github.com/bisq-network/bisq/blob/566ab53c8fb56654478cba9bdd1af581790d89bb/desktop/src/main/java/bisq/desktop/util/FormBuilder.java#L684

@preland
Copy link
Contributor Author

preland commented Jan 13, 2024

I had originally not attempting using this fix because of the comment on the PR claiming it did not work in Dec. 2023, and because the fix was similar to something else I had tried, which had done nothing; I'll check back in after testing

@preland
Copy link
Contributor Author

preland commented Jan 13, 2024

Using the fix, most of the behavior is gone; However, when clicking on the datePicker, growth begins occurring;

I'll look further into this fix and see if it can be improved further.

(Same caveats about the overall functionality of the page still apply)

@woodser
Copy link
Contributor

woodser commented Jan 14, 2024

If JFXDatePicker is still not working and your solution is fully functional, we can move forward with that for now, depending on what you find.

@preland
Copy link
Contributor Author

preland commented Jan 14, 2024

Looking into it further, it appears that there is a lot of weird stuff going on in JFoenix overall. For one, the version on Maven isn’t….right? (There are minute differences in the codebase, but the big giveaway is that the version on Maven is Apache….despite the license for JFoenix being changed to MIT over 3 years ago)

Using the most up-to-date version of JFoenix and building it as such, I cannot reproduce the infinitely growing datePicker, so I think it may be fixed in that version.

Theoretically, we could remove the Maven dependency and use a “custom” (not really custom since it’s the unmodified version on their GitHub) build of JFoenix instead, though that might cause unexpected issues in other parts of the UI.

As far as functionality is concerned, using datePicker should work just fine. JFXDatePicker is mainly just a css wrapper for datePicker anyway, so the difference should be mostly aesthetic.

@woodser
Copy link
Contributor

woodser commented Jan 14, 2024

Yeah I don't think we want to change a major dependency like that, since it can introduce many quirks in the UI which are difficult to catch and debug.

So I think it makes sense to simply switch away from JFXDatePicker.

@@ -106,6 +106,8 @@ protected void initialize() {
displaySeedWordsTextArea.setEditable(false);

datePicker = addTopLabelDatePicker(root, ++gridRow, Res.get("seed.date"), 10).second;
//note: on MacOS this datePicker does not actually list a date...is it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this comment since it's a separate bug which will be fixed separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is now removed

@woodser
Copy link
Contributor

woodser commented Jan 14, 2024

The code is still using JFXDatePicker in add2TopLabelDatePicker. Thinking that should be switched over too?

@preland
Copy link
Contributor Author

preland commented Jan 14, 2024

I have switched that code over as well; it isn't currently in use in the project, but just in case someone tries to use it in the future....

@woodser
Copy link
Contributor

woodser commented Jan 14, 2024

The unused import needs removed too, to fix the checkstyle error:

/home/runner/work/haveno/haveno/desktop/src/main/java/haveno/desktop/util/FormBuilder.java:21:8: Unused import - com.jfoenix.controls.JFXDatePicker. [UnusedImports]

Remove unused import
@preland
Copy link
Contributor Author

preland commented Jan 14, 2024

The import is now removed

@woodser woodser merged commit 1a981f2 into haveno-dex:master Jan 15, 2024
6 checks passed
@woodser
Copy link
Contributor

woodser commented Jan 15, 2024

Thanks, please post or DM an XMR address for payment. :)

@preland
Copy link
Contributor Author

preland commented Jan 15, 2024

You are welcome :)

48pre1andu3Z8E186es2mZYBcHMTyowcn1DQ3htN6rLCGwG39ycDCeP8kSa3b7rqaZ6to3L1K7bd92fERMex3nEpJashdga

@woodser
Copy link
Contributor

woodser commented Jan 15, 2024

Payment sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants