You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by D0m3 <fl...@orange.com> on 2011/11/18 11:52:25 UTC

Button with 3 images and issues

Hello everybody,
I am starting a wicket project for the first time, and I created a button
made of 3 images with html css. Here is my html :

I want this button to be disableable. In Java, I only declare 1 AjaxButton,
which is linked to the button tag. When I use setEnabled(false), it only
adds the disabled tag to the button tag. I would need to add the disabled
tag to the 2 other spans.
While searching for an answer, I realized I could either create a custom
component or add a behavior to automatically add the markup necessary to
create this button. Thus, in my html I would only write :

And all the class and span stuff would be added by wicket.
However I have no idea how to do that. beforeRender and afterRender add
markup before and after if I understood correctly, and onComponentTag adds
attributes.
It would be great if you could provide links or hints on how to do that.
Thanks in advance.

Florian

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Button-with-3-images-and-issues-tp4082830p4082830.html
Sent from the Users forum 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: Button with 3 images and issues

Posted by D0m3 <fl...@orange.com>.
Ok eventually I have made a behavior which extends
AbstractTransformerBehavior, because I wanted to add the markup to Link,
Button, AjaxButton, etc.
About the disabled part, I check in the behavior whether the component is
enabled and I add Disabled to my classes if not.
Don't hesitate if you have comments.
At least I hope it can help someone.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Button-with-3-images-and-issues-tp4082830p4103246.html
Sent from the Users forum 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: Button with 3 images and issues

Posted by D0m3 <fl...@orange.com>.
I did some more research, and I found out how to solve my second problem.
I  have extended AjaxButton and overriden onComponentTagBody.



Simple actually, but difficult to find out that I could use this method when
I have never used it.

About the disable part, I think I will override the setEnable method.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Button-with-3-images-and-issues-tp4082830p4099458.html
Sent from the Users forum 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: Button with 3 images and issues

Posted by D0m3 <fl...@orange.com>.
Oh sorry, on the forum I used the "raw" tag and it looks good. What should I
actually use ?
I added spaces, hope it works.



Hello everybody,
I am starting a wicket project for the first time, and I created a button
made of 3 images with html css. Here is my html :

< button class="buttonLeft">
  < span class="buttonRight">
    < span class="buttonMid">
      my text
    < /span>
  < /span>
< /button>

I want this button to be disableable. In Java, I only declare 1 AjaxButton,
which is linked to the button tag. When I use setEnabled(false), it only
adds the disabled tag to the button tag. I would need to add the disabled
tag to the 2 other spans.
While searching for an answer, I realized I could either create a custom
component or add a behavior to automatically add the markup necessary to
create this button. Thus, in my html I would only write :

< button wicket:id="myId">
  < wicket:message key="button.text">< /wicket:message>
< /button>

And all the class and span stuff would be added by wicket.
However I have no idea how to do that. beforeRender and afterRender add
markup before and after if I understood correctly, and onComponentTag adds
attributes.
It would be great if you could provide links or hints on how to do that.
Thanks in advance.

Florian

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Button-with-3-images-and-issues-tp4082830p4090888.html
Sent from the Users forum 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: Button with 3 images and issues

Posted by Igor Vaynberg <ig...@gmail.com>.
your html got eaten...

-igor

On Fri, Nov 18, 2011 at 2:52 AM, D0m3 <fl...@orange.com> wrote:
> Hello everybody,
> I am starting a wicket project for the first time, and I created a button
> made of 3 images with html css. Here is my html :
>
> I want this button to be disableable. In Java, I only declare 1 AjaxButton,
> which is linked to the button tag. When I use setEnabled(false), it only
> adds the disabled tag to the button tag. I would need to add the disabled
> tag to the 2 other spans.
> While searching for an answer, I realized I could either create a custom
> component or add a behavior to automatically add the markup necessary to
> create this button. Thus, in my html I would only write :
>
> And all the class and span stuff would be added by wicket.
> However I have no idea how to do that. beforeRender and afterRender add
> markup before and after if I understood correctly, and onComponentTag adds
> attributes.
> It would be great if you could provide links or hints on how to do that.
> Thanks in advance.
>
> Florian
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Button-with-3-images-and-issues-tp4082830p4082830.html
> Sent from the Users forum 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
>
>

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