Tim,

I didn't know anything about OSC, so hadn't looked but we use ZK which is
quite similar to Vaadin, so the use case is pretty similar and this
provides a nice point of reference.

Thanks
Alain


On Tue, Aug 21, 2018 at 8:00 AM Tim Ward <[email protected]> wrote:

> Have you looked at what the OSC project does? It uses Vaadin, and uses the
> ViewProvider interface to provide view instances. These automatically have
> a detach listener added on creation so that they get correctly disposed
> when their parent container is closed.
>
> See
> https://github.com/opensecuritycontroller/osc-core/blob/4441c96fe49e4b11ce6f380a440367912190a246/osc-ui/src/main/java/org/osc/core/broker/view/OSCViewProvider.java#L60-L67
>  for
> details.
>
> Tim
>
> On 21 Aug 2018, at 09:56, Alain Picard via osgi-dev <
> [email protected]> wrote:
>
> When using factory components, you get a ComponentInstance and you should
> dispose once done. For services with prototype scope, you get
> ComponentServiceObjects from which you need to ungetService after use.
>
> I have some cases where I am creating some UI Widgets and where I don't
> have a well defined lifecycle that my class controls. It is expected to
> hand over a widget and the widget will be "disposed" when necessary. The
> widget can add actions when it is "disposed" or a listener can be added to
> watch for such events with the UI framework.
>
> What is the best way to handle those and is either factory component or
> CSO better that the other, in this case and others? I was thinking that I
> might implement a factory for managed widgets that keeps a map of provided
> widgets and registers for events of disposed widgets and cleans up at that
> time, but feels like an added moving part.
>
> Alain
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
>
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to