Re: Building a dynamic comma separated link list

2009-01-30 Thread John Krasnay
I did this by subclassing RepeatingView and overriding
AbstractRepeater.renderChild as follows...

public class SeparatorRepeatingView extends RepeatingView {

private boolean firstChildRendered = false;

private String separator = " | ";

public SeparatorRepeatingView(String id, IModel model) {
super(id, model);
}

public SeparatorRepeatingView(String id) {
super(id);
}

@Override
protected void onBeforeRender() {
firstChildRendered = false;
super.onBeforeRender();
}

@Override
protected void renderChild(Component child) {

boolean childVisible = child.isVisible();

if (firstChildRendered && childVisible && separator != null) {
getResponse().write(separator);
}

super.renderChild(child);

if (childVisible) {
firstChildRendered = true;
}
}

public String getSeparator() {
return separator;
}

public void setSeparator(String separator) {
this.separator = separator;
}

}

Unfortunately, ListView marks renderChild as final, so this technique
won't work there.

jk

On Fri, Jan 30, 2009 at 07:52:03AM -0800, Prag wrote:
> 
> I have the same problem.
> Did you find an elegant solution for this?
> 
> 
> 
> pixologe wrote:
> > 
> > Hi everybody,
> > This is probably quite easy, but I do not seem to be able to find an
> > elegant solution for this, so if anyone could give me a hint, I would
> > highly appreciate it...
> > 
> > I'd like to have a comma-separated link list with variable number of items
> > generated by wicket.
> > The link list is not a problem, just a link in the template and a listview
> > applied to it:
> >  # asdf 
> > 
> > But what is a neat way to get the commas inbetween? My idea was to have a
> > template like this:
> >  # asdf ,
> > A listview could be applied to "linklistitem" while "separator" could be
> > set invisible for the last item in the list...
> > 
> > But this seems quite complicated to me, is there something more elegant
> > than this? Perhaps a way to add a String between to items of a listview
> > when the view is being rendered?
> > 
> > Thanks in advance :)
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Building-a-dynamic-comma-separated-link-list-tp18343730p21749819.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

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



Re: Building a dynamic comma separated link list

2009-01-30 Thread Prag

I have the same problem.
Did you find an elegant solution for this?



pixologe wrote:
> 
> Hi everybody,
> This is probably quite easy, but I do not seem to be able to find an
> elegant solution for this, so if anyone could give me a hint, I would
> highly appreciate it...
> 
> I'd like to have a comma-separated link list with variable number of items
> generated by wicket.
> The link list is not a problem, just a link in the template and a listview
> applied to it:
>  # asdf 
> 
> But what is a neat way to get the commas inbetween? My idea was to have a
> template like this:
>  # asdf ,
> A listview could be applied to "linklistitem" while "separator" could be
> set invisible for the last item in the list...
> 
> But this seems quite complicated to me, is there something more elegant
> than this? Perhaps a way to add a String between to items of a listview
> when the view is being rendered?
> 
> Thanks in advance :)
> 

-- 
View this message in context: 
http://www.nabble.com/Building-a-dynamic-comma-separated-link-list-tp18343730p21749819.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Building a dynamic comma separated link list

2008-07-08 Thread pixologe

because it is a link list, not a word list.
just chaining strings in an iterator would not be too hard, even for me ;-)


igor.vaynberg wrote:
> 
> if all you are doing is generating a comma separater list of words why
> not do that in the model and simply use a label to spit it out instead
> of a bunch of labels inside a listview
> 
> -igor
> 
> On Tue, Jul 8, 2008 at 9:46 AM, pixologe <[EMAIL PROTECTED]> wrote:
>>
>> Hi everybody,
>> This is probably quite easy, but I do not seem to be able to find an
>> elegant
>> solution for this, so if anyone could give me a hint, I would highly
>> appreciate it...
>>
>> I'd like to have a comma-separated link list with variable number of
>> items
>> generated by wicket.
>> The link list is not a problem, just a link in the template and a
>> listview
>> applied to it:
>> # asdf
>>
>> But what is a neat way to get the commas inbetween? My idea was to have a
>> template like this:
>> # asdf ,
>> A listview could be applied to "linklistitem" while "separator" could be
>> set
>> invisible for the last item in the list...
>>
>> But this seems quite complicated to me, is there something more elegant
>> than
>> this? Perhaps a way to add a String between to items of a listview when
>> the
>> view is being rendered?
>>
>> Thanks in advance :)
>> --
>> View this message in context:
>> http://www.nabble.com/Building-a-dynamic-comma-separated-link-list-tp18343730p18343730.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Building-a-dynamic-comma-separated-link-list-tp18343730p18344681.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Building a dynamic comma separated link list

2008-07-08 Thread Igor Vaynberg
if all you are doing is generating a comma separater list of words why
not do that in the model and simply use a label to spit it out instead
of a bunch of labels inside a listview

-igor

On Tue, Jul 8, 2008 at 9:46 AM, pixologe <[EMAIL PROTECTED]> wrote:
>
> Hi everybody,
> This is probably quite easy, but I do not seem to be able to find an elegant
> solution for this, so if anyone could give me a hint, I would highly
> appreciate it...
>
> I'd like to have a comma-separated link list with variable number of items
> generated by wicket.
> The link list is not a problem, just a link in the template and a listview
> applied to it:
> # asdf
>
> But what is a neat way to get the commas inbetween? My idea was to have a
> template like this:
> # asdf ,
> A listview could be applied to "linklistitem" while "separator" could be set
> invisible for the last item in the list...
>
> But this seems quite complicated to me, is there something more elegant than
> this? Perhaps a way to add a String between to items of a listview when the
> view is being rendered?
>
> Thanks in advance :)
> --
> View this message in context: 
> http://www.nabble.com/Building-a-dynamic-comma-separated-link-list-tp18343730p18343730.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Building a dynamic comma separated link list

2008-07-08 Thread pixologe

Hi everybody,
This is probably quite easy, but I do not seem to be able to find an elegant
solution for this, so if anyone could give me a hint, I would highly
appreciate it...

I'd like to have a comma-separated link list with variable number of items
generated by wicket.
The link list is not a problem, just a link in the template and a listview
applied to it:
# asdf 

But what is a neat way to get the commas inbetween? My idea was to have a
template like this:
# asdf ,
A listview could be applied to "linklistitem" while "separator" could be set
invisible for the last item in the list...

But this seems quite complicated to me, is there something more elegant than
this? Perhaps a way to add a String between to items of a listview when the
view is being rendered?

Thanks in advance :)
-- 
View this message in context: 
http://www.nabble.com/Building-a-dynamic-comma-separated-link-list-tp18343730p18343730.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]