Hello all,

I am trying to implement a panel with a table whose tr's are Fragments. I am
using
ListView in order to generate several table rows, but my rendered
table has some markup that I wish to eliminate:

1.- the <span wicket:id="caption"> tag, which I thought would be
  eliminated when calling .setOutputMarkupPlaceholderTag(false)
2.- the <span wicket:id="menuitemrv"> tag. I do not understand why
  this tag appears outside the <tbody> tag. I have tried
  setOutputMarkupPlaceholderTag in the ListView, but it doesn't work
  either.

Clearly, there is something about placeholder tags that I do not
understand at all. Could anyone please help me with this?

Any other suggestion on how to implement this table is welcome.

Thanks a lot.



Here is my panel code/markup and the rendered panel
:
** Source Code:
MyPanel.html:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"; xmlns:wicket="
http://wicket.sourceforge.net/";>
<wicket:panel>
    <table width="155" cellspacing="0" cellpadding="0" align="center">
        <tbody>
            <tr>
                <td align="center" class="tbmenu">
                <table cellspacing="0" style="width: 155px; border: 0px;
padding: 0px">
                    <tbody>
                        <span wicket:id="menuitemrv">
                          <!-- menu item -->
                          <tr wicket:id="menuitem">menu goes here</tr>
                          <!-- end menu item -->
                        </span>
                    </tbody>
                </table>
                </td>
            </tr>
        </tbody>
    </table>
<wicket:fragment wicket:id="menuitemfragment">
        <td onmouseout="this.style.color=''"
            style="height: 26px; width =157px; vertical-align: middle;
padding-left: 25px; text-align: left; background:
url('images/menu-inicial.gif'); background-repeat: no-repeat;"
            onmouseover="this.style.color='#c32127'"
            class="tbmenuitem">

            <a wicket:id="link"
               onmouseout="this.style.color=''"
               onmouseover="this.style.color='#c32127'"
               class="tbmenuitem"
               href="#">
               <span wicket:id="caption">caption</span>
            </a>
        </td>
</wicket:fragment>
</wicket:panel>

MyPanel.java:
public class MyPanel extends Panel {


    public MyPanel(String id, IModel model) {
        super(id,model);
        changeableComponent = contentPanel;

        Arrays.asList(new String[] {
        "item 1", "item 2" })
        ListView lview = new ListView("menuitemrv", model) {

            //private int counter = 0;

            @Override
            protected void populateItem(ListItem listitem) {
                final String menuitemstr =  (String)
listitem.getModelObject();
                listitem.add(new
MenuItemFragment("menuitem","menuitemfragment", new Model(menuitemstr)));

            }
        };

        lview.setOutputMarkupPlaceholderTag(false);
        add(lview);

    }

    class MenuItemFragment extends Fragment {


        public MenuItemFragment(String id, String markupId, IModel model) {
            super(id, markupId, MainMenuPanel.this, model);

            AjaxFallbackLink link = new AjaxFallbackLink("link") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                }
            };

            link.add(new
Label("caption",model).setOutputMarkupPlaceholderTag(false));

            add(link);
        }

    }

}


** Rendered panel:
<table cellspacing="0" cellpadding="0" align="center" width="155">
        <tbody>
            <tr>
                <td align="center" class="tbmenu">
                <span wicket:id="menuitemrv">
                          <!-- menu item -->
                          </span><span wicket:id="menuitemrv">
                          <!-- menu item -->
                          </span><span wicket:id="menuitemrv">
                          <!-- menu item -->
                          </span><table cellspacing="0" style="border: 0px
none ; padding: 0px; width: 155px;">
                    <tbody>
                        <tr wicket:id="menuitem">
        <td class="tbmenuitem" onmouseover="this.style.color='#c32127'"
style="background: transparent url(images/menu-inicial.gif) no-repeat scroll
0% 0%; height: 26px; vertical-align: middle; padding-left: 25px; text-align:
left; -moz-background-clip: -moz-initial; -moz-background-origin:
-moz-initial; -moz-background-inline-policy: -moz-initial;"
onmouseout="this.style.color=''">

            <a onmouseover="this.style.color='#c32127'" id="link1"
onmouseout="this.style.color=''" onclick="var
wcall=wicketAjaxGet('?wicket:interface=:1:aswborder:mainmenu:menuitemrv:0:menuitem:link::IBehaviorListener:0:',null,null,
function() {return Wicket.$('link1') != null;}.bind(this));return !wcall;"
class="tbmenuitem" wicket:id="link"
href="?wicket:interface=:1:aswborder:mainmenu:menuitemrv:0:menuitem:link::ILinkListener::">

               <span wicket:id="caption">item 1</span>
            </a>
        </td>
    </tr>
                          <!-- end menu item -->
                          <!-- submenu items -->

                          <!-- end submenu items -->
                        <tr wicket:id="menuitem">
        <td class="tbmenuitem" onmouseover="this.style.color='#c32127'"
style="background: transparent url(images/menu-inicial.gif) no-repeat scroll
0% 0%; height: 26px; vertical-align: middle; padding-left: 25px; text-align:
left; -moz-background-clip: -moz-initial; -moz-background-origin:
-moz-initial; -moz-background-inline-policy: -moz-initial;"
onmouseout="this.style.color=''">

            <a onmouseover="this.style.color='#c32127'"
onmouseout="this.style.color=''" onclick="var w = window.open(href, '',
'scrollbars=yes,location=yes,menuBar=yes,resizable=yes,status=yes,toolbar=yes');
if(w.blur) w.focus(); return false;" class="tbmenuitem" wicket:id="link"
href="http://www.google.com";>
               <span wicket:id="caption">item 2</span>
            </a>
        </td>
    </tr>
                          <!-- end menu item -->
                          <!-- submenu items -->

                          <!-- end submenu items -->

                    </tbody>
                </table>
                </td>
            </tr>
        </tbody>
    </table>

Reply via email to