You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Cristi Manole <cr...@gmail.com> on 2007/10/15 21:47:17 UTC
Custom rendering
Hello,
I was wondering if it is possible to do custom rendering in wicket.
What i need is something like a panel in which
-> if the user is not logged in, there will be a text with "in order to sign
in please click <<Sign in>>" and then the link and
-> if the user is logged in, the same text component would show "hello
<<user>>, please click <<Sign out>> in order to logout" and then the link.
The point is having an anchor with different text and different target
through code - one panel, not having two very similar panels.
I didn't manage to get this custom functionality by having <a
wicket:id=".."><span wicked:id=".."/></a>.
Thank you.
Re: Custom rendering
Posted by Igor Vaynberg <ig...@gmail.com>.
Put a label inside the link?
-igor
On 10/16/07, Cristi Manole <cr...@gmail.com> wrote:
> Thank you for your reply.
>
> The text of the label is easy to change. I cannot find a method to change
> the text of the anchor. That's my problem.
>
> Is there a way to do that?
>
> On 10/16/07, Swaroop Belur <sw...@gmail.com> wrote:
> >
> > I think you just have to toggle the operation (url ) and model object for
> > label
> > based on user is null or not.
> > Label dynamicText = new Label("lbl" , new AbstractReadOnlyModel(){
> >
> > public Object getObject(){
> >
> > User u = ...;
> > if(u==null){
> >
> > return ""in order to sign in please click";
> > }
> > else{
> > return hello u.<get_name()>;
> >
> > }
> >
> > }
> > });
> >
> > Similarly for link. just change the action in onClick for example
> >
> > -swaroop
> >
> >
> > On 10/16/07, Cristi Manole <cr...@gmail.com> wrote:
> > >
> > > Hello,
> > >
> > > I was wondering if it is possible to do custom rendering in wicket.
> > >
> > > What i need is something like a panel in which
> > > -> if the user is not logged in, there will be a text with "in order to
> > > sign
> > > in please click <<Sign in>>" and then the link and
> > > -> if the user is logged in, the same text component would show "hello
> > > <<user>>, please click <<Sign out>> in order to logout" and then the
> > link.
> > >
> > > The point is having an anchor with different text and different target
> > > through code - one panel, not having two very similar panels.
> > >
> > > I didn't manage to get this custom functionality by having <a
> > > wicket:id=".."><span wicked:id=".."/></a>.
> > >
> > > Thank you.
> > >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Custom rendering
Posted by Cristi Manole <cr...@gmail.com>.
This is exactly what i was missing (i tried to add them both to page):
*Link* l = new *Link*..
l.add(new *Label*..
the label is a child of link...
tks a lot Thies!
On 10/16/07, Thies Edeling <th...@rrm.net> wrote:
>
> see the "Link embedded in localized Label/Message?" thread
>
> Cristi Manole wrote:
> > Thank you for your reply.
> >
> > The text of the label is easy to change. I cannot find a method to
> change
> > the text of the anchor. That's my problem.
> >
> > Is there a way to do that?
> >
> > On 10/16/07, Swaroop Belur <sw...@gmail.com> wrote:
> >
> >> I think you just have to toggle the operation (url ) and model object
> for
> >> label
> >> based on user is null or not.
> >> Label dynamicText = new Label("lbl" , new AbstractReadOnlyModel(){
> >>
> >> public Object getObject(){
> >>
> >> User u = ...;
> >> if(u==null){
> >>
> >> return ""in order to sign in please click";
> >> }
> >> else{
> >> return hello u.<get_name()>;
> >>
> >> }
> >>
> >> }
> >> });
> >>
> >> Similarly for link. just change the action in onClick for example
> >>
> >> -swaroop
> >>
> >>
> >> On 10/16/07, Cristi Manole <cr...@gmail.com> wrote:
> >>
> >>> Hello,
> >>>
> >>> I was wondering if it is possible to do custom rendering in wicket.
> >>>
> >>> What i need is something like a panel in which
> >>> -> if the user is not logged in, there will be a text with "in order
> to
> >>> sign
> >>> in please click <<Sign in>>" and then the link and
> >>> -> if the user is logged in, the same text component would show "hello
> >>> <<user>>, please click <<Sign out>> in order to logout" and then the
> >>>
> >> link.
> >>
> >>> The point is having an anchor with different text and different target
> >>> through code - one panel, not having two very similar panels.
> >>>
> >>> I didn't manage to get this custom functionality by having <a
> >>> wicket:id=".."><span wicked:id=".."/></a>.
> >>>
> >>> Thank you.
> >>>
> >>>
> >
> >
>
>
> --
> http://www.ehour.nl/
> http://blog.ehour.nl/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Custom rendering
Posted by Thies Edeling <th...@rrm.net>.
see the "Link embedded in localized Label/Message?" thread
Cristi Manole wrote:
> Thank you for your reply.
>
> The text of the label is easy to change. I cannot find a method to change
> the text of the anchor. That's my problem.
>
> Is there a way to do that?
>
> On 10/16/07, Swaroop Belur <sw...@gmail.com> wrote:
>
>> I think you just have to toggle the operation (url ) and model object for
>> label
>> based on user is null or not.
>> Label dynamicText = new Label("lbl" , new AbstractReadOnlyModel(){
>>
>> public Object getObject(){
>>
>> User u = ...;
>> if(u==null){
>>
>> return ""in order to sign in please click";
>> }
>> else{
>> return hello u.<get_name()>;
>>
>> }
>>
>> }
>> });
>>
>> Similarly for link. just change the action in onClick for example
>>
>> -swaroop
>>
>>
>> On 10/16/07, Cristi Manole <cr...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I was wondering if it is possible to do custom rendering in wicket.
>>>
>>> What i need is something like a panel in which
>>> -> if the user is not logged in, there will be a text with "in order to
>>> sign
>>> in please click <<Sign in>>" and then the link and
>>> -> if the user is logged in, the same text component would show "hello
>>> <<user>>, please click <<Sign out>> in order to logout" and then the
>>>
>> link.
>>
>>> The point is having an anchor with different text and different target
>>> through code - one panel, not having two very similar panels.
>>>
>>> I didn't manage to get this custom functionality by having <a
>>> wicket:id=".."><span wicked:id=".."/></a>.
>>>
>>> Thank you.
>>>
>>>
>
>
--
http://www.ehour.nl/
http://blog.ehour.nl/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Custom rendering
Posted by Cristi Manole <cr...@gmail.com>.
Thank you for your reply.
The text of the label is easy to change. I cannot find a method to change
the text of the anchor. That's my problem.
Is there a way to do that?
On 10/16/07, Swaroop Belur <sw...@gmail.com> wrote:
>
> I think you just have to toggle the operation (url ) and model object for
> label
> based on user is null or not.
> Label dynamicText = new Label("lbl" , new AbstractReadOnlyModel(){
>
> public Object getObject(){
>
> User u = ...;
> if(u==null){
>
> return ""in order to sign in please click";
> }
> else{
> return hello u.<get_name()>;
>
> }
>
> }
> });
>
> Similarly for link. just change the action in onClick for example
>
> -swaroop
>
>
> On 10/16/07, Cristi Manole <cr...@gmail.com> wrote:
> >
> > Hello,
> >
> > I was wondering if it is possible to do custom rendering in wicket.
> >
> > What i need is something like a panel in which
> > -> if the user is not logged in, there will be a text with "in order to
> > sign
> > in please click <<Sign in>>" and then the link and
> > -> if the user is logged in, the same text component would show "hello
> > <<user>>, please click <<Sign out>> in order to logout" and then the
> link.
> >
> > The point is having an anchor with different text and different target
> > through code - one panel, not having two very similar panels.
> >
> > I didn't manage to get this custom functionality by having <a
> > wicket:id=".."><span wicked:id=".."/></a>.
> >
> > Thank you.
> >
>
Re: Custom rendering
Posted by Swaroop Belur <sw...@gmail.com>.
I think you just have to toggle the operation (url ) and model object for
label
based on user is null or not.
Label dynamicText = new Label("lbl" , new AbstractReadOnlyModel(){
public Object getObject(){
User u = ...;
if(u==null){
return ""in order to sign in please click";
}
else{
return hello u.<get_name()>;
}
}
});
Similarly for link. just change the action in onClick for example
-swaroop
On 10/16/07, Cristi Manole <cr...@gmail.com> wrote:
>
> Hello,
>
> I was wondering if it is possible to do custom rendering in wicket.
>
> What i need is something like a panel in which
> -> if the user is not logged in, there will be a text with "in order to
> sign
> in please click <<Sign in>>" and then the link and
> -> if the user is logged in, the same text component would show "hello
> <<user>>, please click <<Sign out>> in order to logout" and then the link.
>
> The point is having an anchor with different text and different target
> through code - one panel, not having two very similar panels.
>
> I didn't manage to get this custom functionality by having <a
> wicket:id=".."><span wicked:id=".."/></a>.
>
> Thank you.
>