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

Switch from microba to LGoodDatePicker #2176

Closed
koppor opened this issue Oct 18, 2016 · 15 comments
Closed

Switch from microba to LGoodDatePicker #2176

koppor opened this issue Oct 18, 2016 · 15 comments
Labels
status: help wanted type: code-quality Issues related to code or architecture decisions

Comments

@koppor
Copy link
Member

koppor commented Oct 18, 2016

It seems that microba is not maintained any more: tdbear/microba@9a67c14. microba also recommends https://github.com/LGoodDatePicker/LGoodDatePicker for date switching (and also available on maven central (in contrast to microba)).

Since there seems to be an issue with the memory leak and microba (see #2166 (comment)), it seems that it is a good idea to switch to that library.

Alternative: Reimplement the tab in JavaFX. This could be significantly more effort than "just" replacing the library.

@koppor koppor added status: help wanted type: code-quality Issues related to code or architecture decisions labels Oct 18, 2016
@matthiasgeiger
Copy link
Member

Using JavaFx this should more or less work out-of-the-box: https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/date-picker.htm

Only the "none" and "today" buttons are not provided by default.

@matthiasgeiger matthiasgeiger added this to the v3.7 milestone Oct 20, 2016
@matthiasgeiger
Copy link
Member

matthiasgeiger commented Oct 25, 2016

Just invested half an hour to check whether integration LGoodDatePicker can be easily accomplished.

Result: No it is not easily possible. The main problem is that the LGoodDatePicker always brings his own TextField which cannot be adjusted to use the textfield already present in the entry editor. Simply hiding the text field of LGoodDatePicker is also not possible as it must be visible for internal calculations to determine the position of the Calender to be shown.

It would be possible to create a customized Calender PopUp using the CalendarPanel provided - but this is would require some effort, too.

Thus, I would recommend not to include it in 3.7 and to use the JavaFX version instead.

@BlakeTNC
Copy link

BlakeTNC commented Dec 2, 2016

Hi there, I'm the primary developer of LGoodDatePicker. I was reading your issue and I'm not sure what your exact use case needs are, but I wanted to let you know that if there are simple modifications that would allow the library to meet your needs, then creating such modifications would be an option as well.

It sounds like you need to hide the text field, and allow the calendar panel to work with only the button showing?

Shot in the dark at assisting: One quick impression is that it would probably not be especially hard to give the developer some control over where the calendar pop-up appears.

I have not looked into the possibility of allowing the text field to be hidden in the library (It's not a use case that had occurred to me), but I'm guessing that could be accomplished too. (Whether by me or by authoring a pull request. )

Warm regards,
Blake

@matthiasgeiger
Copy link
Member

Hi Blake!
Thanks for your assistance!
Let me provide you a screenshot from our use case to clarify the things:

datepicker example

We have an "EntryEditor" using some custom "TextFields" in which our user can input the data to describe bibliography items (title, authors, ...). On of these fields is "date" for which we are using currently the microba DatePicker. As you can see we use the version with an icon to open a Calendar pop-up. The picked date is then used to set the value of our custom textfield.

(You can checkout our current implementation here at GitHub)

If I got it right this is not really possible out-of-the-box with LGoodDatePicker, right? The only possibility would be to directly use the CalendarPanel.

Regards,
Matthias

@BlakeTNC
Copy link

BlakeTNC commented Dec 2, 2016

Thanks, yes that does show what you need.

To answer your question, yes. You could directly use the calendar panel, with some work. However, I'm thinking it might be a lot less work to modify the DatePicker class to allow the date text field to be hidden. That way you might get all the custom pop-up functionality for free. The date picker does already have hooks to allow you to watch for date value changes, so a callback for transferring the date after the user selects it is already available.

I'm going to play with the code a bit to see what it might take to show a "button only" form. I intend to post again when I have some more info.

Blake

@matthiasgeiger
Copy link
Member

Great! Thank you!

@BlakeTNC
Copy link

BlakeTNC commented Dec 2, 2016

Hello,
Okay, now you can hide the date picker text field. This feature is implemented and released as of LGoodDatePicker 8.2.2. See the function called "DatePickerSettings.setVisibleDateTextField()".

For a visual demo, run "LGoodDatePicker-8.2.2-executable-demo.jar", scroll down under the date picker examples to see "Date 16, Hidden text field".

Here's the applicable demo source code:
( From FullDemo.java )

    // Create a date picker: With Hidden text field (Showing button only).
    // Note: A developer might want to do this if they were providing their own component 
    // for displaying the date.
    dateSettings = new DatePickerSettings();
    dateSettings.setVisibleDateTextField(false);
    dateSettings.setGapBeforeButtonPixels(0);
    datePicker = new DatePicker(dateSettings);
    panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
    panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier),
            "Date 16, Hidden text field (Showing button only):");

I'm guessing it's likely that the new source code is working fine, but please give feedback if you find any problems or bugs.

Let me know if this fills the need.

Warm regards,
Blake

@matthiasgeiger
Copy link
Member

Hi @BlakeTNC !

Sorry for not replying earlier, but I was on the road this weekend.

Thank you very much for your quick implementation! It works fine as can be seen in PR #2340.

Just one small request: Is it possible to push the 8.2.2 version also to the maven repository? Would be easier for us to integrate in our gradle build.

Regards
Matthias

@BlakeTNC
Copy link

BlakeTNC commented Dec 5, 2016

Hi @matthiasgeiger,
Sure no problem, I'm glad to help. I published version 8.2.2 to Maven Central as of 4dec16 7:30pm Pacific Time. It should appear at the following link within an hour or two (a day at the most). http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22LGoodDatePicker%22

If you like, please add a "star" for the project on the top of the project page, to increase the project ratings. My goal is 30 stars, I have 6 to go.

Cool that you were able to use the component pretty easily. (I looked at your change file.)

Warm regards,
Blake

@matthiasgeiger
Copy link
Member

Awesome!

Just have merged the PR - so starting from the next version (and by now in the dev builds we are using your lib.

Thanks again for your help! You have earned your star 😜

@JabRef/developers maybe you could push @BlakeTNC over the 30 stars? 😉

@lenhard
Copy link
Member

lenhard commented Dec 5, 2016

@matthiasgeiger @BlakeTNC I already did :-) Thanks for being so responsive!

@BlakeTNC
Copy link

BlakeTNC commented Dec 5, 2016

Very nice. You are welcome. : )
Yay 30! Thanks for the stars, developers.
-Blake

@BlakeTNC
Copy link

FYI: You may wish to update to LGoodDatePicker 8.3.0, (also visible on Maven Central within a few hours), because it includes a second Linux-specific bug fix. As I've learned, the JComponent focus gain/loss events are less than perfectly portable across operating systems. ("Write once, debug everywhere", right?, lol)

If you'd like to receive notifications automatically of future releases, you could sign up for the release feed.
Happy holidays,
Blake

@koppor
Copy link
Member Author

koppor commented Dec 14, 2016

Thank you for letting us know. We use https://www.versioneye.com/ to automatically track updates on depended libraries. Furthermore, I personally use https://sibbell.com/, which notifies me of new releases by starred repositories. 🎉

@BlakeTNC
Copy link

nice, thanks for letting me know about those tools.
-Blake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted type: code-quality Issues related to code or architecture decisions
Projects
None yet
Development

No branches or pull requests

5 participants