Problem with DropDownMenuDisplayer

Thomas Bednarz <[email protected]>
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
Matt,

I try to use the simple drop down menu. It works fine with frames too.

But there is one problem: the 'null' behind every unexpanded or leave 
menu item. (This is visible on your exemples too!)

The generated code looks like this:

<table width="150px" cellpadding=1 cellspacing=1>
    <tr align=left>
        <td nowrap class=normal>
            <b><label 
style="cursor:hand;font-family:verdana;font-size:10px" 
onMouseOver="this.style.color='red'" 
onMouseOut="this.style.color='black'" 
onClick="toggleMenuDisplay(document.getElementById('WNT'), 
document.getElementById('WNT_img'))"> <img id="WNT_img" 
src="../Images/Rarrow.gif" style="border-style:none"/>&nbsp;Windows NT 
</label>
            *<div id="WNT" style="display:none">*
                <table cellpadding=0 cellspacing=0>
                    <tr>
                        <td>
                            <b>&nbsp;&nbsp;<a href="null" target="_self" 
title="Test Menu 1.1" 
style="text-decoration:none;font-family:Helvetica,Arial;font-size:10px">&nbsp;&nbsp;Test 
Menu 1.1</a>
                        </td>
                    </tr>
                </table>
            *</div>null           <-------- where does this come from?????*
        </td>
    </tr>
</table>

I did some research in the sources and found the following:
In net.sf.navigator.displayer is a file called 
DisplayerStrings.properties. There you can find the following two lines:

dd.menu.item.bottom=</table></div>
dd.menu.item.row.start=<tr><td><b>&nbsp;&nbsp;

In the source code I saw, that you read this property in 
net.sf.navigator.displayer.DropDownDisplayer.java. It is the last 
statement of the method displayComponents(..) [line 149]

The method displayComponents() is called in several of your displayers. 
I just looked at the DropDownMenuDisplayer and found to places where it 
is called:

            if (components[i].getMenuComponents().length > 0) {
                if (this.isAllowed(components[i])) {
                    sb.append(displayStrings.getMessage("dd.menu.expander",
                            components[i].getName(),
                            components[i].getName() + "_img",
                            displayStrings.getMessage("dd.image.expander",
                                components[i].getName() + "_img",
                                
displayStrings.getMessage("dd.image.src.expand")) +
                            NBSP + img + title));
                    *displayComponents(components[i], sb);*
*                    sb.append(displayStrings.getMessage("dd.menu.restore",
                            components[i].getName(),
                            components[i].getName() + "_img"));
*                } else {
                    
sb.append(displayStrings.getMessage("dd.menu.restricted",
                            components[i].getName(),
                            components[i].getName() + "_img",
                            displayStrings.getMessage("dd.image.expander",
                                components[i].getName() + "_img",
                                
displayStrings.getMessage("dd.image.src.expand")) +
                            NBSP + img + title));
                }

The red marked code might be a problem if the key dd.menu.restore is not 
found. The struts documentation does not say what is returned, if a 
message is not found.

Could you please have a look at this and see, if this is the real 
problem? Maybe the problem is solved if I simply define the property 
dd.menu.restore but I have no idea what the value of this property 
should be.

Many thanks for your help.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.