• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what design Pattern to use for this problem

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
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.
So
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?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Command pattern?
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Command pattern?

and the Jtables ? use Factory pattern?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yahya Elyasse wrote:
David Newton wrote:Command pattern?

and the Jtables ? use Factory pattern?


What's the design problem that the Factory pattern would solve here?
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can apply Abstract Factory to create "families" of product.

For example, you can do something like the following:
 
Sanjay Singhaniya
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic