Author Topic: JMenu/JPopupMenu with submenus  (Read 20745 times)

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
JMenu/JPopupMenu with submenus
« on: June 06, 2008, 05:53:12 PM »
I'm having some problems with the rendering of menus in AjaxSwing:

- I have a JMenu in my JMenuBar which itself contains JMenus (submenus).  Some of the items in the submenu are disabled (based on which tree node is selected).
  - The position of the main menu jumps down and over when I mouseover the first menu item.
  - The disabled items in the submenus are greyed out but the text is larger than the enabled items.

- On the same page, I have multiple tree node JPopupMenus which contain JMenus (submenus).
  - The position of the popup menu jumps down and over when I mouseover the first menu item.
  - The submenu items do not get rendered at all.

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #1 on: June 09, 2008, 04:30:47 PM »
- Disabled item text styles have been adjusted for Windows theme demo. In general, I have to note that Windows theme is not our most polished theme. Blue and Khaki are more professionally done. Do you prefer Windows theme?

- We were able to reproduce the jumpy menu for JPopupMenu but not for JMenuBar. It might be the same issue so fixing JPopupMenu may help with JMenuBar. If not, then we'll probably ask you to attach generated HTML.

I'll post when the fixes available for download.

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #2 on: June 10, 2008, 05:54:08 PM »
Why is Windows the default in default.properties, if you don't recommend it?  I tried the Blue theme, but still see the same display problems.  The default.properties lists predefined themes as AjaxSwing, Windows, Fancy and Blue.  I only see Windows_docs/ and Blue_docs/ in the .war file; I don't see a Khaki_docs/?

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #3 on: June 11, 2008, 12:09:11 AM »
I'll request the default theme to be changed to Blue. Khaki theme is only available to customers with the commercial license. It can be download from http://creamtec.com/products/ajaxswing/customers/Khaki_docs.zip. Unzip the contents of the jar in AjaxSwing/tomcat/webapps/ajaxswing directory next to the other themes. You can view the Khaki theme in our online demos.

The blue theme's disabled menu items should be of the same font size as regular menu items.

The jumping menus are a JavaScript problem that was fixed and is now being tested. Therefore it doesn't depend on the theme.

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #4 on: June 11, 2008, 11:08:46 AM »
I tried the Blue and Khaki themes.  Since we support our GUI both natively and via HTML, we're trying to maintain as much as possible the same look-and-feel between the two.  I think the Windows theme is the closest match for us, so I'll probably stick with that.

I did confirm that the Blue and Khaki theme's disabled menu items were not a problem like the Windows theme.

I think you might have missed the last problem I identified in my original post.  Submenus for right-click context menus are not being rendered.  I did look at the generated HTML, and it looks like the component IDs for the submenus aren't right.  Here's a context menu with submenus:

<div id="JPopupMenu17914465_m0" class="wcPulldownMenu">
<a href="#" onclick="return submenuMouseclick(this, '/event/' + activeButton.id + '/menu/0/0');" onmouseover="submenuMouseover(this, 'JPopupMenu17914465_m-1');" class="submenuText">
Generate
</a>
<a href="#" onclick="return submenuMouseclick(this, '/event/' + activeButton.id + '/menu/0/1');" onmouseover="submenuMouseover(this, 'JPopupMenu17914465_m-1');" class="submenuText">
Import
</a>
</div>

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #5 on: June 11, 2008, 02:37:00 PM »
We know that submenus weren't rendered and that's fixed as well. The patch should be available today, and you would be able to use Windows theme.

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #6 on: June 11, 2008, 09:32:16 PM »
You can download the patch files using the following URLs:

http://creamtec.com/products/ajaxswing/install/2.1.3/ajaxswing.jar.jdk1.5
http://creamtec.com/products/ajaxswing/install/2.1.3/asboot.jar.jdk1.5
http://creamtec.com/products/ajaxswing/install/2.1.3/ajaxswing.js  (place into AjaxSwing/tomcat/webapps/ajaxswing/scripts directory)
http://creamtec.com/products/ajaxswing/install/2.1.3/styles_common.css (place into AjaxSwing/tomcat/webapps/ajaxswing/Windows_docs/css/ajaxswing directory)

Let us know if it fixed all the issues you've reported.

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #7 on: June 12, 2008, 05:14:50 PM »
I applied the four new files and made sure I cleared the cache in my browser, but I still have most of the problems.  The only one that appears to be fixed is the submenu rendering in a right-click popup menu.  It is renderering, but I'm getting a ClassCastException when I select a submenu item.  I've attached the server and client debug files.

The other problems - larger text for disabled menu items in the Windows theme and a position jumping in the pulldown or popup menu still seem to be a problem?  I double and triple checked that I applied the updates correctly.

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #8 on: June 12, 2008, 06:15:50 PM »
From the log it appears that ajaxswing.js and styles_common.css have not been updated and are out of synch with the .jars. I have double checked the files on our server and it seems that ajaxswing.js was updated but styles_common.css was not. So it would explain why the disabled text is still large but it does not explain the outdated JavaScript.

Please re-download .css file.
To verify that you have the right ajaxswing.js please search for "source.treeId" in it. There should be two occurances.

I think the problem might be that you have a custom tree renderer that uses RenderUtils.renderContextMenu. In order to distinguish between the clicks on the item and clicks on the tree (one of your previous bug reports) we had to refactor DefaultJTreeRenderer to submit additional information when the user clicks a menu item. It does it by calling RClTree() JavaScript function for the tree or RClIt() for the node. I have attached the latest DefaultJTreeRenderer for your reference to this post.

You can verify that the functionality works by viewing our webmail demo. Right click on the tree and look see if the popup menu works. Then you can also view the generated HTML.

Sorry if our refactoring broke your renderer, let us know if you need help with updating it.

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #9 on: June 12, 2008, 06:34:13 PM »
I re-downloaded the .css file and now my disabled menu items are the correct size.  Thanks.

Now for the jumpy menus and ClassCastException.  I verified that I have the updated ajaxswing.js and I commented out my custom tree renderer in the application properties file so that it is no longer in play.  But I still have these problems.  Are you certain the jar files I downloaded are the correct ones or there isn't some other updated file I need???

I haven't verified your webmail demo.

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #10 on: June 12, 2008, 10:49:50 PM »
I am as certain as I can be. I've re-downloaded those files and applied them to a fresh install of 2.1.2. Then viewed our demo and it worked fine. But as you know, every case is different so maybe it's not the problems with files not applied, but something else. I've also rebuilt ajaxswing.js and compared it to the one on our server and they match 100%. But from your log file and description it looks like ajaxswing.js is old. So let's take one step at a time.

Open WebMail (WindowsThemeDemo) on your patched AjaxSwing and right mouse click on Inbox of the tree. That should have popup menu with submenus. Let us know if it's jumpy or not, and if submissions work.

Also, if you can post or email us a URL to your server then I can check it to see what might be wrong.

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #11 on: June 13, 2008, 09:32:46 AM »
I don't have a full 2.1.2 zip - maybe that's my problem.  Where can I download this from?

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #12 on: June 13, 2008, 10:13:33 AM »
I found the download, never mind.  I start over with a fresh 2.1.2 and these updated files.

Support Team

  • Administrator
  • Hero Member
  • *****
  • Posts: 1074
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #13 on: June 13, 2008, 11:53:56 AM »
It may make sense to try the webmail demo with your current setup, before you start from scratch. Just to make sure we are not going down the wrong path.

aevett

  • Customer
  • Sr. Member
  • *
  • Posts: 482
    • View Profile
Re: JMenu/JPopupMenu with submenus
« Reply #14 on: June 13, 2008, 01:58:05 PM »
I don't run through Apache Tomcat - we have our own web server servlet container implementation and I don't have an easy way to plug in your webmail demo into our web server.

I did do this.  I downloaded 2.1.2 and made sure the webmail demo worked out-of-the box, which it did.  I then applied the four updated files - ajaxswing.jar, asboot.jar, ajaxswing.js and common_styles.css - to 2.1.2 and ran the webmail demo again.  I see the new submenus in the demo in the menubar and popup menus, but I don't see the jumpiness.  I do however get the same ClassCastException when I select the submenu item from the node's popup menu.

So why I'm seeing the jumpiness in my app is still a mystery.  If you want, I can try to plug-in the webmail demo into our web server, but this will take some time, and I probably wouldn't be able to this until later next week.