Is this a common enough requirement to add something like IdentityHashMap for
behaviours so from another component you can do getBehaviours(this) to
retrieve the AttributeModifier or named behaviours e.g.
getBehaviourById("com.company.thingy.Repeater.ClassHack")?

The latter might also be a nice way of marking components for various uses. 


Sam Hough wrote:
> 
> That seems a bit ugly as I want this rule to apply to all components I put
> into MyRepeatingView.
> 
> I'm trying to have MyLink, MyPanel, MyBlah so could add some standard
> behaviour but seems like wrong way around and will obviously break if
> somebody puts vanilla wicket component in.
> 
> :wq
> 
> 
> Al Maw wrote:
>> 
>> You can override onComponentTag for the component itself, if that's an 
>> option. Call super.onComponentTag(...) then tag.put("class", "foo") or 
>> whatever it is.
>> 
>> Regards,
>> 
>> Al
>> 
>> Sam Hough wrote:
>>> In my ignorance it seems tough to make that work the second time if the
>>> list
>>> has changed. It is also less pretty as the only extension points I have
>>> are
>>> renderIterator and renderChild. I can think of nasty hacks like using
>>> IdentityHashMap to hold onto Components I've already added an
>>> AttributeAppender (the HTML monkey is class happy) to...
>>> 
>>> If I can't hook into all child add/remove events and looking for my
>>> attributeappender in each component is a bit slow seems like the only
>>> option.
>>> 
>>> 
>>> Martijn Dashorst wrote:
>>>> This:
>>>>
>>>> Component first = null;
>>>> Component last = null;
>>>> for(Foo foo : foos) {
>>>>     last = new Component(view.newChildId());
>>>>     if(first == null) first = last;
>>>>     view.add(last);
>>>> }
>>>>
>>>> first.add(new SimpleAttributeModifier("class", "first"));
>>>> last.add(new SimpleAttributeModifier("class", "last"));
>>>>
>>>> doesn't work?
>>>>
>>>> Martijn
>>>>
>>>> On 9/27/07, Sam Hough <[EMAIL PROTECTED]> wrote:
>>>>> I've got my own wiz bang extension of RepeatingView and I want to add
>>>>> class
>>>>> attributes "last", "first" to the children for the HTML monkey.
>>>>>
>>>>> Is the best way to add an AttributeAppender to each child Component
>>>>> that
>>>>> uses an IModel to get the class? Maybe in beforeOnRender I can't see
>>>>> an
>>>>> onChildAttach or onChildRemove method or anything like that. All my
>>>>> ideas
>>>>> seem a bit heavy and clumsy.
>>>>>
>>>>> This must be somewhere in existing code or Nabble but I'm afraid I
>>>>> couldn't
>>>>> see it. Sorry.
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Reach-into-a-component-to-change-XML-attribute-tf4527906.html#a12919632
>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> Buy Wicket in Action: http://manning.com/dashorst
>>>> Apache Wicket 1.3.0-beta3 is released
>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Reach-into-a-component-to-change-XML-attribute-tf4527906.html#a12936562
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to