title: What object-oriented GUI design would properly combine Command and Observer patterns?
body: <p>Is there an object-oriented GUI design that would be a reasonable combination of the Command and Observer patterns? </p>
  
  <p>My Java GUI attempts to combine Command and Observer patterns as follows:</p>
  
  <ul>
  <li>the client is an observer of the Command receiver (e.g. an input GUI screen, or a dialog)</li>
  <li>the invoker is an instance variable of the client</li>
  <li>the update() method of the client receives the Command receiver's input and updates the invoker with the appropriate Command</li>
  </ul>
  
  <p>What is making me uncomfortable with this implementation is that the update() method comprises a huge number of conditional if statements. </p>
  
  <p>e.g. </p>
  
  <pre><code>public class Client implements Observer {
      InputScreen inputScreen;
      Invoker director;
      InputScreenCommand inputScreenCommand;
  
      public Client {
          inputScreen = new InputScreen();
          inputScreen.registerObserver(this);            
          inputScreenCommand = new InputScreenCommand(inputScreen)
          director.setCommand(inputScreenCommand);
          director.invoke();
      }
  
      public void update(String command) {
          if (command.equals("Input Screen 2")) {
              inputScreen.removeObserver(this);
              // generate new receiver/subject
              inputScreen2.registerObserver(this);
              // generate new Command
              director.setCommand(inputScreen2Command);
              director.invoke();
          }
          // and so on through all the permutations of input from receivers
      }
  }
  </code></pre>
  
  <p>The proper way of using the Command pattern to effectively and efficiently handle GUI events is eluding me at the moment. Is the Observer pattern a useful partner for it?</p>