You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by the_adam <ad...@gmail.com> on 2009/01/26 11:53:46 UTC

Wicket placeholder for component causing invalid markup

If we have a component with a corresponding markup tag <tr> and want to hide
it and display placeholder tag via Component#setOutputMarkupPlaceholderTag
the resulting markup will be:

<tr style="display: none;" id="componentId"/>

However this is not a valid markup. The proper markup would be:

<tr style="display: none;" id="componentId"><td span="x"></tr> where x is
the number of columns. Obviously wicket won't know how many columns there
are so one would have to set that explicitly.

Are you planning to anyhow address this issue, i.e. provide a different
placeholder method (maybe
WebMarkupContainer#setOutputRowPlaceholderTag(boolean, short)) or is the
only way of solving this to manually swap component-to-display with custom
placeholder component?
-- 
View this message in context: http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21663544.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Wicket placeholder for component causing invalid markup

Posted by the_adam <ad...@gmail.com>.
Hi,


Jeremy Thomerson-5 wrote:
> 
> I agree 100% - that's the only clean solution I see.
> 

To let you all know - Igor has provided a quick solution and committed it to
a trunk. Now there is overridible Component#renderPlaceholderTag method.

Regards,
Adam
-- 
View this message in context: http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21681424.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Wicket placeholder for component causing invalid markup

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I agree 100% - that's the only clean solution I see.

On Mon, Jan 26, 2009 at 9:25 AM, the_adam <ad...@gmail.com>wrote:

>
>
> Jeremy Thomerson-5 wrote:
> >
> > The problem you're facing is clear - and you're right - wicket:enclosure
> > won't work for you.  Unfortunately, that closed-tag code for the
> > placeholder
> > is hard-coded in Component.
> >
>
> Thanks for understanding :) Also, I've looked already in the Component
> source and I realise that it can't be done as is, hence the thread.
>
>
> Jeremy Thomerson-5 wrote:
> >
> > Hmmm....  Could you instead have a wrapping component inside of your TR
> > and
> > use that for the visibility swap?  (...) Or don't use TR - use div's
> (...)
> >
>
> The wrapping component would be a solution, but it's rather an ugly
> workaround and a code-expensive one (as of trading invocation of chainable
> method for an additional container AND manual setting of a td colspan
> property AND explicit visibility linking).
>
> I might have opened this thread in a wrong group - I was thinking about a
> possibility of reimplementing the placeholder generation fragment of
> Component#render(MarkupStream) method. Right now it is hardcoded into the
> method and invoked if flag FLAG_PLACEHOLDER has been set to true. It could
> delegate the generation to a different method which wouldn't be final. I
> can
> think of a few solutions, but since we've settled that my problem won't be
> solved in a clean way with the current state of Wicket I will move this
> discussion to developers group.
> --
> View this message in context:
> http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21667320.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com

Re: Wicket placeholder for component causing invalid markup

Posted by the_adam <ad...@gmail.com>.

Jeremy Thomerson-5 wrote:
> 
> The problem you're facing is clear - and you're right - wicket:enclosure
> won't work for you.  Unfortunately, that closed-tag code for the
> placeholder
> is hard-coded in Component.
> 

Thanks for understanding :) Also, I've looked already in the Component
source and I realise that it can't be done as is, hence the thread.


Jeremy Thomerson-5 wrote:
> 
> Hmmm....  Could you instead have a wrapping component inside of your TR
> and
> use that for the visibility swap?  (...) Or don't use TR - use div's (...)
> 

The wrapping component would be a solution, but it's rather an ugly
workaround and a code-expensive one (as of trading invocation of chainable
method for an additional container AND manual setting of a td colspan
property AND explicit visibility linking).

I might have opened this thread in a wrong group - I was thinking about a
possibility of reimplementing the placeholder generation fragment of
Component#render(MarkupStream) method. Right now it is hardcoded into the
method and invoked if flag FLAG_PLACEHOLDER has been set to true. It could
delegate the generation to a different method which wouldn't be final. I can
think of a few solutions, but since we've settled that my problem won't be
solved in a clean way with the current state of Wicket I will move this
discussion to developers group.
-- 
View this message in context: http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21667320.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Wicket placeholder for component causing invalid markup

Posted by Jeremy Thomerson <je...@wickettraining.com>.
The problem you're facing is clear - and you're right - wicket:enclosure
won't work for you.  Unfortunately, that closed-tag code for the placeholder
is hard-coded in Component.

Hmmm....  Could you instead have a wrapping component inside of your TR and
use that for the visibility swap?  That's the only thing I can think of at
this point.  Or don't use TR - use div's, etc, which may only work depending
on what you're trying to do, and not for grid-style display.

Sorry I couldn't be more help here.

On Mon, Jan 26, 2009 at 7:08 AM, the_adam <ad...@gmail.com>wrote:

>
>
> Thies Edeling-2 wrote:
> >
> > That's exactly what wicket:enclosure does; otherwise you'd have to wrap
> > the
> > row in a WebMarkupContainer to keep a reference in the DOM.
> >
>
> I know the benefits of wicket:enclosure. What I need, however is a
> placeholder, which is what wicket:enclosure doesn't provide (instead it
> removes it's entire body along with self when the specified child is not
> visible). This makes it impossible to show a component after the page has
> been rendered without it. The whole problem is even explicily stated on the
> page that Pills linked to:
>
> "Note: Changing the visibility of a child component in Ajax callback method
> will not affect the entire enclosure but just the child component itself.
> This is because only the child component is added
> to the AjaxRequestTarget." - though as far as I know even this is
> misleading
> since you can't show even a child of something that is not visible.
>
> Feel free to prove me wrong on this, but to shut down the subject of
> wicket:enclosure regarding my case, I am rendering more than one row using
> a
> repeater (repeater's body is the tr) and I want to be able to AJAXly switch
> the visibility of some of those on and off. This excludes wicket:enclosure
> from possible solutions.
>
> If the problem I'm facing isn't clearing enough let me know, I will try to
> rephrase.
> --
> View this message in context:
> http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21665137.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com

Re: Wicket placeholder for component causing invalid markup

Posted by the_adam <ad...@gmail.com>.

Thies Edeling-2 wrote:
> 
> That's exactly what wicket:enclosure does; otherwise you'd have to wrap
> the
> row in a WebMarkupContainer to keep a reference in the DOM.
> 

I know the benefits of wicket:enclosure. What I need, however is a
placeholder, which is what wicket:enclosure doesn't provide (instead it
removes it's entire body along with self when the specified child is not
visible). This makes it impossible to show a component after the page has
been rendered without it. The whole problem is even explicily stated on the
page that Pills linked to:

"Note: Changing the visibility of a child component in Ajax callback method
will not affect the entire enclosure but just the child component itself.
This is because only the child component is added
to the AjaxRequestTarget." - though as far as I know even this is misleading
since you can't show even a child of something that is not visible.

Feel free to prove me wrong on this, but to shut down the subject of
wicket:enclosure regarding my case, I am rendering more than one row using a
repeater (repeater's body is the tr) and I want to be able to AJAXly switch
the visibility of some of those on and off. This excludes wicket:enclosure
from possible solutions.

If the problem I'm facing isn't clearing enough let me know, I will try to
rephrase. 
-- 
View this message in context: http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21665137.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Wicket placeholder for component causing invalid markup

Posted by Thies Edeling <te...@gmail.com>.
the_adam wrote:
> Pills wrote:
>   
>> I'm pretty sure what you need is wicket:enclosure [1] instead
>>     
>
> That would be the case if I've wanted to hide certain rows forever, unless
> I'm largely mistaken. I want to be able to switch the visibility of certain
> table rows and since Wicket's AJAX works by replacing given DOM elements
> with parts of the DOM tree from the response I need a placeholder to be
> there, which is exactly opposite of what wicket:enclosure tag is for.
>
>   
That's exactly what wicket:enclosure does; otherwise you'd have to wrap the
row in a WebMarkupContainer to keep a reference in the DOM.


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


Re: Wicket placeholder for component causing invalid markup

Posted by the_adam <ad...@gmail.com>.

Pills wrote:
> 
> I'm pretty sure what you need is wicket:enclosure [1] instead
> 

That would be the case if I've wanted to hide certain rows forever, unless
I'm largely mistaken. I want to be able to switch the visibility of certain
table rows and since Wicket's AJAX works by replacing given DOM elements
with parts of the DOM tree from the response I need a placeholder to be
there, which is exactly opposite of what wicket:enclosure tag is for.

However maybe there is a away for inserting a node AFTER the given node or
as the last element of the parent's node in Wicket without writing my own
behaviours? Implementing this would definitely be worth considering.
-- 
View this message in context: http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21664382.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Wicket placeholder for component causing invalid markup

Posted by Sébastien Piller <pi...@hmcrecord.ch>.
Hi,

I'm pretty sure what you need is wicket:enclosure [1] instead

[1] http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html


the_adam wrote:
> If we have a component with a corresponding markup tag <tr> and want to hide
> it and display placeholder tag via Component#setOutputMarkupPlaceholderTag
> the resulting markup will be:
>
> <tr style="display: none;" id="componentId"/>
>
> However this is not a valid markup. The proper markup would be:
>
> <tr style="display: none;" id="componentId"><td span="x"></tr> where x is
> the number of columns. Obviously wicket won't know how many columns there
> are so one would have to set that explicitly.
>
> Are you planning to anyhow address this issue, i.e. provide a different
> placeholder method (maybe
> WebMarkupContainer#setOutputRowPlaceholderTag(boolean, short)) or is the
> only way of solving this to manually swap component-to-display with custom
> placeholder component?
>   


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


RE: Wicket placeholder for component causing invalid markup

Posted by the_adam <ad...@gmail.com>.

Phooey wrote:
> 
> I'm unclear of what you actually want here...
> 
Actually what I want has been already provided as stated in my previous post
:)


Phooey wrote:
> 
> Surely if you use the wicket:enclosure around a tr (something I have
> done in the past) then surely all you need is a little ajax to make the
> enclosure and its contents visible again?  IIRC all you need to do is to
> add the list item to the target once you've set the visibility.
> 

You cannot show the enclosure when it is hidden - since it's not a DOM
element you cannot add it to target. Instead you'd have to use a
WebMarkupContainer (but still you'd have to output it's id, so i.e.
wicket:container wouldn't be a go). <TR> would have to be wrapped in <TBODY>
to make visibility swapping possible. But again I wanted a simple solution
without an overhead of adding additional components. Of course you could add
your own AJAX js calls that would do thing other way then the Wicket way,
but Wicket way is - return a chunk of markup and replace a dom element with
a given id with this returned chunk - you need a hook to be there before
switching visibility on.

Also - you cannot just add ListItem to the target - it's a repeater and they
don't have the body of their own - instead their children inherit it.
addChildren would be helpful here though.
-- 
View this message in context: http://www.nabble.com/Wicket-placeholder-for-%3Ctr%3E-component-causing-invalid-markup-tp21663544p21682504.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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