<AWT Dev> Better support for external Toolkits/GraphicEnvs
Roman Kennke
roman.kennke at aicas.com
Wed Jun 20 07:11:14 PDT 2007
hi,
> > At the moment I'm trying to get GNU Classpath's GTK peers (and a handful
> > of own peer/graphicsenv implementations for embedded systems) working
> > with OpenJDK. I'm encountering a couple of problems and I ask myself if
> > the OpenJDK project has any interest in patches to improve support for
> > external toolkits.
> >
> > For example, there's a bunch of places with code like this:
> >
> > private void initPeer() {
> > if (Toolkit.getDefaultToolkit() instanceof HeadlessToolkit){
> > peer =
> > ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createKeyboardFocusManagerPeer(this);
> > }
> > if (Toolkit.getDefaultToolkit() instanceof SunToolkit){
> > peer =
> > ((SunToolkit)Toolkit.getDefaultToolkit()).createKeyboardFocusManagerPeer(this);
> > }
> > }
> >
> > Obviously, this wouldn't work with anything except the built-in
> > toolkits.
>
> it is a sweet dream to have pluggable toolkit. So, the answer is yes we
> would like to clean such places. As usual the only problem is a price
> :) For example, for this particular case you will need to add new
> method to Toolkit,
nope I don't. I'd introduce an interface (e.g.
sun.awt.KeyboardFocusManagerPeerProvider), let SunToolkit,
HeadlessToolkit and my Toolkits implement this and check+call against
the interface :-)
> for others you may need to do even more :(
Yeah I know. I'm motivated (paid) to work hard ;-)
> So, although we would be happy to clean the code and make the toolkit
> pluggable, I, personally, afraid that this is very hard. And thus even
> if you are going to to this I'd suggest to start from places which do
> not require API changes.
Of course. No API changes from my side. Hopefully.
> > Other areas where I suspect big problems are fonts and probably images.
> > It seems like OpenJDK has no support for a pluggable font implementation
> > at all. However, the GTK peers rely on their own implementation (which
> > is abstracted behind an extension of FontPeer).
>
> well, fonts and images are 2D areas :) you should propose this on their
> alias.
Eh, yes. I'm not yet used to the separation of AWT and Java2D. For me
this is mostly the same thing.
> > With the new FB-Toolkit project approved, I'd guess that there would be
> > interest in developing a clean(er) interface and allowing alternative
> > peers and graphics environments to be plugged in, is that correct? If so
> > I would prepare some patches soon.
>
> I'd suggest to start FBToolkit as subclass of SunToolkit, because this
> will simplify the process, but, as I said above, patches are welcome
> (although do not expect that all wil be accepted ;)
Ok, I'll go hacking now.
Cheers, Roman
--
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
More information about the awt-dev
mailing list