You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Ojeda <do...@integra.la> on 2008/12/26 16:02:49 UTC

Confusion with placeholder tags

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>

Re: Confusion with placeholder tags

Posted by David Ojeda <do...@integra.la>.
Thanks Martijn,
I had a mixup between those methods.

On Sat, Dec 27, 2008 at 10:45 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> setOutputMarkupPlaceholderTag is for ajax refreshes. See
> setRenderBodyOnly() or use <wicket:container> in your markup.
>
> Martijn
>
> On Fri, Dec 26, 2008 at 4:02 PM, David Ojeda <do...@integra.la>
> wrote:
> > 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>
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Confusion with placeholder tags

Posted by Martijn Dashorst <ma...@gmail.com>.
setOutputMarkupPlaceholderTag is for ajax refreshes. See
setRenderBodyOnly() or use <wicket:container> in your markup.

Martijn

On Fri, Dec 26, 2008 at 4:02 PM, David Ojeda <do...@integra.la> wrote:
> 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>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org