Hi,

On Wed, May 16, 2012 at 7:43 PM, Ciocoiu Elvis
<[email protected]> wrote:
> I'm working on a framework that builds the user interface (input fields,
> labels, containers for layout, grids, ...) and one of the features is that
> a custom field editor (for example a dropdown) can publish events (for
> example value changed). Internally when creating the field editor I
> register it it as a PropertyProvider somewhere ... in a shared
> EditorContext. So this EditorContext is a central point in building a
> particular form. One other fieldEditor can declare it's interest in events
> of type valueCHanged published by the first field editor (the dropdown).
> Well in EditorContext I have a map of propertyProviders and
> PropertyChangeListeners ... But my framework generates also some links for
> filtering and CRUD features ... and replaces dynamically the components
> (for example the user click on add link and the list of persons is replaced
> with a form that creates a new person). FInally every dynamically generated
> form can have a field that listen for property change so I need a way to
> unregister somewhere. Can I do it using the wicket component callbacks ...
> like register the listener in onCreate and unregister it in onDestroy? (I
> know that there is no onDestroy for component ... but maybe other
> callbacks).

Which #onCreate() method do you mean ?
There is ISessionListener#onCreated() but nothing with that name for
the components.
Maybe you mean #onInitialize().

Have you considered using Wicket's event system ?
See the code of http://www.wicket-library.com/wicket-examples/events
Basically, every Component can broadcast events with Component@send()
method and every Component, Behavior, RequestCycle, Session and
Application can listen for there events by overriding their
#onEvent(Event) method. Depending on the type of the event's payload
you can decide whether you should do something or just ignore it.

>
>
> Thank you
> On Wed, May 16, 2012 at 4:41 PM, Fernando Wermus
> <[email protected]>wrote:
>
>> May you explain further your user case? Thus, we can understand the needs.
>>
>>
>> Fernando Wermus.
>>
>> www.linkedin.com/in/fernandowermus
>>
>>
>>
>> On Wed, May 16, 2012 at 7:00 AM, elvis.ciocoiu
>> <[email protected]>wrote:
>>
>> > I'm working on something that uses custom information attached to the
>> > components and needs some sort of a listeners mechanism. The path taken
>> was
>> > to register the needed listeners in onCreate() of some component but I
>> > don't
>> > have a solution to unregister ... The onRemove doesn't help because it's
>> > called when replacing the component with another in an ajax call. Is
>> there
>> > a
>> > way to be notified that a component is reatached to component hierarchy?
>> > I'm
>> > using wicket 1.4. Is there another solution? Imagine that using a
>> ListView
>> > that creates elements and every element registers some listeners ... I
>> need
>> > to clear those listeners when the element is destroyed.
>> > Thak you
>> >
>> > --
>> > View this message in context:
>> >
>> http://apache-wicket.1842946.n4.nabble.com/custom-listeners-tp4641122.html
>> > Sent from the Users forum mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [email protected]
>> > For additional commands, e-mail: [email protected]
>> >
>> >
>>
>
>
>
> --
> _____________________________________________________
> Elvis Ciocoiu
> Senior Consultant
>
> Synthesys Consulting ROMANIA
>
> address: http://www.synthesys.ro
> e-mail: [email protected]
> mobile : (40) 0745 13 75 85
>
> This message and any attachments contain information, which may be
> confidential or privileged.
> If you are not the intended recipient, please refrain from any
> disclosure, copying, distribution or use of this information.
> Please be aware that such actions are prohibited. If you have received
> this transmission in error, kindly notify us by email to
> [email protected]. We appreciate your cooperation.



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to