Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [albireo-dev] SwingSet2 Example View

Hi Gordon,

> I've checked in a new, odd example view that embeds the standard Sun 
> SwingSet2 demo applet into an RCP view.

Nice work :-) I had also considered Sun's SwingSet2 for testing, but the
copyright problems dissuaded me (although, after all, it's only a BSD license).
Nice to see how you worked around it.

> 1) The toolbar overlays the top of the frame contents. As a result the 
> Demo/SourceCode tabs are completely obscured along with the top of the 
> content in the demo tab.

And once you drag the toolbar outside the panel, you cannot move it back
- except by changing the look&feel...

Also, in the ToolTip Demo panel, no tooltips appear before I switch look&feel...

Also, very often, the view just displays its splash screen, and it does not
disappear (except if I close the view, of course). Since I wasted about an
hour understanding where it comes from, I'm adding a comment about it.
It does not come from Albireo. It most likely comes from the use of static
variables and isApplet() calls that don't describe the Eclipse-embedded
situation appropriately.

> 2) I can't get the content to resize properly while resizing the RCP 
> application shell.

Me too. I tried a few things, in vain. But I'm not spending more time on it,
because it's an atypical case to use source code that 1. inherits from
JApplet, 2. cannot be modified. The typical case is that people write a
JComponent and are able to do some modifications for the sake of the
embedding in Eclipse.

> 3) Implementing this view required an override to 
> SwingControl.addRootPaneContainer. With our latest changes to AWT size 
> caching, it's no longer easy to override this method without losing some 
> of the function that was added in the override of JApplet. I think we 
> should provide a way to change the JApplet to something else, without 
> losing the function in our overrides of invalidate() and validateTree().
> 
> Though this example is not a compelling use case, is there any value in 
> specific support for applets in Albireo?

I don't think so. Applets and JApplets are made for embedding in a browser.
They cannot be embedded in an AWT window, nor in a JComponent. Why would
someone expect to be able to embed it into SWT? The common form for embedding
into a Java application is a JComponent - this is IMO what Albireo should
support.

> ... they cannot be embedded 
> consistently in the SWT browser widget. See:
> 
> http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.platform.swt/msg25238.html

Writing a browser in Java that can realize applets is certainly non-trivial.
The minimum you need to provide to the applet is a restricted SecurityManager.
The full sources of the sun.plugin package are 2.3 MB large.

Bruno


Index: src/org/eclipse/albireo/examples/plugin/views/SwingSetView.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.examples.plugin/src/org/eclipse/albireo/examples/plugin/views/SwingSetView.java,v
retrieving revision 1.1
diff -c -3 -r1.1 SwingSetView.java
*** src/org/eclipse/albireo/examples/plugin/views/SwingSetView.java	6 Feb 2008 22:37:45 -0000	1.1
--- src/org/eclipse/albireo/examples/plugin/views/SwingSetView.java	7 Feb 2008 21:23:11 -0000
***************
*** 19,28 ****
  import org.eclipse.ui.part.ViewPart;
  
  /**
!  * This example allows for testing and experimentation with a wide variety of Swing controls
!  * by embedding the standard Sun SwingSet applet in an RCP view. This does not work perfectly,
!  * and, at least for now, the albireo API does not smoothly support the integration of an applet
!  * like this.  
   */
  public class SwingSetView extends ViewPart {
  
--- 19,34 ----
  import org.eclipse.ui.part.ViewPart;
  
  /**
!  * This example allows for testing and experimentation with a wide variety of
!  * Swing controls by embedding the standard Sun SwingSet applet in an RCP view.
!  * This does not work perfectly, and, at least for now, the Albireo API does
!  * not smoothly support the integration of an applet like this.
!  *
!  * Note! This view only works if it was closed when Eclipse was launched
!  * and it is the first time you open it. It does *not* work (it displays only
!  * a splash screen) if it opens when Eclipse starts (restoring the previous
!  * session's views), or the second time you open it in the same Eclipse
!  * session. This must be due to the internals of the SwingSet2 class.
   */
  public class SwingSetView extends ViewPart {
  


Back to the top