Giter VIP home page Giter VIP logo

Comments (21)

tbee avatar tbee commented on September 25, 2024

Well, reusing the CalendarTextField in the LocalDate*TextField has saved me a lot of duplicate code (and corresponding maintenance), but it comes at a price that you have such forwarding code.

I'm not sure why the runLater is there; apparently it was needed to make it work :-)

Would you mind creating a PR for this change, this time with a test?

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Yes I'll do it as soon as possible!

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

I'm working on the PR and doing some tests on my application.

I came across this bug because I want to put the editor inside a TableCell when edition is requested on a TableView.
What I do is that I request the focus and do a "select all" inside the Textfield. Therefore, if the user is double clicking on a cell, he can start typing directly and the text is erased by what he's typing.

Also if the user is typing directly into a cell not in edition, I manually start the edition. But because the runLater is there, the focus is not given immediately, and the user's input is gone. Can I remove this runLater in the code? There is no comment explaining why it was there in the first place..

Also, do you have any idea how to make public the "selectAll" method of the TextField through the LocalDateTextField?

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Apparently the runLater was needed, otherwise it would not be there. A comment would have been good, shame on me. That said, the original code was pretty darn old, back to the prerelease of JavaFX 2.0, so chances are focus handling has changed. You may remove the runLater if all the test keep running.

The selectAll, because the control is named "TextField" it is allowed to assume that its skin will implement a TextField, so the selectAll method can be added to the Calendar/LocalDateTextField control and forwarded to the skin. For this I usually create an interface and have the control assume all skins have implemented that.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Allright, I'll run the tests but I don't think the runLater is needed.

How would you forward the selectAll()? You mean creating an Interface for the skin containing like :
public void selectAll();

And the Calendar/LocalDateTextField will have :

public void selectAll(){
((MySkin)getSkin()).selectAll();
}

Something like that..?

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Exactly like that. The interface requires what the skins must implement. But this is only applicable for the CalendarTextField skin(s), the LocalDateTextField will forward the selectAll at control level (just like the focus change).

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

But the focus change is forwarded in the LocalDateTextFieldSkin .

So the selectAll method in the LocalDateTextField will call the selectAll of the LocalDateTextFieldSkin, which will call selectAll of the CalendarTextField control?

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Yes, CalendarTextField will have a selectAll(). LocalDateTextFieldSkin uses a CalendarTextField control without addressing its skin directly, so it should call the selectAll() on CalendarTextField.

Please also add the selectAll on the other *TextField controls?

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Allright I think I got it.
Yes I will add this method on other controls and some tests as soon as possible.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Well without modifying any files, I have some test failing..
Is the test "slideStep15" of CalendarTimePickerTest of JfXtras Controls succeeding on your side?

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Do you use a mac?

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Nope I have a Windows..

Le 21 nov. 2016 20:30, "Tom Eugelink" [email protected] a Γ©crit :

Do you use a mac?

β€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#73 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIi-baN5duC-HAYINTCxgl_seRtotOVJks5rAfFegaJpZM4Ku8o_
.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

That is strange (so have I).
Yes, last time I ran the tests, a week ago or so, all ran ok.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

I see it failing now as well.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

My bad! Fixed it.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Allright, I've commited the things on my repo. Now I have (again!) another issue !

When the popup is shown, and you press escape, the focus is sent to the next element. That annoys me and it doesn't feel right. Maybe you clicked on the calendar (or maybe it was opened by the code) but you actually want to do some input with the keyboard. Thus you press escape, and you want to type something.

But since the focus is away, you have to manually click inside the TextField to input something. I think putting the focus inside the TextField after the popup is hidden is better for keyboard user experience.

Any thought on that?

The test is ready (all other tests are running with the modification )and should be looking like that :

@Test
    public void inputAfterEscape() {
        // open the popup
        TestUtil.runThenWaitForPaintPulse(() -> {
            calendarTextField.setPickerShowing(true);
        });
        type(KeyCode.ESCAPE);

        type(KeyCode.NUMPAD2);

        //TextField should be focused
        Assert.assertTrue(find(".text-field").isFocused());

        Assert.assertEquals("2", ((TextField) find(".text-field")).getText());
    }

I have to look a bit deeper because the CalendarTimeTextFieldSkin doesn't have a setOnHiding method like the CalendarTextFieldSkin, but I think it should also have.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Apparently you are the first one to put the control through its paces like this. Thank you for that. I'll get back to you.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Also on a side note, what is "getText()" supposed to give in CalendarTextField? Should it return the exact same thing as "getText()" on the TextField?

Because apparently, it's updated only when a value is set, or when we parse the Text. But we don't parse it each time a key is typed. So since the documentation is a bit light, I'm wondering if this "textProperty" should reflect the "textProperty" of the Textfield, or it has another purpose that I'm missing.

EDIT : I'm sorry to ask so many questions, but I'm using these calendars in very specific mode where everything is important.. I don't want to fork the project and do things on my side. I really want to give my feedback on real applications in order to improve these controls for other people. And like always, I'm able to provide pull requests for every demand I make.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

You're question are highly appreciated! Yes, getText should return what getText on textfield does.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Allright, I'll try to modify the management of this textProperty and add some tests.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

I've opened a separate issue for the getText issue. Waiting on your opinion regarding the focus on popup hiding. When you have some spare time of course ;)

from jfxtras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.