You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Stefan Droog <sd...@educator.eu> on 2010/12/03 13:55:04 UTC
Extending Wicket's Button class to do some extra styling
Hi all,
I want to extend Wicket's Button to do some extra styling (image/etc):
What I want to write in my markup is:
<button wicket:id="myButton" type="submit" class="positive">
So my own implementation of the button is responsible for adding the image
and the label.
The expected HTML output should be:
<button type="submit" class="positive">
<img src="/images/icons/tick.png"/>
Save
</button>
What is the best approach to do this?
Thanks in advance,
Stefan
Re: Extending Wicket's Button class to do some extra styling
Posted by Pedro Santos <pe...@gmail.com>.
sure
On Fri, Dec 3, 2010 at 12:21 PM, Stefan Droog <sd...@educator.eu> wrote:
> Thanks for your reply but I prefer to add the image and label via
>
> add(new Image(..,...));
> add(new Label(..,..));
>
> Instead of replacing the body.
>
> Is that possible as well?
>
> Stefan
>
>
> 2010/12/3 Alexander Morozov <al...@gmail.com>
>
> >
> >
> > class StyledButton extends Button {
> >
> > public StyledButton(...) {
> > super();
> > add(new SimpleAttributeModifier("class", "positive"));
> > }
> >
> > @Override
> > protected void onComponentTagBody(MarkupStream markupStream,
> ComponentTag
> > openTag) {
> > replaceComponentTagBody(markupStream, openTag, " ");
> > }
> >
> > }
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Extending-Wicket-s-Button-class-to-do-some-extra-styling-tp3071023p3071104.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
> >
> >
>
--
Pedro Henrique Oliveira dos Santos
Re: Extending Wicket's Button class to do some extra styling
Posted by Stefan Droog <sd...@educator.eu>.
Thanks for your reply but I prefer to add the image and label via
add(new Image(..,...));
add(new Label(..,..));
Instead of replacing the body.
Is that possible as well?
Stefan
2010/12/3 Alexander Morozov <al...@gmail.com>
>
>
> class StyledButton extends Button {
>
> public StyledButton(...) {
> super();
> add(new SimpleAttributeModifier("class", "positive"));
> }
>
> @Override
> protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
> openTag) {
> replaceComponentTagBody(markupStream, openTag, " ");
> }
>
> }
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Extending-Wicket-s-Button-class-to-do-some-extra-styling-tp3071023p3071104.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: Extending Wicket's Button class to do some extra styling
Posted by Alexander Morozov <al...@gmail.com>.
class StyledButton extends Button {
public StyledButton(...) {
super();
add(new SimpleAttributeModifier("class", "positive"));
}
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
openTag) {
replaceComponentTagBody(markupStream, openTag, " ");
}
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Extending-Wicket-s-Button-class-to-do-some-extra-styling-tp3071023p3071104.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