code: public void toggle() {
      Command cmd = state.isPrimary() ? command1 : command2;
      setState(state.other());
      cmd.execute();
    }
docs: Toggles the link executing the command. All state is changed before the command
  is executed and it is therefore safe to call this from within the commands.