Hi there, I'm thinking of using command pattern together with AbstractAction in UI to separate UI from application logic like openning connection to DB, searching flight, booking flight and closing connection. I have some issues to ask for clarification before I go actual implementation.
How to pass parameters to the command's execution method when an event/action is invoked. For example, in a OpenConnection dialog box, you enter DB URL in the text field, then press Connecting button, the text value in the field should be passed the command.
How to update UI after you finish the command execute. For example, after you open connection successfully, you should update UI, and go to SearchFlight etc.
Additionally, execute() in command patter should be generic so it can serve all logic. Your comments are really appreciated. Thanks, Lijun
I'm using a command pattern. For my command objects, I implemented a command interface and in the constructor took whatever parameters I needed to perform the behavior. Sometimes this meant passing a reference to the table. In my client, I simply added the listner I wanted passing in a new command object (which was taking whatever the command object needed). I'm finding as I proceed with my project it is _very_ easy to add the same command object (say book flights) to my client in various areas (such as a menu bar, a JButton or a JToolBar.) Hope this helps some...it sounds like you are on the right track.