Background:
I have extensive experience in web applications, but I have very little or no experience with RCP. Presently, I am working with Java Swing API. Everything is good. The only problem is, I don't feel very confident about my design.
Question:
In web application when we implement MVC, we forward the request to a View
. The Controller
doesn't care about where to show it. Everything is going to be displayed on a page, typically. But in RCP, we need to know where to show this form/table/etc.. I mean which panel, right or left, up or down. That requires a reference to a container component in which we desire to show the thing. How we should design our code to get that reference?
Take:
I am keeping reference to all first level components in the main class -- that has main()
method. And then wherever I need some component, I am doing something like,
JPanel formPanel = MainApp.getMainPanel().getFormPanel();
..
JPanel treePanel = MainApp.getMainPanel().getTreePanel();
Is it okay?