0
Swing and OSGi
       - please play nice
by Angelo van der Sijpt / Xander Tamminga
Has this ever happened to you?
www.devoxx.com
Has this ever happened to you?
www.devoxx.com
Has this ever happened to you?
www.devoxx.com
Has this ever happened to you?
www.devoxx.com
Has this ever happened to you?
www.devoxx.com
Has this ever happened to you?
www.devoxx.com
www.devoxx.com




                 Swing & OSGi
Why’s that?
                  Different design philosophies & assumptions
                    OSGi is dynamic by definition...
How to fix that?
                  Startlevels
                    Which may have more impact than desired
                ...
How to really fix that?
www.devoxx.com
How to really fix that?
www.devoxx.com
How to really fix that?
www.devoxx.com
How to really fix that?
www.devoxx.com
The ComponentProvider
www.devoxx.com
The ComponentProvider
www.devoxx.com
Notes
                  The problem gets worse with complexity

                  Dependency management helps

           ...
That’s it!



                 See the Luminis LSD blog for details and code
                       http://lsd.luminis.nl/...
Upcoming SlideShare
Loading in...5
×

Swing & OSGi - Devoxx 09

4,887

Published on

At Devoxx 09, Xander Tamminga and I told the tale of the perils in using Swing in an OSGi-based application. The details can be found at http://lsd.luminis.nl/swing-and-osgi .

Published in: Technology, Art & Photos
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,887
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
37
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • You have a window with a table in it. The table is created before the window sets its look and feel; you need to restart the table-providing bundle before the table’s look and feel is correct.
  • Even worse: two menu’s with different look and feel’s in a single window.
  • A table gets put into a scrollpane _before_ this scrollpane is part of the AWT hierarchy; hence, a NPE.
    (The ColumnHeader only gets created when the scrollpane receives a ‘notify’ from the window)
  • A table gets put into a scrollpane _before_ this scrollpane is part of the AWT hierarchy; hence, a NPE.
    (The ColumnHeader only gets created when the scrollpane receives a ‘notify’ from the window)
  • How do we create an OSGi-aware Swing application anyway?
  • - Startlevels are about all bundles; besides, the NPE before cannot be solved by this.
  • We start out with an application with consisting of a host and nested children.
  • We use OSGi to resolve our services.
  • Host -> Childeren -> and their Childeren

    finally, all components can initialize themselves.
  • Since every component now uses the same service interface, we add some service properties to keep them separate; we could also use subclasses of ComponentProvider
  • The ComponentProvider is a very simple interfaces, which separates these three steps.
  • - Some dependency management mechanism makes this easier, since we rely on service resolution (the Apache Felix Dependency Manager has been used successfully in the past)
    - Application composition is determined at application start.
    - So, don’t create your components on a framework thread
  • Transcript of "Swing & OSGi - Devoxx 09"

    1. 1. Swing and OSGi - please play nice by Angelo van der Sijpt / Xander Tamminga
    2. 2. Has this ever happened to you? www.devoxx.com
    3. 3. Has this ever happened to you? www.devoxx.com
    4. 4. Has this ever happened to you? www.devoxx.com
    5. 5. Has this ever happened to you? www.devoxx.com
    6. 6. Has this ever happened to you? www.devoxx.com
    7. 7. Has this ever happened to you? www.devoxx.com
    8. 8. www.devoxx.com Swing & OSGi
    9. 9. Why’s that? Different design philosophies & assumptions OSGi is dynamic by definition Swing is built to be static www.devoxx.com
    10. 10. How to fix that? Startlevels Which may have more impact than desired May not even solve the problem All UI in a single bundle But we don’t want that! www.devoxx.com
    11. 11. How to really fix that? www.devoxx.com
    12. 12. How to really fix that? www.devoxx.com
    13. 13. How to really fix that? www.devoxx.com
    14. 14. How to really fix that? www.devoxx.com
    15. 15. The ComponentProvider www.devoxx.com
    16. 16. The ComponentProvider www.devoxx.com
    17. 17. Notes The problem gets worse with complexity Dependency management helps You give up flexibility at runtime Remember to use the EDT correctly www.devoxx.com
    18. 18. That’s it! See the Luminis LSD blog for details and code http://lsd.luminis.nl/swing-and-osgi www.devoxx.com
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×