Jide components trash Nimbus menu and a potential fix

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Jide components trash Nimbus menu and a potential fix

Postby mawcs » Sun Jan 24, 2010 3:40 pm

Hello,

I am building an application using the Nimbus LnF (which will be default in JSE 7). If I add any components to my application from the Jide OSS project that eventually call installJideExtension() from it updateUI method (e.g. JideTabbedPane), the menus and pop-up menus are broken. Rendering is quite off and the menu will sometimes have a grey background instead of transparent.

I discovered that the problem is that the LookAndFeelFactory is installing Jide-dependent changes to the menu look and feel based on the assumption that the Jide Action Framework is in use. Since the Jide Action Framework is not part of the open source library, this is a poor assumption.

I propose a solution to this problem.

In LookAndFeelFactory.getDefaultStyle():
Code: Select all
public static int getDefaultStyle() {
        if (_defaultStyle == -1) {
            String defaultStyle = SecurityUtils.getProperty("jide.defaultStyle", "-1");
            try {
                _defaultStyle = Integer.parseInt(defaultStyle);
            }
            catch (NumberFormatException e) {
                // ignore
            }
            if (_defaultStyle == -1) {
                int suggestedStyle;
                try {
                    if (SystemInfo.isWindowsVistaAbove() && UIManager.getLookAndFeel() instanceof WindowsLookAndFeel && SystemInfo.isJdk6Above()) {
                        suggestedStyle = OFFICE2007_STYLE;
                    }
                    else if (XPUtils.isXPStyleOn() && UIManager.getLookAndFeel() instanceof WindowsLookAndFeel) {
                        suggestedStyle = OFFICE2003_STYLE;
                    }
                    else {
                        suggestedStyle = VSNET_STYLE;
                    }
                }
                catch (UnsupportedOperationException e) {
                    suggestedStyle = VSNET_STYLE;
                }
                return suggestedStyle;
            }
        }
        return _defaultStyle;
    }


Change this method to use VSNET_STYLE_WITHOUT_MENU instead:
Code: Select all
public static int getDefaultStyle() {
        if (_defaultStyle == -1) {
            String defaultStyle = SecurityUtils.getProperty("jide.defaultStyle", "-1");
            try {
                _defaultStyle = Integer.parseInt(defaultStyle);
            }
            catch (NumberFormatException e) {
                // ignore
            }
            if (_defaultStyle == -1) {
                int suggestedStyle;
                try {
                    if (SystemInfo.isWindowsVistaAbove() && UIManager.getLookAndFeel() instanceof WindowsLookAndFeel && SystemInfo.isJdk6Above()) {
                        suggestedStyle = OFFICE2007_STYLE;
                    }
                    else if (XPUtils.isXPStyleOn() && UIManager.getLookAndFeel() instanceof WindowsLookAndFeel) {
                        suggestedStyle = OFFICE2003_STYLE;
                    }
                    else {
                        suggestedStyle = VSNET_STYLE_WITHOUT_MENU;
                    }
                }
                catch (UnsupportedOperationException e) {
                    suggestedStyle = VSNET_STYLE_WITHOUT_MENU;
                }
                return suggestedStyle;
            }
        }
        return _defaultStyle;
    }



Further, to make sure that the correct default is used for developers using the Jide Action Framework, I suggest using setDefaultStyle(LookAndFeelFactory.VSNET_STYLE) somewhere in the Action Framework's initialization code.

The result will be that the default style will not intrude on any LnF used by the application.
mawcs
 
Posts: 10
Joined: Mon Oct 09, 2006 2:10 pm

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Sun Jan 24, 2010 6:41 pm

There are a big percentage of users use JIDE Action Framework so we don't want to make it default to use VSNET_STYLE_WITHOUT_MENU for "else". So for now, I will add a check for Nimbus and use VSNET_STYLE_WITHOUT_MENU if so, until we find a better solution to support Nimbus.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby mawcs » Sun Jan 24, 2010 8:42 pm

I mean no disrespect, but that seems like a poor solution. If your "common layer" truly is common, it should be made to stand on its own without assuming that your other libraries are present. The "default" mode should be the least intrusive and obtrusive path. In this case, to use the WITHOUT_MENU support; which is clearly made only for your other libraries.

The simplest solution would be to include a single line within the constructor of the CommandBar parent class:

Code: Select all
setDefaultStyle(LookAndFeelFactory.VSNET_STYLE_WITHOUT_MENU);


With that change, the common layer is much more "common" and you don't have to explicitly check for Nimbus. (As an aside, this issue would present itself for any LaF that you don't currently "support." Making this fix would broaden your support for other LaFs out-of-the-box ). For an open source project, this change would improve the appeal and usefulness of this library; albeit a relatively unknown feature. Just knowing that the library will "play nice" with a plethora of LaF would increase the chances of its use.
mawcs
 
Posts: 10
Joined: Mon Oct 09, 2006 2:10 pm

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Sun Jan 24, 2010 8:57 pm

JIDE Common layer is "common" for all other JIDE products. And I had to say it is still the paid customers keeping us alive, not the JCL-only users. So our higher priority goal is to make paid customers happy by not asking them to do unnecessary extra steps. Sorry :)

The line you suggested will prevent people from using Office2007 and other styles so it doesn't work.

I think I have a better solution in mind. We already have a way to check what JIDE jars is in classpath. So if jide-action.jar is not in the class path, we use VSNET_STYLE_WITHOUT_MENU. So for JCL only users, that'll work perfectly.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Fri Jan 29, 2010 11:56 am

Just so you know, this is fixed in 2.8.3.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Sat Feb 06, 2010 12:51 am

Just so you know, this is fixed also in 2.7.8.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby Java1Guy » Thu Feb 10, 2011 4:09 pm

Where can one download JideCommon (including older releases such as 2.7.8)? I don't see any download files at jide-oss.java.net...
Is the only option to build from source?
In the java.net project subversion, there are no tags, so i presume a branch is appropriate. There is no branch for 2.7.8, so i guess 2.8.3 will be needed to pick up this fix...???

Other suggestions?
Mark

BTW - thanks to whoever just built 2.11.0 and put it in the downloads page!!!
Java1Guy
 
Posts: 5
Joined: Wed Feb 02, 2011 12:07 am

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Thu Feb 10, 2011 4:38 pm

Just uploaded the latest version there. The website is recently renewed and we just got how we should proceed in this new website.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby Java1Guy » Thu Feb 10, 2011 4:43 pm

Thanks for doing that - it is quite helpful (since otherwise I would have to install subversion, and maven... etc. etc.).
Mark
Java1Guy
 
Posts: 5
Joined: Wed Feb 02, 2011 12:07 am

Re: Jide components trash Nimbus menu and a potential fix

Postby Java1Guy » Thu Feb 10, 2011 5:02 pm

So I installed 2.11.0... what is the upshot of what else to do to get a "fix"?
I have this code:
Code: Select all
LookAndFeelFactory.installDefaultLookAndFeel();
LookAndFeelFactory.installJideExtension();
which works fine for Win7 default L&F...
but when I switch to Nimbus during execution of the app, the menu items on the menu bar are all run together - there's no space between the items.

(Edit: which btw is the same as it looks when using Jide OSS 2.2.1.12 :(
Attachments
MenusHosed.png
MenusHosed.png (18.87 KiB) Viewed 27055 times
Java1Guy
 
Posts: 5
Joined: Wed Feb 02, 2011 12:07 am

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Thu Feb 10, 2011 5:17 pm

Would you please share with us a simple test case to investigate further?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Thu Feb 10, 2011 6:20 pm

We don't officially support Nimbus. It is not technically possible right now. The earliest time we can consider supporting it is when JDK7 is released where it makes all Synth UI classes public. As a result, we will not attempt to work on any glitches that are related to the usage of Nimbus.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby baslat » Fri Nov 29, 2013 8:25 am

Do you officially support Nimbus as of today?
baslat
 
Posts: 28
Joined: Mon May 10, 2010 8:27 am

Re: Jide components trash Nimbus menu and a potential fix

Postby JIDE Support » Fri Nov 29, 2013 11:07 am

We don't support Nimbus and don't plan to support it in the near future due to technical reasons.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36503
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide components trash Nimbus menu and a potential fix

Postby baslat » Fri Nov 29, 2013 2:09 pm

:'(
baslat
 
Posts: 28
Joined: Mon May 10, 2010 8:27 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: Bing [Bot] and 5 guests