-
Notifications
You must be signed in to change notification settings - Fork 329
enhancedtabs moved to common, implemented in UnitDisplay #6960
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR moves the EnhancedTabbedPane component from MML to MM common, enhancing the tabbed UI in the UnitDisplay window and improving window state persistence by storing x, y, width, and height. Key changes include:
- Updating MekPanelTabStrip constant naming to use capitalized strings.
- Replacing the old tab strip with a new EnhancedTabbedPane in UnitDisplay.
- Adding getters and setters in GUIPreferences for saving and retrieving window size and position.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
megamek/src/megamek/client/ui/swing/widget/MekPanelTabStrip.java | Updated constant string values for tab names. |
megamek/src/megamek/client/ui/swing/unitDisplay/UnitDisplay.java | Replaced MekPanelTabStrip with EnhancedTabbedPane and re-arranged layout using CardLayout for view switching. |
megamek/src/megamek/client/ui/swing/GUIPreferences.java | Added methods for persisting named window size and position. |
Comments suppressed due to low confidence (1)
megamek/src/megamek/client/ui/swing/unitDisplay/UnitDisplay.java:505
- In tabbed view mode the method showPanel() immediately returns without updating the tab selection. It is recommended to select the corresponding tab in tabbedPane based on the value of 's'.
if (GUIP.getUnitDisplayStartTabbed()) { return; }
Can you add the screen shots? Also there is a long standing ask to include the sprite of the unit on the card so players can at a glance see the sprite outside of the map. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6960 +/- ##
============================================
- Coverage 30.31% 30.21% -0.10%
- Complexity 15807 15811 +4
============================================
Files 2886 2887 +1
Lines 283126 284084 +958
Branches 49326 49495 +169
============================================
+ Hits 85833 85841 +8
- Misses 191694 192642 +948
- Partials 5599 5601 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
if (windowCoords.length < 4) { | ||
return Optional.empty(); | ||
} | ||
int x = Integer.parseInt(windowCoords[0]); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException Note
return Optional.empty(); | ||
} | ||
int x = Integer.parseInt(windowCoords[0]); | ||
int y = Integer.parseInt(windowCoords[1]); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException Note
} | ||
int x = Integer.parseInt(windowCoords[0]); | ||
int y = Integer.parseInt(windowCoords[1]); | ||
int width = Integer.parseInt(windowCoords[2]); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException Note
int x = Integer.parseInt(windowCoords[0]); | ||
int y = Integer.parseInt(windowCoords[1]); | ||
int width = Integer.parseInt(windowCoords[2]); | ||
int height = Integer.parseInt(windowCoords[3]); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException Note
* @param tabIndex The index of the tab being detached | ||
* @param component The component in the tab | ||
*/ | ||
default boolean onTabDetaching(int tabIndex, Component component) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
* @param component The component in the tab | ||
* @param event The event that triggered the close (may be null) | ||
*/ | ||
default void onTabCloseRequest(int tabIndex, Component component, InputEvent event) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
* @param component The component in the tab | ||
* @param event The event that triggered the close (may be null) | ||
*/ | ||
default void onTabCloseRequest(int tabIndex, Component component, InputEvent event) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
* @param tabIndex The index of the tab that was removed | ||
* @param component The component that was removed | ||
*/ | ||
default void onTabRemoved(int tabIndex, Component component) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
* @param tabIndex The index of the tab that was removed | ||
* @param component The component that was removed | ||
*/ | ||
default void onTabRemoved(int tabIndex, Component component) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
/** | ||
* Configures a JFrame for detached tab display | ||
*/ | ||
private void setupFrame(JFrame frame, String title, Icon icon, Component component, Dimension size, |
Check notice
Code scanning / CodeQL
Useless parameter Note
This PR moves the EnhancedTabbedPane from MML to MM common.
Improves them using the saving of x;y;w;h instead of only w;h
Implements them in the UnitDisplay window