ho-dev / HattrickOrganizer

Assistant for Hattrick online football manager
https://ho-dev.github.io/HattrickOrganizer/
GNU Lesser General Public License v3.0
195 stars 79 forks source link

[BUG] Best position and AutoLineup are not in sync when using darklaf theme #744

Closed johari75 closed 3 years ago

johari75 commented 4 years ago

Describe the bug Activating or deactivating the autoLineUp flag for a player causes activation or deactivation the autoLineUp flag for another player.

To Reproduce Steps to reproduce the behavior: see clip in zip-file

Screenshots HO! - Hattrick Organizer 4.0 r3266 - Unterhose Kairo - 14.0.1 2020-10-21 15-11-27.zip

Platform information:

Additional context Add any other context about the problem here.

akasolace commented 4 years ago

@johari75 I can't reproduce. Something should be wrong with your database. Can you share it?

johari75 commented 3 years ago

@akasolace Of course. Do you need the complete db folder ?

akasolace commented 3 years ago

@johari75 yes please as a zip file. You only have one team, right ?

johari75 commented 3 years ago

@akasolace yes, I have only one team. My db folder is to big. 27 MB zipped I´ll try to reduce the data volume

johari75 commented 3 years ago

@akasolace Here you are 20201022_UnterhoseKairo_db.zip

akasolace commented 3 years ago

@tychobrailleur @weisJ I checked this one and the error comes from darklaf. The mouse pressed events are not detected correctly (at least for boolean cells I am not sure for other). Events are not always detected sometime and the reported value is incorrect: https://github.com/akasolace/HO/blob/733405bb6404efeec3eeddd5a09045885bcaad88/src/main/java/module/lineup/AustellungSpielerTable.java#L51

with nimbus: best position and autolineup are in sync across the app

EVdgy7YZA1

with darklaf: best position and autolineup are not in sync across the app

GeXRhbrYAp

weisJ commented 3 years ago

Relying on a mouse released event to be triggered isn't really the best option here. Lafs don't need to guarantee that the mouseRelease event will be send to the JTable. In fact almost all the time this event will be consumed by the editing component (which is happening in darklaf).

I would recommend to install a TableModelListener on the tables model and react to the events in there (Which is in fact currently broken in darklaf, but I am working on updating the table value as soon as the editor value changes).

akasolace commented 3 years ago

@tychobrailleur when you got a bit of free time again it could be nice if you can have a look at this one. It is a blocking one for 4.0 and so far I did not manage to fix it ....

weisJ commented 3 years ago

Version 2.5.0 of darklaf should resolve this issue as is (i.e. without further changes). Though I would still highly recommend to change the approach as suggested above.

akasolace commented 3 years ago

should be fixed by https://github.com/weisJ/darklaf/commit/31b16fbd9e1132da0c5f70289899c927281fd83d but ideally this should be adressed via TableModelListener

johari75 commented 3 years ago

Is there anything I can do to support you or to test your solution anyhow?

akasolace commented 3 years ago

@johari75 you should be able to test with the next beta ...

akasolace commented 3 years ago

@weisJ @tychobrailleur in this example the Jtable model is a TableSorter. AddingTableModelListener to the Jtable only captures changes on sorting (see below)

getModel().addTableModelListener(new TableModelListener() {
tableSorter.addTableModelListener(e -> System.out.println("Table Changed 1 !"));
tableSorter.getModel().addTableModelListener(e -> System.out.println("Table Changed 2 !"));

"Table Changed 1 !" is displayed if I change sorting of some columns but "Table Changed 2 !" is never displayed

I am not sure if in such case I can use TableModelListener .... any ideas ?

weisJ commented 3 years ago

Did you try this with the new darklaf version? Also it like TableSorter is a custom table model for HO. So if sorting events aren’t propagated then there needs to be changes made to TableSorter itself.

akasolace commented 3 years ago

Did you try this with the new darklaf version?

yes it fxed the issue !

Also it like TableSorter is a custom table model for HO. So if sorting events aren’t propagated then there needs to be changes made to TableSorter itself.

yes I will try again to look at this in the future ... I opened a ticket for this (https://github.com/akasolace/HO/issues/752)

@weisJ thank you for your help !