class mybutton extends button {
public mybutton(...) {
add(new abstractbehavior() {
beforerender(component c) {
c.getresponse().write("<img src=\""+url+"\"/>");
}
afterrender(component c) { // ditto }
}
}
}
-igor
On Wed, Mar 26, 2008 at 10:40 AM, Eyal Golan <[EMAIL PROTECTED]> wrote:
> thanks,
> can you please explain it more detailed ?
>
> On Wed, Mar 26, 2008 at 7:25 PM, Igor Vaynberg <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > personally, if all you really need are the img tags i would use a
> > behavior and spit out the img tags in before/after render
> >
> > -igor
> >
> >
> > On Wed, Mar 26, 2008 at 9:43 AM, Eyal Golan <[EMAIL PROTECTED]> wrote:
> > > Hello all,
> > > we want to create a styled button for our application.
> > > Each button can be of different size and we want to use localization
> > for the
> > > text so we thought about creating 3 images for our buttons.
> > > left gif, middle gif and right gif.
> > >
> > > I want to create a new component that rendered itself to something
> > like:
> > > <img .....> <input type="submit" ...> <img....>
> > >
> > > If there is already something like that, I would love using it.
> > > If not, I would be even more glad creating it.
> > >
> > > Here's something I started:
> > >
> > > package com.....components;
> > >
> > > import org.apache.wicket.markup.ComponentTag;
> > > import org.apache.wicket.markup.MarkupStream;
> > > import
> > org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup;
> > > import org.apache.wicket.markup.html.form.Button;
> > > import org.apache.wicket.model.IModel;
> > >
> > > public abstract class MyButton extends
> > > WebMarkupContainerWithAssociatedMarkup {
> > > private static final long serialVersionUID = -5168724130685807087L;
> > > private final Button button;
> > >
> > > public MyButton(String id) {
> > > super(id);
> > > button = new Button("eurekifyButton");
> > > }
> > >
> > > public MyButton(String id, IModel model) {
> > > super(id, model);
> > > button = new Button("eurekifyButton", model);
> > > }
> > >
> > > @Override
> > > protected void onComponentTag(ComponentTag tag) {
> > > // TODO Auto-generated method stub
> > > super.onComponentTag(tag);
> > > }
> > >
> > > @Override
> > > protected void onComponentTagBody(MarkupStream markupStream,
> > > ComponentTag openTag) {
> > > // TODO Auto-generated method stub
> > > super.onComponentTagBody(markupStream, openTag);
> > > }
> > >
> > > public abstract void onSubmit();
> > > }
> > >
> > > The onSubmit is to imitate the onSubmit of a button.
> > >
> > > Is the component should be WebMarkupContainerWithAssociatedMarkup or
> > just
> > > WebMarkupContainer?
> > > Is a Panel good candidate? (I believe not).
> > >
> > > Any help would be appreciated.
> > > It seems that this is my first "more that a trivial" reusable
> > component.
> > >
> > > Thanks guys,
> > > This users list is most helpful.
> > >
> > >
> > > --
> > > Eyal Golan
> > > [EMAIL PROTECTED]
> > >
> > > Visit: http://jvdrums.sourceforge.net/
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
>
>
> Eyal Golan
> [EMAIL PROTECTED]
>
> Visit: http://jvdrums.sourceforge.net/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]