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

[Theming] Incorrect inverted logic of ComponentOrParentChainScope.setExtraWidgetsPresence #402

Closed
ScoreUnder opened this issue Aug 21, 2022 · 0 comments
Assignees
Labels
6.0 - Iridium Release 6.0 - 2022.H2

Comments

@ScoreUnder
Copy link

Version of Radiance (latest development is 6.0-SNAPSHOT)

5addb52

Sub-project (Common, Animation, Theming, Component, ...)

Theming

The issue you're experiencing (expected vs actual, screenshot, stack trace etc)

theming/src/main/java/org/pushingpixels/radiance/theming/internal/utils/RadianceCoreUtilities.java declares a toShowExtraWidgets function, documented as

@return true if the specified component has extra Radiance-specific UI elements, false otherwise.

But it actually has this behaviour:

                Object componentProp = jcomp.getClientProperty(RadianceSynapse.SHOW_EXTRA_WIDGETS);
                if (componentProp != null) {
                    if (Boolean.TRUE.equals(componentProp))
                        return false;
                    if (Boolean.FALSE.equals(componentProp))
                        return true;
                }

That is, if the user sets SHOW_EXTRA_WIDGETS to false, it returns true, and vice versa.

Compare org/pushingpixels/radiance/theming/api/RadianceThemingCortex.java:

        public static void setExtraWidgetsPresence(JComponent comp, Boolean extraWidgetsPresence) {
            comp.putClientProperty(RadianceSynapse.SHOW_EXTRA_WIDGETS, extraWidgetsPresence);
        }

Documented as:

@param extraWidgetsPresence If true, extra UI elements (such as menu items in system menu or lock borders) will be shown in the component. Pass null to reset to the default behavior.

The check in toShowExtraWidgets makes this docstring contradictory, so I am relatively sure that it's a bug.

Found with a debugger while trying to get a lock border on a specific text field.

@kirill-grouchnikov kirill-grouchnikov self-assigned this Aug 21, 2022
@kirill-grouchnikov kirill-grouchnikov added the 6.0 - Iridium Release 6.0 - 2022.H2 label Aug 21, 2022
@kirill-grouchnikov kirill-grouchnikov changed the title toShowExtraWidgets is backwards?? [Theming] Incorrect inverted logic of ComponentOrParentChainScope.setExtraWidgetsPresence Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.0 - Iridium Release 6.0 - 2022.H2
Projects
None yet
Development

No branches or pull requests

2 participants