Closing Modal from a subobject

I have some code that takes a CustomComposite and puts it into a modal window. Is it possible to close the modal window from within the CustomComposite?

modal.addComponent(new CustomComposite());

would be the modal creation,
could I do something like


Currently, the app is in development, and is far from done, but I have a window that pops up, and when the ‘rename’ button on said modal is clicked, it simply disables the window’s components, requiring the user to click the X in the top corner. It’s a usability thing, but if it is not possible, I guess I could move all of the components to the main window.

Thanks in advance,


How about just passing the modal instance to the CustomComposite and call modal.close() from there, if that’s where you handle the logic?


modal.setContent(new CustomComposite(modal));

Or just make your CustomComposite extend Window, so you could call this.close() from anywhere in that class. But this won’t work if you plan on reusing the component elsewhere.

Yet another way is to separate the logic from the presentation (often a good idea). In this case you can provide any kind of API to take care of closing the modal yourself.


That looks like it will work (I cannot test it, as I had accidentally cleaned the workspace, and for some reason Eclipse is no longer compiling java source to class files), so when I can get Eclipse to start compiling again, I will report back. This has never happened before, as I have never cleaned a project before (Nor have I really used eclipse, I hate it with a passion), and I am getting ClassNotFound errors on all of them, my classes/ directory is empty, basically everything is gone, and nothing works. Is there any way to ‘reset’ this? (NetBeans user, Would use it if there was a graphical designer in the NetBeans plugin)

How about

Window modal = compositeComponent.getWindow();