I'm trying to come up with the best design for the following requirements:
There would be many commands mapped with buttons or menu items. each one of these commands will launch a different GUI window with different functionality.
the UI windows will have many common components but there will be a JTable which need to be different for each command.
each common GUI component in each window X will do a different job. ex: there will be a common button B in all windows. in window X this button will execute a given task TX. but in window Y it will execute a different task TY.
command X -> window X (JTable with a Table model X +other UI common components)
command Y -> window Y (JTable with a Table model Y +other UI common components)
and so on...
this system must be extensible so that every time i add a new command, i'll only need to implement a new Window for this command.
what is the best design patterns and architectural designs to implement such system?
What's the design problem that the Factory pattern would solve here?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Jul 05, 2005
You can apply Abstract Factory to create "families" of product.
For example, you can do something like the following:
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Joined: Feb 21, 2009
You can use state design pattern to capture which button is clicked.
button X implies State X
button Y implies State Y
If many of GUI components remain the same, you can use state design pattern. State design pattern will capture what changes and you can implement common components only once. Common components will delegate the call to State object to implement state-specific functionality.
I would like to have inputs over my design.