Customizing window title with javascript

Hello,

I’m currently trying to customize a Window title (caption). The API allows to provide a String to Window.setCaption , however I want to include a font-awesome icon, and handle clicks on this icon, in addition to the normal title. I haven’t found the way to do it through the java api so I ended up doing it in javascript, using the @Javascript annotation + DOM manipulation.

But there’s still issues. In particular, when some user action are performed on the Window, like resizing, moving, or even some action in components in that window that result in repainting the frame, the title’s DOM seems to be rewritten and my modifications are gone.

I tried to override Window with my own class, in particular the “paintContent” method to trigger my javascript again, but it looks like I would have to override ALL the “paint” methods in every components that are in my window. I can’t do that.

So what do you think would be the best way to do it?

FYI I ended up with a different approach: not setting any window caption, reducing height of window header by CSS, adding some components to the main layout (label / buttons) and make them look like a standard title through CSS. It’s not exactly an easy way to do it, but at least it works !