This code is taken from the wicket-contrib-navmenu. It defines a
wicket:panel for the menuitems.
I'm having real trouble with the AttributeModifier.
Looking at the code the AttributeModifier is attached to the panel itself.

public ItemPanel(final String id, final MenuRow row)
        {
            super(id);
            final String label = getLabel();
            final BookmarkablePageLink pageLink = new
BookmarkablePageLink("link", getPageClass(),
                    getPageParameters());
            pageLink.setAutoEnable(false);
            pageLink.add(new Label("label", label));
            add(pageLink);
            add(new AttributeModifier("class", true, new Model()
            {
                public Object getObject(final Component component)
                {
                    return
row.getRowStyle().getItemCSSClass(MenuItem.this, row);
                }
            }));
        }

The HTML code for the panel is:

<wicket:panel><a wicket:id="link" href="#"><span wicket:id="label">the
label</span></a></wicket:panel>

The panel itself is used from the following code:

<wicket:panel>

<div wicket:id="div">
 <ul wicket:id="ul">
  <li wicket:id="columns"><span wicket:id="itemPanel"><a
href="#">label here</a></span>
  </li>
 </ul>
</div>

</wicket:panel>

Looking in the css the class "tabSelected" referenced from the code is
applied to an <li> which to me indicates that the AttributeModifier is
attached to the <li>.
However the getObject-method of the Model is never called. And the
resulting HTML doesn't contain any class-attribute.

I've been looking at the code for two days now and I'm certain that
I've overlooked something but I don't now what...

Would appreciate another pair of eyes on it...

I'm running wicket 1.2 CVS from friday last week.

/Mats


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to