This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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.