well, if you dont want img to be a child component use a label to output the entire markup, and change that based on whether or not the link is enabled.
-igor On Sun, Mar 30, 2008 at 3:18 PM, Maurice Marrink <[EMAIL PROTECTED]> wrote: > Yeah but still even if he has the link and overwrites oncomponenttag > on that component, he has to get the content of the link tag > (everything between <a> and </a>) and be able to manipulate it. As far > as i know this is not possible from within wicket. The most likely > candidate getXmlTag() is private and even if that was not the case you > would have to resort to String manipulation because it does not have a > getChild(s) method. > > But you might be able to do the same with some javascript. Just add a > header contributor which adds some javascript that will fetch the > first img childelement of the link and manipulate it any way you want. > > Maurice > > > > On Sun, Mar 30, 2008 at 9:48 PM, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > well, you have to have the reference to that link somehow to know if > > its enabled or disabled.. > > > > -igor > > > > > > > > > > On Sun, Mar 30, 2008 at 11:44 AM, Matthew Young <[EMAIL PROTECTED]> wrote: > > > I forgot to mention: the link is created by other people's code. I > can't > > > change the template: I can't put wicket:id in the <img> tag. > > > > > > > > > >new image(...) { > > > > oncomponenttag(tag) { > > > > if (link.isenabled()==false) { tag.put("class","foo"); } > > > > > > So how would this work? > > > > > > new Image("there-is-not-wicket-id-to-use"... > > > > > > Anyway, I was hoping I can do: > > > > > > link.add(new AbstractBehavior() { > > > > > > onComponentTag(Component c, Component tag) { > > > use 'c' or 'tag' to get <img> > > > put attr into <img> > > > } > > > ); > > > > > > On Sun, Mar 30, 2008 at 11:31 AM, Igor Vaynberg <[EMAIL PROTECTED]> > > > wrote: > > > > > > > > > > > > > new image(...) { > > > > oncomponenttag(tag) { > > > > if (link.isenabled()==false) { tag.put("class","foo"); } > > > > } > > > > } > > > > > > > > -igor > > > > > > > > > > > > On Sun, Mar 30, 2008 at 11:27 AM, Matthew Young <[EMAIL PROTECTED]> > wrote: > > > > > I have a link like this: > > > > > > > > > > <a wicket:id="link"><img src="face.png"/></a> > > > > > > > > > > When link.isEnable() == false, I need to add style attribute to > the > > > > <img> > > > > > tag. Is it possible to do this without turning the <img> into a > child > > > > > component of the link? > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > 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] > > > > > > --------------------------------------------------------------------- > 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]