Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Jul 11, 2024

This update makes the selected Player update the following dialogs (either for the first time, or now correctly):

  • "Add a Combat Unit",
  • "Create Random Army",
  • "Load Unit List"
  • "Save Unit List"

The above dialogs will now correctly reflect which Player has been selected when they open, and new units will be added to the appropriate players' lists. Filenames likewise will correctly reflect the current player for loading and saving (previously they would stick with whatever player was selected when the dialog was first opened).

autoselect_player_in_config_dialogs_1 autoselect_player_in_config_dialogs_2 autoselect_player_in_config_dialogs_3 autoselect_player_in_config_dialogs_4 autoselect_player_in_config_dialogs_5 autoselect_player_in_config_dialogs_6

It also adds a utility GetFocusListener class that can be added as an AncestorListener to components: when that component or its ancestor (containing component, such as JPanel or JDialog) is set to visible, it will be notified and made the focus. This is slightly cleaner than the current ".grabFocus()" approach we use in a lot of places.

Note: Unfortunately the wonkiness of Java JDialog modals means that it is not possible to focus on more than one component prior to turning the Dialog visible, and this new functionality requires taking focus initially to ensure that the Player combo box gets updated appropriately, so I have removed the auto-focus on the text filter box from the MegaMek unit picker only (this will not affect other derived dialogs or projects).

Testing:

  • Ran all 3 projects' unit tests
  • Tested all dialogs with various Bots (and no Bots)

@codecov
Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.09%. Comparing base (ef98c2a) to head (e120518).
Report is 39 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5727      +/-   ##
============================================
- Coverage     29.29%   29.09%   -0.20%     
- Complexity    13877    13882       +5     
============================================
  Files          2468     2506      +38     
  Lines        264115   265959    +1844     
  Branches      47316    47557     +241     
============================================
+ Hits          77368    77381      +13     
- Misses       182845   184682    +1837     
+ Partials       3902     3896       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@IllianiBird IllianiBird merged commit f524085 into MegaMek:master Jul 12, 2024
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